freetype-devel
[Top][All Lists]
Advanced

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

Re: [Devel] Loading composite glyphs


From: David Turner
Subject: Re: [Devel] Loading composite glyphs
Date: Wed, 20 Dec 2000 14:37:42 +0100

Hi Scott,

> 
> Greetings everybody.
> 
> The composite glyph loading code is quite complex and I've been having
> difficulty understanding how exactly a composite glyph is loaded. I can
> tell that a stack of subglyphs is being used, but it's hard to see how.
> Are the subglyphs collected on a stack and their points merged together
> into the final glyph? The last time I saw such looping/switching was
> when I was writing an LALR parser for a compilers course. I didn't
> understand my own code that well either, when I was done with it. At
> least the FreeType code involves only a single stack instead of three :)
>
the method corresponds to:

  - a "current glyph" is initially created with 0 points and contours

  - when a new sub-glyph is loaded, it is transformed according
    to the corresponding matrix (when needed)

  - it is then translated according to either a direct vector
    or relative point positions between the new glyph and the
    current one.

  - then, the new glyph is merged in the current one, simply by
    adding its points and contours.

there are a few subtleties due to the two shadow points and the
fact that sub-glyphs can be composite themselves (hence the stack)

> I guess the crux of my question is this: if, for example, I've got a
> composite glyph which is an "A" with two dots on top of it (I'm assuming
> such a glyph is probably composite), and I get the outline of the glyph,
> does that outline contain 4 contours (two for the A, one for each dot)
> and all the points which make up the glyph as a whole? That is, does the
> points array for the outline contain ALL the points for the four
> contours?
> 
Yes, unless you use the FT_LOAD_NO_RECURSE flag, where you'll end up
with a "face->glyph->format" of "ft_glyph_format_composite" and
appropriate values in "face->glyph->subglyphs" and
"face->glyph->num_subglyphs"

Regards,

- David



reply via email to

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