w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

psfont.h
Go to the documentation of this file.
1 /* Copyright (C) 2000-2012 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:
5 
6  * Redistributions of source code must retain the above copyright notice, this
7  * list of conditions and the following disclaimer.
8 
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.
12 
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.
15 
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.
26  */
27 #ifndef _PSFONT_H_
28 #define _PSFONT_H_
29 
30 #include "splinefont.h"
31 
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.
41 */
42 
43 struct charprocs {
44  int cnt, next;
45  char **keys;
47 };
48 
49 struct fontinfo {
50  char *familyname;
51  char *fullname;
52  char *notice;
53  char *weight;
54  char *version;
56  unsigned int isfixedpitch:1;
59  int em, ascent, descent; /* Generated by Fontographer (and us) */
60  int fstype; /* 2=>no embedding, 4=>print, 8=>edit */
61  /* Multiple master */
65 };
66 
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 /* int bluefuzz; /\* (optional) (expand bluezones by this much, def=1) *\/ */
73 /* real bluescale; /\* (optional) if the current pointsize in pixels is less than this value then do overshoot hinting *\/ */
74 /* int blueshift; /\* (optional) *\/ */
75 /* real bluevalues[14]; /\* <=7 pairs of integers, first less than second, (may be empty) *\/ */
76 /* /\* first pair is baseline overshoots, other pairs above baseline *\/ */
77 /* real expansionfactor; /\* (optional) only for languagegroup==1 (CJK) *\/ */
78 /* real familyblues[14]; /\* (optional) bluevalues for family, can override local entry at small pointsizes *\/ */
79 /* real familyotherblues[10];/\* (optional) otherblues for family *\/ */
80 /* unsigned int forcebold:1; /\* (optional) *\/ */
81 /* int languagegroup; /\* (optional) (0=>latin, greek, cyril, etc.), (1=>CJK)*\/ */
82 /* int leniv; /\* (optional) must be 4 for old interpreters (number of rand chars at start of charstrings entries) *\/ */
83 /* char *minfeature; /\* obsolete, required must be {16 16} *\/ */
84 /* char *nd; /\* "noaccess def" (may also be named "|-") *\/ */
85 /* char *np; /\* "noaccess put" (may also be named "|") *\/ */
86 /* real otherblues[10]; /\* (optional) descender blue zones *\/ */
87 /* struct pschars *othersubrs; /\* (optional) shouldn't contain user defined subs *\/ */
88 /* int password; /\* obsolete, required must be 5839 *\/ */
89 /* char *rd; /\* "{string currentfile exch readstring pop}" (may also be named "-|") *\/ */
90 /* unsigned int rndstemup:1; /\* (optional) obsolete, false if languagegroud==1 *\/ */
91 /* real stdhw[1]; /\* (optional) dominant horizontal stem width *\/ */
92 /* real stdvw[1]; /\* (optional) dominant vert *\/ */
93 /* real stemsnaph[12]; /\* (optional) common h stem widths (at most 12, includes stdhw, sorted by increasing size) *\/ */
94 /* real stemsnapv[12]; /\* (optional) common v stem widths*\/ */
95 /* struct pschars *subrs; /\* (optional, required if othersubrs is present) *\/ */
96 /* /\* 0-2 part of Flex, 3 hint replacement, 4 and up for charstrings *\/ */
97 /* int uniqueid; /\* (optional) seems same as fontdict entry. why's it here too? what of XUID? *\/ */
98 /* /\* CID entries *\/ */
99 /* int subrmapoffset; /\* Offset to the start of this font's subr strings map *\/ */
100 /* int sdbytes; /\* bytes in each pointer in the map *\/ */
101 /* int subrcnt; /\* number of subroutines, number of pointers-1 in the map *\/ */
102 };
103 
104 typedef struct fontdict {
105  int fonttype;
107  char *fontname; /* (optional) */
109  int languagelevel; /* (optional) */
110  int wmode; /* (optional) chooses between alternate metric sets */
111 /* non-type0 entries */
112  char (*encoding[256]);
114  int uniqueid; /* (optional) open range between 4,000,000 and 4,999,999 */
115  int xuid[20]; /* (optional) */
116 /* Type1 specific values */
117  int painttype; /* 0 (filled) 2 (stroked) */
118  real strokewidth; /* (optional) only if painttype==2 */
119  struct psdict *metrics; /* (optional) */
120  struct psdict *metrics2; /* (optional) */
121  struct pschars *chars;
123  struct private *private;
124  unsigned int wasbinary: 1;
125  unsigned int wascff: 1;
127 /* CID stuff */
128  int fdcnt; /* For the underlying dictionaries */
129  struct fontdict **fds;
130  char *cidfontname;
133  char *registry;
134  char *ordering;
137  int fdbytes;
138  int gdbytes;
139  int cidcnt;
143 /* CFF stuff */
144  struct splinefont *sf;
145 /* MM stuff */
146  char *blendfunc;
148  char *cdv;
149  char *ndv;
152  long long creationtime; /* seconds since 1970 */
153  long long modificationtime;
155 
156 struct fddata {
157  int leniv;
159  int flexmax;
160  unsigned int iscjk:1;
161  struct pschars *subrs;
162 };
163 
164 struct cidbytes {
167  int fdcnt;
168  struct fddata *fds;
169  int *fdind;
170  int errors;
171 };
172 
173 struct fd2data {
174  int defwid, nomwid; /* For Type2 charstrings */
175  struct pschars *subrs;
176  FILE *private; /* Subroutines get stored in the private file immediately after the private dict */
179 };
180 
181 extern const char (*AdobeStandardEncoding[256]);
182 extern const char (*AdobeExpertEncoding[256]);
184 
185 extern FontDict *_ReadPSFont(FILE *ps);
186 extern FontDict *ReadPSFont(char *fontname);
187 extern void PSFontFree(FontDict *fd);
188 #endif
const char * fontname
Definition: afm2pl.c:186
double real
Definition: dvips.h:66
short int16
Definition: tiff.h:61
unsigned char uint8
Definition: tiff.h:60
static bool ps
Definition: pdftocairo.cc:91
FontDict * ReadPSFont(char *fontname)
Definition: parsepfa.c:2598
int copyttfinstr
Definition: psfont.h:183
int copymetadata
Definition: cvundoes.c:36
FontDict * _ReadPSFont(FILE *ps)
Definition: parsepfa.c:2569
const char *[256] AdobeExpertEncoding
Definition: parsepfa.c:289
const char *[256] AdobeStandardEncoding
Definition: parsepfa.c:30
void PSFontFree(FontDict *fd)
Definition: parsepfa.c:2667
struct fontdict FontDict
int next
Definition: psfont.h:44
int cnt
Definition: psfont.h:44
char ** keys
Definition: psfont.h:45
SplineChar ** values
Definition: psfont.h:46
int * fdind
Definition: psfont.h:169
int cidcnt
Definition: psfont.h:165
int cidmapoffset
Definition: psfont.h:166
struct fddata * fds
Definition: psfont.h:168
int gdbytes
Definition: psfont.h:165
int fdcnt
Definition: psfont.h:167
int errors
Definition: psfont.h:170
int fdbytes
Definition: psfont.h:165
int fillindictmark
Definition: psfont.h:177
struct pschars * subrs
Definition: psfont.h:175
int privatelen
Definition: psfont.h:178
int nomwid
Definition: psfont.h:174
int eodictmark
Definition: psfont.h:177
int defwid
Definition: psfont.h:174
Definition: psfont.h:156
int subrcnt
Definition: psfont.h:158
unsigned int iscjk
Definition: psfont.h:160
int sdbytes
Definition: psfont.h:158
int flexmax
Definition: psfont.h:159
int subrmapoff
Definition: psfont.h:158
struct pschars * subrs
Definition: psfont.h:161
int leniv
Definition: psfont.h:157
int mapoffset
Definition: psfont.h:136
Encoding * encoding_name
Definition: psfont.h:126
int fdbytes
Definition: psfont.h:137
float strokewidth
Definition: psfont.h:118
float cidversion
Definition: psfont.h:132
unsigned int wasbinary
Definition: psfont.h:124
struct fontdict ** fds
Definition: psfont.h:129
float fontbb[4]
Definition: psfont.h:113
unsigned int wascff
Definition: psfont.h:125
char * weightvector
Definition: psfont.h:147
int cidcnt
Definition: psfont.h:139
char * ndv
Definition: psfont.h:149
float fontmatrix[6]
Definition: psfont.h:106
int uniqueid
Definition: psfont.h:114
int fdcnt
Definition: psfont.h:128
struct charprocs * charprocs
Definition: psfont.h:122
char * cidfontname
Definition: psfont.h:130
char * cdv
Definition: psfont.h:148
long long creationtime
Definition: psfont.h:152
int16 * cidlens
Definition: psfont.h:141
int wmode
Definition: psfont.h:110
int painttype
Definition: psfont.h:117
int fonttype
Definition: psfont.h:105
struct psdict * blendprivate
Definition: psfont.h:150
struct fontinfo * fontinfo
Definition: psfont.h:108
long long modificationtime
Definition: psfont.h:153
char * blendfunc
Definition: psfont.h:146
char * fontname
Definition: psfont.h:107
int cidfonttype
Definition: psfont.h:131
int16 * cidfds
Definition: psfont.h:142
int supplement
Definition: psfont.h:135
int languagelevel
Definition: psfont.h:109
struct pschars * chars
Definition: psfont.h:121
struct psdict * blendfontinfo
Definition: psfont.h:151
struct splinefont * sf
Definition: psfont.h:144
int xuid[20]
Definition: psfont.h:115
char * registry
Definition: psfont.h:133
uint8 ** cidstrs
Definition: psfont.h:140
struct psdict * metrics2
Definition: psfont.h:120
struct psdict * metrics
Definition: psfont.h:119
int gdbytes
Definition: psfont.h:138
char * ordering
Definition: psfont.h:134
int descent
Definition: psfont.h:59
float underlinethickness
Definition: psfont.h:58
char * blendaxistypes
Definition: psfont.h:64
char * blenddesignpositions
Definition: psfont.h:62
int fstype
Definition: psfont.h:60
char * familyname
Definition: psfont.h:50
int ascent
Definition: psfont.h:59
char * notice
Definition: psfont.h:52
char * blenddesignmap
Definition: psfont.h:63
float italicangle
Definition: psfont.h:55
char * fullname
Definition: psfont.h:51
int em
Definition: psfont.h:59
char * weight
Definition: psfont.h:53
unsigned int isfixedpitch
Definition: psfont.h:56
float underlineposition
Definition: psfont.h:57
char * version
Definition: psfont.h:54
Definition: psfont.h:67
struct pschars * subrs
Definition: psfont.h:69
int leniv
Definition: psfont.h:71
#define FILE
Definition: t1stdio.h:34