• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Creating CGFont from PDF Tf operator
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating CGFont from PDF Tf operator


  • Subject: Re: Creating CGFont from PDF Tf operator
  • From: Marcel Weiher <email@hidden>
  • Date: Wed, 28 Aug 2013 14:22:13 +0200

On Aug 27, 2013, at 14:46 , Graham Cox <email@hidden> 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 (email@hidden)

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:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Creating CGFont from PDF Tf operator
      • From: Graham Cox <email@hidden>
References: 
 >Creating CGFont from PDF Tf operator (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: "Introducing ioscomponents.com"
  • Next by Date: Re: Creating CGFont from PDF Tf operator
  • Previous by thread: Re: Creating CGFont from PDF Tf operator
  • Next by thread: Re: Creating CGFont from PDF Tf operator
  • Index(es):
    • Date
    • Thread