Post Reply 
Custom Text Formatting (Previously: Getting long results in a program)
03-26-2024, 07:03 AM (This post was last modified: 03-26-2024 07:07 AM by komame.)
Post: #11
RE: Getting long results in Program
(03-24-2024 04:28 PM)Tyann Wrote:  Hello Komame

Thank you for these details, I knew PRINT2D.
To overcome this, I worked on 2 functions: DEFTEXT and TEXT_P
which allow you to define attributes and thus display text in bold, raised, underlined and strikethrough.
I could publish this if anyone is interested; however, I don't know how to
program an italic display.

Hi Tyann,

To display text written in italics, you first need to buffer the text, for example in G9, and then move it to the target area (G0?) using BLIT_P in groups of a few lines (to avoid too steep an angle), shifting them by one pixel to the right.
Let's assume that in variables sx and sy, you have the dimensions of the text (obtained using TEXTSIZE), and in G9 at position (0, 0), you have your text displayed using TEXTOUT_P. You start from the bottom, and you directly move the last 3 lines from G9 to G0 at (x, y+sy), then the next 3 lines to (x+1, y+sy-3), the next 3 to (x+2, y+sy-6), and so on. Because HP Prime applies antialiasing during text rendering, it's important to consider whether the text will also be displayed on other objects. If the background under the text doesn't need to be preserved (e.g., when the background under the text is of a uniform color), the matter is simple. But if you want to preserve it, you must additionally copy a portion of the target area from G0 to G9, on which you will display the text, moving it in groups of lines one pixel in the other direction (i.e., to the left), even before displaying the text on G9 using TEXTOUT_P, because otherwise, color distortions will appear on the edges of the text or distortions of the background.

Hah, before I finished writing this description, I realized that in the time I spent on it, I could have already completed the implementation of this solution Big Grin

If you need help, let me know, because it's already working in my head... Wink

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


Messages In This Thread
RE: Getting long results in Program - komame - 03-26-2024 07:03 AM
RE: Custom Text Formatting - Tyann - 04-15-2024, 06:55 PM
RE: Custom Text Formatting - komame - 04-15-2024, 07:42 PM
RE: Custom Text Formatting - Tyann - 04-16-2024, 04:38 AM
RE: Custom Text Formatting - komame - 04-16-2024, 06:02 AM



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