Differences between /FontFile2 and /FontFile3, or OS X Preview?

New Here ,
Dec 05, 2013 Dec 05, 2013

Copy link to clipboard

Copied

(This is my first post in these forums, so apologies if this topic is not appropriate.)

I've written a pile of Java utility code to generate PDFs with subsetted TrueType fonts using a CID-keyed font. (I know: there are multiple frameworks that do this type of thing. But I'm a hobbyist tinkerer who enjoys building things, and I'm enjoying learning how these technology stacks hang together.)

My code creates a font descriptor with a /FontFile2 reference to my TrueType font program output stream. The subsetted font always has the .notdef glyph at glyphIndex 0, with subsetted glyphs thereafter as they are first referenced. I'm using an identity mapping of CID==GlyphID. (I've been reading the various specs... the ISO PDF 1.7 reference, TrueType and OpenType specs at Microsoft and Apple, and several Adobe Tech Notes on various font and CMap technologies.)

All this seems to work.

However I'd like to also explore OpenType fonts with glyphs in a 'CFF ' table (CIDFontType0 instead of my CIDFontType2), and in preparation I'm trying to adapt my current TrueType-based code to OpenType using a /FontFile3 reference.

That's where the wheels fall off the train. Since I'm still dealing with 'glyf'-based fonts, I expected minimal changes, e.g., switching the font file dictionary key and putting the /Subtype -> /OpenType wrapper on the font stream itself.

Adobe Acrobat renders the resulting PDF just fine, and preflighting didn't bring up any errors (though possibly I'm not using Acrobat right). However OS X Preview under Mavericks scrambles my glyph mapping in a way that I can't mentally reverse engineer. I've tried tweaking things, but I'm stuck.

So my questions are: if your font subset is a TrueType-based CID font with 'glyf' outlines using /FontFile2, what changes are necessary to make an equivalent OpenType font using /FontFile3? and/or Does Mavericks Preview support PDFs with /FontFile3 and 'glyf'-based OpenType fonts? I think the odds are with me misunderstanding aspects of the specifications, and it's also possible that my /FontFile2 code is also broken in a way that (un)fortunately is forgiven by both Acrobat and Preview.

(I have two "equivalent" PDF examples of what my code generates that I can try to attach if this topic gets any traction.)

Thank you in advance!

/djk

Views

2.0K

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Dec 06, 2013 Dec 06, 2013

Copy link to clipboard

Copied

I think the key lies in "OS X Preview under Mavericks scrambles my glyph mapping."  My grasp of font internals is pretty shallow, but I am pretty sure an author recently screwed up the coding for PDF proofs for a book simply by using Preview to add comments -- meaning Preview saved the PDF and in doing so re-processed the font tables: ASCII survived, but words containing the fi and fl ligatures were no longer searchable (the file-size also shrank significantly).  You will find many criticisms of Preview down the hall on the Acrobat and InDesign forums, though I don't recall any that mention this aspect.

In fact, the inner workings of fonts don't come up too often on these forums -- not the place to find out about mark-to-mark-positioning, for example.  You might want to check out the Build forum over on Typophile, though the site has had speed/connection issues lately.  I've also picked up useful information lurking on Typedrawers.com.

Good luck,

David

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 23, 2014 Sep 23, 2014

Copy link to clipboard

Copied

It happen to me when i had to create some pdf's to an old website full of tech details pdf's for each product.[removed by moderator]. They were using their own software made by some else couple of years before me and they had a special font acording to the company logo, all the pdf's were rendered with that font. Was not the same case as yours ofcourse but they were using Type0 CID-keyed option in the software i mention before. I really didn't find out how this men before me used this software because was not mine and directly i passed to Starling-frameworks to render the font they use normally. It's such a big suprize people like you enjoy with this difficoult stuff...

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 24, 2014 Sep 24, 2014

Copy link to clipboard

Copied

LATEST

Don't forget too that Preview doesn't know anything about rendering PDFs really. Preview uses Mac OS's built in PDF handling. Now, this will have bugs and fixes and features but I've never found any description of any of these. But to discuss problems with Preview it's not enough to talk about Preview as a generic product. Rather you need to say something like "Preview in Mac OS 10.7.3" or whatever, and compare with Preview in the latest Mavericks etc.

It's certainly the case that later additions to PDF, infrequently used by creators, are likely to have poorer support in third party tools.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines