| 1 |
/* |
| 2 |
* ttf2tfm.h |
| 3 |
* |
| 4 |
* This file is part of the ttf2pk package. |
| 5 |
* |
| 6 |
* Copyright 1997-1999 by |
| 7 |
* Frederic Loyer <[email protected]> |
| 8 |
* Werner Lemberg <[email protected]> |
| 9 |
*/ |
| 10 |
|
| 11 |
#ifndef TTF2TFM_H |
| 12 |
#define TTF2TFM_H |
| 13 |
|
| 14 |
#include <stdio.h> |
| 15 |
|
| 16 |
|
| 17 |
enum Boolean_ |
| 18 |
{ |
| 19 |
False = 0, |
| 20 |
True = 1 |
| 21 |
}; |
| 22 |
typedef enum Boolean_ Boolean; |
| 23 |
|
| 24 |
enum PSstate_ |
| 25 |
{ |
| 26 |
No = 0, |
| 27 |
Yes = 1, |
| 28 |
Only = 2 |
| 29 |
}; |
| 30 |
typedef enum PSstate_ PSstate; |
| 31 |
|
| 32 |
|
| 33 |
struct _encoding |
| 34 |
{ |
| 35 |
const char *name; |
| 36 |
const char *vec[256]; |
| 37 |
}; |
| 38 |
typedef struct _encoding encoding; |
| 39 |
|
| 40 |
|
| 41 |
/* |
| 42 |
* This is what we store character data in. |
| 43 |
*/ |
| 44 |
|
| 45 |
struct _ttfinfo; |
| 46 |
typedef struct _ttfinfo ttfinfo; |
| 47 |
struct _lig; |
| 48 |
typedef struct _lig lig; |
| 49 |
struct _kern; |
| 50 |
typedef struct _kern kern; |
| 51 |
struct _ttfptr; |
| 52 |
typedef struct _ttfptr ttfptr; |
| 53 |
struct _pcc; |
| 54 |
typedef struct _pcc pcc; |
| 55 |
struct _stringlist; |
| 56 |
typedef struct _stringlist stringlist; |
| 57 |
struct _sflist; |
| 58 |
typedef struct _sflist sflist; |
| 59 |
|
| 60 |
|
| 61 |
struct _ttfinfo |
| 62 |
{ |
| 63 |
ttfinfo *next; |
| 64 |
long charcode; /* the TTF character code (or glyph index */ |
| 65 |
/* if bit 17 is set) */ |
| 66 |
unsigned short glyphindex; /* the TTF glyph number */ |
| 67 |
short incode; /* the code position in the raw TeX font */ |
| 68 |
short outcode; /* the code position in the virtual font */ |
| 69 |
const char *adobename; |
| 70 |
|
| 71 |
short width; |
| 72 |
short llx, lly, urx, ury; |
| 73 |
|
| 74 |
lig *ligs; |
| 75 |
kern *kerns; |
| 76 |
ttfptr *kern_equivs; |
| 77 |
Boolean constructed; |
| 78 |
pcc *pccs; /* we use the composite feature for */ |
| 79 |
/* `germandbls' <--> `SS' only */ |
| 80 |
unsigned char wptr, hptr, dptr, iptr; |
| 81 |
|
| 82 |
short fntnum; |
| 83 |
}; |
| 84 |
|
| 85 |
|
| 86 |
struct _lig |
| 87 |
{ |
| 88 |
lig *next; |
| 89 |
const char *succ, *sub; |
| 90 |
short op, boundleft; |
| 91 |
}; |
| 92 |
|
| 93 |
|
| 94 |
struct _kern |
| 95 |
{ |
| 96 |
kern *next; |
| 97 |
const char *succ; |
| 98 |
short delta; |
| 99 |
}; |
| 100 |
|
| 101 |
|
| 102 |
struct _ttfptr |
| 103 |
{ |
| 104 |
ttfptr *next; |
| 105 |
ttfinfo *ch; |
| 106 |
}; |
| 107 |
|
| 108 |
|
| 109 |
struct _pcc |
| 110 |
{ |
| 111 |
pcc *next; |
| 112 |
const char *partname; |
| 113 |
short xoffset, yoffset; |
| 114 |
}; |
| 115 |
|
| 116 |
|
| 117 |
struct _stringlist |
| 118 |
{ |
| 119 |
stringlist* next; |
| 120 |
char *old_name; |
| 121 |
char *new_name; |
| 122 |
Boolean single_replacement; |
| 123 |
}; |
| 124 |
|
| 125 |
|
| 126 |
struct _sflist |
| 127 |
{ |
| 128 |
char *name; |
| 129 |
long cksum; |
| 130 |
}; |
| 131 |
|
| 132 |
|
| 133 |
struct _Font |
| 134 |
{ |
| 135 |
char *ttfname; |
| 136 |
|
| 137 |
/* |
| 138 |
* Full path and extension of the tfm file |
| 139 |
*/ |
| 140 |
|
| 141 |
char *tfm_path; |
| 142 |
char *tfm_ext; |
| 143 |
|
| 144 |
/* |
| 145 |
* The final tfm name is composed of the following three parts. |
| 146 |
*/ |
| 147 |
|
| 148 |
char *outname; /* only namestem without extension */ |
| 149 |
char *subfont_name; /* NULL if not used */ |
| 150 |
char *outname_postfix; /* NULL if not used */ |
| 151 |
char *fullname; /* outname + subfont_name + outname_postfix */ |
| 152 |
|
| 153 |
FILE *vplout; |
| 154 |
FILE *tfmout; |
| 155 |
|
| 156 |
/* |
| 157 |
* The input encoding maps from the TrueType font to the raw TeX font. |
| 158 |
*/ |
| 159 |
|
| 160 |
char *inencname; /* name of input encoding file */ |
| 161 |
encoding *inencoding; /* the input encoding vector */ |
| 162 |
ttfinfo *inencptrs[256]; /* the input mapping table. Will be |
| 163 |
filled initially with the first |
| 164 |
256 characters in the selected |
| 165 |
cmap of the TrueType font */ |
| 166 |
stringlist *replacements; /* replacements for glyph names given |
| 167 |
with the -r option on the command |
| 168 |
line */ |
| 169 |
char *replacementname; /* name of replacement file */ |
| 170 |
|
| 171 |
/* |
| 172 |
* The output encoding maps from the raw TeX font to the virtual font. |
| 173 |
*/ |
| 174 |
|
| 175 |
char *outencname; /* name of output encoding file */ |
| 176 |
encoding *outencoding; /* the output encoding vector */ |
| 177 |
ttfinfo *outencptrs[256]; /* the output mapping table */ |
| 178 |
|
| 179 |
short nextout[256]; /* for characters encoded multiple times |
| 180 |
in output */ |
| 181 |
|
| 182 |
Boolean sawligkern; /* there were LIGKERN lines in the |
| 183 |
output encoding file */ |
| 184 |
Boolean subfont_ligs; /* ligatures 1st byte/2nd byte in |
| 185 |
subfonts wanted */ |
| 186 |
char *ligname; /* ligatures 1st byte/2nd byte in |
| 187 |
subfonts with ligaturename */ |
| 188 |
Boolean write_enc; /* generate encoding vectors |
| 189 |
containing glyph indices wanted */ |
| 190 |
|
| 191 |
ttfinfo *charlist; /* a linked list of all valid chars */ |
| 192 |
|
| 193 |
ttfinfo *uppercase[256]; /* needed for small caps fonts */ |
| 194 |
ttfinfo *lowercase[256]; /* ditto */ |
| 195 |
|
| 196 |
short boundarychar; /* the boundary character */ |
| 197 |
const char *codingscheme; /* coding scheme for TeX */ |
| 198 |
char *titlebuf; |
| 199 |
|
| 200 |
long cksum; |
| 201 |
|
| 202 |
short subfont_num; |
| 203 |
sflist *subfont_list; |
| 204 |
|
| 205 |
/* |
| 206 |
* The name of the subfont definition file. |
| 207 |
*/ |
| 208 |
|
| 209 |
char *sfdname; |
| 210 |
long sf_code[256]; |
| 211 |
|
| 212 |
/* |
| 213 |
* We get the following three values from the TTF's postscript table. |
| 214 |
*/ |
| 215 |
|
| 216 |
short units_per_em; |
| 217 |
float italicangle; |
| 218 |
char fixedpitch; |
| 219 |
|
| 220 |
short xheight; /* xheight for TeX */ |
| 221 |
short fontspace; /* font space for TeX */ |
| 222 |
|
| 223 |
/* |
| 224 |
* These values can be specified on the command line. |
| 225 |
*/ |
| 226 |
|
| 227 |
unsigned short pid; /* the TTF platform ID */ |
| 228 |
unsigned short eid; /* the TTF encoding ID */ |
| 229 |
float efactor; /* to extend the glyphs horizontally */ |
| 230 |
float slant; /* to slant the font */ |
| 231 |
unsigned long fontindex; /* font number in TTC */ |
| 232 |
float capheight; /* the height of small caps glyphs */ |
| 233 |
PSstate PSnames; /* we use the PS names in the TTF */ |
| 234 |
Boolean rotate; /* we rotate the glyphs by 90 degrees */ |
| 235 |
float y_offset; /* y offset for rotated glyphs */ |
| 236 |
|
| 237 |
/* |
| 238 |
* The command line parameter strings needed for ttf2pk. |
| 239 |
*/ |
| 240 |
|
| 241 |
char *pidparam; |
| 242 |
char *eidparam; |
| 243 |
char *efactorparam; |
| 244 |
char *slantparam; |
| 245 |
char *fontindexparam; |
| 246 |
char *y_offsetparam; |
| 247 |
}; |
| 248 |
typedef struct _Font Font; |
| 249 |
|
| 250 |
#endif /* TEX2TFM_H */ |
| 251 |
|
| 252 |
|
| 253 |
/* end */ |