> On 17 May 2016, at 09:39, Daniel Wilson <will... <>@gmail.com> wrote: > > My application needs to find the coordinates of the artwork within the > Adobe Illustrator (PDF) document. For most graphic instructions (lineTo, > curveTo, appendRectangle, etc.) this is very easy. > > But I need to create a chunk of code like the one at > https://github.com/apache/pdfbox/blob/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java#L350 > > <https://github.com/apache/pdfbox/blob/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java#L350> > > (I know, that's not the official repo, but it's very handy for reference.) > > In order to create that chunk of code, I need a variable of type Glyph2D. > Glyph2D and the classes that implement it are private. > > https://github.com/apache/pdfbox/blob/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/Glyph2D.java > > <https://github.com/apache/pdfbox/blob/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/Glyph2D.java> > https://github.com/apache/pdfbox/blob/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/TTFGlyph2D.java#L39 > > <https://github.com/apache/pdfbox/blob/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/TTFGlyph2D.java#L39> > > Is there any reason NOT to make that interface and those classes public? > > Yes, these are just implementation details of our rendering component. At this > point they’re mostly artefacts of the previous design and really needs to be > moved to PDFont, where it can be public. > > The various subclasses of PDFont have a getPath(…) method which can be called > to > get a GeneralPath from a glyph name / CID. Much as I’d like to suggest > something > better, you can copy/paste the code from Glyph2D to get the mapping. > > — John > > Thanks! > > Daniel
To follow up on this, I’ve removed Glyph2D in the trunk in PDFBOX-3459 and moved its functionality to a new method getNormalizedPath(code) on each PDFont subclass. This allows you to easily get access to the same glyph path which PDFBox uses for rendering. — John
