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

Andreas Lehmkühler edited comment on PDFBOX-5915 at 12/1/24 4:58 PM:
---------------------------------------------------------------------

[~tilman] It looks like your fix just masked the underlying issue. 

The calculation at the end of 
"org.apache.fontbox.cff.Type2CharStringParser.readCommand(int, DataInput, 
GlyphData)" looks suspicious to me
{code}
        case 19:
        case 20:
            glyphData.vstemCount += countNumbers(glyphData.sequence) / 2;
            int[] value = new int[1 + getMaskLength(glyphData.hstemCount, 
glyphData.vstemCount)];
            value[0] = b0;

            for (int i = 1; i < value.length; i++)
            {
                value[i] = input.readUnsignedByte();
            }

            return CharStringCommand.getInstance(value);
{code}

Why do we read those additional values and why to add them to the command byxte 
sequence?

UPDATE:
As long as we don't support those commands IMHO we can simply drop the value 
array and return {{CharStringCommand.getInstance(b0)}}


was (Author: lehmi):
[~tilman] It looks like your fix just masked the underlying issue. 

The calculation at the end of 
"org.apache.fontbox.cff.Type2CharStringParser.readCommand(int, DataInput, 
GlyphData)" looks suspicious to me
{code}
        case 19:
        case 20:
            glyphData.vstemCount += countNumbers(glyphData.sequence) / 2;
            int[] value = new int[1 + getMaskLength(glyphData.hstemCount, 
glyphData.vstemCount)];
            value[0] = b0;

            for (int i = 1; i < value.length; i++)
            {
                value[i] = input.readUnsignedByte();
            }

            return CharStringCommand.getInstance(value);
{code}

Why do we read those additional values and why to add them to the command byxte 
sequence?



> false "Unknown charstring command in glyph" messages
> ----------------------------------------------------
>
>                 Key: PDFBOX-5915
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5915
>             Project: PDFBox
>          Issue Type: Bug
>          Components: FontBox
>    Affects Versions: 3.0.3 PDFBox
>            Reporter: Tilman Hausherr
>            Assignee: Tilman Hausherr
>            Priority: Minor
>             Fix For: 3.0.4 PDFBox, 4.0.0
>
>
> I'm often getting "Unknown charstring command in glyph" messages. I took the 
> time to find whether these are real, and they're not. They happen because of 
> type2 charstrings that start with 19 or 20. These are passed to 
> {{CharStringCommand.getInstance(value)}} where they are classified as UNKNOWN 
> either because the value array is more than 2 or because a 2 byte command 
> doesn't result in a known value. However 19 and 20 are 1 byte commands 
> (hintmask and cntrmask, which we ignore) so this must be changed.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to