Active Forums > Bugs
Repeated calls to _LOADFONT with "monospace" can crash
moises1953:
_LOADFONT needs the use of style$ variable, not a constant.
This example works OK:
--- Code: QB64: ---'MultipleFontLoad'SCREEN 0 may use only one FONT. When changed, changes full screen'Otherwise graphic modes preserve the screen contents when change font'_LOADFONT needs the use of style$ variable instead of constantCONST MINSIZE = 8, MAXSIZE = 100DIM i AS INTEGER, hFont(MAXSIZE) AS LONGf$ = "cour.ttf"style$ = "MONOSPACE" PRINT "LOADING:"; f$;FOR i = MINSIZE TO MAXSIZE PRINT i; hFont(i) = _LOADFONT(f$, i, style$) IF hFont(i) <= 0 THEN EXIT FORNEXT iIF i > MAXSIZE THEN PRINT DO PRINT "Font sizes:"; MINSIZE; "-"; MAXSIZE; INPUT ". Select size"; fontsize% IF fontsize% < MINSIZE OR fontsize% > MAXSIZE THEN EXIT DO _FONT hFont(fontsize%) LOOPELSE PRINT "Fail"; i; hFont(i)END IF _FONT 16FOR i = MINSIZE TO MAXSIZE _FREEFONT hFont(i)NEXT iEND
Navigation
[0] Message Index
[*] Previous page
Go to full version