> On 5 Feb 2016, at 05:05, Branden Visser <[email protected]> wrote: > > Hi all, > > I'm trying to get the visual bounds of a type 3 font. I've had success > getting that information from many fonts using `getPath`, but it > appears it's not supported for Type3. Is there a reliable way to > understand drawing information for those?
Some Type 3 glyphs begin with the “d1” operator which specifies both the logical width and the bounding box of the glyph. However, many begin with “d0” which simply specifies the logical width, which isn’t what you want. In theory a Type 3 glyph can contain arbitrary PDF drawing commands but in practice they are used only for bitmap fonts which contain a single “BI” operator to draw a masked image. This means it’s actually fairly easy to extract this image (and then combine its size with the bbox from d1 and the font matrix to get the glyph’s visual bounding rect). All you need is a custom PDFStreamEngine which handles only those operators. We actually have one in preflight, called PreflightType3Stream, which you can use as starting point. — John > Thanks, > Branden > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

