Post Reply 
Parameters of the TEXTSIZE
03-16-2024, 05:35 PM (This post was last modified: 03-16-2024 05:36 PM by komame.)
Post: #3
RE: Parameters of the TEXTSIZE
(03-15-2024 11:24 PM)Guenter Schink Wrote:  Maybe the syntax is the same as in "TEXTOUT" in order to have the same parsing of the command, but then disregarding parameters 3 and 5. I just gave the 3rd parameter which under my assumption would be "textColor", an excessive high value, e.g.999999999. Then it returns "Error:Invalid input" Conclusion (perhaps) it uses the same syntax as TEXTOUT, but disregards parameter 3(textColor) and parameter 5(backgroundColor). Thus it's easy for the system to evaluate parameter 4(width). Great find, by the way.

When using hex numbers it seems to be more obvious(assuming still). You first have to set integers to a length > 32. e.g. 64 in the setup screen. Now entering a value of #FFFFFFh for textColor works as there are four channels, while #1FFFFFFFFh gives the error, no fifth channel there.

Hi, Günter.

Thank you for your comment.
What you suggest makes sense. It's likely that during the implementation of the TEXTSIZE instruction, a portion of the code was copied from the definition of the TEXTOUT instruction due to their similarity. So, it's another messy instruction that needs to be rebuilt, much like TEXTOUT_P with 2D mode.

Additionally, it can be said that TEXTSIZE(obj, font) is an alternative to TEXTOUT_P(obj, {"2D", font}) with the difference that TEXTOUT_P in 2D mode does not work correctly with text strings and returns a slightly wider width than TEXTSIZE. This slightly wider width probably results from the initial assumption for TEXTOUT_P that the measurement should provide the X coordinate for the next text, potentially appearing after the measured text (so, it took into account the position where the given text is being inserted). Unfortunately, for 2D mode, we have another bug (or inconsistency) here, because coordinates are required but ignored in 2D mode, and the provided width (slightly increased) is always calculated from the point (0, 0).

For example:
TEXTSIZE(123,4) → {27,20}
TEXTOUT_P(123,0,0,{"2D",4}) → {29,20}
TEXTOUT_P(123,50,50,{"2D",4}) → {29,20}

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


Messages In This Thread
Parameters of the TEXTSIZE - komame - 03-14-2024, 09:14 PM
RE: Parameters of the TEXTSIZE - komame - 03-16-2024 05:35 PM
RE: Parameters of the TEXTSIZE - komame - 03-18-2024, 06:45 AM
RE: Parameters of the TEXTSIZE - Tyann - 03-31-2024, 01:06 PM
RE: Parameters of the TEXTSIZE - komame - 03-31-2024, 06:37 PM



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