⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 glnames.py

📁 一个Xpdf应用的例子
💻 PY
📖 第 1 页 / 共 5 页
字号:
0020;space;SPACE00A0;space;NO-BREAK SPACE;Duplicate2660;spade;BLACK SPADE SUITF6F2;ssuperior;SUPERSCRIPT LATIN SMALL LETTER S00A3;sterling;POUND SIGN220B;suchthat;CONTAINS AS MEMBER2211;summation;N-ARY SUMMATION263C;sun;WHITE SUN WITH RAYS0074;t;LATIN SMALL LETTER T03C4;tau;GREEK SMALL LETTER TAU0167;tbar;LATIN SMALL LETTER T WITH STROKE0165;tcaron;LATIN SMALL LETTER T WITH CARON0163;tcommaaccent;LATIN SMALL LETTER T WITH CEDILLA021B;tcommaaccent;LATIN SMALL LETTER T WITH COMMA BELOW;Duplicate2234;therefore;THEREFORE03B8;theta;GREEK SMALL LETTER THETA03D1;theta1;GREEK THETA SYMBOL00FE;thorn;LATIN SMALL LETTER THORN0033;three;DIGIT THREE215C;threeeighths;VULGAR FRACTION THREE EIGHTHS2083;threeinferior;SUBSCRIPT THREEF733;threeoldstyle;OLDSTYLE DIGIT THREE00BE;threequarters;VULGAR FRACTION THREE QUARTERSF6DE;threequartersemdash;THREE QUARTERS EM DASH00B3;threesuperior;SUPERSCRIPT THREE02DC;tilde;SMALL TILDE0303;tildecomb;COMBINING TILDE0384;tonos;GREEK TONOS2122;trademark;TRADE MARK SIGNF8EA;trademarksans;TRADE MARK SIGN SANS SERIFF6DB;trademarkserif;TRADE MARK SIGN SERIF25BC;triagdn;BLACK DOWN-POINTING TRIANGLE25C4;triaglf;BLACK LEFT-POINTING POINTER25BA;triagrt;BLACK RIGHT-POINTING POINTER25B2;triagup;BLACK UP-POINTING TRIANGLEF6F3;tsuperior;SUPERSCRIPT LATIN SMALL LETTER T0032;two;DIGIT TWO2025;twodotenleader;TWO DOT LEADER2082;twoinferior;SUBSCRIPT TWOF732;twooldstyle;OLDSTYLE DIGIT TWO00B2;twosuperior;SUPERSCRIPT TWO2154;twothirds;VULGAR FRACTION TWO THIRDS0075;u;LATIN SMALL LETTER U00FA;uacute;LATIN SMALL LETTER U WITH ACUTE016D;ubreve;LATIN SMALL LETTER U WITH BREVE00FB;ucircumflex;LATIN SMALL LETTER U WITH CIRCUMFLEX00FC;udieresis;LATIN SMALL LETTER U WITH DIAERESIS00F9;ugrave;LATIN SMALL LETTER U WITH GRAVE01B0;uhorn;LATIN SMALL LETTER U WITH HORN0171;uhungarumlaut;LATIN SMALL LETTER U WITH DOUBLE ACUTE016B;umacron;LATIN SMALL LETTER U WITH MACRON005F;underscore;LOW LINE2017;underscoredbl;DOUBLE LOW LINE222A;union;UNION2200;universal;FOR ALL0173;uogonek;LATIN SMALL LETTER U WITH OGONEK2580;upblock;UPPER HALF BLOCK03C5;upsilon;GREEK SMALL LETTER UPSILON03CB;upsilondieresis;GREEK SMALL LETTER UPSILON WITH DIALYTIKA03B0;upsilondieresistonos;GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS03CD;upsilontonos;GREEK SMALL LETTER UPSILON WITH TONOS016F;uring;LATIN SMALL LETTER U WITH RING ABOVE0169;utilde;LATIN SMALL LETTER U WITH TILDE0076;v;LATIN SMALL LETTER V0077;w;LATIN SMALL LETTER W1E83;wacute;LATIN SMALL LETTER W WITH ACUTE0175;wcircumflex;LATIN SMALL LETTER W WITH CIRCUMFLEX1E85;wdieresis;LATIN SMALL LETTER W WITH DIAERESIS2118;weierstrass;SCRIPT CAPITAL P1E81;wgrave;LATIN SMALL LETTER W WITH GRAVE0078;x;LATIN SMALL LETTER X03BE;xi;GREEK SMALL LETTER XI0079;y;LATIN SMALL LETTER Y00FD;yacute;LATIN SMALL LETTER Y WITH ACUTE0177;ycircumflex;LATIN SMALL LETTER Y WITH CIRCUMFLEX00FF;ydieresis;LATIN SMALL LETTER Y WITH DIAERESIS00A5;yen;YEN SIGN1EF3;ygrave;LATIN SMALL LETTER Y WITH GRAVE007A;z;LATIN SMALL LETTER Z017A;zacute;LATIN SMALL LETTER Z WITH ACUTE017E;zcaron;LATIN SMALL LETTER Z WITH CARON017C;zdotaccent;LATIN SMALL LETTER Z WITH DOT ABOVE0030;zero;DIGIT ZERO2080;zeroinferior;SUBSCRIPT ZEROF730;zerooldstyle;OLDSTYLE DIGIT ZERO2070;zerosuperior;SUPERSCRIPT ZERO03B6;zeta;GREEK SMALL LETTER ZETA"""t1_bias    = 0glyph_list = []def adobe_glyph_names():  """return the list of glyph names from the adobe list"""  lines  = string.split( adobe_glyph_list, '\n' )  glyphs = []  for line in lines:    if line:      fields = string.split( line, ';' )#     print fields[0] + ' - ' + fields[1]      glyphs.append( fields[1] )  return glyphsdef adobe_glyph_values():  """return the list of glyph names and their unicode values"""  lines  = string.split( adobe_glyph_list, '\n' )  glyphs = []  values = []  for line in lines:    if line:      fields = string.split( line, ';' )#     print fields[0] + ' - ' + fields[1]      glyphs.append( fields[1] )      values.append( fields[0] )  return glyphs, valuesdef filter_glyph_names( alist, filter ):  """filter 'alist' by taking _out_ all glyph names that are in 'filter'"""  count  = 0  extras = []  for name in alist:    try:      filtered_index = filter.index( name )    except:      extras.append( name )  return extrasdef dump_mac_indices( file, all_glyphs ):  write = file.write  write( "  static const unsigned short  mac_standard_names[" + \        repr( len( mac_standard_names ) + 1 ) + "] =\n" )  write( "  {\n" )  for name in mac_standard_names:    write( "    " + repr( all_glyphs.index( name ) ) + ",\n" )  write( "    0\n" )  write( "  };\n" )  write( "\n" )  write( "\n" )def dump_glyph_list( file, base_list, adobe_list ):  write = file.write  name_list = []  write( "  static const char* const  ps_glyph_names[] =\n" )  write( "  {\n" )  for name in base_list:    write( '    "' + name + '",\n' )    name_list.append( name )  write( "\n" )  write( "#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST\n" )  write( "\n" )  for name in adobe_list:    write( '    "' + name + '",\n' )    name_list.append( name )  write( "\n" )  write( "#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */\n" )  write( "\n" )  write( "    NULL\n" )  write( "  };\n" )  write( "\n" )  write( "\n" )  return name_listdef dump_unicode_values( file, sid_list, adobe_list ):  """build the glyph names to unicode values table"""  write = file.write  agl_names, agl_unicodes = adobe_glyph_values()  write( "\n" )  write( "  static const unsigned short  ps_names_to_unicode[" + \          repr( len( sid_list ) + len( adobe_list ) + 1 ) + "] =\n" )  write( "  {\n" )  for name in sid_list:    try:      index = agl_names.index( name )      write( "    0x" + agl_unicodes[index] + ",\n" )    except:      write( "    0,\n" )  write( "\n" )  write( "#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST\n" )  write( "\n" )  for name in adobe_list:    try:      index = agl_names.index( name )      write( "    0x" + agl_unicodes[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( "\n" )  write( "\n" )def dump_encoding( file, encoding_name, encoding_list ):  """dumps a given encoding"""  write = file.write  write( "  static const unsigned short  " + encoding_name + "[" + \          repr( len( encoding_list ) + 1 ) + "] =\n" )  write( "  {\n" )  for value in encoding_list:    write( "    " + repr( value ) + ",\n" )  write( "    0\n" )  write( "  };\n" )  write( "\n" )  write( "\n" )def main():  """main program body"""  if len( sys.argv ) != 2:    print __doc__ % sys.argv[0]    sys.exit( 1 )  file  = open( sys.argv[1], "w\n" )  write = file.write  count_sid = len( sid_standard_names )  # 'mac_extras' contains the list of glyph names in the Macintosh standard  # encoding which are not in either the Adobe Glyph List or the SID  # Standard Names.  #  mac_extras = filter_glyph_names( mac_standard_names, adobe_glyph_names() )  mac_extras = filter_glyph_names( mac_extras, sid_standard_names )  # 'base_list' contains the first names of our final glyph names table.  # It consists of the 'mac_extras' glyph names, followed by the SID  # Standard names.  #  mac_extras_count = len( mac_extras )  t1_bias          = mac_extras_count  base_list        = mac_extras + sid_standard_names  # 'adobe_list' contains the glyph names that are in the AGL, but not in  # the base_list; they will be placed after base_list glyph names in  # our final table.  #  adobe_list  = filter_glyph_names( adobe_glyph_names(), base_list )  adobe_count = len( adobe_list )  write( "/***************************************************************************/\n" )  write( "/*                                                                         */\n" )  write( "/*  %-71s*/\n" % sys.argv[1] )  write( "/*                                                                         */\n" )  write( "/*    PostScript glyph names (specification only).                         */\n" )  write( "/*                                                                         */\n" )  write( "/*  Copyright 2000-2001 by                                                 */\n" )  write( "/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */\n" )  write( "/*                                                                         */\n" )  write( "/*  This file is part of the FreeType project, and may only be used,       */\n" )  write( "/*  modified, and distributed under the terms of the FreeType project      */\n" )  write( "/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */\n" )  write( "/*  this file you indicate that you have read the license and              */\n" )  write( "/*  understand and accept it fully.                                        */\n" )  write( "/*                                                                         */\n" )  write( "/***************************************************************************/\n" )  write( "\n" )  write( "\n" )  write( "  /* this file has been generated automatically -- do not edit! */\n" )  write( "\n" )  write( "\n" )  # dump final glyph list (mac extras + sid standard names + AGL glyph names)  #  name_list = dump_glyph_list( file, base_list, adobe_list )  # dump t1_standard_list  write( "  static const char* const * const  sid_standard_names = " \          + "ps_glyph_names + " + repr( t1_bias ) + ";\n" )  write( "\n" )  write( "\n" )  write( "#define NUM_SID_GLYPHS " + repr( len( sid_standard_names ) ) + "\n" )  write( "\n" )  write( "#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST\n" )  write( "#define NUM_ADOBE_GLYPHS " + \          repr( len( base_list ) + len( adobe_list ) - t1_bias ) + "\n" )  write( "#else\n" )  write( "#define NUM_ADOBE_GLYPHS " + \          repr( len( base_list ) - t1_bias )  + "\n" )  write( "#endif\n" )  write( "\n" )  write( "\n" )  # dump mac indices table  dump_mac_indices( file, name_list )  # dump unicode values table  dump_unicode_values( file, sid_standard_names, adobe_list )  dump_encoding( file, "t1_standard_encoding", t1_standard_encoding )  dump_encoding( file, "t1_expert_encoding", t1_expert_encoding )  write( "/* END */\n" )# Now run the main routine#main()# END

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -