Skip to content

Commit ddef86f

Browse files
committed
PDFBOX-6175: reduce the direct usage of the descendant font
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1936125 13f79535-47bb-0310-9956-ffa450edef68
1 parent 677eaf2 commit ddef86f

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

  • debugger/src/main/java/org/apache/pdfbox/debugger/fontencodingpane

debugger/src/main/java/org/apache/pdfbox/debugger/fontencodingpane/Type0Font.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ class Type0Font extends FontPane
4444

4545
/**
4646
* Constructor.
47+
*
4748
* @param descendantFont PDCIDFontType2 instance.
48-
* @param parentFont PDFont instance.
49+
* @param parentFont PDType0Font instance.
4950
* @throws IOException If fails to parse cidtogid map.
5051
*/
5152
Type0Font(PDCIDFont descendantFont, PDType0Font parentFont) throws IOException
@@ -63,7 +64,7 @@ class Type0Font extends FontPane
6364
}
6465
else
6566
{
66-
Object[][] tab = readMap(descendantFont, parentFont);
67+
Object[][] tab = readMap(parentFont);
6768
attributes.put("CIDs", Integer.toString(tab.length));
6869
attributes.put("Glyphs", Integer.toString(totalAvailableGlyph));
6970
attributes.put("Standard 14", Boolean.toString(parentFont.isStandard14()));
@@ -74,12 +75,12 @@ class Type0Font extends FontPane
7475
}
7576
}
7677

77-
private Object[][] readMap(PDCIDFont descendantFont, PDType0Font parentFont) throws IOException
78+
private Object[][] readMap(PDType0Font parentFont) throws IOException
7879
{
7980
int codes = 0;
8081
for (int code = 0; code < 65535; ++code)
8182
{
82-
if (descendantFont.hasGlyph(code))
83+
if (parentFont.hasGlyph(code))
8384
{
8485
++codes;
8586
}
@@ -88,13 +89,13 @@ private Object[][] readMap(PDCIDFont descendantFont, PDType0Font parentFont) thr
8889
int index = 0;
8990
for (int code = 0; code < 65535; ++code)
9091
{
91-
if (descendantFont.hasGlyph(code))
92+
if (parentFont.hasGlyph(code))
9293
{
9394
tab[index][0] = code;
94-
tab[index][1] = descendantFont.codeToCID(code);
95-
tab[index][2] = descendantFont.codeToGID(code);
95+
tab[index][1] = parentFont.codeToCID(code);
96+
tab[index][2] = parentFont.codeToGID(code);
9697
tab[index][3] = parentFont.toUnicode(code);
97-
GeneralPath path = descendantFont.getPath(code);
98+
GeneralPath path = parentFont.getPath(code);
9899
tab[index][4] = path;
99100
if (!path.getBounds2D().isEmpty())
100101
{
@@ -106,7 +107,7 @@ private Object[][] readMap(PDCIDFont descendantFont, PDType0Font parentFont) thr
106107
return tab;
107108
}
108109

109-
private Object[][] readCIDToGIDMap(PDCIDFont font, PDFont parentFont) throws IOException
110+
private Object[][] readCIDToGIDMap(PDCIDFont font, PDType0Font parentFont) throws IOException
110111
{
111112
Object[][] cid2gid = null;
112113
COSDictionary dict = font.getCOSObject();
@@ -130,7 +131,7 @@ private Object[][] readCIDToGIDMap(PDCIDFont font, PDFont parentFont) throws IOE
130131
{
131132
cid2gid[index][2] = parentFont.toUnicode(index);
132133
}
133-
GeneralPath path = font.getPath(index);
134+
GeneralPath path = parentFont.getPath(index);
134135
cid2gid[index][3] = path;
135136
if (!path.getBounds2D().isEmpty())
136137
{

0 commit comments

Comments
 (0)