; FontSheetError Example ; ---------------------- ; Requires Extended mode. Graphics 640,480,0,2 SetBuffer BackBuffer() ; Deliberately try to load a descriptor that does not exist: ; LoadFontSheet returns 0 instead of opening an error dialog bad=LoadFontSheet("missing-font-sheet.fnt") ; FontSheetError returns the diagnostic for the most recent failure bad_error$=FontSheetError() ; A successful load clears the diagnostic again good=LoadFontSheet("../../../samples/font-sheets/assets/glossy_cyan_techno_font_atlas_game.fnt",36) good_error$=FontSheetError() ; A small system font for the report text info_font=LoadFont("Arial",14) While Not KeyDown(1) Cls SetFont info_font Color 255,255,255 Text 0,0,"Esc: exit" Text 0,40,"LoadFontSheet(missing-font-sheet.fnt) returned "+bad Color 255,120,120 Text 0,60,"FontSheetError() =" ; The diagnostic includes the full path, so wrap it over two lines Text 20,80,Left$(bad_error$,60) Text 20,100,Mid$(bad_error$,61) Color 255,255,255 Text 0,140,"Valid sheet then loaded OK, handle "+good Text 0,160,"FontSheetError() after success = '"+good_error$+"' (empty again)" ; Prove the good handle works If good<>0 Then SetFont good Color 180,255,255 Text 320,220,"loaded!",True End If Flip Wend End