Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Loading font from memory help needed...
#4
Try these @Dav :

Code: (Select All)

'load from file into fontdata$
OPEN "c:\windows\fonts\courbd.ttf" FOR BINARY AS 1
fontdata$ = INPUT$(LOF(1), 1)
CLOSE

'load courbd from fontdata$ string memory
myfont& = _LOADFONT(fontdata$, 32, "memory, monospace")
_FONT myfont&
PRINT "Hello World"

SLEEP

SCREEN _NEWIMAGE(640, 480, 32)
myfont& = _LOADFONT(fontdata$, 32, "memory")
_FONT myfont&
PRINT "Hello World"

What was the glitch?  If you look at the top code, you'll notice that you're in a SCREEN 0 text screen.  SCREEN 0 *requires* that all fonts used for it has to be MONOSPACE specified when loaded.  Without the "monospace" you can't load the font in memory and use it in SCREEN 0.

If you look at the second segment of the above, you'll notice that I'm not using "monospace", and yet it's working.  This is because 32-bits screens support variable-width fonts and they don't have to have that flag enabled when loading them.

The issue you're seeing seems to be just a simple case of trying to use a variable-width font in a monospace-required screen.  Wink
Reply


Messages In This Thread
Loading font from memory help needed... - by Dav - 09-16-2023, 12:10 AM
RE: Loading font from memory help needed... - by SMcNeill - 09-16-2023, 01:09 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Fibonacci Help needed! Unseen Machine 18 1,407 12-26-2025, 09:05 PM
Last Post: Petr
  Font Size in Threads Dimster 5 376 12-12-2025, 04:49 PM
Last Post: Dimster
  Problem with font in Teletext browser. SquirrelMonkey 7 763 08-27-2025, 11:38 AM
Last Post: BDS107
  Loading from file into _MEM? and LEN a TYPE... Unseen Machine 9 975 08-03-2025, 02:55 AM
Last Post: SMcNeill
  need help printing a scaled string in a custom font to a 32-bit image madscijr 9 1,166 07-03-2025, 04:48 PM
Last Post: SMcNeill

Forum Jump:


Users browsing this thread: 1 Guest(s)