You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "John Hewson (JIRA)" <ji...@apache.org> on 2015/02/01 01:53:34 UTC

[jira] [Commented] (PDFBOX-2649) Character widths incorrect in a loaded font

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

John Hewson commented on PDFBOX-2649:
-------------------------------------

Yes, thanks - that will simplify things too.

> Character widths incorrect in a loaded font
> -------------------------------------------
>
>                 Key: PDFBOX-2649
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2649
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 2.0.0
>            Reporter: Alex Nevidomsky
>            Assignee: John Hewson
>             Fix For: 2.0.0
>
>
> {code}
> @Test
> testRelativeWidth() {
> PDFont font = PDType0Font.load(document, this.getClass().getResourceAsStream("/LiberationSans-Regular.ttf"));
> float wO = font.getStringWidth("O");
> float wP = font.getStringWidth("P");
> float wN = font.getStringWidth("N");
> Assert.assertTrue("O must be wider than P", wO>wP);
> Assert.assertTrue("O must be wider than N", wO>wN);
> }
> {code}
> I can see that there is a confusion in the process between GID and CID values. The reason may not be entirely clear to me, but PDCIDFontType2Embedder.buildWidths(COSDictionary cidFont) seems to name "cid" something that in my opinion is still a glyph id. And when it comes to PDCIDFont.getWidth(int), the "widths" map that should presumably contain cid->width values in reality contains git->width.



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

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