Re: Kanji bit-mapped font
- Posted by Craig Welch <euphoria at welchaviation.org> Jul 04, 2004
- 588 views
Derek Parnell wrote: > > Truetype fonts don't work. They're fine in Microsoft applications such as > > Office, but won't work in my Euphoria application. Hence my search for a > > way to render a bitmap font. > > You can simply write a True-Type font to a bitmap in RAM and then render > that on the screen. Here is starting point for you. It creates 26 bitmaps, > from "A" to "Z" in Times New Roman font at 200 point. Thanks Derek, I'll have a play with that later today. It will be interesting to see if I can use that for double-byte fonts. Meanwhile, I found that there are a few kanji fonts available in bdf format, which is far easier to understand than the example to which I first referred. Here is one character, for example:
STARTCHAR CNS2-5071 ENCODING 17522 SWIDTH 985 0 DWIDTH 40 0 BBX 40 40 0 -3 BITMAP 0300018000 03e000c000 03c000e000 0380007000 038000700c 038000301e 0383ffffff 0388300180 039c1801e0 fffe0c01c0 03800e0380 0380070300 0780070618 0781830c3c 07c1fffffe 0fe1c0601e 0fb1c0781c 0fb9c0701c 1f9dc0701c 1b9dc0719c 1b8ddfffdc 3b81c0701c 3381c0701c 3381c0701c 6381c0701c 6381c7ff1c c381c7071c c381c7071c 8381c7071c 0381c7071c 0381c7071c 0381c7ff1c 0381c6061c 0381c0001c 0381c0001c 0381c0003c 0381c007fc 0381c00078 0381c00070 0301800060 ENDCHAR
The second number in 'BBX' (40) refers to the number of encoding lines to follow. Because that's so readable, it was a simple 10 minutes coding to turn 0381c007fc into the Euphoria required {0,0,0,0,0,0,1,1, etc} and display the character as a bitmap. Now I'll just write an indexing routine and all should be well. Thanks again for your help ... -- Craig