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

John Hewson closed PDFBOX-973.
------------------------------
    Resolution: Invalid

This issue no longer applies to the current trunk.

> 2 byte codes not supported in PDType1CFont.getStringWidth
> ---------------------------------------------------------
>
>                 Key: PDFBOX-973
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-973
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 1.6.0
>            Reporter: Timo Boehme
>
> PDType1CFont overrides the method getStringWidth. The width is calculated by 
> getting the code for each character of the string. However it is assumed that 
> the code only has a maximum value of 255 (1 byte) while - as one can see in 
> e.g. getName() two bytes are possible as well. Therefore the line within 
> getStringWidth which reads
> width += getFontWidth(new byte[]{(byte)code.intValue()}, 0, 1); 
> must be replaced 
> width += ( code < 256 ) ? getFontWidth( new byte[]{ (byte)code.intValue() }, 
> 0, 1 ) :
>                                    getFontWidth( new byte[]{ 
> (byte)(code.intValue() >> 8),
>                                                                             
> (byte) code.intValue() },
>                                                                 0, 2 );



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

Reply via email to