views:

143

answers:

1

So, this is mainly for fun, I'm poking around and trying to find my way inside a few fonts and i have a few questions i'd reeally appreciate some help on if anyone has done this kind of stuff.

cmap table

The fonts i am testing with contain several cmap subtables of different formats. I can read them, but i don't understand which i should be using. ie. what is the strategy for choosing the most appropriate subtable? Does this even make sense?

glyf table

This is really making my head hurt. I'm going by what is on here. Looking at the second table on that page.. I've got 'n' endPtsOfContours, 'n' instructions and 'n' flags but it is not clear to me if i have the same number of flags as contours (i know how many contours i have). Then, to make matters worse..(fun!) i have an array of xCoords and an array of yCoords. These arrays seem to be of indeterminate length and may contain data of either BYTE or SHORT but we are not going to tell you which..

Ok, i suppose this is what the instructions and flags are for but as you can probably tell i don't really know how to deal with them. Do i need a TrueType interpreter to access the coordinate data?

Thanks to anyone willing to shed some light.

A: 

You are correct, of course.

flags bit 1: If set, the corresponding x-coordinate is 1 byte long. If not set, 2 bytes.

flags bit 2: If set, the corresponding y-coordinate is 1 byte long. If not set, 2 bytes.

I wrote code to walk the TrueType tables a long time ago--in C of course. I suppose you can compare your results with the output of TTFDump (still available from Microsoft).

egrunin
Thanks @egrunin i'm still struggling to see how many flags and coords i might have, but having the output of TTFDump would be a great help.
mustISignUp
So i used TTFDump on a few fonts and it makes it pretty clear
mustISignUp