You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "John Hewson (JIRA)" <ji...@apache.org> on 2014/10/11 01:59:47 UTC
[jira] [Updated] (PDFBOX-2012) Extend CMAPEncodingEntry API
[ https://issues.apache.org/jira/browse/PDFBOX-2012?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
John Hewson updated PDFBOX-2012:
--------------------------------
Fix Version/s: 2.0.0
> Extend CMAPEncodingEntry API
> ----------------------------
>
> Key: PDFBOX-2012
> URL: https://issues.apache.org/jira/browse/PDFBOX-2012
> Project: PDFBox
> Issue Type: Wish
> Components: FontBox
> Affects Versions: 1.8.4, 2.0.0
> Reporter: Philip Helger
> Fix For: 2.0.0
>
>
> Please extend the API with the following 2 methods (incl. a minor performance improvement):
> ### Eclipse Workspace Patch 1.0
> #P fontbox
> Index: src/main/java/org/apache/fontbox/ttf/CMAPEncodingEntry.java
> ===================================================================
> --- src/main/java/org/apache/fontbox/ttf/CMAPEncodingEntry.java (revision 1583927)
> +++ src/main/java/org/apache/fontbox/ttf/CMAPEncodingEntry.java (working copy)
> @@ -436,7 +436,7 @@
> for (int i = 0; i < 256; i++)
> {
> subHeaderKeys[i] = data.readUnsignedShort();
> - maxSubHeaderIndex = Math.max(maxSubHeaderIndex, (int) (subHeaderKeys[i] / 8));
> + maxSubHeaderIndex = Math.max(maxSubHeaderIndex, subHeaderKeys[i] / 8);
> }
>
> // ---- Read all SubHeaders to avoid useless seek on DataSource
> @@ -556,18 +556,32 @@
> */
> public int getGlyphId(int characterCode)
> {
> - if (characterCodeToGlyphId.containsKey(characterCode))
> - {
> - return characterCodeToGlyphId.get(characterCode);
> - }
> - else
> - {
> - return 0;
> - }
> + Integer glyphId = characterCodeToGlyphId.get(characterCode);
> + return glyphId == null ? 0 : glyphId.intValue ();
> }
> +
> + /**
> + * Get the minimum character code for which a glyph id is present
> + *
> + * @return The minimum character code for which a glyph id is present or -1 if no character code is present.
> + */
> + public int getMinimumCharacterCode()
> + {
> + return characterCodeToGlyphId.isEmpty () ? -1 : Collections.min (characterCodeToGlyphId.keySet ()).intValue ();
> + }
>
> /**
> + * Get the maximum character code for which a glyph id is present
> *
> + * @return The maximum character code for which a glyph id is present or -1 if no character code is present.
> + */
> + public int getMaximumCharacterCode()
> + {
> + return characterCodeToGlyphId.isEmpty () ? -1 : Collections.max (characterCodeToGlyphId.keySet ()).intValue ();
> + }
> +
> + /**
> + *
> * Class used to manage CMap - Format 2.
> *
> */
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)