summaryrefslogtreecommitdiff
path: root/noncore/unsupported/qpdf/xpdf/GfxFont.h
Unidiff
Diffstat (limited to 'noncore/unsupported/qpdf/xpdf/GfxFont.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/qpdf/xpdf/GfxFont.h24
1 files changed, 18 insertions, 6 deletions
diff --git a/noncore/unsupported/qpdf/xpdf/GfxFont.h b/noncore/unsupported/qpdf/xpdf/GfxFont.h
index b1aa952..8e9fe38 100644
--- a/noncore/unsupported/qpdf/xpdf/GfxFont.h
+++ b/noncore/unsupported/qpdf/xpdf/GfxFont.h
@@ -1,11 +1,11 @@
1//======================================================================== 1//========================================================================
2// 2//
3// GfxFont.h 3// GfxFont.h
4// 4//
5// Copyright 1996-2001 Derek B. Noonburg 5// Copyright 1996-2002 Glyph & Cog, LLC
6// 6//
7//======================================================================== 7//========================================================================
8 8
9#ifndef GFXFONT_H 9#ifndef GFXFONT_H
10#define GFXFONT_H 10#define GFXFONT_H
11 11
@@ -110,14 +110,13 @@ public:
110 // Returns false if there is no embedded font. 110 // Returns false if there is no embedded font.
111 GBool getEmbeddedFontID(Ref *embID) 111 GBool getEmbeddedFontID(Ref *embID)
112 { *embID = embFontID; return embFontID.num >= 0; } 112 { *embID = embFontID; return embFontID.num >= 0; }
113 113
114 // Get the PostScript font name for the embedded font. Returns 114 // Get the PostScript font name for the embedded font. Returns
115 // NULL if there is no embedded font. 115 // NULL if there is no embedded font.
116 char *getEmbeddedFontName() 116 GString *getEmbeddedFontName() { return embFontName; }
117 { return embFontName ? embFontName->getCString() : (char *)NULL; }
118 117
119 // Get the name of the external font file. Returns NULL if there 118 // Get the name of the external font file. Returns NULL if there
120 // is no external font file. 119 // is no external font file.
121 GString *getExtFontFile() { return extFontFile; } 120 GString *getExtFontFile() { return extFontFile; }
122 121
123 // Get font descriptor flags. 122 // Get font descriptor flags.
@@ -134,12 +133,15 @@ public:
134 fouble *getFontBBox() { return fontBBox; } 133 fouble *getFontBBox() { return fontBBox; }
135 134
136 // Return the ascent and descent values. 135 // Return the ascent and descent values.
137 fouble getAscent() { return ascent; } 136 fouble getAscent() { return ascent; }
138 fouble getDescent() { return descent; } 137 fouble getDescent() { return descent; }
139 138
139 // Return the writing mode (0=horizontal, 1=vertical).
140 virtual int getWMode() { return 0; }
141
140 // Read an external or embedded font file into a buffer. 142 // Read an external or embedded font file into a buffer.
141 char *readExtFontFile(int *len); 143 char *readExtFontFile(int *len);
142 char *readEmbFontFile(XRef *xref, int *len); 144 char *readEmbFontFile(XRef *xref, int *len);
143 145
144 // Get the next char from a string <s> of <len> bytes, returning the 146 // Get the next char from a string <s> of <len> bytes, returning the
145 // char <code>, its Unicode mapping <u>, its displacement vector 147 // char <code>, its Unicode mapping <u>, its displacement vector
@@ -152,24 +154,24 @@ public:
152 fouble *dx, fouble *dy, fouble *ox, fouble *oy) = 0; 154 fouble *dx, fouble *dy, fouble *ox, fouble *oy) = 0;
153 155
154protected: 156protected:
155 157
156 void readFontDescriptor(XRef *xref, Dict *fontDict); 158 void readFontDescriptor(XRef *xref, Dict *fontDict);
157 CharCodeToUnicode *readToUnicodeCMap(Dict *fontDict, int nBits); 159 CharCodeToUnicode *readToUnicodeCMap(Dict *fontDict, int nBits);
158 void GfxFont::findExtFontFile(); 160 void findExtFontFile();
159 161
160 GString *tag; // PDF font tag 162 GString *tag; // PDF font tag
161 Ref id; // reference (used as unique ID) 163 Ref id; // reference (used as unique ID)
162 GString *name; // font name 164 GString *name; // font name
163 GfxFontType type; // type of font 165 GfxFontType type; // type of font
164 int flags; // font descriptor flags 166 int flags; // font descriptor flags
165 GString *embFontName; // name of embedded font 167 GString *embFontName; // name of embedded font
166 Ref embFontID; // ref to embedded font file stream 168 Ref embFontID; // ref to embedded font file stream
167 GString *extFontFile; // external font file name 169 GString *extFontFile; // external font file name
168 fouble fontMat[6]; // font matrix (Type 3 only) 170 fouble fontMat[6]; // font matrix (Type 3 only)
169 fouble fontBBox[4]; // font bounding box 171 fouble fontBBox[4]; // font bounding box (Type 3 only)
170 fouble missingWidth; // "default" width 172 fouble missingWidth; // "default" width
171 fouble ascent; // max height above baseline 173 fouble ascent; // max height above baseline
172 fouble descent; // max depth below baseline 174 fouble descent; // max depth below baseline
173 GBool ok; 175 GBool ok;
174}; 176};
175 177
@@ -201,24 +203,31 @@ public:
201 // Returns true if the PDF font specified an encoding. 203 // Returns true if the PDF font specified an encoding.
202 GBool getHasEncoding() { return hasEncoding; } 204 GBool getHasEncoding() { return hasEncoding; }
203 205
204 // Get width of a character or string. 206 // Get width of a character or string.
205 fouble getWidth(Guchar c) { return widths[c]; } 207 fouble getWidth(Guchar c) { return widths[c]; }
206 208
209 // Return the Type 3 CharProc dictionary, or NULL if none.
210 Dict *getCharProcs();
211
207 // Return the Type 3 CharProc for the character associated with <code>. 212 // Return the Type 3 CharProc for the character associated with <code>.
208 Object *getCharProc(int code, Object *proc); 213 Object *getCharProc(int code, Object *proc);
209 214
215 // Return the Type 3 Resources dictionary, or NULL if none.
216 Dict *getResources();
217
210private: 218private:
211 219
212 char *enc[256]; // char code --> char name 220 char *enc[256]; // char code --> char name
213 char encFree[256]; // boolean for each char name: if set, 221 char encFree[256]; // boolean for each char name: if set,
214 // the string is malloc'ed 222 // the string is malloc'ed
215 CharCodeToUnicode *ctu;// char code --> Unicode 223 CharCodeToUnicode *ctu;// char code --> Unicode
216 GBool hasEncoding; 224 GBool hasEncoding;
217 fouble widths[256]; // character widths 225 fouble widths[256]; // character widths
218 Object charProcs; // Type3 CharProcs dictionary 226 Object charProcs; // Type 3 CharProcs dictionary
227 Object resources; // Type 3 Resources dictionary
219}; 228};
220 229
221//------------------------------------------------------------------------ 230//------------------------------------------------------------------------
222// GfxCIDFont 231// GfxCIDFont
223//------------------------------------------------------------------------ 232//------------------------------------------------------------------------
224 233
@@ -233,12 +242,15 @@ public:
233 virtual GBool isCIDFont() { return gTrue; } 242 virtual GBool isCIDFont() { return gTrue; }
234 243
235 virtual int getNextChar(char *s, int len, CharCode *code, 244 virtual int getNextChar(char *s, int len, CharCode *code,
236 Unicode *u, int uSize, int *uLen, 245 Unicode *u, int uSize, int *uLen,
237 fouble *dx, fouble *dy, fouble *ox, fouble *oy); 246 fouble *dx, fouble *dy, fouble *ox, fouble *oy);
238 247
248 // Return the writing mode (0=horizontal, 1=vertical).
249 virtual int getWMode();
250
239 // Return the Unicode map. 251 // Return the Unicode map.
240 CharCodeToUnicode *getToUnicode(); 252 CharCodeToUnicode *getToUnicode();
241 253
242 // Get the collection name (<registry>-<ordering>). 254 // Get the collection name (<registry>-<ordering>).
243 GString *getCollection(); 255 GString *getCollection();
244 256