[ https://issues.apache.org/jira/browse/PDFBOX-1645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13871851#comment-13871851 ]
Robert Meyer commented on PDFBOX-1645: -------------------------------------- Hi John, Thanks for taking the time to look at this and respond. I knew when I put this patch forward that it was computationally expensive but could not see any other way of retrieving accurate bounding box information for the characters. At the time I was having issues with character layout in documents generated by FOP and this naturally led me to believe that it was an issue with the co-ordinates I was getting from the renderer. From further investigation though I now understand that this information is only used in SVG documents and as such I am no longer convinced that this information is vital or necessary for the OTF implementation in the project. As such I will investigate further and submit a patch should the need arise once I have a better understanding of what is required. > [PATCH] Improved the accuracy of the bounding box for each rendered CFF glyph > ----------------------------------------------------------------------------- > > Key: PDFBOX-1645 > URL: https://issues.apache.org/jira/browse/PDFBOX-1645 > Project: PDFBox > Issue Type: Improvement > Components: FontBox > Affects Versions: 1.8.2 > Reporter: Robert Meyer > Assignee: Andreas Lehmkühler > Fix For: 2.0.0 > > Attachments: characterl.png, charactert.png, patch-20131202.diff, > patch.diff > > > In a previous patch to the CharStringRenderer class, I resolved the rendering > issues and added a method to retrieve the bounding box for a CFF glyph. This > utilized the GeneralPath.getBounds() method to retrieve it's bounding box. > Unfortunately it was found that the method uses the control points of the > bezier curves instead of the actual lines and was not very accurate. I have > therefore added several new methods to calculate the correct extents of the > glyph so that now it matches that of the measurements found in tools like > FontForge. > As a side note, there are several checks which were originally added in my > patch which were unfortunately removed relating to the number of arguments > provided with an operator. I have one Adobe Font (Adobe Heiti Standard - > CID-Keyed OTF) which has one or more glyphs which trip up on this and cause > an Array index out of Bounds exception. Each glyph renders correctly even > though this issue occurs and therefore would be grateful if these could be > left in. I have re-added these checks back with the patch I am about to add. -- This message was sent by Atlassian JIRA (v6.1.5#6160)