You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Andreas Lehmkühler (JIRA)" <ji...@apache.org> on 2010/11/27 20:20:38 UTC

[jira] Created: (PDFBOX-909) Add support for a 6 element matrix

Add support for a 6 element matrix
----------------------------------

                 Key: PDFBOX-909
                 URL: https://issues.apache.org/jira/browse/PDFBOX-909
             Project: PDFBox
          Issue Type: Improvement
          Components: PDModel
    Affects Versions: 1.3.1, 1.2.1, 1.2.0
            Reporter: Andreas Lehmkühler
            Assignee: Andreas Lehmkühler


The PDMatrix class only supports 3x3 matrices.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (PDFBOX-909) Add support for a 6 element matrix

Posted by "Andreas Lehmkühler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PDFBOX-909?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Lehmkühler resolved PDFBOX-909.
---------------------------------------

    Resolution: Fixed

I added the proposed fix in revision 1043175. It uses the same logic than PDFStreamEngine#processEncodedText.

At least a 2x3 matrix is nothing else than a 3x3 matrix without the 3rd column.

@Jeremias
Thanks for figuring that out

> Add support for a 6 element matrix
> ----------------------------------
>
>                 Key: PDFBOX-909
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-909
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: PDModel
>    Affects Versions: 1.2.0, 1.2.1, 1.3.1
>            Reporter: Andreas Lehmkühler
>            Assignee: Andreas Lehmkühler
>             Fix For: 1.4.0
>
>
> The PDMatrix class only supports 3x3 matrices.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (PDFBOX-909) Add support for a 6 element matrix

Posted by "Andreas Lehmkühler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PDFBOX-909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12966246#action_12966246 ] 

Andreas Lehmkühler commented on PDFBOX-909:
-------------------------------------------

I had to add a fix for matrices with 6 in revision 1041554 to ensure a correct initialization.

> Add support for a 6 element matrix
> ----------------------------------
>
>                 Key: PDFBOX-909
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-909
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: PDModel
>    Affects Versions: 1.2.0, 1.2.1, 1.3.1
>            Reporter: Andreas Lehmkühler
>            Assignee: Andreas Lehmkühler
>             Fix For: 1.4.0
>
>
> The PDMatrix class only supports 3x3 matrices.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (PDFBOX-909) Add support for a 6 element matrix

Posted by "Andreas Lehmkühler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PDFBOX-909?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Lehmkühler resolved PDFBOX-909.
---------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.4.0

I added support for 3x2 matrices like the font matrix of a type 3 font in revision 1039732

> Add support for a 6 element matrix
> ----------------------------------
>
>                 Key: PDFBOX-909
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-909
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: PDModel
>    Affects Versions: 1.2.0, 1.2.1, 1.3.1
>            Reporter: Andreas Lehmkühler
>            Assignee: Andreas Lehmkühler
>             Fix For: 1.4.0
>
>
> The PDMatrix class only supports 3x3 matrices.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (PDFBOX-909) Add support for a 6 element matrix

Posted by "Andreas Lehmkühler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PDFBOX-909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12968698#action_12968698 ] 

Andreas Lehmkühler commented on PDFBOX-909:
-------------------------------------------

I'm pretty sure that my changes are right. There are only 2 possible kinds of matrices within the PDF format, 3x3 and 2x3, so that IMO we don't need a special constructor. According to the reference the FontMatrix always consists of 6 values, e.g. [0.001 0 0 0.001 0 0]. 

But to cut a long story short there is an issue in PageDrawer#processTextPosition():

at.scale(fontMatrix.getValue(0, 0) * 1000f, fontMatrix.getValue(1, 0) * 1000f); 

The second scaling factor has to be: fontMatrix.getValue(1, 1)

Obviously the author of that code (I guess it was me) used a "workaround" for the wrong PDMatrix implementation without thinking about it. 

If you liked to fix it, go ahead. Otherwise I'll fix that later when I'm back home.

> Add support for a 6 element matrix
> ----------------------------------
>
>                 Key: PDFBOX-909
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-909
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: PDModel
>    Affects Versions: 1.2.0, 1.2.1, 1.3.1
>            Reporter: Andreas Lehmkühler
>            Assignee: Andreas Lehmkühler
>             Fix For: 1.4.0
>
>
> The PDMatrix class only supports 3x3 matrices.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Reopened: (PDFBOX-909) Add support for a 6 element matrix

Posted by "Jeremias Maerki (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PDFBOX-909?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jeremias Maerki reopened PDFBOX-909:
------------------------------------


Andreas, are you sure these changes are right? Right now, I have a case reported to me by a client in which a Type1C font produces tons of exceptions at AffineTransform.createInverse() because the numberOfRowElements in PDMatrix was set to 2. This causes the wrong element to be fetched from the FontMatrix (0 instead of 0.001). As an experiment, I've added another constructor to PDMatrix which lets you set the number of columns explicitely:

    /**
     * Constructor.
     *
     * @param array The array that describes the matrix.
     * @param elementsPerRow the number of elements in a row of the matrix
     */
    public PDMatrix( COSArray array, int elementsPerRow )
    {
        this.matrix = array;
        this.numberOfRowElements = elementsPerRow;
    }

Setting the elementsPerRow to 3 (instead of 2) from PDFont and PDType1CFont solves the problem. I don't think it's a good idea to add implicit knowledge about the number of columns in PDMatrix. I'd rather use an explicit constructor parameter for each use case. That puts the knowledge where the matrix is created. I can fix it like that if you like.

> Add support for a 6 element matrix
> ----------------------------------
>
>                 Key: PDFBOX-909
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-909
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: PDModel
>    Affects Versions: 1.2.0, 1.2.1, 1.3.1
>            Reporter: Andreas Lehmkühler
>            Assignee: Andreas Lehmkühler
>             Fix For: 1.4.0
>
>
> The PDMatrix class only supports 3x3 matrices.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.