QB64 Phoenix Edition
Font display on 3.7.0 - Printable Version

+- QB64 Phoenix Edition (https://staging.qb64phoenix.com)
+-- Forum: QB64 Rising (https://staging.qb64phoenix.com/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://staging.qb64phoenix.com/forumdisplay.php?fid=3)
+---- Forum: Help Me! (https://staging.qb64phoenix.com/forumdisplay.php?fid=10)
+---- Thread: Font display on 3.7.0 (/showthread.php?tid=1691)



Font display on 3.7.0 - NasaCow - 05-17-2023

I have been playing around with various ideas but it seems the fonts are loaded differently or displayed differently from 3.6.0 and 3.7.0. Not sure if I have to adjust what I am doing to make it look good again but, personally, I can't accept how they look. Here is a comparision side by side of the two different versions.

[Image: image.png]

You can see the new hotness on the left and the old and busted on the right. Look at the '2's and 'o's. They are cut-off. The problem seems to show itself on lower font sizes where letters are being cut off. (the 3rd line is using a large font and being scaled down as a temp work around but still doesn't look as good as it should if you ask me...)

Here is a quick program ran in 3.7.0

[Image: image.png]

Same code on 3.6.0


[Image: image.png]

You can see in 3.7.0 that 'J' and '2' is being cut (oddly the 'o' isn't) and gets worse the smaller the font size loaded.

Here is the code:

Code: (Select All)
DIM AS LONG Screen1, Font24, Font12

$NOPREFIX

Screen1 = NEWIMAGE(1280, 720, 32)
Font24 = NEWIMAGE(600, 300, 32)
Font12 = NEWIMAGE(210, 100, 32)

SCREEN Screen1

FONT LOADFONT("arial.ttf", 60)
PRINT "1234567890-=`~!@#$%^&*()_+?:<>"
PRINT "abcdefghijklmonpqrstuvwxyz"
PRINT UCASE$("abcdefghijklmonpqrstuvwxyz")
PRINT

FONT LOADFONT("arial.ttf", 48)
LOCATE 5
PRINT "1234567890-=`~!@#$%^&*()_+?:<>"
PRINT "abcdefghijklmonpqrstuvwxyz"
PRINT UCASE$("abcdefghijklmonpqrstuvwxyz")
PRINT

DEST Font24
FONT LOADFONT("arial.ttf", 24)
PRINT "1234567890-=`~!@#$%^&*()_+?:<>"
PRINT "abcdefghijklmonpqrstuvwxyz"
PRINT UCASE$("abcdefghijklmonpqrstuvwxyz")
PRINT

DEST Font12
FONT LOADFONT("arial.ttf", 12)
PRINT "1234567890-=`~!@#$%^&*()_+?:<>"
PRINT "abcdefghijklmonpqrstuvwxyz"
PRINT UCASE$("abcdefghijklmonpqrstuvwxyz")
'LINE (0, 0)-(209, 39), , B
PRINT

DEST Screen1

'No scaling
PUTIMAGE (0, 350), Font24
PUTIMAGE (0, 450), Font12

'Scaling to see better
PUTIMAGE (300, 450)-(1140, 850), Font12

FONT 16
SLEEP

A copy of the font file I used is attached, it is the same as the system installed Arial


Any work arounds or new ways of doing things, please let me know! Thanks


RE: Font display on 3.7.0 - mnrvovrfc - 05-17-2023

To enjoy the new font functionality, you have to use _UPRINTSTRING instead of PRINT, and take the time to study what _UFONTHEIGHT and _ULINESPACING do.


RE: Font display on 3.7.0 - SMcNeill - 05-17-2023

To show the difference in the newer graphic commands and the old version of Print:

Code: (Select All)
Dim As Long Screen1, Font24, Font12

$NoPrefix

Screen1 = NewImage(1280, 720, 32)
Font24 = NewImage(600, 300, 32)
Font12 = NewImage(210, 100, 32)

Screen Screen1

Font LoadFont("arial.ttf", 60)
Print "1234567890-=`~!@#$%^&*()_+?:<>"
Print "abcdefghijklmonpqrstuvwxyz"
Print UCase$("abcdefghijklmonpqrstuvwxyz")
Sleep

UPrintString (0, 4 * ULineSpacing), "1234567890-=`~!@#$%^&*()_+?:<>"
UPrintString (0, 5 * ULineSpacing), "abcdefghijklmonpqrstuvwxyz"
UPrintString (0, 6 * ULineSpacing), UCase$("abcdefghijklmonpqrstuvwxyz")

Sleep
Cls

Font LoadFont("arial.ttf", 48)

Print "1234567890-=`~!@#$%^&*()_+?:<>"
Print "abcdefghijklmonpqrstuvwxyz"
Print UCase$("abcdefghijklmonpqrstuvwxyz")
Print
UPrintString (0, 4 * ULineSpacing), "1234567890-=`~!@#$%^&*()_+?:<>"
UPrintString (0, 5 * ULineSpacing), "abcdefghijklmonpqrstuvwxyz"
UPrintString (0, 6 * ULineSpacing), UCase$("abcdefghijklmonpqrstuvwxyz")

Sleep
Cls

Font LoadFont("arial.ttf", 24)
Print "1234567890-=`~!@#$%^&*()_+?:<>"
Print "abcdefghijklmonpqrstuvwxyz"
Print UCase$("abcdefghijklmonpqrstuvwxyz")
Print
UPrintString (0, 4 * ULineSpacing), "1234567890-=`~!@#$%^&*()_+?:<>"
UPrintString (0, 5 * ULineSpacing), "abcdefghijklmonpqrstuvwxyz"
UPrintString (0, 6 * ULineSpacing), UCase$("abcdefghijklmonpqrstuvwxyz")

Sleep
Cls


Font LoadFont("arial.ttf", 12)
Print "1234567890-=`~!@#$%^&*()_+?:<>"
Print "abcdefghijklmonpqrstuvwxyz"
Print UCase$("abcdefghijklmonpqrstuvwxyz")
'LINE (0, 0)-(209, 39), , B
Print
UPrintString (0, 4 * ULineSpacing), "1234567890-=`~!@#$%^&*()_+?:<>"
UPrintString (0, 5 * ULineSpacing), "abcdefghijklmonpqrstuvwxyz"
UPrintString (0, 6 * ULineSpacing), UCase$("abcdefghijklmonpqrstuvwxyz")

Sleep
System


As you can see, the new UPrint tends to have extra space between rows, just so letters don't get clipped and overwritten as often.  As for the "3" seeming to squash the "2" somewhat, I don't know what the heck is up with that.  It's not a monospaced font, so is it designed that way?  Or is it a flaw in the new font rendering?  I dunno at the moment and something like that will probably take a little looking into to see how it's supposed to look and display for us, and what the glitch might be, if there is one.


RE: Font display on 3.7.0 - NasaCow - 05-17-2023

Personally, I don't see a real difference between the two commands in the rendering of the font to screen. As a quck example for font size 24, we can see the lower case 'j' is almost half missing from both. I even added a space after j to see if k was clipping it. I have no issues using print or uprintstring, it is similar enough of a case to qprintstring which is/was just as awesome.


[Image: image.png]

Trying the same with Times New Roman. I see no rendering issues. I do wonder if it just happens with the Arial font. Thanks for taking and hopefully it is just an one-off issue with Arial.


RE: Font display on 3.7.0 - SMcNeill - 05-17-2023

Aye.  That's why I mentioned them squishing together side by side.  Vertically, the new commands give extra spacing to stop clipping, but horizontal might need some tweaking.


RE: Font display on 3.7.0 - SMcNeill - 05-17-2023

Further testing shows that this is a glitch on our c-side of things, and is something that we should be able to sort out and correct in a future patch.  For now, you can load your font with the "dontblend" option and it should display without any issues, as showcased below:

Code: (Select All)
Dim As Long Screen1, Font24, Font12

$NoPrefix

Screen1 = NewImage(1280, 720, 32)
Font24 = NewImage(600, 300, 32)
Font12 = NewImage(210, 100, 32)

Screen Screen1

Font LoadFont("arial.ttf", 60, "dontblend")
Print "1234567890-=`~!@#$%^&*()_+?:<>"
Print "abcdefghijklmonpqrstuvwxyz"
Print UCase$("abcdefghijklmonpqrstuvwxyz")
Sleep

UPrintString (0, 4 * ULineSpacing), "1234567890-=`~!@#$%^&*()_+?:<>"
UPrintString (0, 5 * ULineSpacing), "abcdefghijklmonpqrstuvwxyz"
UPrintString (0, 6 * ULineSpacing), UCase$("abcdefghijklmonpqrstuvwxyz")

Sleep
Cls

Font LoadFont("arial.ttf", 48, "dontblend")

Print "1234567890-=`~!@#$%^&*()_+?:<>"
Print "abcdefghijklmonpqrstuvwxyz"
Print UCase$("abcdefghijklmonpqrstuvwxyz")
Print
UPrintString (0, 4 * ULineSpacing), "1234567890-=`~!@#$%^&*()_+?:<>"
UPrintString (0, 5 * ULineSpacing), "abcdefghijklmonpqrstuvwxyz"
UPrintString (0, 6 * ULineSpacing), UCase$("abcdefghijklmonpqrstuvwxyz")

Sleep
Cls

Font LoadFont("arial.ttf", 24, "dontblend")
Print "1234567890-=`~!@#$%^&*()_+?:<>"
Print "abcdefghijklmonpqrstuvwxyz"
Print UCase$("abcdefghijklmonpqrstuvwxyz")
Print
UPrintString (0, 4 * ULineSpacing), "1234567890-=`~!@#$%^&*()_+?:<>"
UPrintString (0, 5 * ULineSpacing), "abcdefghijklmonpqrstuvwxyz"
UPrintString (0, 6 * ULineSpacing), UCase$("abcdefghijklmonpqrstuvwxyz")

_Delay 5
Sleep
Cls


Font LoadFont("arial.ttf", 12, "dontblend")
Print "1234567890-=`~!@#$%^&*()_+?:<>"
Print "abcdefghijklmonpqrstuvwxyz"
Print UCase$("abcdefghijklmonpqrstuvwxyz")
'LINE (0, 0)-(209, 39), , B
Print
UPrintString (0, 4 * ULineSpacing), "1234567890-=`~!@#$%^&*()_+?:<>"
UPrintString (0, 5 * ULineSpacing), "abcdefghijklmonpqrstuvwxyz"
UPrintString (0, 6 * ULineSpacing), UCase$("abcdefghijklmonpqrstuvwxyz")

Sleep
System


Good news is this doesn't seem to be an overtly complex issue to replicate and isolate, and hopefully won't be too hard to fix for when the next version of QB64PE comes out.  Smile


RE: Font display on 3.7.0 - NasaCow - 05-17-2023

(05-17-2023, 02:10 PM)SMcNeill Wrote: Further testing shows that this is a glitch on our c-side of things, and is something that we should be able to sort out and correct in a future patch.  For now, you can load your font with the "dontblend" option and it should display without any issues, as showcased below:

Code: (Select All)
Dim As Long Screen1, Font24, Font12

$NoPrefix

Screen1 = NewImage(1280, 720, 32)
Font24 = NewImage(600, 300, 32)
Font12 = NewImage(210, 100, 32)

Screen Screen1

Font LoadFont("arial.ttf", 60, "dontblend")
Print "1234567890-=`~!@#$%^&*()_+?:<>"
Print "abcdefghijklmonpqrstuvwxyz"
Print UCase$("abcdefghijklmonpqrstuvwxyz")
Sleep

UPrintString (0, 4 * ULineSpacing), "1234567890-=`~!@#$%^&*()_+?:<>"
UPrintString (0, 5 * ULineSpacing), "abcdefghijklmonpqrstuvwxyz"
UPrintString (0, 6 * ULineSpacing), UCase$("abcdefghijklmonpqrstuvwxyz")

Sleep
Cls

Font LoadFont("arial.ttf", 48, "dontblend")

Print "1234567890-=`~!@#$%^&*()_+?:<>"
Print "abcdefghijklmonpqrstuvwxyz"
Print UCase$("abcdefghijklmonpqrstuvwxyz")
Print
UPrintString (0, 4 * ULineSpacing), "1234567890-=`~!@#$%^&*()_+?:<>"
UPrintString (0, 5 * ULineSpacing), "abcdefghijklmonpqrstuvwxyz"
UPrintString (0, 6 * ULineSpacing), UCase$("abcdefghijklmonpqrstuvwxyz")

Sleep
Cls

Font LoadFont("arial.ttf", 24, "dontblend")
Print "1234567890-=`~!@#$%^&*()_+?:<>"
Print "abcdefghijklmonpqrstuvwxyz"
Print UCase$("abcdefghijklmonpqrstuvwxyz")
Print
UPrintString (0, 4 * ULineSpacing), "1234567890-=`~!@#$%^&*()_+?:<>"
UPrintString (0, 5 * ULineSpacing), "abcdefghijklmonpqrstuvwxyz"
UPrintString (0, 6 * ULineSpacing), UCase$("abcdefghijklmonpqrstuvwxyz")

_Delay 5
Sleep
Cls


Font LoadFont("arial.ttf", 12, "dontblend")
Print "1234567890-=`~!@#$%^&*()_+?:<>"
Print "abcdefghijklmonpqrstuvwxyz"
Print UCase$("abcdefghijklmonpqrstuvwxyz")
'LINE (0, 0)-(209, 39), , B
Print
UPrintString (0, 4 * ULineSpacing), "1234567890-=`~!@#$%^&*()_+?:<>"
UPrintString (0, 5 * ULineSpacing), "abcdefghijklmonpqrstuvwxyz"
UPrintString (0, 6 * ULineSpacing), UCase$("abcdefghijklmonpqrstuvwxyz")

Sleep
System


Good news is this doesn't seem to be an overtly complex issue to replicate and isolate, and hopefully won't be too hard to fix for when the next version of QB64PE comes out.  Smile

Awesome work around. Glad to hear that it won't be a difficult thing to squash. Always looking forward to the next release.