I was already thinking about this after examining the Font.c and the private header.

Here is what I think:
1. The fontMap is contracted on the fly.
2. A fake subfont featuring few unused "character codes" is added to the system.
3. On a first run we run a "calibration loop" - set the starting subfont index to 0 and create the master font and the subfont; call CharWidth() for say 3 or 30 (no matter) of the unused chars; on !=expected widths - undefined the two fonts, increase the subfont index; do it again until success.


Should take a up to a second to calibrate the font. May even calibrate it on every run if this is fast enough.

What do you think about this?

If you are trying to determine the maximum in use subfont index, then (if I understand your code correctly) you are relying on the OS handing an invalid subfont index properly. I don't know whether this is true for all versions of the OS.


Another approach (I think) would be to call FntGetFontPtr for the four standard fonts. By checking the bits in the header, you can verify that it's a font map. If so, you can walk the data to determine the subfont indexes that are actually in use, and thus determine the maximum value. And then continue with your idea for creating the font map on the fly.

I have one more question ’Äì is there a decent way to extract all the printable char codes on a Japanese device? To clarify ’Äúall the printable’Äù I mean all the char codes that are in the hierarchical ’ÄústdFont’Äù and need to be in my replacement font for the replacement to be valid?

There's not an existing API, unfortunately.

One approach I've used is to first draw (to an offscreen bitmap) a character that I know is undefined (but valid), and record the resulting bits. Then go into a loop like:

for (uint16_t i = 0; i < 0xFFFF; i++)
{
        if (TxtCharIsValid(i))
        {
                Draw the character into another offscreen bitmap
                Compare to the "known" undefined bitmap
        }
}

-- Ken
--
Ken Krugler
TransPac Software, Inc.
<http://www.transpac.com>
+1 530-470-9200

--
For information on using the Palm Developer Forums, or to unsubscribe, please 
see http://www.palmos.com/dev/support/forums/

Reply via email to