Skip to content

Commit cd4781a

Browse files
committed
Rename Type3FontProgram to Type3Font
DEVSIX-1468
1 parent fb040aa commit cd4781a

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

kernel/src/main/java/com/itextpdf/kernel/font/PdfType3Font.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@ This file is part of the iText (R) project.
6767
* To be able to be wrapped with this {@link PdfObjectWrapper} the {@link PdfObject}
6868
* must be indirect.
6969
*/
70-
public class PdfType3Font extends PdfSimpleFont<Type3FontProgram> {
70+
public class PdfType3Font extends PdfSimpleFont<Type3Font> {
7171

7272
private static final long serialVersionUID = 4940119184993066859L;
73+
//todo use default font matrix constant
7374
private double[] fontMatrix = {0.001, 0, 0, 0.001, 0, 0};
7475

7576
/**
@@ -82,7 +83,7 @@ public class PdfType3Font extends PdfSimpleFont<Type3FontProgram> {
8283
makeIndirect(document);
8384
subset = true;
8485
embedded = true;
85-
fontProgram = new Type3FontProgram(colorized);
86+
fontProgram = new Type3Font(colorized);
8687
fontEncoding = FontEncoding.createEmptyFontEncoding();
8788
}
8889

@@ -96,7 +97,7 @@ public class PdfType3Font extends PdfSimpleFont<Type3FontProgram> {
9697
ensureObjectIsAddedToDocument(fontDictionary);
9798
subset = true;
9899
embedded = true;
99-
fontProgram = new Type3FontProgram(false);
100+
fontProgram = new Type3Font(false);
100101
CMapToUnicode toUni = FontUtil.processToUnicode(fontDictionary.get(PdfName.ToUnicode));
101102
fontEncoding = DocFontEncoding.createDocFontEncoding(fontDictionary.get(PdfName.Encoding), toUni);
102103
PdfDictionary charProcsDic = getPdfObject().getAsDictionary(PdfName.CharProcs);
@@ -121,13 +122,13 @@ public class PdfType3Font extends PdfSimpleFont<Type3FontProgram> {
121122
int unicode = AdobeGlyphList.nameToUnicode(glyphName.getValue());
122123
if (unicode != -1 && fontEncoding.canEncode(unicode)) {
123124
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()));
125126
}
126127
}
127128
}
128129

129130
public Type3Glyph getType3Glyph(int unicode) {
130-
return ((Type3FontProgram) getFontProgram()).getType3Glyph(unicode);
131+
return ((Type3Font) getFontProgram()).getType3Glyph(unicode);
131132
}
132133

133134
@Override
@@ -170,11 +171,11 @@ public Type3Glyph addGlyph(char c, int wx, int llx, int lly, int urx, int ury) {
170171
return glyph;
171172
}
172173
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);
175176
fontEncoding.addSymbol((byte) code, c);
176177

177-
if (!((Type3FontProgram) getFontProgram()).isColorized()) {
178+
if (!((Type3Font) getFontProgram()).isColorized()) {
178179
if (fontProgram.countOfGlyphs() == 0) {
179180
fontProgram.getFontMetrics().setBbox(llx, lly, urx, ury);
180181
} else {
@@ -226,7 +227,7 @@ protected PdfDocument getDocument() {
226227
@Override
227228
public void flush() {
228229
ensureUnderlyingObjectHasIndirectReference();
229-
if (((Type3FontProgram) getFontProgram()).getGlyphsCount() < 1) {
230+
if (((Type3Font) getFontProgram()).getGlyphsCount() < 1) {
230231
throw new PdfException("no.glyphs.defined.fo r.type3.font");
231232
}
232233
PdfDictionary charProcs = new PdfDictionary();

kernel/src/main/java/com/itextpdf/kernel/font/Type3FontProgram.java renamed to kernel/src/main/java/com/itextpdf/kernel/font/Type3Font.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@ This file is part of the iText (R) project.
5050
import java.util.HashMap;
5151
import java.util.Map;
5252

53-
public class Type3FontProgram extends FontProgram {
53+
public class Type3Font extends FontProgram {
5454

5555
private static final long serialVersionUID = 1027076515537536993L;
5656

5757
private final Map<Integer, Type3Glyph> type3Glyphs = new HashMap<>();
5858
private boolean colorized = false;
5959

6060

61-
public Type3FontProgram(boolean colorized) {
61+
public Type3Font(boolean colorized) {
6262
this.colorized = colorized;
6363
getFontMetrics().setBbox(0, 0, 0, 0);
6464
fontNames = new FontNames();

kernel/src/test/java/com/itextpdf/kernel/pdf/PdfFontTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ This file is part of the iText (R) project.
6464
import com.itextpdf.kernel.font.PdfType0Font;
6565
import com.itextpdf.kernel.font.PdfType1Font;
6666
import com.itextpdf.kernel.font.PdfType3Font;
67-
import com.itextpdf.kernel.font.Type3FontProgram;
67+
import com.itextpdf.kernel.font.Type3Font;
6868
import com.itextpdf.kernel.font.Type3Glyph;
6969
import com.itextpdf.kernel.geom.PageSize;
7070
import com.itextpdf.kernel.pdf.canvas.PdfCanvas;
@@ -816,7 +816,7 @@ public void testUpdateType3FontBasedExistingFont() throws IOException, Interrupt
816816
page.flush();
817817
pdfDoc.close();
818818

819-
Assert.assertEquals(6, ((Type3FontProgram) pdfType3Font.getFontProgram()).getGlyphsCount());
819+
Assert.assertEquals(6, ((Type3Font) pdfType3Font.getFontProgram()).getGlyphsCount());
820820

821821
Assert.assertNull(new CompareTool().compareByContent(outputFileName, cmpOutputFileName, destinationFolder, "diff_"));
822822
}
@@ -859,7 +859,7 @@ public void testNewType3FontBasedExistingFont() throws IOException, InterruptedE
859859
page.flush();
860860
outputPdfDoc.close();
861861

862-
Assert.assertEquals(6, ((Type3FontProgram) pdfType3Font.getFontProgram()).getGlyphsCount());
862+
Assert.assertEquals(6, ((Type3Font) pdfType3Font.getFontProgram()).getGlyphsCount());
863863

864864
Assert.assertNull(new CompareTool().compareByContent(outputFileName, cmpOutputFileName, destinationFolder, "diff_"));
865865
}

0 commit comments

Comments
 (0)