views:

133

answers:

0

Hi, I am developing an application which requires me to do fetch the glyph id from the CFF stream either through a character code or through a glyph name. This is a raw CFF stream and is not embedded inside an OTF File. I need to parse the CFF stream to fetch the charset and encoding information. Using that, how do I get to glyph indices? I have read the CFF spec and this is my understanding:

If the cff stream defines a custom encoding, the array of character codes would look like (for eg:) - charCodes[] = {89, 41, 56, 78, ....} and the glyph index would be: GID(89) = 1 GID(41) = 2 GID(56) = 3 GID(78) = 4 and so on. Is this correct?

Also, how do I get to to the glyph indices from the CFF's charset? Based on my understanding, if we have a custom charset of the form (conceptually) charset[] = {sid1, sid2, sid3, ...}, how do we get to the glyph index from the sids? Would GID(sid1) = 1? Or GID(sid1) = nStandardStringsCount+1?

Appreciate any help.