Oh, this is a patch against version 1.05a of MagicPoint to provide TrueType font encodings iso-8859-1, iso-8859-2 (by default, read on!), iso-8859-3 and iso-8859-4. In my patch against version 1.04a I had more encodings. I dropped all others because only this four encodings are supported in other parts of MagicPoint code. When I did last version I had feeling that it's a cludge. I have it now also, even more. Why? Documentation of MagicPoint in places refere to %charset which isn't implemented right now. So, in line: char *registry = "iso8859-2"; /* was NULL */ I actually set iso8859-2 as a default which you have to change if you want some other encoding. When %charset become available, I will have to use that. For word wrapping, don't forget to set LANG variable, otherwise it WILL try to split words at your national characters (read README.lang !) Other than that this patch is cleaner than one against 1.04a, and I recomend it! Dobrica Pavlinusic , 1999-07-18 diff -u -r magicpoint-1.05a/configure.in magicpoint-1.05a+ttfencoding/configure.in --- magicpoint-1.05a/configure.in Tue Jun 8 22:00:41 1999 +++ magicpoint-1.05a+ttfencoding/configure.in Sun Jul 18 05:27:04 1999 @@ -220,6 +220,19 @@ fi fi +if test "$mgp_use_freetype" = "yes"; then + AC_MSG_CHECKING(if --disable-freetype-encoding option specified) + AC_ARG_ENABLE(freetype-encoding, + [ --disable-freetype-encoding don't use freetype encodings.], + [mgp_skip_freetype_enc="yes"], + [mgp_skip_freetype_enc="no"]) + AC_MSG_RESULT($mgp_skip_freetype_enc) + + if test "$mgp_skip_freetype_enc" = "no"; then + AC_DEFINE(FREETYPE_ENCODING) + fi +fi + dnl Checks for header files. AC_PATH_X AC_HEADER_STDC diff -u -r magicpoint-1.05a/draw.c magicpoint-1.05a+ttfencoding/draw.c --- magicpoint-1.05a/draw.c Tue Jun 8 04:43:58 1999 +++ magicpoint-1.05a+ttfencoding/draw.c Sun Jul 18 07:04:45 1999 @@ -958,10 +958,10 @@ char *data; { u_char *p, *q; - char *registry = NULL; + char *registry = "iso8859-2"; /* was NULL */ u_int code2; static char *rtab96[] = { - NULL, /* ESC - @ */ + NULL, /* ESC - @ */ "iso8859-1", /* ESC - A */ "iso8859-2", /* ESC - B */ "iso8859-3", /* ESC - C */ diff -u -r magicpoint-1.05a/mgp.h magicpoint-1.05a+ttfencoding/mgp.h --- magicpoint-1.05a/mgp.h Sun Jun 6 19:55:18 1999 +++ magicpoint-1.05a+ttfencoding/mgp.h Sun Jul 18 06:55:12 1999 @@ -583,6 +583,10 @@ extern char *freetypefontdir; extern char *freetypefont0; /* font name to be used as a last resort */ extern int unicode_map[65536]; +extern u_int unicode_map_iso8859_1(u_int); +extern u_int unicode_map_iso8859_2(u_int); +extern u_int unicode_map_iso8859_3(u_int); +extern u_int unicode_map_iso8859_4(u_int); #endif #ifdef TTY_KEYINPUT diff -u -r magicpoint-1.05a/tfont.c magicpoint-1.05a+ttfencoding/tfont.c --- magicpoint-1.05a/tfont.c Sat May 15 17:58:08 1999 +++ magicpoint-1.05a+ttfencoding/tfont.c Sun Jul 18 07:11:17 1999 @@ -519,10 +519,10 @@ n = TT_Get_CharMap_Count(face[tfcuridx]); #endif -#if 0 +#if 1 if (verbose) { - fprintf(stderr, "%d charmaps for font %s code %04x\n", - n, tfloadedfont[tfcuridx], code & 0xffff); + fprintf(stderr, "%d charmaps for font %s code %04x registry %s\n", + n, tfloadedfont[tfcuridx], code & 0xffff, registry); } #endif @@ -543,6 +543,17 @@ if (code > 256) code = unicode_map[code]; #endif /* FREETYPE_CHARSET16 */ +#ifdef FREETYPE_ENCODING + if (registry && strncmp(registry, "iso8859-1", 9) == 0) { + code = unicode_map_iso8859_1(code); + } else if (registry && strncmp(registry, "iso8859-2", 9) == 0) { + code = unicode_map_iso8859_2(code); + } else if (registry && strncmp(registry, "iso8859-3", 9) == 0) { + code = unicode_map_iso8859_3(code); + } else if (registry && strncmp(registry, "iso8859-4", 9) == 0) { + code = unicode_map_iso8859_4(code); + } +#endif /* FREETYPE_ENCODING */ return TT_Char_Index(char_map, (short) code); } #ifdef FREETYPE_CHARSET16 Only in magicpoint-1.05a+ttfencoding: tokdefs.h diff -u -r magicpoint-1.05a/unimap.c magicpoint-1.05a+ttfencoding/unimap.c --- magicpoint-1.05a/unimap.c Sun Apr 11 20:14:27 1999 +++ magicpoint-1.05a+ttfencoding/unimap.c Sun Jul 18 06:24:56 1999 @@ -3480,3 +3480,85 @@ } #endif /* FREETYPE_CHARSET16 */ + +/* remap from unicode to other encodings + Based on file encoding.cpp from xfstt (C) Copyright 1998 Herbert Duerr + Modifications for MagicPoint by Dobrica Pavlinusic +*/ + +#ifdef FREETYPE_ENCODING + +u_int unicode_map_iso8859_1( u_int code) +{ + if( code == 0x80) code = 0x20AC; // euro currency symbol + return code; +} + + +u_int unicode_map_iso8859_2( u_int code) +{ + static unsigned short table[] = { + 0x0a0, 0x104, 0x2d8, 0x141, 0x0a4, 0x13d, 0x15a, 0xa7, + 0x0a8, 0x160, 0x15e, 0x164, 0x179, 0x0ad, 0x17d, 0x17b, + 0x0b0, 0x105, 0x2db, 0x142, 0x0b4, 0x13e, 0x15b, 0x2c7, + 0x0b8, 0x161, 0x15f, 0x165, 0x17a, 0x2dd, 0x17e, 0x17c, + 0x154, 0x0c1, 0x0c2, 0x102, 0x0c4, 0x139, 0x106, 0x0c7, + 0x10c, 0x0c9, 0x118, 0x0cb, 0x11a, 0x0cd, 0x0ce, 0x10e, + 0x110, 0x143, 0x147, 0x0d3, 0x0d4, 0x150, 0x0d6, 0x0d7, + 0x158, 0x16e, 0x0da, 0x170, 0x0dc, 0x0dd, 0x162, 0x0df, + 0x155, 0x0e1, 0x0e2, 0x103, 0x0e4, 0x13a, 0x107, 0x0e7, + 0x10d, 0x0e9, 0x119, 0x0eb, 0x11b, 0x0ed, 0x0ee, 0x10f, + 0x111, 0x144, 0x148, 0x0f3, 0x0f4, 0x151, 0x0f6, 0x0f7, + 0x159, 0x16f, 0x0fa, 0x171, 0x0fc, 0x0fd, 0x163, 0x2d9 + }; + + if( code == 0x80) return 0x20AC; // euro currency symbol + if( code <= 0xa0 || code >= 256) return code; + return table[ code - 0xa0]; +} + +u_int unicode_map_iso8859_3( u_int code) +{ + static unsigned short table[] = { + 0x0a0, 0x126, 0x2d8, 0x0a3, 0x0a4, 0x0a5, 0x124, 0x0a7, + 0x0a8, 0x130, 0x15e, 0x11e, 0x134, 0x0ad, 0x0ae, 0x17b, + 0x0b0, 0x127, 0x0b2, 0x0b3, 0x0b4, 0x0b5, 0x125, 0x0b7, + 0x0b8, 0x131, 0x15f, 0x11f, 0x135, 0x0bd, 0x0be, 0x17c, + 0x0c0, 0x0c1, 0x0c2, 0x0c3, 0x0c4, 0x10a, 0x108, 0x0c7, + 0x0c8, 0x0c9, 0x0ca, 0x0cb, 0x0cc, 0x0cd, 0x0ce, 0x0cf, + 0x0d0, 0x0d1, 0x0d2, 0x0d3, 0x0d4, 0x120, 0x0d6, 0x0d7, + 0x11c, 0x0d9, 0x0da, 0x0db, 0x0dc, 0x16c, 0x15c, 0x0df, + 0x0e0, 0x0e1, 0x0e2, 0x0e3, 0x0e4, 0x10b, 0x109, 0x0e7, + 0x0e8, 0x0e9, 0x0ea, 0x0eb, 0x0ec, 0x0ed, 0x0ee, 0x0ef, + 0x0f0, 0x0f1, 0x0f2, 0x0f3, 0x0f4, 0x121, 0x0f6, 0x0f7, + 0x11d, 0x0f9, 0x0fa, 0x0fb, 0x0fc, 0x16d, 0x15d, 0x2d9 + }; + + if( code == 0x80) return 0x20AC; // euro currency symbol + if( code <= 0xa0 || code >= 256) return code; + return table[ code - 0xa0]; +} + +u_int unicode_map_iso8859_4( u_int code) +{ + static unsigned short table[] = { + 0x0a0, 0x104, 0x138, 0x156, 0x0a4, 0x128, 0x13b, 0x0a7, + 0x0a8, 0x160, 0x112, 0x122, 0x166, 0x0ad, 0x17d, 0x0af, + 0x0b0, 0x105, 0x2db, 0x157, 0x0b4, 0x129, 0x13c, 0x2c7, + 0x0b8, 0x161, 0x113, 0x123, 0x167, 0x14a, 0x17e, 0x14b, + 0x100, 0x0c1, 0x0c2, 0x0c3, 0x0c4, 0x0c5, 0x0c6, 0x12e, + 0x10c, 0x0c9, 0x118, 0x0cb, 0x116, 0x0cd, 0x0ce, 0x12a, + 0x110, 0x145, 0x14c, 0x136, 0x0d4, 0x0d5, 0x0d6, 0x0d7, + 0x0d8, 0x172, 0x0da, 0x0db, 0x0dc, 0x168, 0x16a, 0x0df, + 0x101, 0x0e1, 0x0e2, 0x0e3, 0x0e4, 0x0e5, 0x0e6, 0x12f, + 0x10d, 0x0e9, 0x119, 0x0eb, 0x117, 0x0ed, 0x0ee, 0x12b, + 0x111, 0x146, 0x14d, 0x137, 0x0f4, 0x0f5, 0x0f6, 0x0f7, + 0x0f8, 0x173, 0x0fa, 0x0fb, 0x0fc, 0x169, 0x16b, 0x2d9 + }; + + if( code == 0x80) return 0x20AC; // euro currency symbol + if( code <= 0xa0 || code >= 256) return code; + return table[ code - 0xa0]; +} + +#endif /* FREETYPE_ENCODING */