Changing font-size in _rgb32 mode
#15
(04-08-2023, 09:51 PM)mnrvovrfc Wrote: Anyway, the following code gives me an illegal function call. Try explaining that, which was what I was trying to say above. Use _PRINTSTRING instead for this! (Trying hard not to be like that privileged user from Galleon's forum who liked using exclamation points...)


Of course it's going to give you an error.  Let's take a moment and look at why:

h& = _LoadFont("C:\Windows\Fonts\DejaVuSerif.ttf", 18)  <-- This line loads a font, non-monospaced, at size 18.  That gives us a _FONTHEIGHT of 18 and a _FONTWIDTH of 0.

Locate 400, 300  <-- This says that we're going to locate 400 rows down and 300 pixels across.

Since each row is 18 pixels in height (font width 18, as specified above), you're trying to print down at position (300, 400 * 18 -- in x/y graphic coordinates)...

Your screen is defined as being 800 x 600 pixels in size.

400 * 18 = 7,200.

What do you think should happen when you try to print at (300, 7200) on a screen that is only (800, 600) in size?  Where would the print cursor go after printing at that position?  How far should the screen scroll?  What do you think is the normal behavior for PRINT in such a situation?

ILLEGAL FUNCTION CALL  (BEEEP!)



Even with variable width fonts, you still always LOCATE by row with the first value.

LOCATE 1 is the first row of text on the screen.
LOCATE 2 is the second row of text on the screen.
LOCATE 400 is an error since your 600 pixel high screen can only hold 33 rows of text upon it at a time.

In a SCREEN 0 text screen, what happens if you try to LOCATE 400, 300?  Isn't that the exact same Illegal Function Call?
Reply


Messages In This Thread
RE: Changing font-size in _rgb32 mode - by bplus - 04-08-2023, 01:51 PM
RE: Changing font-size in _rgb32 mode - by bplus - 04-08-2023, 05:10 PM
RE: Changing font-size in _rgb32 mode - by SMcNeill - 04-08-2023, 10:31 PM



Users browsing this thread: 5 Guest(s)