QB64 Phoenix Edition
Is _NEWIMAGE just a nicer way of saying, "Special needs?" - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: Chatting and Socializing (https://qb64phoenix.com/forum/forumdisplay.php?fid=11)
+--- Forum: General Discussion (https://qb64phoenix.com/forum/forumdisplay.php?fid=2)
+--- Thread: Is _NEWIMAGE just a nicer way of saying, "Special needs?" (/showthread.php?tid=2499)

Pages: 1 2


Is _NEWIMAGE just a nicer way of saying, "Special needs?" - Pete - 03-10-2024

Just poking some fun at the obvious extra work and thinking required to expand font use in a graphics environment, instead of taking advantage of the ease of spacing and wrapping with a text display.

I'm wondering if I could cheat it a bit, and get something that looks reasonably okay using mono-spaced fonts. The challenge here would be finding bold and italics in the same as regular font.

It's possible to make a wrap routine based upon non-mono-spaced fonts, by concatenating the font widths. When there is enough physical space, then wrap. I guess another alternative would be to measure any font width and simply print it to the screen at center point, 16 pixels away from the previous center point.

I really wonder how Word works in this regard. Regular fonts, bold, italicized, underlined. Well, you don't actually need an underlined font set, just position a LINE statement.

I wish all fonts came with the above aforementioned glyphs, but they don't. If anyone has found some better choices, methods, or font selections for this type of project, I'm all ears... You just can't see them unders me big ASCII hat.

Pete

 - Steve to reply... Look, Pete just called himself a, " big ASCII hat. "


RE: Is _NEWIMAGE just a nicer way of saying, "Special needs?" - Kernelpanic - 03-10-2024

Quote:I really wonder how Word works in this regard. Regular fonts, bold, italicized, underlined. Well, you don't actually need an underlined font set, just position a LINE statement.
@Pete - just ask Microsoft. Describe the problem/matter to MS and ask if they can give you a tip. The answer can't be worse than "NO".  Tongue


RE: Is _NEWIMAGE just a nicer way of saying, "Special needs?" - Pete - 03-10-2024

I suppose I should throw in an example. Incomplete, but works as a demo...

Code: (Select All)
Screen _NewImage(900, 600, 32)
nof = 4
ReDim fh(nof), mystring$(nof)

fh(1) = _LoadFont("lmsans10-regular.otf", 21)
fh(2) = _LoadFont("lmsans10-bold.otf", 21)
fh(3) = _LoadFont("lmsans10-oblique.otf", 21)
fh(4) = _LoadFont("lmsans10-boldoblique.otf", 21)

For i = 1 To nof
    If fh(i) <= 0 Then
        Print "Failed to load font."
        End
    End If
Next
_Font fh(1)
For i = 1 To nof
    Restore text_data
    mystring$(i) = LoadUData$
Next
x = 8: j = 1
f = 1: _UPrintString (8, _Height \ 2 - _UFontHeight \ 2 + y - 48), mystring$(f), _Width, 8

For i = 1 To nof * 26 ' Step 4
    f = (i - 1) Mod 4 + 1
    'f = 1: q = q + 1
    If f = 2 Or f = 4 Then adj = 1 Else adj = 0
    _Font fh(f)
    '_UPrintString (x, _Height \ 2 - _UFontHeight \ 2 + y + adj), Mid$(mystring$(f), q, 1), _Width, 8
    _UPrintString (x, _Height \ 2 - _UFontHeight \ 2 + y + adj), Mid$(mystring$(f), j, 1), _Width, 8
    If i = nof / 2 * 26 Then
        x = 8
        y = y + 48
    Else
        If mono Then
            x = x + 11 ' For mono-spaced fonts.
        Else
            x = x + _PrintWidth(Mid$(mystring$(f), j, 1))
        End If
    End If
    If i Mod 4 = 0 Then j = j + 1
Next
_Font fh(1)
End

text_data:
Data 61,62,63,64,65,66,67,68,69,6A,6B,6C,6D,6E,6F,70,71,72,73,74,75,76,77,78,79,7A,7B
Data E2,96,8F
Data E2,89,A1

Function LoadUData$
    Dim As _Unsigned Long i, s
    Dim d As String
    Dim buffer As String

    s = 26
    buffer = Space$(s)

    For i = 1 To s
        Read d
        Asc(buffer, i) = Val("&h" + d)
    Next

    LoadUData = buffer
End Function
 


You only need the regular, bold, italics, and italics bold from the first zip for the routine, as currently coded.

Pete


RE: Is _NEWIMAGE just a nicer way of saying, "Special needs?" - Kernelpanic - 03-10-2024

I would have to load this font first, maybe another one would work. But not today, I'm currently im Magic Forest   Tongue


[Image: icon-ghost.gif]




RE: Is _NEWIMAGE just a nicer way of saying, "Special needs?" - bplus - 03-10-2024

(03-10-2024, 09:18 PM)Kernelpanic Wrote: I would have to load this font first, maybe another one would work. But not today, I'm currently im Magic Forest   Tongue


[Image: icon-ghost.gif]


I vote for that for Spring Banner! ;-))


RE: Is _NEWIMAGE just a nicer way of saying, "Special needs?" - Pete - 03-10-2024

Well like my Chinese friend Ho Lee Howe would say... What the Ho Lee Howe does this have to do with fonts Huh


RE: Is _NEWIMAGE just a nicer way of saying, "Special needs?" - bplus - 03-11-2024

Yes with FONT! of course
   


RE: Is _NEWIMAGE just a nicer way of saying, "Special needs?" - Pete - 03-11-2024

I'd rate that an 86. It's got a nice beat, and you can dance to it!

Pete


RE: Is _NEWIMAGE just a nicer way of saying, "Special needs?" - bplus - 03-11-2024

actually that was not the version i intended see the little marks top middle? no I have a better shot without those and the light is more right but someone will likely say it's blurrier. So that will be my final and last submission and sorry about interrupting your _NewImage discovery, I thought it great way back when i learned it as a side area to create drawings or layers to main image on screen. It is a big deal!


RE: Is _NEWIMAGE just a nicer way of saying, "Special needs?" - Pete - 03-11-2024

No apologies needed. You know I always kid about such things. I started that way back in the QBasic Forum days when a couple of posters got way too anal about staying on topic. I always say, when you can taste a hint of hickory when you swallow, you know that stick, your carrying, has gotten pushed up waaaay too far.

Pete Smile