On Mon, Apr 27, 2020 at 10:55 PM Werner LEMBERG <[email protected]> wrote:

> > FT_Outline_Get_Orientation takes an FT_Outline argument, so I can't
> > compute the orientation of an individual contour.
>
> Mhmm, you could copy the data stored `face->glyph->outline' into a new
> `FT_Outline` structure and iterate over the outlines, something like
>
>   FT_Outline outline;
>   FT_Orientation orientations[face->glyph->outline->n_contours];
>
>   FT_Outline_New(library, face->glyph->outline->n_points,
>                  1, &outline);
>
>   short first = 0;
>   for (short c = 0; c < face->glyph->outline->n_contours; c++)
>   {
>     FT_Int last = face->glyph->outline->contours[c];
>
>
>     <copy data from `first` to `last` of `face->glyph_outline`
>      to `outline`>
>
>     orientations[c] = FT_Outline_Get_Orientation(outline);
>
>     first = last + 1;
>   }
>
>   FT_Outline_Done(library, outline);

I wrote something that seems to be working, but I would like to cache
the contours. For Open_type_font, this is easy, but for Pango_font,
each string can be composed of multiple FT_Faces, and I suspect they
might be deallocated during a program run. Do you know of a suitable
immutable key for FT_Face (eg. full filename) that I could get out of
either Freetype or Pango?

-- 
Han-Wen Nienhuys - [email protected] - http://www.xs4all.nl/~hanwen

Reply via email to