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: Werner LEMBERG
Subject: Re: Extracting approximate outlines from FT ?
Date: Mon, 27 Apr 2020 22:55:33 +0200 (CEST)

>> Unfortunately, the OpenType standard doesn't store the orientation
>> of outlines in the `glyf` or `CFF` (or `CFF2`) table.  In other
>> words, this has to be computed, which further means that you have
>> to use `FT_Outline_Get_Orientation` so that you can differentiate
>> between inner and outer outlines in case you need it.
>
> 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);


    Werner



reply via email to

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