Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
print + scroll text big to an image (is there a better way?)
#8
My quick little thing - use _PutImage to enlarge the text, if you use a font other than MonoSpace, you will have to set the height and width of the font yourself according to the given font size (by estimation or calculation or otherwise), you can also zoom in on each character extra, but here I would really solve it with an array. Use the mouse wheel in the program, it's just a quick code that is far from perfect.

Code: (Select All)

font = _LoadFont("arial.ttf", 40, "monospace")
text$ = "test"

virtual = _NewImage(_FontWidth(font) * Len(text), _FontHeight(font), 32)
_Font font, virtual
_PrintString (0, 0), text$, virtual

Screen _NewImage(1080, 1050, 32)
Do Until I$ = Chr$(27)
    I$ = InKey$
    Do While _MouseInput
        zoom = zoom + _MouseWheel / 10
    Loop
    Cls
    Z virtual, _MouseX, _MouseY, zoom
    _Display
    _Limit 20
Loop

Sub Z (image, x, y, zoom)
    w = _Width(image)
    h = _Height(image)
    _PutImage (x, y)-(x + w * zoom, y + w * zoom), image, 0
End Sub


Reply


Messages In This Thread
RE: print + scroll text big to an image (is there a better way?) - by Petr - 03-25-2025, 08:59 PM



Users browsing this thread: 1 Guest(s)