Post Reply 
Question about displaying strings
10-21-2019, 06:49 PM
Post: #9
RE: Question about displaying strings
Quote:The issue is that you do not have a fixed font anymore. You have a TTF font, with 30K+ characters, and flags to render in different forms. The only way to really determine what the display size will be is to do it basically!
Given what the HPP command set is, yes.
That said, the method used to center a string is a work around. It has two disadvantages:
1. It calls for allocating memory taking it from available memory pool.
2. It goes through the extra printing process, which takes time.
On the OS level getting the width of the glyph (regardless whether it's a rater, vector, or true type font) is a simple process. A function which would get the widths of the glyphs in the string, add them up, and return the result is way faster than printing the string, and calls for no memory allocation.
All I am stating is that there should be such a function available in the HPP command set. Such a function is very common in other language implementations.
To back my statement with an example and at the same time remain withing the realm of calculator world: A FontLib font library for CE C for TI84+CE provides a few variants of such a function.
Of course you may say that HPP G2 with its half a gigahertz of clock speed and a quarter of gigabyte of RAM can handle such a work around easily, and this is not a statement without merit. But I believe that every engineer during designing a product should optimize it for best performance within input requirements, and I am not seeing it in the context of this example.

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:49 PM



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