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: Sun, 07 Jun 2020 12:46:25 +0200 (CEST)


> So, I have been trying to convert my code to FT_Fixed for a few days
> now without any success.  [...]
>
> As for bezier curves, there is almost always an overflow because
> while solving polynomials some large numbers are involved.  I even
> tried using Newton's approximation, but it's too slow and still not
> as accurate as floating points.

Perhaps you have to subdivide the Bezier curves, using the Bezier
envelope as a guide?  Or maybe you can do something similar to
Behdad's `GLyphy` implementation: He uses circular arcs to approximate
Bezier curves.

> I did not try using 64 bit integers because they are not portable I
> guess and because of that I have to create separate implementations
> for 32 and 64 bit architecture.  So, after comparing both, I prefer
> floats over fixed points because they satisfy both range and
> precision.

I'm quite sure that everything can be handled gracefully with
fixed-point arithmetic by sophisticated rewriting of the formulae.

> I can try using 64 bit integers but I am not sure whether I will be
> able to finish the project on time or not because of separate
> implementation.  I have attached the code below, note that this is
> my first time dealing with fixed points so there might be something
> that I am not doing right.
> 
> SDF with fixed point:
> https://github.com/preversewharf45/freetype2-sdf/tree/FT_Fixed

Hmm.  The last commit in this tree deletes the code for conic and
cubic curves in `get_min_distance`...


    Werner



reply via email to

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