From ba97ea29163e1bf825c5857c8fbf07714f8d5eea Mon Sep 17 00:00:00 2001 From: Werner LEMBERG Date: Thu, 1 Jan 2004 14:50:48 +0000 Subject: [PATCH] * font/devlj4/generate/text.map, font/devlj4/generate/special.map: Fix placement of comments. * src/utils/hpftodit/hpftodit.cpp (main): Read map file also if option `-d' is given. (output_charset): Improve warning messages to give more information. (dump_symbols): Make information more precise. (usage): Updated. (read_map): Don't call unicode_to_ucode_name; the glyph names must appear as-is and shouldn't be decomposed. --- ChangeLog | 15 ++++ font/devlj4/generate/special.map | 3 +- font/devlj4/generate/text.map | 68 +++++++++----- src/utils/hpftodit/hpftodit.cpp | 185 +++++++++++++++++++++------------------ 4 files changed, 164 insertions(+), 107 deletions(-) diff --git a/ChangeLog b/ChangeLog index a863921a..94f9c511 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2004-01-01 Werner LEMBERG + + * font/devlj4/generate/text.map, font/devlj4/generate/special.map: + Fix placement of comments. + +2004-01-01 Jeff Conrad + + * src/utils/hpftodit/hpftodit.cpp (main): Read map file also if + option `-d' is given. + (output_charset): Improve warning messages to give more information. + (dump_symbols): Make information more precise. + (usage): Updated. + (read_map): Don't call unicode_to_ucode_name; the glyph names must + appear as-is and shouldn't be decomposed. + 2003-12-31 Werner LEMBERG * src/utils/hpftodit/hpftodit.cpp (dump_tags): Handle posture_tag. diff --git a/font/devlj4/generate/special.map b/font/devlj4/generate/special.map index 4aa51f45..65f4b850 100644 --- a/font/devlj4/generate/special.map +++ b/font/devlj4/generate/special.map @@ -48,7 +48,8 @@ 225 2193 da 226 2192 -> 227 2190 <- -228 2319 u2319 # ? +# 228 ? +228 2319 u2319 229 2194 <> 230 25B2 u25B2 231 25BC u25BC diff --git a/font/devlj4/generate/text.map b/font/devlj4/generate/text.map index c9dd9874..06625744 100644 --- a/font/devlj4/generate/text.map +++ b/font/devlj4/generate/text.map @@ -19,7 +19,8 @@ 10 0029 ) 11 002A * -12 002B + # * +# 12 * +12 002B + 13 002C , 14 002D - hy 15 002E . @@ -39,38 +40,52 @@ 28 003B ; 29 003C < -30 003D = # * +# 30 * +30 003D = 31 003E > 32 003F ? 33 0040 @ at -34 0041 A # * -35 0042 B # * +# 34 * +34 0041 A +# 35 * +35 0042 B 36 0043 C 37 0044 D -38 0045 E # * +# 38 * +38 0045 E 39 0046 F 40 0047 G -41 0048 H # * -42 0049 I # * +# 41 * +41 0048 H +# 42 * +42 0049 I 43 004A J -44 004B K # * +# 44 * +44 004B K 45 004C L -46 004D M # * -47 004E N # * -48 004F O # * -49 0050 P # * +# 46 * +46 004D M +# 47 * +47 004E N +# 48 * +48 004F O +# 49 * +49 0050 P 50 0051 Q 51 0052 R 52 0053 S -53 0054 T # * +# 53 * +53 0054 T 54 0055 U 55 0056 V 56 0057 W -57 0058 X # * +# 57 * +57 0058 X 58 0059 Y -59 005A Z # * +# 59 * +59 005A Z 60 005B [ lB 61 005C \ rs @@ -111,7 +126,8 @@ 93 007B lC { 94 007C ba | 95 007D rC } -96 007E ti # * +# 96 * +96 007E ti # 97 medium shading * # 98 ? 99 00C0 `A @@ -207,7 +223,8 @@ 180 00B5 mc 181 00B6 ps 182 00BE 34 -183 2212 \- # * +# 183 * +183 2212 \- 184 00BC 14 185 00BD 12 186 00AA Of @@ -216,10 +233,12 @@ # 189 medium solid box * 190 00BB Fc -191 00B1 t+- # * +# 191 * +191 00B1 t+- 192 00A6 bb 193 00A9 co -194 00AC tno # * +# 194 * +194 00AC tno 195 00AD u00AD 196 00AE rg 197 00B2 S2 @@ -227,8 +246,10 @@ 199 00B8 ac 200 00B9 S1 -201 00D7 tmu # * -202 00F7 tdi # * +# 201 * +201 00D7 tmu +# 202 * +202 00F7 tdi # 203 open smiling face * # 204 solid smiling face * # 205 solid heart * @@ -338,7 +359,8 @@ # 300 bottom segment integral * # 301 2 wavy line approximation * -302 00B7 pc # * +# 302 * +302 00B7 pc # 303 radical symbol * # 304 ? # 305 small solid box * @@ -706,7 +728,9 @@ 1036 211E u211E # 1037-1039 ? +# older HP TrueType TFM files use Unicode value U+F001 instead 1040 FB01 fi +# older HP TrueType TFM files use Unicode value U+F002 instead 1041 FB02 fl 1042 FB00 ff 1043 FB03 Fi diff --git a/src/utils/hpftodit/hpftodit.cpp b/src/utils/hpftodit/hpftodit.cpp index d359c158..779d3c1b 100644 --- a/src/utils/hpftodit/hpftodit.cpp +++ b/src/utils/hpftodit/hpftodit.cpp @@ -361,8 +361,10 @@ int main(int argc, char **argv) int tfm_type = check_type(); if (debug_flag) dump_tags(f); - else if (!read_map(argv[optind + 1], tfm_type)) + if (!debug_flag && !read_map(argv[optind + 1], tfm_type)) exit(1); + else if (debug_flag && argc - optind > 1) + read_map(argv[optind + 1], tfm_type); current_filename = NULL; current_lineno = -1; // no line numbers if (!debug_flag && !equal(argv[optind + 2], "-")) @@ -394,10 +396,8 @@ int main(int argc, char **argv) output_pclstyle(); } read_symbol_sets(f); - if (debug_flag) { - printf("Symbols:\n"); + if (debug_flag) dump_symbols(tfm_type); - } else { output_ligatures(); read_and_output_kernpairs(f); @@ -410,8 +410,9 @@ static void usage(FILE *stream) { fprintf(stream, - "usage: %s [-s] [-a] [-q] [-i n] tfm_file map_file output_font\n", - program_name); + "usage: %s [-s] [-a] [-q] [-i n] tfm_file map_file output_font\n" + " %s -d tfm_file [map_file]\n", + program_name, program_name); } static @@ -847,81 +848,90 @@ void output_charset(const int tfm_type) else printf(unicode_to_ucode_name(charcode)); - printf("\t%d,%d", - scale(char_table[i].width), scale(char_table[i].ascent)); - - int depth = scale(-char_table[i].descent); - if (depth < 0) - depth = 0; - int italic_correction = 0; - int left_italic_correction = 0; - int subscript_correction = 0; - - if (italic_flag) { - italic_correction = scale(char_table[i].right_extent - - char_table[i].width - + italic_sep); - if (italic_correction < 0) - italic_correction = 0; - subscript_correction = int((tag_info(x_height_tag).value - * slant * .8) + .5); - if (subscript_correction > italic_correction) - subscript_correction = italic_correction; - left_italic_correction = scale(italic_sep - - char_table[i].left_extent); - } + printf("\t%d,%d", + scale(char_table[i].width), scale(char_table[i].ascent)); + + int depth = scale(-char_table[i].descent); + if (depth < 0) + depth = 0; + int italic_correction = 0; + int left_italic_correction = 0; + int subscript_correction = 0; + + if (italic_flag) { + italic_correction = scale(char_table[i].right_extent + - char_table[i].width + + italic_sep); + if (italic_correction < 0) + italic_correction = 0; + subscript_correction = int((tag_info(x_height_tag).value + * slant * .8) + .5); + if (subscript_correction > italic_correction) + subscript_correction = italic_correction; + left_italic_correction = scale(italic_sep + - char_table[i].left_extent); + } - if (subscript_correction != 0) - printf(",%d,%d,%d,%d", - depth, italic_correction, left_italic_correction, - subscript_correction); - else if (left_italic_correction != 0) - printf(",%d,%d,%d", depth, italic_correction, left_italic_correction); - else if (italic_correction != 0) - printf(",%d,%d", depth, italic_correction); - else if (depth != 0) - printf(",%d", depth); - // This is fairly arbitrary. Fortunately it doesn't much matter. - unsigned type = 0; - if (char_table[i].ascent > int16(tag_info(lower_ascent_tag).value)*9/10) - type |= 2; - if (char_table[i].descent < int16(tag_info(lower_descent_tag).value)*9/10) - type |= 1; - printf("\t%d\t%d", type, - char_table[i].symbol_set*256 + char_table[i].code); - - if (tfm_type == UNICODE) { - if (charcode >= 0xE000 && charcode <= 0xF8FF) - printf("\t\t-- HP PUA U+%04X", charcode); - else - printf("\t\t-- U+%04X", charcode); - } + if (subscript_correction != 0) + printf(",%d,%d,%d,%d", + depth, italic_correction, left_italic_correction, + subscript_correction); + else if (left_italic_correction != 0) + printf(",%d,%d,%d", depth, italic_correction, left_italic_correction); + else if (italic_correction != 0) + printf(",%d,%d", depth, italic_correction); + else if (depth != 0) + printf(",%d", depth); + // This is fairly arbitrary. Fortunately it doesn't much matter. + unsigned type = 0; + if (char_table[i].ascent > int16(tag_info(lower_ascent_tag).value)*9/10) + type |= 2; + if (char_table[i].descent < int16(tag_info(lower_descent_tag).value)*9/10) + type |= 1; + printf("\t%d\t%d", type, + char_table[i].symbol_set*256 + char_table[i].code); + + if (tfm_type == UNICODE) { + if (charcode >= 0xE000 && charcode <= 0xF8FF) + printf("\t\t-- HP PUA U+%04X", charcode); else - printf("\t\t-- HP MSL %4d", charcode); - int symset = char_table[i].symbol_set; - printf(" (%d%c %d)\n", - symset / 32, (symset & 31) + 64, char_table[i].code); - - if (charcode < charcode_name_table_size - && charcode_name_table[charcode]) - for (name_list *p = charcode_name_table[charcode]->next; - p; p = p->next) - printf("%s\t\"\n", p->name); + printf("\t\t-- U+%04X", charcode); + } + 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); + + if (charcode < charcode_name_table_size + && charcode_name_table[charcode]) + for (name_list *p = charcode_name_table[charcode]->next; + p; p = p->next) + printf("%s\t\"\n", p->name); + } + // warnings about characters in mapfile not found in TFM + else if (charcode < charcode_name_table_size + && charcode_name_table[charcode]) { + char *name = charcode_name_table[charcode]->name; + // don't warn about Unicode or unnamed glyphs + // that aren't in the the TFM file + if (tfm_type == UNICODE && !quiet_flag && !equal(name, UNNAMED) + && !is_uname(name)) { + fprintf(stderr, "%s: warning: symbol U+%04X (%s", + program_name, charcode, name); + for (name_list *p = charcode_name_table[charcode]->next; + p; p = p->next) + fprintf(stderr, ", %s", p->name); + 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", + program_name, charcode, name); + for (name_list *p = charcode_name_table[charcode]->next; + p; p = p->next) + fprintf(stderr, ", %s", p->name); + fprintf(stderr, ") not in any searched symbol set\n"); } - // warnings about characters in mapfile not found in TFM - else if (charcode < charcode_name_table_size - && charcode_name_table[charcode]) { - char *name = charcode_name_table[charcode]->name; - // don't warn about Unicode or unnamed glyphs - // that aren't in the the TFM file - if (tfm_type == UNICODE && !quiet_flag && !equal(name, UNNAMED) - && !is_uname(name)) - fprintf(stderr, - "%s: warning: symbol U+%04X (%s) not in any of the searched symbol sets\n", - program_name, charcode, name); - else if (!quiet_flag && !equal(name, UNNAMED) && !is_uname(name)) - warning("MSL %1 (%2) not in any of the searched symbol sets", - charcode, name); } } } @@ -1185,22 +1195,31 @@ void dump_symbol_sets(File &f) static void dump_symbols(int tfm_type) { + printf("Symbols:\n" + "\n" + " glyph id# symbol set name(s)\n" + "----------------------------------\n"); for (uint32 i = 0; i < nchars; i++) { uint16 charcode = char_table[i].charcode; if (charcode < charcode_name_table_size && charcode_name_table[charcode]) { if (char_table[i].symbol_set != NO_SYMBOL_SET) { - printf(tfm_type == UNICODE ? "%4d (%04x) %d (%d%c)\t%s\n" - : "%4d (%4d) %d (%d%c)\t%s\n" , - i, charcode, char_table[i].symbol_set, + printf(tfm_type == UNICODE ? "%4d (U+%04X) (%2d%c %3d) %s" + : "%4d (MSL %4d) (%2d%c %3d) %s", + i, charcode, char_table[i].symbol_set / 32, (char_table[i].symbol_set % 32) + 64, + char_table[i].code, charcode_name_table[charcode]->name); + for (name_list *p = charcode_name_table[charcode]->next; + p; p = p->next) + printf(", %s", p->name); + putchar('\n'); } } else printf(tfm_type == UNICODE ? "%4d (U+%04X)\n" - : "%4d (HP MSL %4d)\n", + : "%4d (MSL %4d)\n", i, charcode); } } @@ -1348,8 +1367,6 @@ int read_map(const char *file, const int tfm_type) fclose(fp); return 0; } - else if (is_uname(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; -- 2.11.4.GIT