beta-0.89.2
[luatex.git] / source / texk / web2c / luatexdir / luafontloader / fontforge / fontforge / psfont.h
blob5362ccd3cf115442704031c2d8560fd02288718a
1 /* Copyright (C) 2000-2008 by George Williams */
2 /*
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions are met:
6 * Redistributions of source code must retain the above copyright notice, this
7 * list of conditions and the following disclaimer.
9 * Redistributions in binary form must reproduce the above copyright notice,
10 * this list of conditions and the following disclaimer in the documentation
11 * and/or other materials provided with the distribution.
13 * The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 #ifndef _PSFONT_H_
28 #define _PSFONT_H_
30 #include "splinefont.h"
32 /* pfb section headers.
33 There seem to be three and a half of them. the first is a the start of the
34 file and is 6 bytes long "\200\001x\005\000\000", the second is right after
35 the newline after eexec and is 6 bytes "\200\002I\224\000\000", the third
36 is right before the zeros (after the encoded data) and is "\200\001\024\002\000\000"
37 the last is at the end of file and is only two bytes "\200\003"
38 I think that the \200 byte indicates a header, the next byte is 1 for ascii,
39 2 for binary and 3 for eof, then next 4 bytes are the length (not present
40 for eof headers) with the first byte the least significant.
43 struct charprocs {
44 int cnt, next;
45 char **keys;
46 SplineChar **values;
49 struct fontinfo {
50 char *familyname;
51 char *fullname;
52 char *notice;
53 char *weight;
54 char *version;
55 real italicangle;
56 unsigned int isfixedpitch:1;
57 real underlineposition;
58 real underlinethickness;
59 int em, ascent, descent; /* Generated by Fontographer (and us) */
60 int fstype; /* 2=>no embedding, 4=>print, 8=>edit */
61 /* Multiple master */
62 char *blenddesignpositions;
63 char *blenddesignmap;
64 char *blendaxistypes;
67 struct private {
68 struct psdict *private;
69 struct pschars *subrs; /* (optional, required if othersubrs is present) */
70 /* 0-2 part of Flex, 3 hint replacement, 4 and up for charstrings */
71 int leniv; /* (optional) must be 4 for old interpreters (number of rand chars at start of charstrings entries) */
72 #if 0
73 int bluefuzz; /* (optional) (expand bluezones by this much, def=1) */
74 real bluescale; /* (optional) if the current pointsize in pixels is less than this value then do overshoot hinting */
75 int blueshift; /* (optional) */
76 real bluevalues[14]; /* <=7 pairs of integers, first less than second, (may be empty) */
77 /* first pair is baseline overshoots, other pairs above baseline */
78 real expansionfactor; /* (optional) only for languagegroup==1 (CJK) */
79 real familyblues[14]; /* (optional) bluevalues for family, can override local entry at small pointsizes */
80 real familyotherblues[10];/* (optional) otherblues for family */
81 unsigned int forcebold:1; /* (optional) */
82 int languagegroup; /* (optional) (0=>latin, greek, cyril, etc.), (1=>CJK)*/
83 int leniv; /* (optional) must be 4 for old interpreters (number of rand chars at start of charstrings entries) */
84 char *minfeature; /* obsolete, required must be {16 16} */
85 char *nd; /* "noaccess def" (may also be named "|-") */
86 char *np; /* "noaccess put" (may also be named "|") */
87 real otherblues[10]; /* (optional) descender blue zones */
88 struct pschars *othersubrs; /* (optional) shouldn't contain user defined subs */
89 int password; /* obsolete, required must be 5839 */
90 char *rd; /* "{string currentfile exch readstring pop}" (may also be named "-|") */
91 unsigned int rndstemup:1; /* (optional) obsolete, false if languagegroud==1 */
92 real stdhw[1]; /* (optional) dominant horizontal stem width */
93 real stdvw[1]; /* (optional) dominant vert */
94 real stemsnaph[12]; /* (optional) common h stem widths (at most 12, includes stdhw, sorted by increasing size) */
95 real stemsnapv[12]; /* (optional) common v stem widths*/
96 struct pschars *subrs; /* (optional, required if othersubrs is present) */
97 /* 0-2 part of Flex, 3 hint replacement, 4 and up for charstrings */
98 int uniqueid; /* (optional) seems same as fontdict entry. why's it here too? what of XUID? */
99 /* CID entries */
100 int subrmapoffset; /* Offset to the start of this font's subr strings map */
101 int sdbytes; /* bytes in each pointer in the map */
102 int subrcnt; /* number of subroutines, number of pointers-1 in the map */
103 #endif
106 typedef struct fontdict {
107 int fonttype;
108 real fontmatrix[6];
109 char *fontname; /* (optional) */
110 struct fontinfo *fontinfo;
111 int languagelevel; /* (optional) */
112 int wmode; /* (optional) chooses between alternate metric sets */
113 /* non-type0 entries */
114 char *encoding[256];
115 real fontbb[4];
116 int uniqueid; /* (optional) open range between 4,000,000 and 4,999,999 */
117 int xuid[20]; /* (optional) */
118 /* Type1 specific values */
119 int painttype; /* 0 (filled) 2 (stroked) */
120 real strokewidth; /* (optional) only if painttype==2 */
121 struct psdict *metrics; /* (optional) */
122 struct psdict *metrics2; /* (optional) */
123 struct pschars *chars;
124 struct charprocs *charprocs;
125 struct private *private;
126 unsigned int wasbinary: 1;
127 unsigned int wascff: 1;
128 Encoding *encoding_name;
129 /* CID stuff */
130 int fdcnt; /* For the underlying dictionaries */
131 struct fontdict **fds;
132 char *cidfontname;
133 int cidfonttype;
134 real cidversion;
135 char *registry;
136 char *ordering;
137 int supplement;
138 int mapoffset;
139 int fdbytes;
140 int gdbytes;
141 int cidcnt;
142 uint8 **cidstrs;
143 int16 *cidlens;
144 int16 *cidfds;
145 /* CFF stuff */
146 struct splinefont *sf;
147 /* MM stuff */
148 char *blendfunc;
149 char *weightvector;
150 char *cdv;
151 char *ndv;
152 struct psdict *blendprivate;
153 struct psdict *blendfontinfo;
154 #ifdef _HAS_LONGLONG
155 long long creationtime; /* seconds since 1970 */
156 long long modificationtime;
157 #else
158 long creationtime;
159 long modificationtime;
160 #endif
161 } FontDict;
163 struct cidbytes {
164 int fdbytes, gdbytes, cidcnt;
165 int cidmapoffset;
166 int fdcnt;
167 struct fddata {
168 int leniv;
169 int subrmapoff, sdbytes, subrcnt;
170 int flexmax;
171 unsigned int iscjk:1;
172 struct pschars *subrs;
173 } *fds;
174 int *fdind;
175 int errors;
178 struct fd2data {
179 int defwid, nomwid; /* For Type2 charstrings */
180 struct pschars *subrs;
181 FILE *private; /* Subroutines get stored in the private file immediately after the private dict */
182 int eodictmark, fillindictmark;
183 int privatelen;
186 extern char *AdobeStandardEncoding[256];
188 extern FontDict *_ReadPSFont(FILE *ps);
189 extern FontDict *ReadPSFont(char *fontname);
190 extern void PSFontFree(FontDict *fd);
191 #endif