@@ -67,9 +67,10 @@ This file is part of the iText (R) project.
67
67
* To be able to be wrapped with this {@link PdfObjectWrapper} the {@link PdfObject}
68
68
* must be indirect.
69
69
*/
70
- public class PdfType3Font extends PdfSimpleFont <Type3FontProgram > {
70
+ public class PdfType3Font extends PdfSimpleFont <Type3Font > {
71
71
72
72
private static final long serialVersionUID = 4940119184993066859L ;
73
+ //todo use default font matrix constant
73
74
private double [] fontMatrix = {0.001 , 0 , 0 , 0.001 , 0 , 0 };
74
75
75
76
/**
@@ -82,7 +83,7 @@ public class PdfType3Font extends PdfSimpleFont<Type3FontProgram> {
82
83
makeIndirect (document );
83
84
subset = true ;
84
85
embedded = true ;
85
- fontProgram = new Type3FontProgram (colorized );
86
+ fontProgram = new Type3Font (colorized );
86
87
fontEncoding = FontEncoding .createEmptyFontEncoding ();
87
88
}
88
89
@@ -96,7 +97,7 @@ public class PdfType3Font extends PdfSimpleFont<Type3FontProgram> {
96
97
ensureObjectIsAddedToDocument (fontDictionary );
97
98
subset = true ;
98
99
embedded = true ;
99
- fontProgram = new Type3FontProgram (false );
100
+ fontProgram = new Type3Font (false );
100
101
CMapToUnicode toUni = FontUtil .processToUnicode (fontDictionary .get (PdfName .ToUnicode ));
101
102
fontEncoding = DocFontEncoding .createDocFontEncoding (fontDictionary .get (PdfName .Encoding ), toUni );
102
103
PdfDictionary charProcsDic = getPdfObject ().getAsDictionary (PdfName .CharProcs );
@@ -121,13 +122,13 @@ public class PdfType3Font extends PdfSimpleFont<Type3FontProgram> {
121
122
int unicode = AdobeGlyphList .nameToUnicode (glyphName .getValue ());
122
123
if (unicode != -1 && fontEncoding .canEncode (unicode )) {
123
124
int code = fontEncoding .convertToByte (unicode );
124
- ((Type3FontProgram ) getFontProgram ()).addGlyph (code , unicode , widths [code ], null , new Type3Glyph (charProcsDic .getAsStream (glyphName ), getDocument ()));
125
+ ((Type3Font ) getFontProgram ()).addGlyph (code , unicode , widths [code ], null , new Type3Glyph (charProcsDic .getAsStream (glyphName ), getDocument ()));
125
126
}
126
127
}
127
128
}
128
129
129
130
public Type3Glyph getType3Glyph (int unicode ) {
130
- return ((Type3FontProgram ) getFontProgram ()).getType3Glyph (unicode );
131
+ return ((Type3Font ) getFontProgram ()).getType3Glyph (unicode );
131
132
}
132
133
133
134
@ Override
@@ -170,11 +171,11 @@ public Type3Glyph addGlyph(char c, int wx, int llx, int lly, int urx, int ury) {
170
171
return glyph ;
171
172
}
172
173
int code = getFirstEmptyCode ();
173
- glyph = new Type3Glyph (getDocument (), wx , llx , lly , urx , ury , ((Type3FontProgram ) getFontProgram ()).isColorized ());
174
- ((Type3FontProgram ) getFontProgram ()).addGlyph (code , c , wx , new int []{llx , lly , urx , ury }, glyph );
174
+ glyph = new Type3Glyph (getDocument (), wx , llx , lly , urx , ury , ((Type3Font ) getFontProgram ()).isColorized ());
175
+ ((Type3Font ) getFontProgram ()).addGlyph (code , c , wx , new int []{llx , lly , urx , ury }, glyph );
175
176
fontEncoding .addSymbol ((byte ) code , c );
176
177
177
- if (!((Type3FontProgram ) getFontProgram ()).isColorized ()) {
178
+ if (!((Type3Font ) getFontProgram ()).isColorized ()) {
178
179
if (fontProgram .countOfGlyphs () == 0 ) {
179
180
fontProgram .getFontMetrics ().setBbox (llx , lly , urx , ury );
180
181
} else {
@@ -226,7 +227,7 @@ protected PdfDocument getDocument() {
226
227
@ Override
227
228
public void flush () {
228
229
ensureUnderlyingObjectHasIndirectReference ();
229
- if (((Type3FontProgram ) getFontProgram ()).getGlyphsCount () < 1 ) {
230
+ if (((Type3Font ) getFontProgram ()).getGlyphsCount () < 1 ) {
230
231
throw new PdfException ("no.glyphs.defined.fo r.type3.font" );
231
232
}
232
233
PdfDictionary charProcs = new PdfDictionary ();
0 commit comments