Post Reply 
TEXTOUT_P()
04-30-2022, 05:14 PM (This post was last modified: 04-30-2022 05:18 PM by Guenter Schink.)
Post: #3
RE: TEXTOUT_P()
A GROB 8 needs to be defined beforehand.

inserting the line e.g.:
DIMGROB_P(G8,80,100)
would return the correct values.

Here are my findings.

1. you know font(0) refers to the system font, don't you? (small(2), medium(3) or large(4))
2. seems the GROB needs to be wide enough to hold the string
3. at least one pixel on the vertical axis of the GROB needs to be in the string
4. if not it defaults to the system font
5. unless the selected font is smaller than the system font, then it provides the correct value

examples:
1.
system font set to large
DIMGROB_P(G8,1,1) // yes only one pixel
ab:=TEXTOUT_P(str,G8,0,0,1);
cd:=TEXTOUT_P(str,G8,0,60,7);

returns 35 VS 56. 35 because font(1) is smaller than the system font, and 56 because font(7) is larger than the system font, therefor it defaults to the system font (large is equivalent to font(4))

2.
system font set to arbitrary size
DIMGROB_P(G8,320,61) \\ Yes, just one pixel more on the y-axis works
ab:=TEXTOUT_P(str,G8,0,0,1);
cd:=TEXTOUT_P(str,G8,0,60,7);
returns 35 VS 78

Conclusion: If you wish to utilize GROB 8 to keep track of the x-position where the next character would be printed, create GROB 8 with width of expected length of the string e.g 320 by a vertical size of at least 1 pixel.

example.
system font set to arbitrary size
DIMGROB_P(G8,320,1) \\ Yes, only one pixel on the y-axis works
ab:=TEXTOUT_P(str,G8,0,0,1);
cd:=TEXTOUT_P(str,G8,0,0,7);

returns 35 VS 78

HTH,
Günter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
TEXTOUT_P() - matalog - 04-29-2022, 11:38 AM
RE: TEXTOUT_P() - matalog - 04-29-2022, 07:59 PM
RE: TEXTOUT_P() - Guenter Schink - 04-30-2022 05:14 PM
RE: TEXTOUT_P() - matalog - 05-01-2022, 02:53 PM



User(s) browsing this thread: 1 Guest(s)