I'm trying to embed a subset of a font with the identity encoding range varying dynamically (only the range used).
For my question, however, let's focus on this specific range which is `a-z`: fontEncoding = new PoDoFo::PdfIdentityEncoding(0x0061, 0x007A, true); Assuming you're familiar with creating a font and writing with a painter, I'll just pseudo code it: document.CreateFontSubset("Arial", false, false, fontEncoding); Given this hard-coded range, drawing the text "za" outputs: <</W [ 68 [ 443.848 500.0 443.848 500.0 443.848 333.008 ] 74 75 500.0 76 77 277.832 78 [ 500.0 277.832 777.832 ] 81 84 500.0 85 [ 333.008 389.16 277.832 ] 88 89 500.0 90 [ 722.168 ] 91 92 500.0 ] When you view the PDF, the "z" character has an incorrect character spacing, with a rather large gap after it. If I use the same input string but change the encoding range max value +1 the same is outputted, except now this is at the end of the array: 93 [ 443.848 ] Now the "z" appears correctly spaced. I can open the first broken PDF manually, add this exact text to the end of the array, save it, and it fixes the "z" inside it as well. While I'm no PDF spec pro by any means, my understanding is that this array maps the character indexs to the font glyphs and it appears that the last entry in this particular range is missing for whatever reason? (this is likely a wrong assumption, no doubt) Now, this exactly was with a hardcoded a-z range, but the problem appears with several ranges I tested arbitrarily and the amount the range is "off" does not appear to follow any pattern I can decern. For example, if the range ends with a tilde "~" I need to add 35 to the max range 0x007E. I can't seem to figure out what I'm doing wrong. If I make the range one less unit, the last character does not appear (as expected), likewise with the min. Anyone see some super obvious that I'm overlooking (or abusing)? Btw, the reason for this need is that I was previously not embedding the font but was still using the max range of 0xFFFF (per the mailing list suggestion for unicode support) but the issue we ran into was that as far as I can tell, this is against spec because doing so creates a CIDToGIDMap which can only be used if the font is embedded (glyph index values cannot be guaranteed for TrueType) Section 5.6. For 99% of PDF readers we found this was a null-issue because they ignore this fact and blindly trust the indexes and usually they are the same so it works. Google Docs is one implementation that does NOT allow this and simply doesn't show the text at all. Adobe Reader on iOS-only does this too. ------------------------------------------------------------------------------ Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb _______________________________________________ Podofo-users mailing list Podofo-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/podofo-users