On Aug 27, 2013, at 14:46 , Graham Cox <graham....@bigpond.com> wrote:
> Parsing a PDF, I need to handle the Tf (set font) operator. The font > situation in PDF files is inordinately complicated, and reading the spec > alone is not really leading to the light-bulb moment. Yes, there are many dark tunnels ahead... > Basically, when I get the Tf operator, I need to end up with a CGFontRef I > can use. I see a number of CGFontCreate… methods, none of which really fit > anything I can see in the PDF spec itself. Perhaps > CGFontCreateWithDataProvider is the "magic bullet" that just works behind the > scenes to make sense of the almost innumerable PDF variations, but I can't > see how I even get to the point where I could use it. Well, first you have a /Font. This should contain a reference to a /FontDescriptor. If the font is embedded in the file, then you have a /FontFile reference ( or /FontFile1, /FontFile2, /FontFile3), which then points to the PDF Stream containing the actual font. If there is no /FontFile, the font is not embedded and you need to figure out where to get the font to use (by name) or supply a fallback font, which has to match the encoding and metrics. > 2013-08-27 12:08:10.304 PDFParser[43098:303] 'Subtype'=[Name]'Type0', > 2013-08-27 12:08:10.304 PDFParser[43098:303] 'ToUnicode'=[Stream], > > I see this in the PDF spec; it's just one among many possible font types and > formats, but I have no idea how to go from this to a CGFontRef. Ahh, a Type0 font. Those are fun! Cheers, Marcel _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com