shithub: freetype+ttf2subf

Download patch

ref: e0bba32291f5ca7b3fc7be4c1277d7a8f406daea
parent: 798e70e44cbbc76ed5b15bf0c50c69924892d026
author: David Turner <[email protected]>
date: Sat Jul 1 15:33:40 EDT 2000

fixed the PSNames -> Unicode translation table
the Python script "glnames.py" was buggy and
lacked quite a few values in the "names_to_unicode"
table !!

git/fs: mount .git/fs: mount/attach disallowed
--- a/docs/glnames.py
+++ b/docs/glnames.py
@@ -1475,7 +1475,7 @@
 
 
 def the_adobe_glyphs():
-  """return the list of glyph names + unicode values"""
+  """return the list of unicode values"""
 
   lines  = string.split( adobe_glyph_list, '\n' )
   glyphs = []
@@ -1531,11 +1531,14 @@
 def dump_glyph_list( file, glyph_list, adobe_extra ):
   write = file.write
 
+  name_list = []
+
   write( "  static const char*  standard_glyph_names[] =\n" )
   write( "  {\n" )
 
   for name in glyph_list:
     write( '    "' + name + '",\n' )
+    name_list.append(name)
 
   write( "\n" )
   write( "#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST\n" )
@@ -1543,6 +1546,7 @@
 
   for name in adobe_extra:
     write( '    "' + name + '",\n' )
+    name_list.append(name)
 
   write( "\n" )
   write( "#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */\n" )
@@ -1551,35 +1555,45 @@
   write( "  };\n" )
   write( "\n" )
   write( "\n" )
+  
+  return name_list
 
 
-def dump_unicode_values( file, glyph_list ):
+def dump_unicode_values( file, base_list, adobe_list ):
   """build the glyph names to unicode values table"""
 
   write = file.write
 
-  adobe_list, uni_values = the_adobe_glyphs()
-  index_list = []
+  adobe_glyphs, uni_values = the_adobe_glyphs()
 
-  write( "#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST\n" )
   write( "\n" )
   write( "  static const unsigned short  names_to_unicode[" + \
-          repr( len( glyph_list ) + 1 ) + "] =\n" )
+          repr( len( base_list ) + len( adobe_list ) + 1 ) + "] =\n" )
   write( "  {\n" )
              
-  for name in glyph_list:
+  for name in base_list:
     try:
-      index = adobe_list.index( name )
-      index_list.append( uni_values[index] )
+      index = adobe_glyphs.index( name )
       write( "    0x" + uni_values[index] + ",\n" )
     except:
-      index_list.append( 0 )
       write( "    0,\n" )
-            
+
+  write( "\n" )
+  write( "#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST\n" )
+  write( "\n" )
+
+  for name in adobe_list:
+    try:
+      index = adobe_glyphs.index( name )
+      write( "    0x" + uni_values[index] + ",\n" )
+    except:
+      write( "    0,\n" )
+
+  write( "\n" )
+  write( "#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */\n" )
   write( "    0\n" )
   write( "  };\n" )
   write( "\n" )
-  write( "#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */\n" )
   write( "\n" )
   write( "\n" )
 
@@ -1617,11 +1631,11 @@
   mac_list   = count_extra_glyphs( mac_standard_names, t1_standard_strings )
   count_mac  = len( mac_list )  
   t1_bias    = count_mac
-  glyph_list = mac_list + t1_standard_strings
+  base_list  = mac_list + t1_standard_strings
     
   # build adobe unicode index table & supplemental glyph names
   adobe_list  = the_adobe_glyph_list()
-  adobe_list  = count_extra_glyphs( adobe_list, glyph_list )
+  adobe_list  = count_extra_glyphs( adobe_list, base_list )
   count_adobe = len( adobe_list )
 
   write( "/***************************************************************************/\n" )
@@ -1649,7 +1663,7 @@
   write( "\n" )
 
   # dump glyph list
-  dump_glyph_list( file, glyph_list, adobe_list )
+  name_list = dump_glyph_list( file, base_list, adobe_list )
     
   # dump t1_standard_list
   write( "  static const char**  t1_standard_glyphs = " \
@@ -1661,10 +1675,10 @@
   write( "\n" )
   write( "#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST\n" )
   write( "#define NUM_ADOBE_GLYPHS " + \
-          repr( len( glyph_list ) + len( adobe_list ) - t1_bias ) + "\n" )
+          repr( len( base_list ) + len( adobe_list ) - t1_bias ) + "\n" )
   write( "#else\n" )
   write( "#define NUM_ADOBE_GLYPHS " + \
-          repr( len( glyph_list ) - t1_bias )  + "\n" )
+          repr( len( base_list ) - t1_bias )  + "\n" )
   write( "#endif\n" )
   write( "\n" )
   write( "\n" )
@@ -1671,9 +1685,12 @@
 
   # dump mac indices table
   dump_mac_indices( file )    
-    
+
+  # discard mac names from base list
+  base_list = base_list[t1_bias:]
+  
   # dump unicode values table
-  dump_unicode_values( file, glyph_list[t1_bias:] )
+  dump_unicode_values( file, base_list, adobe_list )
 
   dump_encoding( file, "t1_standard_encoding", t1_standard_encoding )
   dump_encoding( file, "t1_expert_encoding", t1_expert_encoding )
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -830,9 +830,6 @@
   /*    a given size object.                                               */
   /*                                                                       */
   /* <Fields>                                                              */
-  /*    pointSize    :: The current point size in 26.6 points, where       */
-  /*                    1 point equals 1/72 inch.                          */
-  /*                                                                       */
   /*    x_ppem       :: The character width, expressed in integer pixels.  */
   /*                    This is the width of the EM square expressed in    */
   /*                    pixels, hence the term `ppem' (pixels per EM).     */
--- a/src/psnames/psmodule.c
+++ b/src/psnames/psmodule.c
@@ -137,8 +137,7 @@
     PS_UniMap*  map2 = (PS_UniMap*)b;
 
 
-    return ( map1->unicode < map2->unicode ? -1 :
-             map1->unicode > map2->unicode ?  1 : 0 );
+    return ( map1->unicode - map2->unicode );
   }
 
 
--- a/src/psnames/pstables.h
+++ b/src/psnames/pstables.h
@@ -1370,9 +1370,8 @@
   };
 
 
-#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
 
-  static const unsigned short  names_to_unicode[392] =
+  static const unsigned short  names_to_unicode[1033] =
   {
     0,
     0x0020,
@@ -1765,10 +1764,655 @@
     0,
     0,
     0,
+
+#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
+
+    0x01FC,
+    0x0102,
+    0xF6C9,
+    0x0391,
+    0x0386,
+    0x0100,
+    0x0104,
+    0x01FA,
+    0x0392,
+    0xF6CA,
+    0x0108,
+    0x010A,
+    0x03A7,
+    0x010E,
+    0x0110,
+    0xF6CB,
+    0xF6CC,
+    0xF6CD,
+    0x0114,
+    0x011A,
+    0x0116,
+    0x0112,
+    0x014A,
+    0x0118,
+    0x0395,
+    0x0388,
+    0x0397,
+    0x0389,
+    0x20AC,
+    0x0393,
+    0x01E6,
+    0x011C,
+    0x0122,
+    0x0120,
+    0xF6CE,
+    0x25CF,
+    0x25AA,
+    0x25AB,
+    0x25A1,
+    0x0126,
+    0x0124,
+    0xF6CF,
+    0x0132,
+    0x012C,
+    0x0130,
+    0x2111,
+    0x012A,
+    0x012E,
+    0x0399,
+    0x03AA,
+    0x038A,
+    0x0128,
+    0x0134,
+    0x039A,
+    0x0136,
+    0xF6BF,
+    0x0139,
+    0x039B,
+    0x013D,
+    0x013B,
+    0x013F,
+    0xF6D0,
+    0x039C,
+    0x0143,
+    0x0147,
+    0x0145,
+    0x039D,
+    0x014E,
+    0x01A0,
+    0x0150,
+    0x014C,
+    0x038F,
+    0x039F,
+    0x038C,
+    0x01FE,
+    0x03A6,
+    0x03A0,
+    0x03A8,
+    0x0154,
+    0x0158,
+    0x0156,
+    0x211C,
+    0x03A1,
+    0x250C,
+    0x2514,
+    0x2510,
+    0x2518,
+    0x253C,
+    0x252C,
+    0x2534,
+    0x251C,
+    0x2524,
+    0x2500,
+    0x2502,
+    0x2561,
+    0x2562,
+    0x2556,
+    0x2555,
+    0x2563,
+    0x2551,
+    0x2557,
+    0x255D,
+    0x255C,
+    0x255B,
+    0x255E,
+    0x255F,
+    0x255A,
+    0x2554,
+    0x2569,
+    0x2566,
+    0x2560,
+    0x2550,
+    0x256C,
+    0x2567,
+    0x2568,
+    0x2564,
+    0x2565,
+    0x2559,
+    0x2558,
+    0x2552,
+    0x2553,
+    0x256B,
+    0x256A,
+    0x015A,
+    0x015C,
+    0x0218,
+    0x03A3,
+    0x03A4,
+    0x0166,
+    0x0164,
+    0x0162,
+    0x0162,
+    0x0398,
+    0xF7FA,
+    0x016C,
+    0x01AF,
+    0x0170,
+    0x016A,
+    0x0172,
+    0x03A5,
+    0x03D2,
+    0x03AB,
+    0x038E,
+    0x016E,
+    0x0168,
+    0x1E82,
+    0x0174,
+    0x1E84,
+    0x1E80,
+    0x039E,
+    0x0176,
+    0x1EF2,
+    0x0179,
+    0x017B,
+    0x0396,
+    0x0103,
+    0x0301,
+    0x01FD,
+    0x2015,
+    0x0410,
+    0x0411,
+    0x0412,
+    0x0413,
+    0x0414,
+    0x0415,
+    0x0401,
+    0x0416,
+    0x0417,
+    0x0418,
+    0x0419,
+    0x041A,
+    0x041B,
+    0x041C,
+    0x041D,
+    0x041E,
+    0x041F,
+    0x0420,
+    0x0421,
+    0x0422,
+    0x0423,
+    0x0424,
+    0x0425,
+    0x0426,
+    0x0427,
+    0x0428,
+    0x0429,
+    0x042A,
+    0x042B,
+    0x042C,
+    0x042D,
+    0x042E,
+    0x042F,
+    0x0490,
+    0x0402,
+    0x0403,
+    0x0404,
+    0x0405,
+    0x0406,
+    0x0407,
+    0x0408,
+    0x0409,
+    0x040A,
+    0x040B,
+    0x040C,
+    0x040E,
+    0xF6C4,
+    0xF6C5,
+    0x0430,
+    0x0431,
+    0x0432,
+    0x0433,
+    0x0434,
+    0x0435,
+    0x0451,
+    0x0436,
+    0x0437,
+    0x0438,
+    0x0439,
+    0x043A,
+    0x043B,
+    0x043C,
+    0x043D,
+    0x043E,
+    0x043F,
+    0x0440,
+    0x0441,
+    0x0442,
+    0x0443,
+    0x0444,
+    0x0445,
+    0x0446,
+    0x0447,
+    0x0448,
+    0x0449,
+    0x044A,
+    0x044B,
+    0x044C,
+    0x044D,
+    0x044E,
+    0x044F,
+    0x0491,
+    0x0452,
+    0x0453,
+    0x0454,
+    0x0455,
+    0x0456,
+    0x0457,
+    0x0458,
+    0x0459,
+    0x045A,
+    0x045B,
+    0x045C,
+    0x045E,
+    0x040F,
+    0x0462,
+    0x0472,
+    0x0474,
+    0xF6C6,
+    0x045F,
+    0x0463,
+    0x0473,
+    0x0475,
+    0xF6C7,
+    0xF6C8,
+    0x04D9,
+    0x200E,
+    0x200F,
+    0x200D,
+    0x066A,
+    0x060C,
+    0x0660,
+    0x0661,
+    0x0662,
+    0x0663,
+    0x0664,
+    0x0665,
+    0x0666,
+    0x0667,
+    0x0668,
+    0x0669,
+    0x061B,
+    0x061F,
+    0x0621,
+    0x0622,
+    0x0623,
+    0x0624,
+    0x0625,
+    0x0626,
+    0x0627,
+    0x0628,
+    0x0629,
+    0x062A,
+    0x062B,
+    0x062C,
+    0x062D,
+    0x062E,
+    0x062F,
+    0x0630,
+    0x0631,
+    0x0632,
+    0x0633,
+    0x0634,
+    0x0635,
+    0x0636,
+    0x0637,
+    0x0638,
+    0x0639,
+    0x063A,
+    0x0640,
+    0x0641,
+    0x0642,
+    0x0643,
+    0x0644,
+    0x0645,
+    0x0646,
+    0x0648,
+    0x0649,
+    0x064A,
+    0x064B,
+    0x064C,
+    0x064D,
+    0x064E,
+    0x064F,
+    0x0650,
+    0x0651,
+    0x0652,
+    0x0647,
+    0x06A4,
+    0x067E,
+    0x0686,
+    0x0698,
+    0x06AF,
+    0x0679,
+    0x0688,
+    0x0691,
+    0x06BA,
+    0x06D2,
+    0x06D5,
+    0x20AA,
+    0x05BE,
+    0x05C3,
+    0x05D0,
+    0x05D1,
+    0x05D2,
+    0x05D3,
+    0x05D4,
+    0x05D5,
+    0x05D6,
+    0x05D7,
+    0x05D8,
+    0x05D9,
+    0x05DA,
+    0x05DB,
+    0x05DC,
+    0x05DD,
+    0x05DE,
+    0x05DF,
+    0x05E0,
+    0x05E1,
+    0x05E2,
+    0x05E3,
+    0x05E4,
+    0x05E5,
+    0x05E6,
+    0x05E7,
+    0x05E8,
+    0x05E9,
+    0x05EA,
+    0xFB2A,
+    0xFB2B,
+    0xFB4B,
+    0xFB1F,
+    0x05F0,
+    0x05F1,
+    0x05F2,
+    0xFB35,
+    0x05B4,
+    0x05B5,
+    0x05B6,
+    0x05BB,
+    0x05B8,
+    0x05B7,
+    0x05B0,
+    0x05B2,
+    0x05B1,
+    0x05B3,
+    0x05C2,
+    0x05C1,
+    0x05B9,
+    0x05BC,
+    0x05BD,
+    0x05BF,
+    0x05C0,
+    0x02BC,
+    0x2105,
+    0x2113,
+    0x2116,
+    0x202C,
+    0x202D,
+    0x202E,
+    0x200C,
+    0x066D,
+    0x02BD,
+    0x2135,
+    0x03B1,
+    0x03AC,
+    0x0101,
+    0x2220,
+    0x2329,
+    0x232A,
+    0x0387,
+    0x0105,
+    0x01FB,
+    0x2194,
+    0x21D4,
+    0x21D3,
+    0x21D0,
+    0x21D2,
+    0x21D1,
+    0x2193,
+    0xF8E7,
+    0x2190,
+    0x2192,
+    0x2191,
+    0x2195,
+    0x21A8,
+    0xF8E6,
+    0x2217,
+    0x03B2,
+    0x2588,
+    0xF8F4,
+    0xF8F3,
+    0xF8F2,
+    0xF8F1,
+    0xF8FE,
+    0xF8FD,
+    0xF8FC,
+    0xF8F0,
+    0xF8EF,
+    0xF8EE,
+    0xF8FB,
+    0xF8FA,
+    0xF8F9,
+    0x21B5,
+    0x0109,
+    0x010B,
+    0x03C7,
+    0x25CB,
+    0x2297,
+    0x2295,
+    0x2663,
+    0xF6C3,
+    0x2245,
+    0xF8E9,
+    0xF6D9,
+    0xF6D1,
+    0xF6D2,
+    0xF6D4,
+    0xF6D5,
+    0xF6D3,
+    0xF6D6,
+    0x010F,
+    0x0111,
+    0x03B4,
+    0x2666,
+    0xF6D7,
+    0xF6D8,
+    0x0385,
+    0x2593,
+    0x2584,
+    0x20AB,
+    0x0323,
+    0xF6BE,
+    0x22C5,
+    0x0115,
+    0x011B,
+    0x0117,
+    0x2208,
+    0x0113,
+    0x2205,
+    0x014B,
+    0x0119,
+    0x03B5,
+    0x03AD,
+    0x2261,
+    0x212E,
+    0x03B7,
+    0x03AE,
+    0x203C,
+    0x2203,
+    0x2640,
+    0x25A0,
+    0x25AC,
+    0x03B3,
+    0x01E7,
+    0x011D,
+    0x0123,
+    0x0121,
+    0x2207,
+    0x0300,
+    0x0127,
+    0x0125,
+    0x2665,
+    0x0309,
+    0x2302,
+    0x012D,
+    0x0133,
+    0x012B,
+    0x2321,
+    0xF8F5,
+    0x2320,
+    0x2229,
+    0x25D8,
+    0x25D9,
+    0x263B,
+    0x012F,
+    0x03B9,
+    0x03CA,
+    0x0390,
+    0x03AF,
+    0x0129,
+    0x0135,
+    0x03BA,
+    0x0137,
+    0x0138,
+    0x013A,
+    0x03BB,
+    0x013E,
+    0x013C,
+    0x0140,
+    0x258C,
+    0x20A4,
+    0xF6C0,
+    0x2227,
+    0x2228,
+    0x017F,
+    0x2591,
+    0x2642,
+    0x2032,
+    0x266A,
+    0x266B,
+    0x0144,
+    0x0149,
+    0x0148,
+    0x0146,
+    0x2209,
+    0x2284,
+    0x03BD,
+    0x014F,
+    0x01A1,
+    0x0151,
+    0x014D,
+    0x03C9,
+    0x03D6,
+    0x03CE,
+    0x03BF,
+    0x03CC,
+    0x25E6,
+    0x221F,
+    0x01FF,
+    0xF8ED,
+    0xF8EC,
+    0xF8EB,
+    0xF8F8,
+    0xF8F7,
+    0xF8F6,
+    0x22A5,
+    0x20A7,
+    0x03C6,
+    0x03D5,
+    0x211E,
+    0x2282,
+    0x2283,
+    0x221D,
+    0x03C8,
+    0x201B,
+    0x0155,
+    0xF8E5,
+    0x0159,
+    0x0157,
+    0x2286,
+    0x2287,
+    0xF8E8,
+    0xF6DA,
+    0x2310,
+    0x03C1,
+    0x2590,
+    0x015B,
+    0x015D,
+    0x0219,
+    0x2033,
+    0x2592,
+    0x03C3,
+    0x03C2,
+    0x223C,
+    0x263A,
+    0x2660,
+    0x220B,
+    0x263C,
+    0x03C4,
+    0x0167,
+    0x0165,
+    0x0163,
+    0x0163,
+    0x2234,
+    0x03B8,
+    0x03D1,
+    0x0303,
+    0x0384,
+    0xF8EA,
+    0xF6DB,
+    0x25BC,
+    0x25C4,
+    0x25BA,
+    0x25B2,
+    0x016D,
+    0x01B0,
+    0x0171,
+    0x016B,
+    0x2017,
+    0x222A,
+    0x2200,
+    0x0173,
+    0x2580,
+    0x03C5,
+    0x03CB,
+    0x03B0,
+    0x03CD,
+    0x016F,
+    0x0169,
+    0x1E83,
+    0x0175,
+    0x1E85,
+    0x2118,
+    0x1E81,
+    0x03BE,
+    0x0177,
+    0x1EF3,
+    0x017A,
+    0x017C,
+    0x03B6,
+
+#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */
     0
   };
 
-#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */
 
 
   static const unsigned short  t1_standard_encoding[257] =