Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Locate command on the ttf graphical screens
#3
@bplus has misdiagnosed your problem as you have left out several important pieces of information for him and no working code to run to showcase the issue in discussion.

The issue you are seeing stems down to this:

LOCATE has two separate methods to move text to a certain position on the screen.   
1) With a monospaced font, text will locate by column and row according to _FontWidth and _FontHeight.
2) With a variable-width font, there is no set _FontWidth so you can't just move X characters to the right.  Instead, it moves by PIXELS for positioning to the right.  The up/down row position is the same as always, as you still have a _FontHeight, but there is no valid _FontWidth for left/right position so pixels are used instead.

Solution?

1) Load a monospace font:  _LOADFONT(fontname$, fontsize, "monospace")     <-- This will give you a valid _FontWidth and allow proper LOCATE positioning based on the width.

2) Swap over to using pixel coordinates for the left/right.  Instead of moving 1 pixel, move.. 8 or so per character, for your font (or whatever you choose to be a reasonable guesstimate for a midpoint of your font sizes)

Anywho... that's the issue you're seeing in a nutshell.  Wink
Reply


Messages In This Thread
RE: Locate command on the ttf graphical screens - by SMcNeill - 03-09-2025, 04:01 PM



Users browsing this thread: 1 Guest(s)