You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Philip Helger (JIRA)" <ji...@apache.org> on 2014/04/02 20:24:14 UTC
[jira] [Created] (PDFBOX-2013) Please extend PDTrueTypeFont API
Philip Helger created PDFBOX-2013:
-------------------------------------
Summary: Please extend PDTrueTypeFont API
Key: PDFBOX-2013
URL: https://issues.apache.org/jira/browse/PDFBOX-2013
Project: PDFBox
Issue Type: Bug
Components: PDModel
Affects Versions: 1.8.4, 2.0.0
Reporter: Philip Helger
Please extend the API to get the default width and the Unicode CMAP table (Patch for 2.0.0 SNAPSHOT):
### Eclipse Workspace Patch 1.0
#P pdfbox
Index: src/main/java/org/apache/pdfbox/pdmodel/font/PDTrueTypeFont.java
===================================================================
--- src/main/java/org/apache/pdfbox/pdmodel/font/PDTrueTypeFont.java (revision 1583927)
+++ src/main/java/org/apache/pdfbox/pdmodel/font/PDTrueTypeFont.java (working copy)
@@ -67,6 +67,9 @@
private static Properties externalFonts = new Properties();
private static Map<String, TrueTypeFont> loadedExternalFonts = new HashMap<String, TrueTypeFont>();
+
+ private int m_nDefaultWidth = -1;
+ private CMAPEncodingEntry m_aUnicodeMap = null;
static
{
@@ -352,10 +355,11 @@
{
widths.add(defaultWidth);
}
+
// Encoding singleton to have acces to the chglyph name to
// unicode cpoint point mapping of Adobe's glyphlist.txt
Encoding glyphlist = WinAnsiEncoding.INSTANCE;
-
+
// A character code is mapped to a glyph name via the provided
// font encoding. Afterwards, the glyph name is translated to a
// glyph ID.
@@ -380,9 +384,12 @@
}
}
}
+
setWidths(widths);
setFirstChar(firstChar);
setLastChar(lastChar);
+ setDefaultWidth(defaultWidth);
+ setUnicodeMap(uniMap);
}
finally
{
@@ -393,6 +400,26 @@
}
}
+ public int getDefaultWidth ()
+ {
+ return m_nDefaultWidth;
+ }
+
+ public void setDefaultWidth (int defaultWidth)
+ {
+ m_nDefaultWidth = defaultWidth;
+ }
+
+ public CMAPEncodingEntry getUnicodeMap ()
+ {
+ return m_aUnicodeMap;
+ }
+
+ public void setUnicodeMap (CMAPEncodingEntry aUnicodeMap)
+ {
+ m_aUnicodeMap = aUnicodeMap;
+ }
+
/**
* Permit to load an external TTF Font program file
*
--
This message was sent by Atlassian JIRA
(v6.2#6252)