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 2012/10/14 13:37:03 UTC

[jira] [Resolved] (PDFBOX-1408) Width of space character is calculated wrong

     [ https://issues.apache.org/jira/browse/PDFBOX-1408?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

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

       Resolution: Fixed
    Fix Version/s: 1.8.0
         Assignee: Andreas Lehmkühler

I adapted Juraj proposal as follows:

- store the mapping for the space character within the CMap
- implemented a new method PDFont/PDSimpleFont#getSpaceWidth which determines the width using the ToUnicode map if present, otherwise the old method is used
- the average font width is used as fall back value

I added all that stuff in revisions 1398055,1398056 and 1398057

Thanks for the contribution
                
> Width of space character is calculated wrong
> --------------------------------------------
>
>                 Key: PDFBOX-1408
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1408
>             Project: PDFBox
>          Issue Type: Bug
>            Reporter: Juraj Lonc
>            Assignee: Andreas Lehmkühler
>             Fix For: 1.8.0
>
>         Attachments: makcene-export.pdf, PDFBOX-1408_PDFStreamEngine.patch
>
>
> PDFStreamEngine calculates width of space (line 357):
> spaceWidthText = (font.getFontWidth( SPACE_BYTES, 0, 1 )*glyphSpaceToTextSpaceFactor);
> In some cases the result is 0.
> Problem is that getFontWidth requires code number of " ".
> If there is "ToUnicode" mapping for that font that it is necessary to lookup CMap for code number and NOT to use 0x20 (space) as it is in souce code.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira