QB64 Phoenix Edition
Accessing Fonts for QB64 on a Mac - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3)
+---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10)
+---- Thread: Accessing Fonts for QB64 on a Mac (/showthread.php?tid=1592)



Accessing Fonts for QB64 on a Mac - NakedApe - 03-30-2023

Hi everybody,

I'm Ted and new to the forum. I've got a question I hope you can help with. I'm working on a game and want to make small, discrete, on-screen labels for a mapping routine. Anyone have any insights on setting up handles for Mac fonts and sizing them. I've seen examples for Windows, but none for Macs. Or is there a way to open a _NEWIMAGE with a higher resolution and print inside that _DEST to reduce font size? Or maybe a way to use _PUTIMAGE to squeeze down text? I tried the latter with little luck.

Thanks! 
Ted


RE: Accessing Fonts for QB64 on a Mac - Petr - 03-30-2023

Hi, welcome to the forum.

Here is a small example of how the font can be made smaller using _PutImage. Round labels can also be made, or wavy according to SIN, the MapTriangle (2D) command can be used for this, or a custom font can be created in case of use on a graphics screen, or images can be used instead of individual characters. It just depends on what you choose.


Code: (Select All)
font& = _LoadFont("arial.ttf", 40, "bold")
virtual& = _NewImage(640, 70, 32)
_Font font&, virtual&
_PrintString (10, 10), "Some text", virtual&
Screen virtual&
Sleep

Screen _NewImage(800, 600, 32)
For t = 100 To 1 Step -1
    Locate 1: Print "Text size: "; (t / 100) * 100; "%"
    _PutImage (200, 200)-(200 + 6.4 * t, 200 + .7 * t), virtual&, 0
    _Delay .1
    _Display
    Cls
Next



RE: Accessing Fonts for QB64 on a Mac - NakedApe - 03-30-2023

(03-30-2023, 06:12 PM)Petr Wrote: Hi, welcome to the forum.

Here is a small example of how the font can be made smaller using _PutImage. Round labels can also be made, or wavy according to SIN, the MapTriangle (2D) command can be used for this, or a custom font can be created in case of use on a graphics screen, or images can be used instead of individual characters. It just depends on what you choose.


Code: (Select All)
font& = _LoadFont("arial.ttf", 40, "bold")
virtual& = _NewImage(640, 70, 32)
_Font font&, virtual&
_PrintString (10, 10), "Some text", virtual&
Screen virtual&
Sleep

Screen _NewImage(800, 600, 32)
For t = 100 To 1 Step -1
    Locate 1: Print "Text size: "; (t / 100) * 100; "%"
    _PutImage (200, 200)-(200 + 6.4 * t, 200 + .7 * t), virtual&, 0
    _Delay .1
    _Display
    Cls
Next

Excellent. Thanks Petr, I'll give it a go!