| 1 |
/* t1reencode.cc -- driver for reencoding Type 1 fonts |
| 2 |
* |
| 3 |
* Copyright (c) 2005-2023 Eddie Kohler |
| 4 |
* |
| 5 |
* This program is free software; you can redistribute it and/or modify it |
| 6 |
* under the terms of the GNU General Public License as published by the Free |
| 7 |
* Software Foundation; either version 2 of the License, or (at your option) |
| 8 |
* any later version. This program is distributed in the hope that it will be |
| 9 |
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| 11 |
* Public License for more details. |
| 12 |
*/ |
| 13 |
|
| 14 |
#ifdef HAVE_CONFIG_H |
| 15 |
# include <config.h> |
| 16 |
#endif |
| 17 |
#include <efont/t1font.hh> |
| 18 |
#include <efont/t1item.hh> |
| 19 |
#include <efont/t1rw.hh> |
| 20 |
#include <efont/psres.hh> |
| 21 |
#include <lcdf/error.hh> |
| 22 |
#include <lcdf/clp.h> |
| 23 |
#include <ctype.h> |
| 24 |
#include <errno.h> |
| 25 |
#include "util.hh" |
| 26 |
#include <lcdf/md5.h> |
| 27 |
#ifdef HAVE_CTIME |
| 28 |
# include <time.h> |
| 29 |
#endif |
| 30 |
#if defined(_MSDOS) || defined(_WIN32) |
| 31 |
# include <fcntl.h> |
| 32 |
# include <io.h> |
| 33 |
#endif |
| 34 |
|
| 35 |
using namespace Efont; |
| 36 |
|
| 37 |
#define VERSION_OPT 301 |
| 38 |
#define HELP_OPT 302 |
| 39 |
#define OUTPUT_OPT 303 |
| 40 |
#define ENCODING_OPT 304 |
| 41 |
#define ENCODING_TEXT_OPT 305 |
| 42 |
#define PFA_OPT 306 |
| 43 |
#define PFB_OPT 307 |
| 44 |
#define FONTNAME_OPT 308 |
| 45 |
#define FULLNAME_OPT 309 |
| 46 |
|
| 47 |
const Clp_Option options[] = { |
| 48 |
{ "help", 'h', HELP_OPT, 0, 0 }, |
| 49 |
{ "output", 'o', OUTPUT_OPT, Clp_ValString, 0 }, |
| 50 |
{ "pfa", 'a', PFA_OPT, 0, 0 }, |
| 51 |
{ "pfb", 'b', PFB_OPT, 0, 0 }, |
| 52 |
{ "name", 'n', FONTNAME_OPT, Clp_ValString, 0 }, |
| 53 |
{ "fullname", 'N', FULLNAME_OPT, Clp_ValString, 0 }, |
| 54 |
{ "full-name", 'N', FULLNAME_OPT, Clp_ValString, 0 }, |
| 55 |
{ "encoding", 'e', ENCODING_OPT, Clp_ValString, 0 }, |
| 56 |
{ "encoding-text", 'E', ENCODING_TEXT_OPT, Clp_ValString, 0 }, |
| 57 |
{ "version", 0, VERSION_OPT, 0, 0 }, |
| 58 |
}; |
| 59 |
|
| 60 |
|
| 61 |
static const char *program_name; |
| 62 |
static PermString::Initializer initializer; |
| 63 |
static HashMap<PermString, int> glyph_order(-1); |
| 64 |
static String encoding_name; |
| 65 |
|
| 66 |
static const char ISOLatin1Encoding[] = "/ISOLatin1Encoding [\n\ |
| 67 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 68 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 69 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 70 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 71 |
/space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quoteright\n\ |
| 72 |
/parenleft /parenright /asterisk /plus /comma /minus /period /slash\n\ |
| 73 |
/zero /one /two /three /four /five /six /seven\n\ |
| 74 |
/eight /nine /colon /semicolon /less /equal /greater /question\n\ |
| 75 |
/at /A /B /C /D /E /F /G\n\ |
| 76 |
/H /I /J /K /L /M /N /O\n\ |
| 77 |
/P /Q /R /S /T /U /V /W\n\ |
| 78 |
/X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore\n\ |
| 79 |
/quoteleft /a /b /c /d /e /f /g\n\ |
| 80 |
/h /i /j /k /l /m /n /o\n\ |
| 81 |
/p /q /r /s /t /u /v /w\n\ |
| 82 |
/x /y /z /braceleft /bar /braceright /asciitilde /.notdef\n\ |
| 83 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 84 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 85 |
/dotlessi /grave /acute /circumflex /tilde /.notdef /breve /dotaccent\n\ |
| 86 |
/.notdef /.notdef /ring /.notdef /.notdef /hungarumlaut /ogonek /caron\n\ |
| 87 |
/.notdef /exclamdown /cent /sterling /currency /yen /brokenbar /section\n\ |
| 88 |
/dieresis /copyright /ordfeminine /guillemotleft /logicalnot /hyphen /registered /macron\n\ |
| 89 |
/degree /plusminus /twosuperior /threesuperior /.notdef /mu /paragraph /periodcentered\n\ |
| 90 |
/cedilla /onesuperior /ordmasculine /guillemotright /onequarter /onehalf /threequarters /questiondown\n\ |
| 91 |
/Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla\n\ |
| 92 |
/Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis\n\ |
| 93 |
/Eth /Ntilde /Ograve /Oacute /Ocircumflex /.notdef /Odieresis /multiply\n\ |
| 94 |
/Oslash /.notdef /.notdef /.notdef /.notdef /Yacute /Thorn /germandbls\n\ |
| 95 |
/agrave /aacute /acircumflex /atilde /.notdef /aring /ae /ccedilla\n\ |
| 96 |
/egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis\n\ |
| 97 |
/eth /ntilde /.notdef /oacute /ocircumflex /otilde /odieresis /.notdef\n\ |
| 98 |
/oslash /ugrave /uacute /ucircumflex /udieresis /yacute /thorn\n\ |
| 99 |
] def\n"; |
| 100 |
|
| 101 |
static const char ISOLatin2Encoding[] = "/ISOLatin2Encoding [\n\ |
| 102 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 103 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 104 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 105 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 106 |
/space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quotesingle\n\ |
| 107 |
/parenleft /parenright /asterisk /plus /comma /hyphen /period /slash\n\ |
| 108 |
/zero /one /two /three /four /five /six /seven\n\ |
| 109 |
/eight /nine /colon /semicolon /less /equal /greater /question\n\ |
| 110 |
/at /A /B /C /D /E /F /G\n\ |
| 111 |
/H /I /J /K /L /M /N /O\n\ |
| 112 |
/P /Q /R /S /T /U /V /W\n\ |
| 113 |
/X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore\n\ |
| 114 |
/grave /a /b /c /d /e /f /g\n\ |
| 115 |
/h /i /j /k /l /m /n /o\n\ |
| 116 |
/p /q /r /s /t /u /v /w\n\ |
| 117 |
/x /y /z /braceleft /bar /braceright /asciitilde /.notdef\n\ |
| 118 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 119 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 120 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 121 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 122 |
/uni00A0 /Aogonek /breve /Lslash /currency /Lcaron /Sacute /section\n\ |
| 123 |
/dieresis /Scaron /Scedilla /Tcaron /Zacute /uni00AD /Zcaron /Zdotaccent\n\ |
| 124 |
/degree /aogonek /ogonek /lslash /acute /lcaron /sacute /caron\n\ |
| 125 |
/cedilla /scaron /scedilla /tcaron /zacute /hungarumlaut /zcaron /zdotaccent\n\ |
| 126 |
/Racute /Aacute /Acircumflex /Abreve /Adieresis /Lacute /Cacute /Ccedilla\n\ |
| 127 |
/Ccaron /Eacute /Eogonek /Edieresis /Ecaron /Iacute /Icircumflex /Dcaron\n\ |
| 128 |
/Dcroat /Nacute /Ncaron /Oacute /Ocircumflex /Ohungarumlaut /Odieresis /multiply\n\ |
| 129 |
/Rcaron /Uring /Uacute /Uhungarumlaut /Udieresis /Yacute /uni0162 /germandbls\n\ |
| 130 |
/racute /aacute /acircumflex /abreve /adieresis /lacute /cacute /ccedilla\n\ |
| 131 |
/ccaron /eacute /eogonek /edieresis /ecaron /iacute /icircumflex /dcaron\n\ |
| 132 |
/dcroat /nacute /ncaron /oacute /ocircumflex /ohungarumlaut /odieresis /divide\n\ |
| 133 |
/rcaron /uring /uacute /uhungarumlaut /udieresis /yacute /uni0163 /dotaccent\n\ |
| 134 |
] def\n"; |
| 135 |
|
| 136 |
static const char ISOLatin3Encoding[] = "/ISOLatin3Encoding [\n\ |
| 137 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 138 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 139 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 140 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 141 |
/space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quotesingle\n\ |
| 142 |
/parenleft /parenright /asterisk /plus /comma /hyphen /period /slash\n\ |
| 143 |
/zero /one /two /three /four /five /six /seven\n\ |
| 144 |
/eight /nine /colon /semicolon /less /equal /greater /question\n\ |
| 145 |
/at /A /B /C /D /E /F /G\n\ |
| 146 |
/H /I /J /K /L /M /N /O\n\ |
| 147 |
/P /Q /R /S /T /U /V /W\n\ |
| 148 |
/X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore\n\ |
| 149 |
/grave /a /b /c /d /e /f /g\n\ |
| 150 |
/h /i /j /k /l /m /n /o\n\ |
| 151 |
/p /q /r /s /t /u /v /w\n\ |
| 152 |
/x /y /z /braceleft /bar /braceright /asciitilde /.notdef\n\ |
| 153 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 154 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 155 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 156 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 157 |
/uni00A0 /Hbar /breve /sterling /currency /yen /Hcircumflex /section\n\ |
| 158 |
/dieresis /Idotaccent /Scedilla /Gbreve /Jcircumflex /uni00AD /registered /Zdotaccent\n\ |
| 159 |
/degree /hbar /twosuperior /threesuperior /acute /mu /hcircumflex /periodcentered\n\ |
| 160 |
/cedilla /dotlessi /scedilla /gbreve /jcircumflex /onehalf /threequarters /zdotaccent\n\ |
| 161 |
/Agrave /Aacute /Acircumflex /Atilde /Adieresis /Cdotaccent /Ccircumflex /Ccedilla\n\ |
| 162 |
/Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis\n\ |
| 163 |
/Eth /Ntilde /Ograve /Oacute /Ocircumflex /Gdotaccent /Odieresis /multiply\n\ |
| 164 |
/Gcircumflex /Ugrave /Uacute /Ucircumflex /Udieresis /Ubreve /Scircumflex /germandbls\n\ |
| 165 |
/agrave /aacute /acircumflex /atilde /adieresis /cdotaccent /ccircumflex /ccedilla\n\ |
| 166 |
/egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis\n\ |
| 167 |
/eth /ntilde /ograve /oacute /ocircumflex /gdotaccent /odieresis /divide\n\ |
| 168 |
/gcircumflex /ugrave /uacute /ucircumflex /udieresis /ubreve /scircumflex /dotaccent\n\ |
| 169 |
] def\n"; |
| 170 |
|
| 171 |
static const char ISOLatin4Encoding[] = "/ISOLatin4Encoding [\n\ |
| 172 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 173 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 174 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 175 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 176 |
/space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quotesingle\n\ |
| 177 |
/parenleft /parenright /asterisk /plus /comma /hyphen /period /slash\n\ |
| 178 |
/zero /one /two /three /four /five /six /seven\n\ |
| 179 |
/eight /nine /colon /semicolon /less /equal /greater /question\n\ |
| 180 |
/at /A /B /C /D /E /F /G\n\ |
| 181 |
/H /I /J /K /L /M /N /O\n\ |
| 182 |
/P /Q /R /S /T /U /V /W\n\ |
| 183 |
/X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore\n\ |
| 184 |
/grave /a /b /c /d /e /f /g\n\ |
| 185 |
/h /i /j /k /l /m /n /o\n\ |
| 186 |
/p /q /r /s /t /u /v /w\n\ |
| 187 |
/x /y /z /braceleft /bar /braceright /asciitilde /.notdef\n\ |
| 188 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 189 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 190 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 191 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 192 |
/uni00A0 /Aogonek /kgreenlandic /Rcommaaccent /currency /Itilde /Lcommaaccent /section\n\ |
| 193 |
/dieresis /Scaron /Emacron /Gcommaaccent /Tbar /uni00AD /Zcaron /macron\n\ |
| 194 |
/degree /aogonek /ogonek /rcommaaccent /acute /itilde /lcommaaccent /caron\n\ |
| 195 |
/cedilla /scaron /emacron /gcommaaccent /tbar /Eng /zcaron /eng\n\ |
| 196 |
/Amacron /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Iogonek\n\ |
| 197 |
/Ccaron /Eacute /Eogonek /Edieresis /Edotaccent /Iacute /Icircumflex /Imacron\n\ |
| 198 |
/Dcroat /Ncommaaccent /Omacron /Kcommaaccent /Ocircumflex /Otilde /Odieresis /multiply\n\ |
| 199 |
/Oslash /Uogonek /Uacute /Ucircumflex /Udieresis /Utilde /Umacron /germandbls\n\ |
| 200 |
/amacron /aacute /acircumflex /atilde /adieresis /aring /ae /iogonek\n\ |
| 201 |
/ccaron /eacute /eogonek /edieresis /edotaccent /iacute /icircumflex /imacron\n\ |
| 202 |
/dcroat /ncommaaccent /omacron /kcommaaccent /ocircumflex /otilde /odieresis /divide\n\ |
| 203 |
/oslash /uogonek /uacute /ucircumflex /udieresis /utilde /umacron /dotaccent\n\ |
| 204 |
] def\n"; |
| 205 |
|
| 206 |
static const char ISOCyrillicEncoding[] = "/ISOCyrillicEncoding [\n\ |
| 207 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 208 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 209 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 210 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 211 |
/space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quotesingle\n\ |
| 212 |
/parenleft /parenright /asterisk /plus /comma /hyphen /period /slash\n\ |
| 213 |
/zero /one /two /three /four /five /six /seven\n\ |
| 214 |
/eight /nine /colon /semicolon /less /equal /greater /question\n\ |
| 215 |
/at /A /B /C /D /E /F /G\n\ |
| 216 |
/H /I /J /K /L /M /N /O\n\ |
| 217 |
/P /Q /R /S /T /U /V /W\n\ |
| 218 |
/X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore\n\ |
| 219 |
/grave /a /b /c /d /e /f /g\n\ |
| 220 |
/h /i /j /k /l /m /n /o\n\ |
| 221 |
/p /q /r /s /t /u /v /w\n\ |
| 222 |
/x /y /z /braceleft /bar /braceright /asciitilde /.notdef\n\ |
| 223 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 224 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 225 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 226 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 227 |
/uni00A0 /afii10023 /afii10051 /afii10052 /afii10053 /afii10054 /afii10055 /afii10056\n\ |
| 228 |
/afii10057 /afii10058 /afii10059 /afii10060 /afii10061 /uni00AD /afii10062 /afii10145\n\ |
| 229 |
/afii10017 /afii10018 /afii10019 /afii10020 /afii10021 /afii10022 /afii10024 /afii10025\n\ |
| 230 |
/afii10026 /afii10027 /afii10028 /afii10029 /afii10030 /afii10031 /afii10032 /afii10033\n\ |
| 231 |
/afii10034 /afii10035 /afii10036 /afii10037 /afii10038 /afii10039 /afii10040 /afii10041\n\ |
| 232 |
/afii10042 /afii10043 /afii10044 /afii10045 /afii10046 /afii10047 /afii10048 /afii10049\n\ |
| 233 |
/afii10065 /afii10066 /afii10067 /afii10068 /afii10069 /afii10070 /afii10072 /afii10073\n\ |
| 234 |
/afii10074 /afii10075 /afii10076 /afii10077 /afii10078 /afii10079 /afii10080 /afii10081\n\ |
| 235 |
/afii10082 /afii10083 /afii10084 /afii10085 /afii10086 /afii10087 /afii10088 /afii10089\n\ |
| 236 |
/afii10090 /afii10091 /afii10092 /afii10093 /afii10094 /afii10095 /afii10096 /afii10097\n\ |
| 237 |
/afii61352 /afii10071 /afii10099 /afii10100 /afii10101 /afii10102 /afii10103 /afii10104\n\ |
| 238 |
/afii10105 /afii10106 /afii10107 /afii10108 /afii10109 /section /afii10110 /afii10193\n\ |
| 239 |
] def\n"; |
| 240 |
|
| 241 |
static const char ISOGreekEncoding[] = "/ISOGreekEncoding [\n\ |
| 242 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 243 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 244 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 245 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 246 |
/space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quotesingle\n\ |
| 247 |
/parenleft /parenright /asterisk /plus /comma /hyphen /period /slash\n\ |
| 248 |
/zero /one /two /three /four /five /six /seven\n\ |
| 249 |
/eight /nine /colon /semicolon /less /equal /greater /question\n\ |
| 250 |
/at /A /B /C /D /E /F /G\n\ |
| 251 |
/H /I /J /K /L /M /N /O\n\ |
| 252 |
/P /Q /R /S /T /U /V /W\n\ |
| 253 |
/X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore\n\ |
| 254 |
/grave /a /b /c /d /e /f /g\n\ |
| 255 |
/h /i /j /k /l /m /n /o\n\ |
| 256 |
/p /q /r /s /t /u /v /w\n\ |
| 257 |
/x /y /z /braceleft /bar /braceright /asciitilde /.notdef\n\ |
| 258 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 259 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 260 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 261 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 262 |
/uni00A0 /afii64937 /afii57929 /sterling /currency /yen /brokenbar /section\n\ |
| 263 |
/dieresis /copyright /ordfeminine /guillemotleft /logicalnot /uni00AD /registered /afii00208\n\ |
| 264 |
/degree /plusminus /twosuperior /threesuperior /tonos /dieresistonos /Alphatonos /periodcentered\n\ |
| 265 |
/Epsilontonos /Etatonos /Iotatonos /guillemotright /Omicrontonos /onehalf /Upsilontonos /Omegatonos\n\ |
| 266 |
/iotadieresistonos /Alpha /Beta /Gamma /uni0394 /Epsilon /Zeta /Eta\n\ |
| 267 |
/Theta /Iota /Kappa /Lambda /Mu /Nu /Xi /Omicron\n\ |
| 268 |
/Pi /Rho /Ograve /Sigma /Tau /Upsilon /Phi /Chi\n\ |
| 269 |
/Psi /uni03A9 /Iotadieresis /Upsilondieresis /alphatonos /epsilontonos /etatonos /iotatonos\n\ |
| 270 |
/upsilondieresistonos /alpha /beta /gamma /delta /epsilon /zeta /eta\n\ |
| 271 |
/theta /iota /kappa /lambda /uni03BC /nu /xi /omicron\n\ |
| 272 |
/pi /rho /sigma1 /sigma /tau /upsilon /phi /chi\n\ |
| 273 |
/psi /omega /iotadieresis /upsilondieresis /omicrontonos /upsilontonos /omegatonos /ydieresis\n\ |
| 274 |
] def\n"; |
| 275 |
|
| 276 |
static const char ISOLatin5Encoding[] = "/ISOLatin5Encoding [\n\ |
| 277 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 278 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 279 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 280 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 281 |
/space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quotesingle\n\ |
| 282 |
/parenleft /parenright /asterisk /plus /comma /hyphen /period /slash\n\ |
| 283 |
/zero /one /two /three /four /five /six /seven\n\ |
| 284 |
/eight /nine /colon /semicolon /less /equal /greater /question\n\ |
| 285 |
/at /A /B /C /D /E /F /G\n\ |
| 286 |
/H /I /J /K /L /M /N /O\n\ |
| 287 |
/P /Q /R /S /T /U /V /W\n\ |
| 288 |
/X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore\n\ |
| 289 |
/grave /a /b /c /d /e /f /g\n\ |
| 290 |
/h /i /j /k /l /m /n /o\n\ |
| 291 |
/p /q /r /s /t /u /v /w\n\ |
| 292 |
/x /y /z /braceleft /bar /braceright /asciitilde /.notdef\n\ |
| 293 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 294 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 295 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 296 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 297 |
/uni00A0 /exclamdown /cent /sterling /currency /yen /brokenbar /section\n\ |
| 298 |
/dieresis /copyright /ordfeminine /guillemotleft /logicalnot /uni00AD /registered /macron\n\ |
| 299 |
/degree /plusminus /twosuperior /threesuperior /acute /mu /paragraph /periodcentered\n\ |
| 300 |
/cedilla /onesuperior /ordmasculine /guillemotright /onequarter /onehalf /threequarters /questiondown\n\ |
| 301 |
/Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla\n\ |
| 302 |
/Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis\n\ |
| 303 |
/Gbreve /Ntilde /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply\n\ |
| 304 |
/Oslash /Ugrave /Uacute /Ucircumflex /Udieresis /Idotaccent /Scedilla /germandbls\n\ |
| 305 |
/agrave /aacute /acircumflex /atilde /adieresis /aring /ae /ccedilla\n\ |
| 306 |
/egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis\n\ |
| 307 |
/gbreve /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide\n\ |
| 308 |
/oslash /ugrave /uacute /ucircumflex /udieresis /dotlessi /scedilla /ydieresis\n\ |
| 309 |
] def\n"; |
| 310 |
|
| 311 |
static const char ISOLatin6Encoding[] = "/ISOLatin6Encoding [\n\ |
| 312 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 313 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 314 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 315 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 316 |
/space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quotesingle\n\ |
| 317 |
/parenleft /parenright /asterisk /plus /comma /hyphen /period /slash\n\ |
| 318 |
/zero /one /two /three /four /five /six /seven\n\ |
| 319 |
/eight /nine /colon /semicolon /less /equal /greater /question\n\ |
| 320 |
/at /A /B /C /D /E /F /G\n\ |
| 321 |
/H /I /J /K /L /M /N /O\n\ |
| 322 |
/P /Q /R /S /T /U /V /W\n\ |
| 323 |
/X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore\n\ |
| 324 |
/grave /a /b /c /d /e /f /g\n\ |
| 325 |
/h /i /j /k /l /m /n /o\n\ |
| 326 |
/p /q /r /s /t /u /v /w\n\ |
| 327 |
/x /y /z /braceleft /bar /braceright /asciitilde /.notdef\n\ |
| 328 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 329 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 330 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 331 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 332 |
/uni00A0 /Aogonek /Emacron /Gcommaaccent /Imacron /Itilde /Kcommaaccent /section\n\ |
| 333 |
/Lcommaaccent /Dcroat /Scaron /Tbar /Zcaron /uni00AD /Umacron /Eng\n\ |
| 334 |
/degree /aogonek /emacron /gcommaaccent /imacron /itilde /kcommaaccent /periodcentered\n\ |
| 335 |
/lcommaaccent /dcroat /scaron /tbar /zcaron /macron /umacron /eng\n\ |
| 336 |
/Amacron /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Iogonek\n\ |
| 337 |
/Ccaron /Eacute /Eogonek /Edieresis /Emacron /Iacute /Icircumflex /Idieresis\n\ |
| 338 |
/Eth /Ncommaaccent /Omacron /Oacute /Ocircumflex /Otilde /Odieresis /Utilde\n\ |
| 339 |
/Oslash /Uogonek /Uacute /Ucircumflex /Udieresis /Yacute /Thorn /germandbls\n\ |
| 340 |
/amacron /aacute /acircumflex /atilde /adieresis /aring /ae /iogonek\n\ |
| 341 |
/ccaron /eacute /eogonek /edieresis /emacron /iacute /icircumflex /idieresis\n\ |
| 342 |
/eth /ncommaaccent /omacron /oacute /ocircumflex /otilde /odieresis /utilde\n\ |
| 343 |
/oslash /uogonek /uacute /ucircumflex /udieresis /yacute /thorn /kgreenlandic\n\ |
| 344 |
] def\n"; |
| 345 |
|
| 346 |
static const char ISOThaiEncoding[] = "/ISOThaiEncoding [\n\ |
| 347 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 348 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 349 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 350 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 351 |
/space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quotesingle\n\ |
| 352 |
/parenleft /parenright /asterisk /plus /comma /hyphen /period /slash\n\ |
| 353 |
/zero /one /two /three /four /five /six /seven\n\ |
| 354 |
/eight /nine /colon /semicolon /less /equal /greater /question\n\ |
| 355 |
/at /A /B /C /D /E /F /G\n\ |
| 356 |
/H /I /J /K /L /M /N /O\n\ |
| 357 |
/P /Q /R /S /T /U /V /W\n\ |
| 358 |
/X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore\n\ |
| 359 |
/grave /a /b /c /d /e /f /g\n\ |
| 360 |
/h /i /j /k /l /m /n /o\n\ |
| 361 |
/p /q /r /s /t /u /v /w\n\ |
| 362 |
/x /y /z /braceleft /bar /braceright /asciitilde /.notdef\n\ |
| 363 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 364 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 365 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 366 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 367 |
/uni00A0 /uni0E01 /uni0E02 /uni0E03 /uni0E04 /uni0E05 /uni0E06 /uni0E07\n\ |
| 368 |
/uni0E08 /uni0E09 /uni0E0A /uni0E0B /uni0E0C /uni0E0D /uni0E0E /uni0E0F\n\ |
| 369 |
/uni0E10 /uni0E11 /uni0E12 /uni0E13 /uni0E14 /uni0E15 /uni0E16 /uni0E17\n\ |
| 370 |
/uni0E18 /uni0E19 /uni0E1A /uni0E1B /uni0E1C /uni0E1D /uni0E1E /uni0E1F\n\ |
| 371 |
/uni0E20 /uni0E21 /uni0E22 /uni0E23 /uni0E24 /uni0E25 /uni0E26 /uni0E27\n\ |
| 372 |
/uni0E28 /uni0E29 /uni0E2A /uni0E2B /uni0E2C /uni0E2D /uni0E2E /uni0E2F\n\ |
| 373 |
/uni0E30 /uni0E31 /uni0E32 /uni0E33 /uni0E34 /uni0E35 /uni0E36 /uni0E37\n\ |
| 374 |
/uni0E38 /uni0E39 /uni0E3A /.notdef /space /.notdef /.notdef /uni0E3F\n\ |
| 375 |
/uni0E40 /uni0E41 /uni0E42 /uni0E43 /uni0E44 /uni0E45 /uni0E46 /uni0E47\n\ |
| 376 |
/uni0E48 /uni0E49 /uni0E4A /uni0E4B /uni0E4C /uni0E4D /uni0E4E /uni0E4F\n\ |
| 377 |
/uni0E50 /uni0E51 /uni0E52 /uni0E53 /uni0E54 /uni0E55 /uni0E56 /uni0E57\n\ |
| 378 |
/uni0E58 /uni0E59 /uni0E5A /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 379 |
] def\n"; |
| 380 |
|
| 381 |
static const char ISOLatin7Encoding[] = "/ISOLatin7Encoding [\n\ |
| 382 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 383 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 384 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 385 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 386 |
/space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quotesingle\n\ |
| 387 |
/parenleft /parenright /asterisk /plus /comma /hyphen /period /slash\n\ |
| 388 |
/zero /one /two /three /four /five /six /seven\n\ |
| 389 |
/eight /nine /colon /semicolon /less /equal /greater /question\n\ |
| 390 |
/at /A /B /C /D /E /F /G\n\ |
| 391 |
/H /I /J /K /L /M /N /O\n\ |
| 392 |
/P /Q /R /S /T /U /V /W\n\ |
| 393 |
/X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore\n\ |
| 394 |
/grave /a /b /c /d /e /f /g\n\ |
| 395 |
/h /i /j /k /l /m /n /o\n\ |
| 396 |
/p /q /r /s /t /u /v /w\n\ |
| 397 |
/x /y /z /braceleft /bar /braceright /asciitilde /.notdef\n\ |
| 398 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 399 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 400 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 401 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 402 |
/uni00A0 /quotedblright /cent /sterling /currency /quotedblbase /brokenbar /section\n\ |
| 403 |
/Oslash /copyright /rcommaaccent /guillemotleft /logicalnot /uni00AD /registered /AE\n\ |
| 404 |
/degree /plusminus /twosuperior /threesuperior /quotedblleft /mu /paragraph /periodcentered\n\ |
| 405 |
/oslash /onesuperior /.notdef /guillemotright /onequarter /onehalf /threequarters /ae\n\ |
| 406 |
/Aogonek /Iogonek /Amacron /Cacute /Adieresis /Aring /Eogonek /Emacron\n\ |
| 407 |
/Ccaron /Eacute /Zacute /Edotaccent /Gcommaaccent /Kcommaaccent /Imacron /Lcommaaccent\n\ |
| 408 |
/Scaron /Nacute /Ncommaaccent /Oacute /Omacron /Otilde /Odieresis /multiply\n\ |
| 409 |
/Uogonek /Lslash /Uacute /Ucircumflex /Udieresis /Zdotaccent /Zcaron /germandbls\n\ |
| 410 |
/aogonek /Iogonek /amacron /cacute /adieresis /aring /eogonek /emacron\n\ |
| 411 |
/ccaron /eacute /zacute /edotaccent /gcommaaccent /kcommaaccent /imacron /lcommaaccent\n\ |
| 412 |
/scaron /nacute /ncommaaccent /oacute /omacron /otilde /odieresis /divide\n\ |
| 413 |
/uogonek /lslash /uacute /ucircumflex /udieresis /zdotaccent /zcaron /quoteright\n\ |
| 414 |
] def\n"; |
| 415 |
|
| 416 |
static const char ISOLatin8Encoding[] = "/ISOLatin8Encoding [\n\ |
| 417 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 418 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 419 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 420 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 421 |
/space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quotesingle\n\ |
| 422 |
/parenleft /parenright /asterisk /plus /comma /hyphen /period /slash\n\ |
| 423 |
/zero /one /two /three /four /five /six /seven\n\ |
| 424 |
/eight /nine /colon /semicolon /less /equal /greater /question\n\ |
| 425 |
/at /A /B /C /D /E /F /G\n\ |
| 426 |
/H /I /J /K /L /M /N /O\n\ |
| 427 |
/P /Q /R /S /T /U /V /W\n\ |
| 428 |
/X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore\n\ |
| 429 |
/grave /a /b /c /d /e /f /g\n\ |
| 430 |
/h /i /j /k /l /m /n /o\n\ |
| 431 |
/p /q /r /s /t /u /v /w\n\ |
| 432 |
/x /y /z /braceleft /bar /braceright /asciitilde /.notdef\n\ |
| 433 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 434 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 435 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 436 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 437 |
/uni00A0 /uni1E02 /uni1E03 /sterling /Cdotaccent /cdotaccent /uni1E0A /section\n\ |
| 438 |
/Wgrave /copyright /Wacute /uni1E0B /Ygrave /uni00AD /registered /Ydieresis\n\ |
| 439 |
/uni1E1E /uni1E1F /Gdotaccent /gdotaccent /uni1E40 /uni1E41 /paragraph /uni1E56\n\ |
| 440 |
/wgrave /uni1E57 /wacute /uni1E60 /ygrave /Wdieresis /wdieresis /uni1E61\n\ |
| 441 |
/Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla\n\ |
| 442 |
/Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis\n\ |
| 443 |
/Wcircumflex /Ntilde /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /uni1E6A\n\ |
| 444 |
/Oslash /Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Ycircumflex /germandbls\n\ |
| 445 |
/agrave /aacute /acircumflex /atilde /adieresis /aring /ae /ccedilla\n\ |
| 446 |
/egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis\n\ |
| 447 |
/wcircumflex /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /uni1E6B\n\ |
| 448 |
/oslash /ugrave /uacute /ucircumflex /udieresis /yacute /ycircumflex /ydieresis\n\ |
| 449 |
] def\n"; |
| 450 |
|
| 451 |
static const char ISOLatin9Encoding[] = "/ISOLatin9Encoding [\n\ |
| 452 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 453 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 454 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 455 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 456 |
/space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quotesingle\n\ |
| 457 |
/parenleft /parenright /asterisk /plus /comma /hyphen /period /slash\n\ |
| 458 |
/zero /one /two /three /four /five /six /seven\n\ |
| 459 |
/eight /nine /colon /semicolon /less /equal /greater /question\n\ |
| 460 |
/at /A /B /C /D /E /F /G\n\ |
| 461 |
/H /I /J /K /L /M /N /O\n\ |
| 462 |
/P /Q /R /S /T /U /V /W\n\ |
| 463 |
/X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore\n\ |
| 464 |
/grave /a /b /c /d /e /f /g\n\ |
| 465 |
/h /i /j /k /l /m /n /o\n\ |
| 466 |
/p /q /r /s /t /u /v /w\n\ |
| 467 |
/x /y /z /braceleft /bar /braceright /asciitilde /.notdef\n\ |
| 468 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 469 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 470 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 471 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 472 |
/uni00A0 /exclamdown /cent /sterling /Euro /yen /Scaron /section\n\ |
| 473 |
/scaron /copyright /ordfeminine /guillemotleft /logicalnot /uni00AD /registered /macron\n\ |
| 474 |
/degree /plusminus /twosuperior /threesuperior /Zcaron /mu /paragraph /periodcentered\n\ |
| 475 |
/zcaron /onesuperior /ordmasculine /guillemotright /OE /oe /Ydieresis /questiondown\n\ |
| 476 |
/Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla\n\ |
| 477 |
/Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis\n\ |
| 478 |
/Eth /Ntilde /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply\n\ |
| 479 |
/Oslash /Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Thorn /germandbls\n\ |
| 480 |
/agrave /aacute /acircumflex /atilde /adieresis /aring /ae /ccedilla\n\ |
| 481 |
/egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis\n\ |
| 482 |
/eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide\n\ |
| 483 |
/oslash /ugrave /uacute /ucircumflex /udieresis /yacute /thorn /ydieresis\n\ |
| 484 |
] def\n"; |
| 485 |
|
| 486 |
static const char KOI8REncoding[] = "/KOI8REncoding [\n\ |
| 487 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 488 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 489 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 490 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 491 |
/space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quotesingle\n\ |
| 492 |
/parenleft /parenright /asterisk /plus /comma /hyphen /period /slash\n\ |
| 493 |
/zero /one /two /three /four /five /six /seven\n\ |
| 494 |
/eight /nine /colon /semicolon /less /equal /greater /question\n\ |
| 495 |
/at /A /B /C /D /E /F /G\n\ |
| 496 |
/H /I /J /K /L /M /N /O\n\ |
| 497 |
/P /Q /R /S /T /U /V /W\n\ |
| 498 |
/X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore\n\ |
| 499 |
/grave /a /b /c /d /e /f /g\n\ |
| 500 |
/h /i /j /k /l /m /n /o\n\ |
| 501 |
/p /q /r /s /t /u /v /w\n\ |
| 502 |
/x /y /z /braceleft /bar /braceright /asciitilde /.notdef\n\ |
| 503 |
/SF100000 /SF110000 /SF010000 /SF030000 /SF020000 /SF040000 /SF080000 /SF090000\n\ |
| 504 |
/SF060000 /SF070000 /SF050000 /upblock /dnblock /block /lfblock /rtblock\n\ |
| 505 |
/ltshade /shade /dkshade /integraltp /filledbox /uni2219 /radical /approxequal\n\ |
| 506 |
/lessequal /greaterequal /uni00A0 /integralbt /degree /twosuperior /periodcentered /divide\n\ |
| 507 |
/SF430000 /SF240000 /SF510000 /afii10071 /SF520000 /SF390000 /SF220000 /SF210000\n\ |
| 508 |
/SF250000 /SF500000 /SF490000 /SF380000 /SF280000 /SF270000 /SF260000 /SF360000\n\ |
| 509 |
/SF370000 /SF420000 /SF190000 /afii10023 /SF200000 /SF230000 /SF470000 /SF480000\n\ |
| 510 |
/SF410000 /SF450000 /SF460000 /SF400000 /SF540000 /SF530000 /SF440000 /copyright\n\ |
| 511 |
/afii10096 /afii10065 /afii10066 /afii10088 /afii10069 /afii10070 /afii10086 /afii10068\n\ |
| 512 |
/afii10087 /afii10074 /afii10075 /afii10076 /afii10077 /afii10078 /afii10079 /afii10080\n\ |
| 513 |
/afii10081 /afii10097 /afii10082 /afii10083 /afii10084 /afii10085 /afii10072 /afii10067\n\ |
| 514 |
/afii10094 /afii10093 /afii10073 /afii10090 /afii10095 /afii10091 /afii10089 /afii10092\n\ |
| 515 |
/afii10048 /afii10017 /afii10018 /afii10040 /afii10021 /afii10022 /afii10038 /afii10020\n\ |
| 516 |
/afii10039 /afii10026 /afii10027 /afii10028 /afii10029 /afii10030 /afii10031 /afii10032\n\ |
| 517 |
/afii10033 /afii10049 /afii10034 /afii10035 /afii10036 /afii10037 /afii10024 /afii10019\n\ |
| 518 |
/afii10046 /afii10045 /afii10025 /afii10042 /afii10047 /afii10043 /afii10041 /afii10044\n\ |
| 519 |
] def\n"; |
| 520 |
|
| 521 |
static const char ExpertEncoding[] = "/ExpertEncoding [\n\ |
| 522 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 523 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 524 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 525 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 526 |
/space /exclamsmall /Hungarumlautsmall /.notdef /dollaroldstyle /dollarsuperior /ampersandsmall /Acutesmall\n\ |
| 527 |
/parenleftsuperior /parenrightsuperior /twodotenleader /onedotenleader /comma /hyphen /period /fraction\n\ |
| 528 |
/zerooldstyle /oneoldstyle /twooldstyle /threeoldstyle /fouroldstyle /fiveoldstyle /sixoldstyle /sevenoldstyle\n\ |
| 529 |
/eightoldstyle /nineoldstyle /colon /semicolon /commasuperior /threequartersemdash /periodsuperior /questionsmall\n\ |
| 530 |
/.notdef /asuperior /bsuperior /centsuperior /dsuperior /esuperior /.notdef /.notdef\n\ |
| 531 |
/.notdef /isuperior /.notdef /.notdef /lsuperior /msuperior /nsuperior /osuperior\n\ |
| 532 |
/.notdef /.notdef /rsuperior /ssuperior /tsuperior /.notdef /ff /fi\n\ |
| 533 |
/fl /ffi /ffl /parenleftinferior /.notdef /parenrightinferior /Circumflexsmall /hyphensuperior\n\ |
| 534 |
/Gravesmall /Asmall /Bsmall /Csmall /Dsmall /Esmall /Fsmall /Gsmall\n\ |
| 535 |
/Hsmall /Ismall /Jsmall /Ksmall /Lsmall /Msmall /Nsmall /Osmall\n\ |
| 536 |
/Psmall /Qsmall /Rsmall /Ssmall /Tsmall /Usmall /Vsmall /Wsmall\n\ |
| 537 |
/Xsmall /Ysmall /Zsmall /colonmonetary /onefitted /rupiah /Tildesmall /.notdef\n\ |
| 538 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 539 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 540 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 541 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 542 |
/.notdef /exclamdownsmall /centoldstyle /Lslashsmall /.notdef /.notdef /Scaronsmall /Zcaronsmall\n\ |
| 543 |
/Dieresissmall /Brevesmall /Caronsmall /.notdef /Dotaccentsmall /.notdef /.notdef /Macronsmall\n\ |
| 544 |
/.notdef /.notdef /figuredash /hypheninferior /.notdef /.notdef /Ogoneksmall /Ringsmall\n\ |
| 545 |
/Cedillasmall /.notdef /.notdef /.notdef /onequarter /onehalf /threequarters /questiondownsmall\n\ |
| 546 |
/oneeighth /threeeighths /fiveeighths /seveneighths /onethird /twothirds /.notdef /.notdef\n\ |
| 547 |
/zerosuperior /onesuperior /twosuperior /threesuperior /foursuperior /fivesuperior /sixsuperior /sevensuperior\n\ |
| 548 |
/eightsuperior /ninesuperior /zeroinferior /oneinferior /twoinferior /threeinferior /fourinferior /fiveinferior\n\ |
| 549 |
/sixinferior /seveninferior /eightinferior /nineinferior /centinferior /dollarinferior /periodinferior /commainferior\n\ |
| 550 |
/Agravesmall /Aacutesmall /Acircumflexsmall /Atildesmall /Adieresissmall /Aringsmall /AEsmall /Ccedillasmall\n\ |
| 551 |
/Egravesmall /Eacutesmall /Ecircumflexsmall /Edieresissmall /Igravesmall /Iacutesmall /Icircumflexsmall /Idieresissmall\n\ |
| 552 |
/Ethsmall /Ntildesmall /Ogravesmall /Oacutesmall /Ocircumflexsmall /Otildesmall /Odieresissmall /OEsmall\n\ |
| 553 |
/Oslashsmall /Ugravesmall /Uacutesmall /Ucircumflexsmall /Udieresissmall /Yacutesmall /Thornsmall\n\ |
| 554 |
] def\n"; |
| 555 |
|
| 556 |
static const char ExpertSubsetEncoding[] = "/ExpertSubsetEncoding [\n\ |
| 557 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 558 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 559 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 560 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 561 |
/space /.notdef /.notdef /.notdef /dollaroldstyle /dollarsuperior /.notdef /.notdef\n\ |
| 562 |
/parenleftsuperior /parenrightsuperior /twodotenleader /onedotenleader /comma /hyphen /period /fraction\n\ |
| 563 |
/zerooldstyle /oneoldstyle /twooldstyle /threeoldstyle /fouroldstyle /fiveoldstyle /sixoldstyle /sevenoldstyle\n\ |
| 564 |
/eightoldstyle /nineoldstyle /colon /semicolon /commasuperior /threequartersemdash /periodsuperior /.notdef\n\ |
| 565 |
/.notdef /asuperior /bsuperior /centsuperior /dsuperior /esuperior /.notdef /.notdef\n\ |
| 566 |
/.notdef /isuperior /.notdef /.notdef /lsuperior /msuperior /nsuperior /osuperior\n\ |
| 567 |
/.notdef /.notdef /rsuperior /ssuperior /tsuperior /.notdef /ff /fi\n\ |
| 568 |
/fl /ffi /ffl /parenleftinferior /.notdef /parenrightinferior /.notdef /hyphensuperior\n\ |
| 569 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 570 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 571 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 572 |
/.notdef /.notdef /.notdef /colonmonetary /onefitted /rupiah /.notdef /.notdef\n\ |
| 573 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 574 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 575 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 576 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 577 |
/.notdef /.notdef /centoldstyle /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 578 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 579 |
/.notdef /.notdef /figuredash /hypheninferior /.notdef /.notdef /.notdef /.notdef\n\ |
| 580 |
/.notdef /.notdef /.notdef /.notdef /onequarter /onehalf /threequarters /.notdef\n\ |
| 581 |
/oneeighth /threeeighths /fiveeighths /seveneighths /onethird /twothirds /.notdef /.notdef\n\ |
| 582 |
/zerosuperior /onesuperior /twosuperior /threesuperior /foursuperior /fivesuperior /sixsuperior /sevensuperior\n\ |
| 583 |
/eightsuperior /ninesuperior /zeroinferior /oneinferior /twoinferior /threeinferior /fourinferior /fiveinferior\n\ |
| 584 |
/sixinferior /seveninferior /eightinferior /nineinferior /centinferior /dollarinferior /periodinferior /commainferior\n\ |
| 585 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 586 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 587 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 588 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 589 |
] def\n"; |
| 590 |
|
| 591 |
static const char SymbolEncoding[] = "/SymbolEncoding [\n\ |
| 592 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 593 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 594 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 595 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 596 |
/space /exclam /universal /numbersign /existential /percent /ampersand /suchthat\n\ |
| 597 |
/parenleft /parenright /asteriskmath /plus /comma /minus /period /slash\n\ |
| 598 |
/zero /one /two /three /four /five /six /seven\n\ |
| 599 |
/eight /nine /colon /semicolon /less /equal /greater /question\n\ |
| 600 |
/congruent /Alpha /Beta /Chi /Delta /Epsilon /Phi /Gamma\n\ |
| 601 |
/Eta /Iota /theta1 /Kappa /Lambda /Mu /Nu /Omicron\n\ |
| 602 |
/Pi /Theta /Rho /Sigma /Tau /Upsilon /sigma1 /Omega\n\ |
| 603 |
/Xi /Psi /Zeta /bracketleft /therefore /bracketright /perpendicular /underscore\n\ |
| 604 |
/radicalex /alpha /beta /chi /delta /epsilon /phi /gamma\n\ |
| 605 |
/eta /iota /phi1 /kappa /lambda /mu /nu /omicron\n\ |
| 606 |
/pi /theta /rho /sigma /tau /upsilon /omega1 /omega\n\ |
| 607 |
/xi /psi /zeta /braceleft /bar /braceright /similar /.notdef\n\ |
| 608 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 609 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 610 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 611 |
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef\n\ |
| 612 |
/.notdef /Upsilon1 /minute /lessequal /fraction /infinity /florin /club\n\ |
| 613 |
/diamond /heart /spade /arrowboth /arrowleft /arrowup /arrowright /arrowdown\n\ |
| 614 |
/degree /plusminus /second /greaterequal /multiply /proportional /partialdiff /bullet\n\ |
| 615 |
/divide /notequal /equivalence /approxequal /ellipsis /arrowvertex /arrowhorizex /carriagereturn\n\ |
| 616 |
/aleph /Ifraktur /Rfraktur /weierstrass /circlemultiply /circleplus /emptyset /intersection\n\ |
| 617 |
/union /propersuperset /reflexsuperset /notsubset /propersubset /reflexsubset /element /notelement\n\ |
| 618 |
/angle /gradient /registerserif /copyrightserif /trademarkserif /product /radical /dotmath\n\ |
| 619 |
/logicalnot /logicaland /logicalor /arrowdblboth /arrowdblleft /arrowdblup /arrowdblright /arrowdbldown\n\ |
| 620 |
/lozenge /angleleft /registersans /copyrightsans /trademarksans /summation /parenlefttp /parenleftex\n\ |
| 621 |
/parenleftbt /bracketlefttp /bracketleftex /bracketleftbt /bracelefttp /braceleftmid /braceleftbt /braceex\n\ |
| 622 |
/.notdef /angleright /integral /integraltp /integralex /integralbt /parenrighttp /parenrightex\n\ |
| 623 |
/parenrightbt /bracketrighttp /bracketrightex /bracketrightbt /bracerighttp /bracerightmid /bracerightbt\n\ |
| 624 |
] def\n"; |
| 625 |
|
| 626 |
void |
| 627 |
usage_error(ErrorHandler *errh, const char *error_message, ...) |
| 628 |
{ |
| 629 |
va_list val; |
| 630 |
va_start(val, error_message); |
| 631 |
if (!error_message) |
| 632 |
errh->message("Usage: %s [OPTION]... FONT", program_name); |
| 633 |
else |
| 634 |
errh->xmessage(ErrorHandler::e_error, error_message, val); |
| 635 |
errh->message("Type %s --help for more information.", program_name); |
| 636 |
exit(1); |
| 637 |
va_end(val); |
| 638 |
} |
| 639 |
|
| 640 |
void |
| 641 |
usage() |
| 642 |
{ |
| 643 |
FileErrorHandler uerrh(stdout); |
| 644 |
uerrh.message("\ |
| 645 |
%<T1reencode%> changes a Type 1 font%,s embedded encoding and writes the\n\ |
| 646 |
reencoded font to the standard output.\n\ |
| 647 |
\n\ |
| 648 |
Usage: %s [OPTION]... [FONTFILE [OUTPUTFILE]]\n\ |
| 649 |
\n\ |
| 650 |
Options:\n\ |
| 651 |
-e, --encoding=FILE Read the encoding from FILE (in DVIPS format).\n\ |
| 652 |
-E, --encoding-text=ENC The ENC argument is the encoding text.\n\ |
| 653 |
-n, --name=NAME Set output font%,s PostScript name.\n\ |
| 654 |
-N, --full-name=NAME Set output font%,s full name.\n\ |
| 655 |
-a, --pfa Output PFA font.\n\ |
| 656 |
-b, --pfb Output PFB font. This is the default.\n\ |
| 657 |
-o, --output=FILE Write output to FILE instead of standard out.\n\ |
| 658 |
-h, --help Print this message and exit.\n\ |
| 659 |
--version Print version number and exit.\n\ |
| 660 |
\n\ |
| 661 |
Report bugs to <[email protected]>.\n", program_name); |
| 662 |
} |
| 663 |
|
| 664 |
|
| 665 |
// FONT MANIPULATION |
| 666 |
|
| 667 |
static void |
| 668 |
kill_def(Type1Font* font, Type1Definition *t1d, int whichd) |
| 669 |
{ |
| 670 |
if (!t1d || font->dict(whichd, t1d->name()) != t1d) |
| 671 |
return; |
| 672 |
|
| 673 |
int icount = font->nitems(); |
| 674 |
for (int i = font->first_dict_item(whichd); i < icount; i++) |
| 675 |
if (font->item(i) == t1d) { |
| 676 |
StringAccum sa; |
| 677 |
sa << '%'; |
| 678 |
t1d->gen(sa); |
| 679 |
PermString name = t1d->name(); |
| 680 |
Type1CopyItem *t1ci = new Type1CopyItem(sa.take_string()); |
| 681 |
font->set_item(i, t1ci); |
| 682 |
font->set_dict(whichd, name, 0); |
| 683 |
return; |
| 684 |
} |
| 685 |
|
| 686 |
assert(0); |
| 687 |
} |
| 688 |
|
| 689 |
static void |
| 690 |
adjust_font_definitions(Type1Font* font, Type1Encoding* encoding, String new_name, String new_full_name) |
| 691 |
{ |
| 692 |
// prepare an MD5 digest over the encoding |
| 693 |
StringAccum etext; |
| 694 |
for (int i = 0; i < 256; i++) |
| 695 |
etext << encoding->elt(i) << ' '; |
| 696 |
MD5_CONTEXT md5; |
| 697 |
md5_init(&md5); |
| 698 |
md5_update(&md5, (const unsigned char*) etext.data(), etext.length() - 1); |
| 699 |
|
| 700 |
// save UniqueID, then kill its definition |
| 701 |
int uniqueid; |
| 702 |
Type1Definition *t1d = font->dict("UniqueID"); |
| 703 |
bool have_uniqueid = (t1d && t1d->value_int(uniqueid)); |
| 704 |
kill_def(font, t1d, Type1Font::dFont); |
| 705 |
kill_def(font, font->p_dict("UniqueID"), Type1Font::dPrivate); |
| 706 |
|
| 707 |
// prepare XUID |
| 708 |
t1d = font->dict("XUID"); |
| 709 |
Vector<double> xuid; |
| 710 |
if (!t1d || !t1d->value_numvec(xuid)) { |
| 711 |
if (have_uniqueid) { |
| 712 |
t1d = font->ensure(Type1Font::dFont, "XUID"); |
| 713 |
xuid.clear(); |
| 714 |
xuid.push_back(1); |
| 715 |
xuid.push_back(uniqueid); |
| 716 |
} else if (t1d) { |
| 717 |
kill_def(font, t1d, Type1Font::dFont); |
| 718 |
t1d = 0; |
| 719 |
} |
| 720 |
} |
| 721 |
if (t1d) { |
| 722 |
uint8_t digest[MD5_DIGEST_SIZE + 2]; // leave 2 bytes of space |
| 723 |
md5_final((unsigned char *) digest, &md5); |
| 724 |
digest[MD5_DIGEST_SIZE] = digest[MD5_DIGEST_SIZE + 1] = 0; |
| 725 |
|
| 726 |
// append digest to XUID; each element must be less than 2^24 |
| 727 |
for (int i = 0; i < MD5_DIGEST_SIZE; i += 3) |
| 728 |
xuid.push_back((digest[i] << 16) | (digest[i+1] << 8) | digest[i+2]); |
| 729 |
t1d->set_numvec(xuid); |
| 730 |
} |
| 731 |
|
| 732 |
// prepare new font name |
| 733 |
if (!encoding_name) { |
| 734 |
char text_digest[MD5_TEXT_DIGEST_SIZE + 1]; |
| 735 |
md5_final_text(text_digest, &md5); |
| 736 |
encoding_name = "AutoEnc_" + String(text_digest); |
| 737 |
} |
| 738 |
|
| 739 |
t1d = font->dict("FontName"); |
| 740 |
PermString name; |
| 741 |
if (t1d && t1d->value_name(name)) { |
| 742 |
if (!new_name) |
| 743 |
new_name = name + encoding_name; |
| 744 |
t1d->set_name(new_name.c_str()); |
| 745 |
font->uncache_defs(); // remove cached font name |
| 746 |
} |
| 747 |
|
| 748 |
// add a FullName too |
| 749 |
String full_name; |
| 750 |
t1d = font->fi_dict("FullName"); |
| 751 |
if (t1d && t1d->value_string(full_name)) { |
| 752 |
if (!new_full_name) |
| 753 |
new_full_name = full_name + "_" + encoding_name + " Enc"; |
| 754 |
t1d->set_string(new_full_name.c_str()); |
| 755 |
} |
| 756 |
|
| 757 |
// add header comments |
| 758 |
{ |
| 759 |
StringAccum sa; |
| 760 |
#if HAVE_CTIME |
| 761 |
time_t cur_time = time(0); |
| 762 |
char *time_str = ctime(&cur_time); |
| 763 |
sa << "%% Created by t1reencode-" VERSION " on " << time_str; |
| 764 |
sa.pop_back(); |
| 765 |
#else |
| 766 |
sa << "%% Created by t1reencode-" VERSION "."; |
| 767 |
#endif |
| 768 |
|
| 769 |
font->add_header_comment(sa.take_string().c_str()); |
| 770 |
font->add_header_comment("%% T1reencode is free software. See <http://www.lcdf.org/type/>."); |
| 771 |
} |
| 772 |
} |
| 773 |
|
| 774 |
|
| 775 |
// ENCODING READER |
| 776 |
|
| 777 |
static String |
| 778 |
tokenize(const String &s, int &pos_in, int &line) |
| 779 |
{ |
| 780 |
const char *data = s.data(); |
| 781 |
int len = s.length(); |
| 782 |
int pos = pos_in; |
| 783 |
while (1) { |
| 784 |
// skip whitespace |
| 785 |
while (pos < len && isspace((unsigned char) data[pos])) { |
| 786 |
if (data[pos] == '\n') |
| 787 |
line++; |
| 788 |
else if (data[pos] == '\r' && (pos + 1 == len || data[pos+1] != '\n')) |
| 789 |
line++; |
| 790 |
pos++; |
| 791 |
} |
| 792 |
|
| 793 |
if (pos >= len) { |
| 794 |
pos_in = len; |
| 795 |
return String(); |
| 796 |
} else if (data[pos] == '%') { |
| 797 |
for (pos++; pos < len && data[pos] != '\n' && data[pos] != '\r'; pos++) |
| 798 |
/* nada */; |
| 799 |
} else if (data[pos] == '[' || data[pos] == ']' || data[pos] == '{' || data[pos] == '}') { |
| 800 |
pos_in = pos + 1; |
| 801 |
return s.substring(pos, 1); |
| 802 |
} else if (data[pos] == '(') { |
| 803 |
int first = pos, nest = 0; |
| 804 |
for (pos++; pos < len && (data[pos] != ')' || nest); pos++) |
| 805 |
switch (data[pos]) { |
| 806 |
case '(': nest++; break; |
| 807 |
case ')': nest--; break; |
| 808 |
case '\\': |
| 809 |
if (pos + 1 < len) |
| 810 |
pos++; |
| 811 |
break; |
| 812 |
case '\n': line++; break; |
| 813 |
case '\r': |
| 814 |
if (pos + 1 == len || data[pos+1] != '\n') |
| 815 |
line++; |
| 816 |
break; |
| 817 |
} |
| 818 |
pos_in = (pos < len ? pos + 1 : len); |
| 819 |
return s.substring(first, pos_in - first); |
| 820 |
} else { |
| 821 |
int first = pos; |
| 822 |
while (pos < len && data[pos] == '/') |
| 823 |
pos++; |
| 824 |
while (pos < len && data[pos] != '/' && !isspace((unsigned char) data[pos]) && data[pos] != '[' && data[pos] != ']' && data[pos] != '%' && data[pos] != '(' && data[pos] != '{' && data[pos] != '}') |
| 825 |
pos++; |
| 826 |
pos_in = pos; |
| 827 |
return s.substring(first, pos - first); |
| 828 |
} |
| 829 |
} |
| 830 |
} |
| 831 |
|
| 832 |
static String |
| 833 |
landmark(const String &filename, int line) |
| 834 |
{ |
| 835 |
return filename + String::make_stable(":", 1) + String(line); |
| 836 |
} |
| 837 |
|
| 838 |
Type1Encoding * |
| 839 |
parse_encoding(String s, String filename, ErrorHandler *errh) |
| 840 |
{ |
| 841 |
filename = printable_filename(filename); |
| 842 |
int pos = 0, line = 1; |
| 843 |
|
| 844 |
// parse text |
| 845 |
String token = tokenize(s, pos, line); |
| 846 |
if (!token || token[0] != '/') { |
| 847 |
errh->lerror(landmark(filename, line), "parse error, expected name"); |
| 848 |
return 0; |
| 849 |
} |
| 850 |
encoding_name = token.substring(1); |
| 851 |
|
| 852 |
if (tokenize(s, pos, line) != "[") { |
| 853 |
errh->lerror(landmark(filename, line), "parse error, expected ["); |
| 854 |
return 0; |
| 855 |
} |
| 856 |
|
| 857 |
Type1Encoding *t1e = new Type1Encoding; |
| 858 |
int e = 0; |
| 859 |
while ((token = tokenize(s, pos, line)) && token[0] == '/') { |
| 860 |
if (e > 255) { |
| 861 |
errh->lwarning(landmark(filename, line), "more than 256 characters in encoding"); |
| 862 |
break; |
| 863 |
} |
| 864 |
t1e->put(e, token.substring(1)); |
| 865 |
e++; |
| 866 |
} |
| 867 |
return t1e; |
| 868 |
} |
| 869 |
|
| 870 |
|
| 871 |
|
| 872 |
// MAIN |
| 873 |
|
| 874 |
/***** |
| 875 |
* MAIN PROGRAM |
| 876 |
**/ |
| 877 |
|
| 878 |
static Type1Font * |
| 879 |
do_file(const char *filename, PsresDatabase *psres, ErrorHandler *errh) |
| 880 |
{ |
| 881 |
FILE *f; |
| 882 |
if (!filename || strcmp(filename, "-") == 0) { |
| 883 |
f = stdin; |
| 884 |
filename = "<stdin>"; |
| 885 |
#if defined(_MSDOS) || defined(_WIN32) |
| 886 |
_setmode(_fileno(f), _O_BINARY); |
| 887 |
#endif |
| 888 |
} else |
| 889 |
f = fopen(filename, "rb"); |
| 890 |
|
| 891 |
if (!f) { |
| 892 |
// check for PostScript name |
| 893 |
Filename fn = psres->filename_value("FontOutline", filename); |
| 894 |
f = fn.open_read(); |
| 895 |
} |
| 896 |
|
| 897 |
if (!f) |
| 898 |
errh->fatal("%s: %s", filename, strerror(errno)); |
| 899 |
|
| 900 |
Type1Reader *reader; |
| 901 |
int c = getc(f); |
| 902 |
ungetc(c, f); |
| 903 |
if (c == EOF) |
| 904 |
errh->fatal("%s: empty file", filename); |
| 905 |
if (c == 128) |
| 906 |
reader = new Type1PFBReader(f); |
| 907 |
else |
| 908 |
reader = new Type1PFAReader(f); |
| 909 |
|
| 910 |
Type1Font *font = new Type1Font(*reader); |
| 911 |
if (!font->ok()) |
| 912 |
errh->fatal("%s: no glyphs in font", filename); |
| 913 |
|
| 914 |
delete reader; |
| 915 |
return font; |
| 916 |
} |
| 917 |
|
| 918 |
int |
| 919 |
main(int argc, char *argv[]) |
| 920 |
{ |
| 921 |
PsresDatabase *psres = new PsresDatabase; |
| 922 |
psres->add_psres_path(getenv("PSRESOURCEPATH"), 0, false); |
| 923 |
|
| 924 |
Clp_Parser *clp = |
| 925 |
Clp_NewParser(argc, (const char * const *)argv, sizeof(options) / sizeof(options[0]), options); |
| 926 |
program_name = Clp_ProgramName(clp); |
| 927 |
|
| 928 |
ErrorHandler *errh = ErrorHandler::static_initialize(new FileErrorHandler(stderr)); |
| 929 |
const char *input_file = 0; |
| 930 |
const char *output_file = 0; |
| 931 |
const char *encoding_file = 0; |
| 932 |
const char *encoding_text = 0; |
| 933 |
const char *new_font_name = 0; |
| 934 |
const char *new_full_name = 0; |
| 935 |
bool binary = true; |
| 936 |
Vector<String> glyph_patterns; |
| 937 |
|
| 938 |
while (1) { |
| 939 |
int opt = Clp_Next(clp); |
| 940 |
switch (opt) { |
| 941 |
|
| 942 |
case ENCODING_OPT: |
| 943 |
if (encoding_file || encoding_text) |
| 944 |
errh->fatal("encoding already specified"); |
| 945 |
encoding_file = clp->vstr; |
| 946 |
break; |
| 947 |
|
| 948 |
case ENCODING_TEXT_OPT: |
| 949 |
if (encoding_file || encoding_text) |
| 950 |
errh->fatal("encoding already specified"); |
| 951 |
encoding_text = clp->vstr; |
| 952 |
break; |
| 953 |
|
| 954 |
case FONTNAME_OPT: |
| 955 |
if (new_font_name) |
| 956 |
errh->fatal("font name already specified"); |
| 957 |
new_font_name = clp->vstr; |
| 958 |
break; |
| 959 |
|
| 960 |
case FULLNAME_OPT: |
| 961 |
if (new_full_name) |
| 962 |
errh->fatal("full name already specified"); |
| 963 |
new_full_name = clp->vstr; |
| 964 |
break; |
| 965 |
|
| 966 |
case OUTPUT_OPT: |
| 967 |
if (output_file) |
| 968 |
errh->fatal("output file already specified"); |
| 969 |
output_file = clp->vstr; |
| 970 |
break; |
| 971 |
|
| 972 |
case PFA_OPT: |
| 973 |
binary = false; |
| 974 |
break; |
| 975 |
|
| 976 |
case PFB_OPT: |
| 977 |
binary = true; |
| 978 |
break; |
| 979 |
|
| 980 |
case VERSION_OPT: |
| 981 |
printf("t1reencode (LCDF typetools) %s\n", VERSION); |
| 982 |
printf("Copyright (C) 1999-2023 Eddie Kohler\n\ |
| 983 |
This is free software; see the source for copying conditions.\n\ |
| 984 |
There is NO warranty, not even for merchantability or fitness for a\n\ |
| 985 |
particular purpose.\n"); |
| 986 |
exit(0); |
| 987 |
break; |
| 988 |
|
| 989 |
case HELP_OPT: |
| 990 |
usage(); |
| 991 |
exit(0); |
| 992 |
break; |
| 993 |
|
| 994 |
case Clp_NotOption: |
| 995 |
if (input_file && output_file) |
| 996 |
errh->fatal("too many arguments"); |
| 997 |
else if (input_file) |
| 998 |
output_file = clp->vstr; |
| 999 |
else |
| 1000 |
input_file = clp->vstr; |
| 1001 |
break; |
| 1002 |
|
| 1003 |
case Clp_Done: |
| 1004 |
goto done; |
| 1005 |
|
| 1006 |
case Clp_BadOption: |
| 1007 |
usage_error(errh, 0); |
| 1008 |
break; |
| 1009 |
|
| 1010 |
default: |
| 1011 |
break; |
| 1012 |
|
| 1013 |
} |
| 1014 |
} |
| 1015 |
|
| 1016 |
done: |
| 1017 |
// read the font |
| 1018 |
Type1Font *font = do_file(input_file, psres, errh); |
| 1019 |
if (!input_file || strcmp(input_file, "-") == 0) |
| 1020 |
input_file = "<stdin>"; |
| 1021 |
|
| 1022 |
// read the encoding |
| 1023 |
if (encoding_text) |
| 1024 |
encoding_file = "<argument>"; |
| 1025 |
if (!encoding_file) |
| 1026 |
errh->fatal("missing %<-e ENCODING%> argument"); |
| 1027 |
Type1Encoding *t1e = 0; |
| 1028 |
if (strcmp(encoding_file, "StandardEncoding") == 0) { |
| 1029 |
t1e = Type1Encoding::standard_encoding(); |
| 1030 |
encoding_name = encoding_file; |
| 1031 |
} else { |
| 1032 |
String text; |
| 1033 |
if (strcmp(encoding_file, "ISOLatin1Encoding") == 0 |
| 1034 |
|| strcmp(encoding_file, "ISO_8859_1_Encoding") == 0) |
| 1035 |
text = String::make_stable(ISOLatin1Encoding); |
| 1036 |
else if (strcmp(encoding_file, "ISOLatin2Encoding") == 0 |
| 1037 |
|| strcmp(encoding_file, "ISO_8859_2_Encoding") == 0) |
| 1038 |
text = String::make_stable(ISOLatin2Encoding); |
| 1039 |
else if (strcmp(encoding_file, "ISOLatin3Encoding") == 0 |
| 1040 |
|| strcmp(encoding_file, "ISO_8859_3_Encoding") == 0) |
| 1041 |
text = String::make_stable(ISOLatin3Encoding); |
| 1042 |
else if (strcmp(encoding_file, "ISOLatin4Encoding") == 0 |
| 1043 |
|| strcmp(encoding_file, "ISO_8859_4_Encoding") == 0) |
| 1044 |
text = String::make_stable(ISOLatin4Encoding); |
| 1045 |
else if (strcmp(encoding_file, "ISOCyrillicEncoding") == 0 |
| 1046 |
|| strcmp(encoding_file, "ISO_8859_5_Encoding") == 0) |
| 1047 |
text = String::make_stable(ISOCyrillicEncoding); |
| 1048 |
else if (strcmp(encoding_file, "ISOGreekEncoding") == 0 |
| 1049 |
|| strcmp(encoding_file, "ISO_8859_7_Encoding") == 0) |
| 1050 |
text = String::make_stable(ISOGreekEncoding); |
| 1051 |
else if (strcmp(encoding_file, "ISO_8859_9_Encoding") == 0 |
| 1052 |
|| strcmp(encoding_file, "ISOLatin5Encoding") == 0) |
| 1053 |
text = String::make_stable(ISOLatin5Encoding); |
| 1054 |
else if (strcmp(encoding_file, "ISOLatin6Encoding") == 0 |
| 1055 |
|| strcmp(encoding_file, "ISO_8859_10_Encoding") == 0) |
| 1056 |
text = String::make_stable(ISOLatin6Encoding); |
| 1057 |
else if (strcmp(encoding_file, "ISOThaiEncoding") == 0 |
| 1058 |
|| strcmp(encoding_file, "ISO_8859_11_Encoding") == 0) |
| 1059 |
text = String::make_stable(ISOThaiEncoding); |
| 1060 |
else if (strcmp(encoding_file, "ISOLatin7Encoding") == 0 |
| 1061 |
|| strcmp(encoding_file, "ISO_8859_13_Encoding") == 0) |
| 1062 |
text = String::make_stable(ISOLatin7Encoding); |
| 1063 |
else if (strcmp(encoding_file, "ISOLatin8Encoding") == 0 |
| 1064 |
|| strcmp(encoding_file, "ISO_8859_14_Encoding") == 0) |
| 1065 |
text = String::make_stable(ISOLatin8Encoding); |
| 1066 |
else if (strcmp(encoding_file, "ISOLatin9Encoding") == 0 |
| 1067 |
|| strcmp(encoding_file, "ISO_8859_15_Encoding") == 0) |
| 1068 |
text = String::make_stable(ISOLatin9Encoding); |
| 1069 |
else if (strcmp(encoding_file, "KOI8REncoding") == 0) |
| 1070 |
text = String::make_stable(KOI8REncoding); |
| 1071 |
else if (strcmp(encoding_file, "ExpertEncoding") == 0) |
| 1072 |
text = String::make_stable(ExpertEncoding); |
| 1073 |
else if (strcmp(encoding_file, "ExpertSubsetEncoding") == 0) |
| 1074 |
text = String::make_stable(ExpertSubsetEncoding); |
| 1075 |
else if (strcmp(encoding_file, "SymbolEncoding") == 0) |
| 1076 |
text = String::make_stable(SymbolEncoding); |
| 1077 |
else if (encoding_text) |
| 1078 |
text = String::make_stable(encoding_text); |
| 1079 |
else if ((text = read_file(encoding_file, errh)), errh->nerrors() > 0) |
| 1080 |
exit(1); |
| 1081 |
if (!(t1e = parse_encoding(text, encoding_file, errh))) |
| 1082 |
exit(1); |
| 1083 |
} |
| 1084 |
|
| 1085 |
// set the encoding |
| 1086 |
font->add_type1_encoding(t1e); |
| 1087 |
|
| 1088 |
// adjust definitions |
| 1089 |
adjust_font_definitions(font, t1e, new_font_name, new_full_name); |
| 1090 |
|
| 1091 |
// write it to output |
| 1092 |
FILE *outf; |
| 1093 |
if (!output_file || strcmp(output_file, "-") == 0) |
| 1094 |
outf = stdout; |
| 1095 |
else { |
| 1096 |
outf = fopen(output_file, binary ? "wb" : "w"); |
| 1097 |
if (!outf) |
| 1098 |
errh->fatal("%s: %s", output_file, strerror(errno)); |
| 1099 |
} |
| 1100 |
#if defined(_MSDOS) || defined(_WIN32) |
| 1101 |
_setmode(_fileno(outf), _O_BINARY); |
| 1102 |
#endif |
| 1103 |
if (binary) { |
| 1104 |
Type1PFBWriter w(outf); |
| 1105 |
font->write(w); |
| 1106 |
} else { |
| 1107 |
Type1PFAWriter w(outf); |
| 1108 |
font->write(w); |
| 1109 |
} |
| 1110 |
|
| 1111 |
return (errh->nerrors() == 0 ? 0 : 1); |
| 1112 |
} |