[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: VMs: For this MONKEY: Help, pointers, etc. please: Unicode, TrueType fonts, kerning



Hi Jacques,

At 11:08 06/09/2003 +1000, Jacques Guy wrote:
Some of my google searches have turned up
pages with "TrueType font for DOS" but when I
visited those pages, there was nothing of the
kind. I did not turn to www.archive.org because
I could not imagine DOS handling TrueType fonts,
only bitmaps generated from TTF.

If you want a free ANSI C library that can render TrueType fonts (even in DOS!) with only a modest memory footprint, here's one excellent candidate:-
http://www.freetype.org/freetype1/


As for Unicode, I am completely lost. Snippets
of code would help, in whatever programming
language (I can read C and its relatives, but
APL is right out!).

In C/C++, an ANSI (UTF-8) 8-bit character is a (char) and a Unicode (UTF-16) character is normally a (wchar_t) [typically 16-bits wide]. Modern C libraries should have a parallel set of string functions for null-terminated strings of (wchar_t)'s:-


For example:
        UTF-8:  char * strcpy(char *s1, const char *s2);
        UTF-16: wchar_t *wcscpy(wchar_t *s1, const wchar_t *s2);

If you're compiling fixed text into a Windows programme, you'd typically include your Unicode multi-byte strings into your resource file - but otherwise, the tricky bit (as I guess you suspect) is normally getting UTF-16 data into the machine. AIUI, the two common solutions to this are:-
(1) parsing an RTF (Rich Text File); or
(2) parsing a UTF-16-encoded XML file.


AIUI, RTF 1.6 was the first version of the spec to encode Unicode - here's a URL on Microsoft's website.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnrtfspec/html/rtfspec.asp
Note that this also includes sample code for a non-robust RTF reader, which looks (to my eyes) slightly suspect. (Gnu Recode [below] looks to be a somewhat better solution).


There are probably numerous other solutions (like PDF - but please email if you know an easier way!), but RTF or XML are probably the two routes I'd choose between - getting an RTF import library is probably your first step.

For freeware RTF handling code, the two that jump out are:-
Gnu UnRTF <-- not actively maintained, I don't know if it handles RTF 1.6
Free Recode <-- probably what you're looking for?
http://www.iro.umontreal.ca/~pinard/recode/HTML/
http://sourceforge.net/projects/recode


Why do I ask? I don't see much point in working
on this MONKEY, if it cannot process texts in,
say Kannada or Chinese, or, why not, Akkadian
cuneiform.

Maintaining and documenting numerous languages in the Unicode 16-bit space is a huge and apparently never-ending task... but most of them are in there somewhere (not sure about Akkadian cuneiform, but you never know). :-)


Hope this is a help! :-)

Cheers, .....Nick Pelling.....


______________________________________________________________________ To unsubscribe, send mail to majordomo@xxxxxxxxxxx with a body saying: unsubscribe vms-list