Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Some unicode symbols not supported.
#1
Code: (Select All)
Option _Explicit

Screen _NewImage(800, 600, 32)

Dim fh As Long: fh = _LoadFont("cyberbit.ttf", 21)
If fh <= 0 Then
    Print "Failed to load font file!"
    End
End If

_Font fh

Restore text_data
Dim myString As String: myString = LoadUData$

_UPrintString (_Width \ 2 - _UPrintWidth(myString, 8, fh) \ 2, _Height \ 2 - _UFontHeight \ 2), myString, _Width, 8

End

text_data:
Data 6F
Data E2,96,95,E2,96,94,E2,96,94,E2,96,94,E2,96,94,E2,96,94,E2,96,94,E2,96,94,E2,96,94,E2,96,94,E2,96,94
Data E2,96,81 'Lower one eighth block won't display.
Data E2,96,8F 'Left one eighth block won't display.
Data E2,89,A1

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

    Read d
    s = Val("&h" + d)
    s = 42
    buffer = Space$(s)

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

    LoadUData = buffer
End Function

What's funny is this routine will print that hamburger menu symbol I wasn't able to display to a screen a couple of years ago, but it misses on two of the outer one eighth blocks. When a symbol fails to display correctly, we get a hollow rectangle symbol in the display.

So is this a QB64 glitch?

Pete
Reply
#2
Are you certain the font has those characters in it? Not all fonts have all characters available.
Reply
#3
Professor Steve nails it again!

I was counting on some continuity, meaning if the font contained the upper 1/8 block and the right 1/8 block, it would certainly have the complimentary lower and left ones two, but no! Big Grin 

So I did find this cool site that helps us check if particular characters are in a font: https://www.charactercodes.net/font-character-map/

We can get a copy/paste of a desired symbol from: https://en.wikipedia.org/wiki/List_of_Un...characters

Now it's time do do some hunting. I wonder how that hamburger symbol tastes with just a dab of orange sauce?

Pete

- the word "just" stricken to complement my personal pronouns.
Reply




Users browsing this thread: 4 Guest(s)