Hi,

I am attempting to use fontbox to provide support for CFF fonts. One of the
things I need is the bounding box for each character. Apparently, the only
way to do this is to render the character and find the bounds which fontbox
has a utliity to do (CharStringRenderer.getBounds). Unfortunately though, I
am getting some strange results back. I have a tool to display a font's
characters with their related bounding boxes overlayed and none of them
seem to match.

Even if I got the mapping between cmap and cff wrong, some of the boxes
seem way off i.e. too large / small for any character. I decided to output
the GeneralPath which is drawn by the CharStringRenderer to an image
initially just to confirm if it was a mistake I made with the mapping, but
the glyph being drawn represents nothing like what I would expect. Most
glyphs appear as unrelated lines, while others have some shape but match no
glyph in the font.

Is this CharStringRenderer class only rendering part of the glyph in an
attempt to get the width, or am I doing something wrong. The way I am
rendering the glyph is to create a BufferedImage and draw the GeneralPath
returned from the render() method in CharStringRenderer and saving it to a
file for each character.

Any help would be appreciated.

Thanks,

Robert Meyer

Reply via email to