I'd like the array method, better. If we don't have to swap and remove fonts, it's less jittery on screen size changes.
It's like the old invention saying goes, "Necessity is a mother."
Pete
Code: (Select All)
SCREEN 0
fontsize% = 16
style$ = "monospace"
fontpath$ = ENVIRON$("SYSTEMROOT") + "\fonts\lucon.ttf"
DIM font(8 TO 32) AS LONG
FOR i = 8 TO 32 STEP 2
font(i) = _LOADFONT(fontpath$, i, style$)
NEXT
_FONT font(fontsize%)
ww = 600: wh = 350
WIDTH ww \ _FONTWIDTH, wh \ _FONTHEIGHT
PALETTE 7, 63: COLOR 0, 7: CLS
_FONT font(fontsize%)
_SCREENMOVE 0, 0
PRINT "Press ctrl + to increase font size or ctrl - to decrease."
DO
_LIMIT 30
c = _KEYHIT
IF c THEN
SELECT CASE c
CASE -189
IF fontsize% > 9 THEN fontsize% = fontsize% - 2
CASE -187
IF fontsize% < 31 THEN fontsize% = fontsize% + 2
END SELECT
END IF
IF oldf% AND fontsize% <> oldf% THEN
_FONT font(fontsize%)
fw% = 0: fh% = 0
DO
fw% = _FONTWIDTH: fh% = _FONTHEIGHT
IF fw% <> 0 AND fh% <> 0 THEN EXIT DO
_DELAY .1
LOOP
WIDTH ww / fw%, wh / fh%
PALETTE 7, 63: COLOR 0, 7: CLS
_FONT font(fontsize%)
DO: LOOP UNTIL _SCREENEXISTS: _SCREENMOVE 0, 0
PRINT "Font size changed to:"; fontsize%, "width ="; _WIDTH
_KEYCLEAR
END IF
oldf% = fontsize%
LOOP
It's like the old invention saying goes, "Necessity is a mother."
Pete