[ 
https://issues.apache.org/jira/browse/PDFBOX-2854?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14617304#comment-14617304
 ] 

Tilman Hausherr edited comment on PDFBOX-2854 at 6/13/16 7:55 PM:
------------------------------------------------------------------

There are two problems. The first is that buildOS2Table() doesn't work properly 
when there is no element in the uniToGID table so we could throw an 
IllegalStateException. The second problem is that buildOS2Table() won't work 
properly if there is only one element in the table. This is because of this 
code segment:
{code}
        Iterator<Entry<Integer, Integer>> it = uniToGID.entrySet().iterator();
        it.next();
        Entry<Integer, Integer> first = it.next();
{code}
The original code by [[email protected]]
http://svn.clazzes.org/svn/sketch/trunk/pdf/pdf-entities/src/main/java/org/clazzes/sketch/pdf/entities/impl/TTFSubFont.java
expects a .notdef there and it is added. Our code doesn't do this anymore, this 
was partially lost in PDFBOX-2565 / [ https://svn.apache.org/r1645796 ] where 
{{addCharCode(0);}} was replaced by {{glyphIds.add(0);}}


was (Author: tilman):
There are two problems. The first is that buildOS2Table() doesn't work properly 
when there is no element in the uniToGID table so we could throw an 
IllegalStateException. The second problem is that buildOS2Table() won't work 
properly if there is only one element in the table. This is because of this 
code segment:
{code}
        Iterator<Entry<Integer, Integer>> it = uniToGID.entrySet().iterator();
        it.next();
        Entry<Integer, Integer> first = it.next();
{code}
The original code by [[email protected]]
http://svn.clazzes.org/svn/sketch/trunk/pdf/pdf-entities/src/main/java/org/clazzes/sketch/pdf/entities/impl/TTFSubFont.java
expects a .notdef there and it is added. Our code doesn't do this anymore, this 
was partially lost in PDFBOX-2565 / 1645796 where {{addCharCode(0);}} was 
replaced by {{glyphIds.add(0);}}

> TTFSubsetter NoSuchElementException
> -----------------------------------
>
>                 Key: PDFBOX-2854
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2854
>             Project: PDFBox
>          Issue Type: Bug
>          Components: FontBox
>    Affects Versions: 2.0.0
>            Reporter: simon steiner
>
> Exception in thread "main" java.util.NoSuchElementException
>       at java.util.TreeMap$PrivateEntryIterator.nextEntry(TreeMap.java:1113)
>       at java.util.TreeMap$EntryIterator.next(TreeMap.java:1151)
>       at java.util.TreeMap$EntryIterator.next(TreeMap.java:1146)
>       at 
> org.apache.fontbox.ttf.TTFSubsetter.buildOS2Table(TTFSubsetter.java:523)
>       at 
> org.apache.fontbox.ttf.TTFSubsetter.writeToStream(TTFSubsetter.java:1081)
>         TrueTypeFont x = new TTFParser().parse("Uvb_____.TTF");
>         new TTFSubsetter(x, null).writeToStream(new ByteArrayOutputStream());



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to