Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Accessing Fonts for QB64 on a Mac
#1
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
Reply
#2
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


Reply
#3
(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!
Reply




Users browsing this thread: 2 Guest(s)