Tgif Home
----
About Tgif
Current Release & Download
FAQ
Copyright Info
A Screendump of Tgif
Release History
Tools That Tgif Uses
Tools That Work with Tgif
Author of Tgif
Miscellaneous Info
----
 
Return to Tgif's Home Page
William Chia-Wei Cheng
(bill.cheng@acm.org)
 

Tgif FAQ - Character Encoding

 
What are the corresponding PostScript character names for iso8859-1 characters?
By default, the screen fonts tgif uses are iso8859-1 encoded. Non-ASCII portion of these fonts (characters with bit 7 on) maps to certain PS font characters by default. Below is a table listing character codes in decimal, character codes in octal, and the corresponding PostScript character names.
Decimal Octal Char Name
161  8#241  exclamdown
162  8#242  cent
163  8#243  sterling
164  8#244  currency
165  8#245  yen
166  8#246  bar
167  8#247  section
168  8#250  dieresis
169  8#251  copyright
170  8#252  ordfeminine
171  8#253  guillemotleft
172  8#254  logicalnot
173  8#255  emdash
174  8#256  registered
175  8#257  macron
176  8#260  degree
177  8#261  plusminus
178  8#262  twosuperior
179  8#263  threesuperior
180  8#264  acute
181  8#265  mu
182  8#266  paragraph
183  8#267  periodcentered
184  8#270  cedilla
185  8#271  onesuperior
186  8#272  ordmasculine
187  8#273  guillemotright
188  8#274  onequarter
189  8#275  onehalf
190  8#276  threequarters
191  8#277  questiondown
192  8#300  Agrave
193  8#301  Aacute
194  8#302  Acircumflex
195  8#303  Atilde
196  8#304  Adieresis
197  8#305  Aring
198  8#306  AE
199  8#307  Ccedilla
200  8#310  Egrave
201  8#311  Eacute
202  8#312  Ecircumflex
203  8#313  Edieresis
204  8#314  Igrave
205  8#315  Iacute
206  8#316  Icircumflex
207  8#317  Idieresis
208  8#320  Eth
209  8#321  Ntilde
210  8#322  Ograve
211  8#323  Oacute
212  8#324  Ocircumflex
213  8#325  Otilde
214  8#326  Odieresis
215  8#327  multiply
216  8#330  Oslash
217  8#331  Ugrave
218  8#332  Uacute
219  8#333  Ucircumflex
220  8#334  Udieresis
221  8#335  Yacute
222  8#336  Thorn
223  8#337  germandbls
224  8#340  agrave
225  8#341  aacute
226  8#342  acircumflex
227  8#343  atilde
228  8#344  adieresis
229  8#345  aring
230  8#346  ae
231  8#347  ccedilla
232  8#350  egrave
233  8#351  eacute
234  8#352  ecircumflex
235  8#353  edieresis
236  8#354  igrave
237  8#355  iacute
238  8#356  icircumflex
239  8#357  idieresis
240  8#360  eth
241  8#361  ntilde
242  8#362  ograve
243  8#363  oacute
244  8#364  ocircumflex
245  8#365  otilde
246  8#366  odieresis
247  8#367  divide
248  8#370  oslash
249  8#371  ugrave
250  8#372  uacute
251  8#373  ucircumflex
252  8#374  udieresis
253  8#375  yacute
254  8#376  thorn
255  8#377  ydieresis
 
I'm using X fonts that use adobe-fontspecific encoding. The PostScript files tgif generated seem to use incorrect character names for some characters. What do I need to do to get tgif to generate the right PostScript code?
Sometimes, different encodings of the same PostScript font is needed. This can be accomplished in two ways. One way is to use Tgif.AdditionalDontReencode (and Tgif.DontReencode). Another way is to use Tgif.PSFontCharSubs. The difference is that with Tgif.AdditionalDontReencode, a PostScript font's encoding is skipped. With Tgif.PSFontCharSubs, characters in a PostScript font can be given specific encoding.

In both cases, there is a need to introduce fake font names (place holders). For example,

Tgif.AdditionalFonts: \n\
utopia-medium-r-normal \n\
adobe-fontspecific \n\
UtopiaTmp-Regular \n\
\n\
utopia-bold-r-normal \n\
adobe-fontspecific \n\
UtopiaTmp-Bold \n\
\n\
utopia-medium-i-normal \n\
adobe-fontspecific \n\
UtopiaTmp-Italic \n\
\n\
utopia-bold-i-normal \n\
adobe-fontspecific \n\
UtopiaTmp-BoldItalic \n\
\n\

Tgif.PSFontAliases: \n\
UtopiaTmp-Regular=Utopia-Regular \n\
UtopiaTmp-Bold=Utopia-Bold \n\
UtopiaTmp-Italic=Utopia-Italic \n\
UtopiaTmp-BoldItalic=Utopia-BoldItalic
In the above example, 4 fake PostScript font names are created (all have a common "UtopiaTmp" prefix). The encoding for these fonts is adobe-fontspecific, according the X11 fonts being used. Tgif.PSFontAliases maps the fake PostScript font names to the corresponding real PostScript font names. (If Tgif.PSFontAliases is missing, non-existent PostScript font names such as UtopiaTmp-Regular will appear in a PostScript file.)

To skip a PostScript font's encoding, one can use the Tgif.AdditionalDontReencode X default. For example, if one specifies:

Tgif.AdditionalDontReencode: UtopiaTmp
characters with character codes between 161 and 255 (inclusive) will not be encoded with ISO-Latin-1 character names. For a list of characters names that are ISO-Latin-1 encoded, please see above.

To substitute characters in a PostScript font with specific encoding, please see below.

 
I'm using X fonts that are iso8859-2 encoded. The PostScript files tgif generated seem to use incorrect character names for characters like /Aogonek, /Lslash, etc. What do I need to do to get tgif to generate the right PostScript code?
(This is only supported in tgif-4.1.45 or later.)
To substitute characters in a PostScript font with specific encoding, one can use the Tgif.PSFontNeedCharSubs and Tgif.PSCharSubs_* X defaults. (You still need Tgif.AdditionalFonts and Tgif.PSFontAliases setup as above.) Here is an example:
Tgif.PSFontNeedCharSubs: \n\
UtopiaTmp-Regular=Foo \n\
UtopiaTmp-Bold=Foo \n\
UtopiaTmp-Italic=Foo \n\
UtopiaTmp-BoldItalic=Foo
Tgif.PSCharSubs_Foo: \n\
161/Aogonek \n\
198/Cacute \n\
202/eogonek
In the above example, Tgif.PSFontNeedCharSubs specified a list of fake PostScript font names that requires character substitutions and their corresponding TOKEN names. For a fake PostScript font name that maps to TOKEN, the list of characters to be substituted is specified in the Tgif.PSCharSubs_TOKEN X default. The format for Tgif.PSCharSubs_TOKEN is a list of OLDCHARCODE/NEWCHARNAME strings where OLDCHARCODE is a character code in decimal or octal format and NEWCHARNAME must be the name of a PostScript character. In the above example, Foo was used as the TOKEN name. In real use, something like iso8895-2 may be more appropriate for a TOKEN name. Since decimal or octal codes are allowed, the following is equivalent to the above:

Tgif.PSFontNeedCharSubs: \n\
UtopiaTmp-Regular=iso8859-2 \n\
UtopiaTmp-Bold=iso8859-2 \n\
UtopiaTmp-Italic=iso8859-2 \n\
UtopiaTmp-BoldItalic=iso8859-2
Tgif.PSCharSubs_iso8859-2: \n\
8#241/Aogonek \n\
8#306/Cacute \n\
8#312/eogonek

Please note that substitution only occurs for characters with character codes between 161 and 255 (inclusive).