SyntheticFont.java
7.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.fontengine.font.cff;
import com.adobe.fontengine.font.CodePage;
import com.adobe.fontengine.font.Font;
import com.adobe.fontengine.font.InvalidFontException;
import com.adobe.fontengine.font.LineMetrics;
import com.adobe.fontengine.font.Matrix;
import com.adobe.fontengine.font.OrigFontType;
import com.adobe.fontengine.font.OutlineConsumer;
import com.adobe.fontengine.font.PDFFontDescription;
import com.adobe.fontengine.font.Permission;
import com.adobe.fontengine.font.ROS;
import com.adobe.fontengine.font.Rect;
import com.adobe.fontengine.font.Subset;
import com.adobe.fontengine.font.SubsetSimpleTrueType;
import com.adobe.fontengine.font.SubsetSimpleType1;
import com.adobe.fontengine.font.UnsupportedFontException;
import com.adobe.fontengine.font.XDCFontDescription;
import com.adobe.fontengine.font.cff.CFFByteArray;
import com.adobe.fontengine.font.cff.CFFFont;
import com.adobe.fontengine.font.cff.CharStrings;
import com.adobe.fontengine.font.cff.Dict;
import com.adobe.fontengine.font.cff.StringIndex;
import com.adobe.fontengine.font.cff.Type2OutlineParser;
import java.io.OutputStream;
public final class SyntheticFont
extends CFFFont {
protected final CFFFont base;
private final XDCFontDescription xdcDescription;
public Subset createSubset() throws UnsupportedFontException {
throw new UnsupportedFontException("createSubset of CFF Synthetic fonts");
}
SyntheticFont(StringIndex stringIndex, CFFFont base, String name, Dict topDict, CFFByteArray data, byte[] digest) throws UnsupportedFontException, InvalidFontException {
super(stringIndex, null, topDict, name, digest);
this.xdcDescription = new SyntheticFontXDCFontDescription();
this.base = base;
}
public int getNumGlyphs() throws UnsupportedFontException, InvalidFontException {
return this.base.getNumGlyphs();
}
public String getGlyphName(int gid) throws InvalidFontException, UnsupportedFontException {
return this.base.getGlyphName(gid);
}
public ROS getROS() {
return this.base.getROS();
}
public int getGlyphCid(int glyphID) throws InvalidFontException, UnsupportedFontException {
return this.base.getGlyphCid(glyphID);
}
int[] getXUID() {
return this.base.getXUID();
}
String getNotice() {
return this.base.getNotice();
}
Integer getFSType() {
return this.base.getFSType();
}
OrigFontType getOrigFontType() {
return this.base.getOrigFontType();
}
public void getGlyphOutline(int gid, OutlineConsumer consumer) throws InvalidFontException, UnsupportedFontException {
this.base.getGlyphOutline(gid, consumer);
}
public void getOutline(int gid, Type2OutlineParser parser, OutlineConsumer consumer) throws InvalidFontException, UnsupportedFontException {
this.base.getOutline(gid, parser, consumer);
}
public double getStemVForGlyph(int gid) throws InvalidFontException {
return this.base.getStemVForGlyph(gid);
}
public Matrix getFontMatrix() {
Matrix m = new Matrix(this.topDict.get(Dict.Key.FontMatrix, true).getValuesAsDouble());
return this.base.getFontMatrix().multiply(m);
}
public double getHorizontalAdvance(int gid) throws InvalidFontException, UnsupportedFontException {
return this.base.getHorizontalAdvance(gid);
}
double getItalicAngle() {
return this.base.getItalicAngle();
}
Rect getRawFontBBox() {
return this.base.getRawFontBBox();
}
private Matrix getFontToMetricsMatrix() throws InvalidFontException, UnsupportedFontException {
Matrix m = this.getFontMatrix();
double x = this.getUnitsPerEmX();
double y = this.getUnitsPerEmY();
return new Matrix(x * m.a, y * m.b, x * m.c, y * m.d, x * m.tx, y * m.ty);
}
public Rect getFontBBox() throws InvalidFontException, UnsupportedFontException {
Rect rawBBox = this.getRawFontBBox();
if (rawBBox == null) {
return null;
}
return rawBBox.applyMatrix(this.getFontToMetricsMatrix());
}
public Rect getCoolTypeRawFontBBox() throws InvalidFontException, UnsupportedFontException {
return this.getFontBBox();
}
public int getGlyphForChar(int usv) throws InvalidFontException, UnsupportedFontException {
return this.base.getGlyphForChar(usv);
}
double getDefaultWidthForFD(int fd) {
return this.base.getDefaultWidthForFD(fd);
}
double getNominalWidthForFD(int fd) {
return this.base.getNominalWidthForFD(fd);
}
int getFDForGlyph(int fullGid) throws InvalidFontException {
return this.base.getFDForGlyph(fullGid);
}
CharStrings getLocalSubrsForFD(int fd) {
return this.base.getLocalSubrsForFD(fd);
}
int getNumFDs() {
return this.base.getNumFDs();
}
CharStrings getCharStrings() {
return this.base.getCharStrings();
}
public LineMetrics getCoolTypeLineMetrics() throws UnsupportedFontException, InvalidFontException {
return this.base.getCoolTypeLineMetrics();
}
public Rect getCoolTypeIdeoEmBox() throws UnsupportedFontException, InvalidFontException {
return this.base.getCoolTypeIdeoEmBox();
}
public Rect getCoolTypeIcfBox() throws UnsupportedFontException, InvalidFontException {
return this.base.getCoolTypeIcfBox();
}
public Permission getEmbeddingPermission(boolean wasEmbedded) throws InvalidFontException, UnsupportedFontException {
return this.base.getEmbeddingPermission(wasEmbedded);
}
public void subsetAndStream(Subset subset, OutputStream out, boolean preserveROS, Integer fsType) throws InvalidFontException, UnsupportedFontException {
throw new UnsupportedFontException("subsetAndStream of CFF Synthetic fonts");
}
String getCopyright() {
return this.base.getCopyright();
}
String getFullName() {
return this.base.getFullName();
}
int getFirstChar() throws InvalidFontException, UnsupportedFontException {
return this.base.getFirstChar();
}
int getLastChar() throws InvalidFontException, UnsupportedFontException {
return this.base.getLastChar();
}
public PDFFontDescription getPDFFontDescription(Font font) {
return this.xdcDescription;
}
public XDCFontDescription getXDCFontDescription(Font font) {
return this.xdcDescription;
}
public void stream(OutputStream out, Integer fsType) throws UnsupportedFontException {
throw new UnsupportedFontException("stream of CFF Synthetic fonts");
}
private class SyntheticFontXDCFontDescription
extends CFFFont.CFFFontXDCFontDescription {
private SyntheticFontXDCFontDescription() {
}
public int getCIDCount() {
return -1;
}
public void subsetAndStream(Subset subset, OutputStream out, boolean preserveROS) throws UnsupportedFontException {
throw new UnsupportedFontException("subsetAndStream of CFF Synthetic fonts");
}
public void subsetAndStream(SubsetSimpleType1 t1Subset, OutputStream out) throws UnsupportedFontException {
throw new UnsupportedFontException("subsetAndStream of CFF Synthetic fonts");
}
public void subsetAndStream(SubsetSimpleTrueType ttSubset, OutputStream out) throws UnsupportedFontException {
throw new UnsupportedFontException("subsetAndStream of CFF Synthetic fonts");
}
public CodePage[] getXDCCodePages() throws InvalidFontException, UnsupportedFontException {
return SyntheticFont.this.base.getXDCFontDescription(null).getXDCCodePages();
}
public void stream(OutputStream out, boolean openTypeFontsAllowed) throws UnsupportedFontException {
throw new UnsupportedFontException("stream of CFF Synthetic fonts");
}
}
}