@bplus
How about this more involved model?
Pete
How about this more involved model?
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
oldf% = fontsize%
IF adj = 0 THEN adj = 2
fontsize% = fontsize% + adj
IF fontsize% = 32 THEN
adj = -2
ELSE
IF fontsize% = 8 THEN adj = 2
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
WHILE _MOUSEINPUT: WEND
IF _MOUSEBUTTON(1) THEN END
LOOP
Pete