Author: lehmi
Date: Tue Jul 14 06:13:33 2026
New Revision: 1936125
Log:
PDFBOX-6175: reduce the direct usage of the descendant font
Modified:
pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/fontencodingpane/Type0Font.java
Modified:
pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/fontencodingpane/Type0Font.java
==============================================================================
---
pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/fontencodingpane/Type0Font.java
Tue Jul 14 06:11:28 2026 (r1936124)
+++
pdfbox/trunk/debugger/src/main/java/org/apache/pdfbox/debugger/fontencodingpane/Type0Font.java
Tue Jul 14 06:13:33 2026 (r1936125)
@@ -44,8 +44,9 @@ class Type0Font extends FontPane
/**
* Constructor.
+ *
* @param descendantFont PDCIDFontType2 instance.
- * @param parentFont PDFont instance.
+ * @param parentFont PDType0Font instance.
* @throws IOException If fails to parse cidtogid map.
*/
Type0Font(PDCIDFont descendantFont, PDType0Font parentFont) throws
IOException
@@ -63,7 +64,7 @@ class Type0Font extends FontPane
}
else
{
- Object[][] tab = readMap(descendantFont, parentFont);
+ Object[][] tab = readMap(parentFont);
attributes.put("CIDs", Integer.toString(tab.length));
attributes.put("Glyphs", Integer.toString(totalAvailableGlyph));
attributes.put("Standard 14",
Boolean.toString(parentFont.isStandard14()));
@@ -74,12 +75,12 @@ class Type0Font extends FontPane
}
}
- private Object[][] readMap(PDCIDFont descendantFont, PDType0Font
parentFont) throws IOException
+ private Object[][] readMap(PDType0Font parentFont) throws IOException
{
int codes = 0;
for (int code = 0; code < 65535; ++code)
{
- if (descendantFont.hasGlyph(code))
+ if (parentFont.hasGlyph(code))
{
++codes;
}
@@ -88,13 +89,13 @@ class Type0Font extends FontPane
int index = 0;
for (int code = 0; code < 65535; ++code)
{
- if (descendantFont.hasGlyph(code))
+ if (parentFont.hasGlyph(code))
{
tab[index][0] = code;
- tab[index][1] = descendantFont.codeToCID(code);
- tab[index][2] = descendantFont.codeToGID(code);
+ tab[index][1] = parentFont.codeToCID(code);
+ tab[index][2] = parentFont.codeToGID(code);
tab[index][3] = parentFont.toUnicode(code);
- GeneralPath path = descendantFont.getPath(code);
+ GeneralPath path = parentFont.getPath(code);
tab[index][4] = path;
if (!path.getBounds2D().isEmpty())
{
@@ -106,7 +107,7 @@ class Type0Font extends FontPane
return tab;
}
- private Object[][] readCIDToGIDMap(PDCIDFont font, PDFont parentFont)
throws IOException
+ private Object[][] readCIDToGIDMap(PDCIDFont font, PDType0Font parentFont)
throws IOException
{
Object[][] cid2gid = null;
COSDictionary dict = font.getCOSObject();
@@ -130,7 +131,7 @@ class Type0Font extends FontPane
{
cid2gid[index][2] = parentFont.toUnicode(index);
}
- GeneralPath path = font.getPath(index);
+ GeneralPath path = parentFont.getPath(index);
cid2gid[index][3] = path;
if (!path.getBounds2D().isEmpty())
{