freetype-devel
[Top][All Lists]
Advanced

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

Re: [Freetype-devel] Re: GSOC - Distance Fields


From: Werner LEMBERG
Subject: Re: [Freetype-devel] Re: GSOC - Distance Fields
Date: Sat, 30 May 2020 18:31:44 +0200 (CEST)

> > [...] go ahead and write a standalone program that calculates DF
> > for a outline glyph in whatever format you choose or is
> > appropriate.
> 
> I have written the program, you can find it at:
> https://github.com/preversewharf45/freetype2-sdf
> To view the output I'm currently using a small OpenGL framework:
> https://github.com/preversewharf45/freetype2-sdf-demo
> this already has the sdf code.

Will have a look soon, thanks!

> However there is an issue with the program, the glyphs which contain
> intersecting contours have an issue.  (example:
> https://imgur.com/MxJfAwY).  Currently the sign of the distance is
> determined by the orientation of the closest edge, so at places
> where one contour intersects another the pixel near that contour can
> be specified as outside even though it is inside the shape.  To fix
> this issue I'm thinking of using the winding of the contours, so is
> there any function in freetype to get the winding or something
> similar?

FreeType doesn't have code to get the orientation of a single contour.
I suggest that you re-use the code of `FT_Get_Outline_Orientation`.

Alexei, do you think it makes sense to provide an
`FT_Get_Contour_Orientation` API?  I had a similar question
w.r.t. contour orientation from a LilyPond developer...

> Also, should I start integrating this in freetype or first fix the
> issue?

As you like.  The idea is that you can go wild within your branch, and
that you prepare another, cleaned-up branch for final GSoC submission
that contains commits in a logical order.


   Werner



reply via email to

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