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 2015/08/25 18:28:45 UTC
[jira] [Created] (PDFBOX-2945) PDType1Font.getNameInFont(String)
very slow when Unicode fallback is used
Philip Helger created PDFBOX-2945:
-------------------------------------
Summary: PDType1Font.getNameInFont(String) very slow when Unicode fallback is used
Key: PDFBOX-2945
URL: https://issues.apache.org/jira/browse/PDFBOX-2945
Project: PDFBox
Issue Type: Improvement
Components: PDModel
Affects Versions: 2.0.0
Environment: Windows 10, Pdfbox SNAPSHOT as of revision 1697721 from today, Java 1.7.0_76, 64Bit
Reporter: Philip Helger
Fix For: 2.0.0
When the method is called on a non-embedded font and the unicode fallback is used, the line "String uniName = String.format("uni%04X", unicodes.codePointAt(0));" is called and it is very slow. I suggest either adding a cache (codepoint to uniname) or at least replace the String.format call with something different, as this internally invokes a new RegExp Matcher etc.
Something like the following might do the trick (maybe you have a better utility classes):
final StringBuilder aID = new StringBuilder (Integer.toString (unicodes.codePointAt (0), 16).toUpperCase (Locale.US));
while (aID.length () < 4)
aID.insert (0, '0');
aID.insert (0, "uni");
final String uniName = aID.toString ();
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org