TTF/OTF spec ambiguity (glyf table)

fanatic font addict's picture

The following is from the specfication for Glyf tables in Apple's OTF file specification.

"If the x-short Vector bit is not set, and this bit is set, then the current x-coordinate is the same as the previous x-coordinate."

Is is not clear whether they mean the *actual* x coordinate or the *relative* x coordinate. What is actually stored in the table is relative offsets from the previously listed coordinate, so if the above statement refers to relative coordinates it would mean if you have a string of x coordinates "3,3,3,3,...." (indicating a constant angle for some stretch) that just one "3" would be stored for that stretch. OTOH if the above spec means *actual* x coordinates, it would mean that only in the case of a series of x's indicating a vertical line (i.e. no change in actual x coordinate) would all those x coordinates be collapsed to 1.

So I can't tell from the spec which they're referring to. And you can't tell from looking at most ttf files because the above spec only applies when x coordinates are 2 bytes as opposed to 1, which will be in an extreme minority as most x offsets form the previous x will be small.

So an obscure question maybe, unless you have to parse TTF/OTF files directly (as in an application). I wouldn't blame you guys if no one here knows this, but if knowledge of the TTF/OTF spec cannot be found here, then I don't know where.

Michel Boyer's picture

You are looking for something like line 2008 in FontForge's parsettf.c source file?

fanatic font addict's picture

Are they parsing the glyf table there? You actually found that out? Outstanding. I haven't looked at their source before.

If you're looking at it now would do you know the answer to my question.


Michel Boyer's picture

just click on the link above or here to download the file without line numbers. The FontForge source repository is here

fanatic font addict's picture

Thanks I'll get back in a bit and report what I found. "Look at someone else's source" - what a concept. THanks again.

fanatic font addict's picture

They look at the actual x coordinate which is what I first assumed as well. But if the goal is space savings you might as well save all repeat relative offsets when they're the same, (just as in the glyf spec any arbitrary flag is saved and repeated when the same as the previous). But if sourceforge interprets it as the actual x coord and get away with it it must be OK.

Syndicate content Syndicate content