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: Vincent Torri
Subject: Re: [Freetype-devel] Re: GSOC - Distance Fields
Date: Sat, 4 Jul 2020 13:01:09 +0200

On Sat, Jul 4, 2020 at 11:52 AM Werner LEMBERG <wl@gnu.org> wrote:
>
>
> > I have created the demo program, it can be used to view raw SDF
> > without any bilinear filtering and there is no way to reconstruct
> > fonts from SDF because again it doesn't have bilinear filtering.  I
> > will add that soon.
>
> Thanks, will test soon.
>
> > There is a pretty weird issue that I ran into while testing the demo
> > on linux which doesn't happen on windows whatsoever. On linux
> > various computations give wrong output.  For example, division of
> > -328032 by 64 gives 1811934202, whereas it should be -5125.
> > Moreover FT_Vector_Length returns negative values even for small
> > vectors.  There is no overflow so what am I doing wrong?  (One of
> > the places it happens is:
> > https://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/src/sdf/ftsdf.c?h=anuj-distance-field#n1129
> > where the `factor' is wrong after division with 64).

from a mathematical point of view only, you are doing a/64 + b/64
(this line and also a bit above, which can be factorized like that :
(a+b)/64. Maybe it is needed to divide first by 64 each term, i don't
know, i just wanted to point this


> I'm not aware of arithmetic computation problems within FreeType.
>
> Maybe you are experiencing a 32bit vs. 64bit issue?

if this is a problem of windows vs linux and 32 bits vs 64 bits, then
it is related to the 'long' type which is always a 32 bits type on
Windows, contrary to unix

>  It might also
> help to compile with UBSan to enable run-time checking of over- and
> underflow.  As an additional step, you could try to compile with clang
> instead of gcc.
>
>
>     Werner
>



reply via email to

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