|
Post by curtis14 on Jul 27, 2023 1:54:43 GMT
I am writing a math lesson about circles, and I am using Screen 32. The standard QB64 IDE font (lucon.ttf) is nice looking, but a little small. I want to make it slightly larger. Below is the program I wrote. It first prints some text in the standard font. Then I load a font and print more text. I want the loaded font to appear just like the system font (same shape, degree of boldness) but slightly larger. I am using a PC running Windows 10. fontpath$ = "C:\WINDOWS\Fonts\lucon.ttf"
style$ = "MONOSPACE, BOLD"
fontsize% = 16
Screen _NewImage(640, 416, 32)
_Font 16
Cls
Locate 3, 1
Print "Using System Font: lucon.ttf, monospace, bold, size = 16"
Sleep
font& = _LoadFont(fontpath$, fontsize%, style$)
If font& > 0 Then _Font font&
Locate 8, 1
Print "Using Loaded Font: lucon.ttf, monospace, bold, size = ?"
For i = 10 To 15
Locate i, i - 9
Print "hello"
Next i
Below is the result of running the program. The loaded font's characters have a different shape than the system font, and the characters don't appear to be bold. I would be very grateful for guidance on how to load the monospaced lucon.ttf font at a font size slightly larger than the default size. Thank you very much.
|
|
|
Post by bplus on Jul 27, 2023 14:43:16 GMT
Fonts work very imperfectly in QB64, pe has some improvements but still not perfect. Just because in QB64 you have a style$ option in _FontLoad() function doesn't mean the font actually can do that style.
Windows fonts are different in .ttf name than style options except MONOSPACE which may or maynot be available for the particular .ttf.
Here is nice arial Monospaced
fontpath$ = "C:\WINDOWS\Fonts\arial.ttf" style$ = "MONOSPACE" fontsize% = 24 Screen _NewImage(640, 416, 32) font& = _LoadFont(fontpath$, fontsize%, style$) If font& > 0 Then _Font font& Else Print " Font failed to load.": End Print "Using Loaded Font: "; fontpath$; ","; size%; ", "; style$ Print "hello," Print "ABCDEFGHIJKLMNOPQRSTUVWXYZabcedefghijklmnopqrstuvwxyz1234567890-=!@#$%^&*()_+"
Tha works in my Windows 10 laptop.
|
|
|
Post by curtis14 on Jul 27, 2023 19:22:48 GMT
Hi bplus, Thank you for the sample code. I'll work with it and try to find the parameters that give me the appearance I'm looking for. Sincerely, Curtis
|
|
|
Post by bplus on Jul 27, 2023 20:44:04 GMT
Yes we have the makings of a nice little font testing app. very handy for checking out fonts.
|
|
|
Post by marjagonzalves on Sept 5, 2023 23:25:50 GMT
Arial is not monospaced.
"lucon" is best could be done on Windows, many monospaced fonts are worse.
If you want high-quality monospaced fonts look here: s://www.nerdfonts.com/font-downloads
Left out on purpose part of address as I'm new. I might not be allowed to post Internet link yet.
|
|
|
Post by bplus on Sept 5, 2023 23:37:31 GMT
Arial is not monospaced. "lucon" is best could be done on Windows, many monospaced fonts are worse. If you want high-quality monospaced fonts look here: s://www.nerdfonts.com/font-downloads Left out on purpose part of address as I'm new. I might not be allowed to post Internet link yet. And yet it looks quite Monospaced to me LOL
|
|
|
Post by bplus on Sept 5, 2023 23:41:50 GMT
Internet links intended to help QB64 fans use QB64 quite alright!
Internet links having nothing to do with QB64 or helping QB64 fans but to promote some other thing we call spam!
|
|