freetype
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Freetype] TrueType Font implementation query


From: Just van Rossum
Subject: Re: [Freetype] TrueType Font implementation query
Date: Tue, 22 May 2001 10:24:54 +0200

Sam Chapman wrote:

> I'm somewhat confused by the documentation of the TrueTypeFont 'glyf' table.
> If anyone out there can help clear up my lack of understanding it would be
> appreciated.
> 
> THE PROBLEM
> 
> The glyf table headers, (offset by the 'loca' table), are clear enough the
> confusion I have is with the Glyph description.
> 
> Simple cases are defined as so.
> 
> Type          Name 
> USHORT        endPtsOfContours[n] n is the number of contours. 
> USHORT        instructionLength 
> BYTE          instructions[n]     n is the number of
> instructions. 
> BYTE          flags[n]        n is the number of flags. 
> BYTE or SHORT     xCoordinates[ ] 
> BYTE or SHORT     yCoordinates[ ] 
> 
> Knowing the number of contours it is possible to size and extract the first
> and second components. This then allows the instructions themselves to be
> loaded. The number of flags is currently unknown to me (so where do I get
> this value?). Also I'm unsure of how the instructions are used as the flags
> and co-ords clearly contain the contour info. This is either omitted or
> obscure within the truetype spec.

The ms tt/ot spec says this about the flags (from
http://www.microsoft.com/typography/otspec/glyf.htm):

    "Array of flags for each coordinate in outline"

So there is one set of flags per coordinate. However, that is not the same as
how many bytes the flags array is long, since flags can be repeated. You have to
interpret the flags in order to extract the coordinates.

For example code, look at, erm, FreeType ;-).

Just



reply via email to

[Prev in Thread] Current Thread [Next in Thread]