From 26b7f99385141b8f009fc756e099dde95ef93e34 Mon Sep 17 00:00:00 2001 From: wlemb Date: Sat, 3 Jan 2004 08:26:56 +0000 Subject: * font/devlj4/generate/text.map: Add more MSL numbers. * src/utils/hpftodit/hpftodit.cpp (is_decomposed): New macro. (text_symbol_sets): Add more symbol sets. (debug_flag): New static variable (moved from `main'). (get_printcode, show_symset): New functions. (main): Remove `debug_flag'. (output_charset): Use `show_symset'. (dump_symbols): Use `show_symset'. Print symsets for all glyphs. (read_map): Actually call `unicode_to_ucode_make' but this time correctly. --- ChangeLog | 17 +++++++ font/devlj4/generate/special.map | 1 - font/devlj4/generate/text.map | 64 ++++++++++++++++++++---- src/utils/hpftodit/hpftodit.cpp | 102 ++++++++++++++++++++++++++++----------- 4 files changed, 144 insertions(+), 40 deletions(-) diff --git a/ChangeLog b/ChangeLog index 94f9c511..138c8454 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2004-01-02 Werner LEMBERG + + * font/devlj4/generate/text.map: Add more MSL numbers. + +2004-01-02 Jeff Conrad + + * src/utils/hpftodit/hpftodit.cpp (is_decomposed): New macro. + (text_symbol_sets): Add more symbol sets. + (debug_flag): New static variable (moved from `main'). + (get_printcode, show_symset): New functions. + (main): Remove `debug_flag'. + (output_charset): Use `show_symset'. + (dump_symbols): Use `show_symset'. + Print symsets for all glyphs. + (read_map): Actually call `unicode_to_ucode_make' but this time + correctly. + 2004-01-01 Werner LEMBERG * font/devlj4/generate/text.map, font/devlj4/generate/special.map: diff --git a/font/devlj4/generate/special.map b/font/devlj4/generate/special.map index 65f4b850..fe947814 100644 --- a/font/devlj4/generate/special.map +++ b/font/devlj4/generate/special.map @@ -48,7 +48,6 @@ 225 2193 da 226 2192 -> 227 2190 <- -# 228 ? 228 2319 u2319 229 2194 <> 230 25B2 u25B2 diff --git a/font/devlj4/generate/text.map b/font/devlj4/generate/text.map index 06625744..c596a217 100644 --- a/font/devlj4/generate/text.map +++ b/font/devlj4/generate/text.map @@ -129,7 +129,7 @@ # 96 * 96 007E ti # 97 medium shading * -# 98 ? +# 98 uppercase greek delta -- unused 99 00C0 `A 100 00C2 ^A @@ -277,7 +277,7 @@ # 225 down arrow * # 226 right arrow * # 227 left arrow * -# 228 tick up at left * +# 228 tick up at left (`logicalnotflopped') * # 229 left/right arrow * # 230 up solid arrowhead * @@ -337,13 +337,13 @@ # 280 top 1/2 solid rectangle * # 281 lowercase greek alpha -- unused -# 282 ? +# 282 lowercase greek beta -- unused # 283 uppercase greek gamma -- unused # 284 lowercase greek pi -- unused # 285 uppercase greek sigma -- unused # 286 lowercase greek sigma -- unused # 287 lowercase greek tau -- unused -# 288 ? +# 288 uppercase greek phi -- unused # 289 uppercase greek theta -- unused # 290 uppercase omega, ohms -- unused @@ -362,7 +362,7 @@ # 302 * 302 00B7 pc # 303 radical symbol * -# 304 ? +# 304 lowercase greek eta -- unused # 305 small solid box * 306 013F u013F 307 0140 u0140 @@ -405,7 +405,13 @@ 340 014A u014A 341 014B u014B 342 0111 u0111 -# 343-399 ? +# 343-369 ? + +# 370 `lira' ? +# 371-374 ? +# 375 `asciigrave' ? + +# 376-399 ? 400 0102 u0041_0306 401 0103 u0061_0306 @@ -789,12 +795,50 @@ # 1110 medium open bullet * # 1111 large solid bullet ? # 1112 visible carriage return * -# 1113 visible tab ? +# 1113 visible tab (`arrowtab') ? # 1114 visible space * # 1115 visible soft hyphen -- unused -# 1116 visible end-of-file ? - -# 1117-3811 ? +# 1116 visible end-of-file (`embox')? +# 1117 `enspacereverse' ? +# 1118 `emspacereverse' ? +# 1119 ? + +# 1120-1399 ? + +1400 u0301 +1401 u0300 +1402 u0302 +1403 u0308 +1404 u0303 +1405 u030C +1406 u0306 +1407 u030B +1408 u030A +1409 u0307 + +1410 u0304 +1411 u0327 +1412 u0328 +# 1413 combining uppercase acute accent -- unused +# 1414 combining uppercase grave accent -- unused +# 1415 combining uppercase circumflex accent -- unused +# 1416 combining uppercase dieresis accent -- unused +# 1417 combining uppercase tilde accent -- unused +# 1418 combining uppercase caron accent -- unused +# 1419 combining uppercase breve accent -- unused + +# 1420 combining uppercase double acute accent -- unused +# 1421 combining uppercase ring accent -- unused +# 1422 combining uppercase dot accent -- unused +# 1423 combining uppercase macron accent -- unused +# 1424 combining uppercase cedilla -- unused +# 1425 combining uppercase ogonek -- unused +# 1426 ? +# 1427 uppercase middle dot -- unused (no Unicode mapping) +# 1428 ? +# 1429 ? + +# 1430-3811 ? # 3812 ornament, apple ? diff --git a/src/utils/hpftodit/hpftodit.cpp b/src/utils/hpftodit/hpftodit.cpp index 779d3c1b..a8dccde0 100644 --- a/src/utils/hpftodit/hpftodit.cpp +++ b/src/utils/hpftodit/hpftodit.cpp @@ -45,7 +45,9 @@ extern "C" const char *Version_string; extern const char *hp_msl_to_unicode_code(const char *); #define SIZEOF(v) (sizeof(v)/sizeof(v[0])) -#define equal(a, b) (strcmp(a, b) == 0) +#define equal(a, b) (strcmp(a, b) == 0) +// only valid if is_uname(c) has returned true +#define is_decomposed(c) strchr(c, '_') #define NO 0 #define YES 1 @@ -206,7 +208,7 @@ uint16 text_symbol_sets[] = { SYMBOL_SET(7, 'J'), // Desktop SYMBOL_SET(6, 'J'), // Microsoft Publishing SYMBOL_SET(9, 'E'), // Windows Latin 2, Code Page 1250 - SYMBOL_SET(2, 'N'), // Latin 2 (subset of 9E, + SYMBOL_SET(2, 'N'), // Latin 2 (subset of 9M, // so we should never get here) SYMBOL_SET(0, 'N'), // Latin 1 (subset of 19U, // so we should never get here) @@ -214,10 +216,9 @@ uint16 text_symbol_sets[] = { SYMBOL_SET(10, 'J'), // PS Standard SYMBOL_SET(9, 'U'), // Windows 3.0 "ANSI" -#if 0 - SYMBOL_SET(13, 'J'), // Ventura International - SYMBOL_SET(6, 'M'), // Ventura Math - SYMBOL_SET(14, 'J'), // Ventura US +//SYMBOL_SET(13, 'J'), // Ventura International (deprecated) +//SYMBOL_SET(6, 'M'), // Ventura Math (deprecated) +//SYMBOL_SET(14, 'J'), // Ventura US (deprecated) SYMBOL_SET(5, 'T'), // Code Page 1254 SYMBOL_SET(0, 'D'), // ISO 60, 7-bit Norwegian version 1 SYMBOL_SET(5, 'N'), // ISO 8859-9, Latin 5 @@ -235,7 +236,6 @@ uint16 text_symbol_sets[] = { SYMBOL_SET(0, 'S'), // ISO 11, 7-bit Swedish SYMBOL_SET(1, 'E'), // ISO 4, 7-bit UK English SYMBOL_SET(0, 'U'), // ISO 6, 7-bit ASCII English -#endif 0 }; @@ -259,6 +259,7 @@ name_list **charcode_name_table = NULL; unsigned int n_symbol_sets; symbol_set *symbol_set_table; +static int debug_flag = NO; static int special_flag = NO; // not a special font static int italic_flag = NO; // don't add italic correction static int italic_sep; @@ -268,6 +269,8 @@ static int quiet_flag = NO; // don't suppress warnings about symbols not found static char *hp_msl_to_ucode_name(int); static char *unicode_to_ucode_name(int); static int is_uname(char *); +static int get_printcode(uint32, uint16 *, uint16 *); +static char *show_symset(unsigned int); static void usage(FILE *); static void usage(); static const char *xbasename(const char *); @@ -304,7 +307,6 @@ int main(int argc, char **argv) program_name = argv[0]; int opt; - int debug_flag = NO; int res = 1200; // PCL unit of measure for cursor moves int scalesize = 4; // LaserJet 4 only allows 1/4 point increments int unitwidth = 6350; @@ -332,13 +334,11 @@ int main(int argc, char **argv) italic_sep = atoi(optarg); // design units break; case 'q': - quiet_flag = YES; // suppress warnings about symbols not found - break; + quiet_flag = YES; // suppress warnings about symbols not found + break; case 'v': - { - printf("GNU hpftodit (groff) version %s\n", Version_string); - exit(0); - } + printf("GNU hpftodit (groff) version %s\n", Version_string); + exit(0); break; case CHAR_MAX + 1: // --help usage(stdout); @@ -619,9 +619,8 @@ void read_symbol_sets(File &f) for (i = 0; i < nchars; i++) char_table[i].symbol_set = NO_SYMBOL_SET; - uint16 *symbol_set_selectors = (special_flag - ? special_symbol_sets - : text_symbol_sets); + uint16 *symbol_set_selectors = special_flag ? special_symbol_sets + : text_symbol_sets; for (i = 0; symbol_set_selectors[i] != 0; i++) { unsigned int j; for (j = 0; j < n_symbol_sets; j++) @@ -836,7 +835,7 @@ void output_charset(const int tfm_type) for (i = 0; i < nchars; i++) { uint16 charcode = char_table[i].charcode; - // the TFM supports the character + // the glyph is bound to one of the searched symbol sets if (char_table[i].symbol_set != NO_SYMBOL_SET) { // the character was in the map file if (charcode < charcode_name_table_size && charcode_name_table[charcode]) @@ -899,9 +898,8 @@ void output_charset(const int tfm_type) } else printf("\t\t-- MSL %4d", charcode); - int symset = char_table[i].symbol_set; - printf(" (%2d%c %3d)\n", - symset / 32, (symset & 31) + 64, char_table[i].code); + printf(" (%3s %3d)\n", + show_symset(char_table[i].symbol_set), char_table[i].code); if (charcode < charcode_name_table_size && charcode_name_table[charcode]) @@ -925,7 +923,7 @@ void output_charset(const int tfm_type) fprintf(stderr, ") not in any searched symbol set\n"); } else if (!quiet_flag && !equal(name, UNNAMED) && !is_uname(name)) { - fprintf(stderr, "%s:warning: symbol MSL %d (%s", + fprintf(stderr, "%s: warning: symbol MSL %d (%s", program_name, charcode, name); for (name_list *p = charcode_name_table[charcode]->next; p; p = p->next) @@ -1204,11 +1202,10 @@ void dump_symbols(int tfm_type) if (charcode < charcode_name_table_size && charcode_name_table[charcode]) { if (char_table[i].symbol_set != NO_SYMBOL_SET) { - printf(tfm_type == UNICODE ? "%4d (U+%04X) (%2d%c %3d) %s" - : "%4d (MSL %4d) (%2d%c %3d) %s", + printf(tfm_type == UNICODE ? "%4d (U+%04X) (%3s %3d) %s" + : "%4d (MSL %4d) (%3s %3d) %s", i, charcode, - char_table[i].symbol_set / 32, - (char_table[i].symbol_set % 32) + 64, + show_symset(char_table[i].symbol_set), char_table[i].code, charcode_name_table[charcode]->name); for (name_list *p = charcode_name_table[charcode]->next; @@ -1217,13 +1214,57 @@ void dump_symbols(int tfm_type) putchar('\n'); } } - else - printf(tfm_type == UNICODE ? "%4d (U+%04X)\n" - : "%4d (MSL %4d)\n", + else { + printf(tfm_type == UNICODE ? "%4d (U+%04X) " + : "%4d (MSL %4d) ", i, charcode); + uint16 symset, code; + if (char_table[i].symbol_set != NO_SYMBOL_SET) + printf("(%3s %3d)", + show_symset(char_table[i].symbol_set), char_table[i].code); + else if (get_printcode(i, &symset, &code)) + printf("[%3s %3d] (set not searched)", show_symset(symset), code); + putchar('\n'); + } } } +static char * +show_symset(unsigned int symset) +{ + static char symset_str[8]; + + sprintf(symset_str, "%d%c", symset / 32, (symset & 31) + 64); + return symset_str; +} + +// search symbol sets opposite the state of the 's' option +static int +get_printcode(uint32 index, uint16 *symset, uint16 *code) +{ + uint16 *symbol_set_selectors = special_flag ? text_symbol_sets + : special_symbol_sets; + for (unsigned int i = 0; symbol_set_selectors[i] != 0; i++) { + unsigned int j; + for (j = 0; j < n_symbol_sets; j++) + if (symbol_set_table[j].select == symbol_set_selectors[i]) + break; + if (j < n_symbol_sets) { + for (unsigned int k = 0; k < 256; k++) { + uint16 ndx = symbol_set_table[j].index[k]; + if (ndx == index) { + *symset = symbol_set_table[j].select; + *code = k; + return 1; + } + } + } + } + + // not found in text or special symbol sets + return 0; +} + static char * hp_msl_to_ucode_name(int msl) { @@ -1367,6 +1408,9 @@ int read_map(const char *file, const int tfm_type) fclose(fp); return 0; } + // leave decomposed Unicode values alone + else if (is_uname(ptr) && !is_decomposed(ptr)) + ptr = unicode_to_ucode_name(strtol(ptr + 1, &nonum, 16)); if (size_t(n) >= charcode_name_table_size) { size_t old_size = charcode_name_table_size; -- cgit v1.2.1