Post Reply 
Question about displaying strings
10-21-2019, 06:58 PM
Post: #10
RE: Question about displaying strings
(10-21-2019 04:29 AM)Wes Loewer Wrote:  In my example, I wrote

Code:
DIMGROB_P(G1,320,240);        // is this line really necessary?
w:=TEXTOUT_P(str2,G1,0,0);

but the program works the same without the DIMGROB_P() function.

My guess would be that if you don't declare a GROB, its initial dimensions are set to zero. TEXTOUT (..._P) must have built-in protection mechanisms against overwriting RAM outside predeclared bounds, so nothing bad happens (processor does not perform erroneous write), but the procedure keeps being executed until the last glyph is processed. And since you don't see what's printed in the GROB, the issue goes unnoticed.
This would explain why you get the right result. TEXTOUT (..._P) simply returns coordinates of where the end of the string would be if it were printed.
(I did not test it, so I may be wrong. My guess is based on the HPP behavior: if a string longer than the remaining space is printed, it's simply truncated.)

Darius
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Question about displaying strings - DrDarius - 10-21-2019 06:58 PM



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