lilypond-devel
[Top][All Lists]
Advanced

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

Re: Extracting approximate outlines from FT ?


From: Han-Wen Nienhuys
Subject: Re: Extracting approximate outlines from FT ?
Date: Mon, 4 May 2020 11:13:31 +0200

On Mon, Apr 27, 2020 at 10:55 PM Werner LEMBERG <address@hidden> 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 - address@hidden - http://www.xs4all.nl/~hanwen



reply via email to

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