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

2020-06-01 Thread Alexei Podtelezhnikov
On Mon, Jun 1, 2020 at 2:43 PM Werner LEMBERG  wrote:
>
>
> >> However there is an issue with the program, the glyphs which
> >> contain intersecting contours have an issue.  (example:
> >> https://imgur.com/MxJfAwY)
> >
> > The intersecting contours used to be discouraged and [are] still
> > quite rare.  [...]
>
> This is no longer true: Variation fonts have officially re-introduced
> intersecting contours.  In other words, it is absolutely necessary to
> cover this case.

We have issues with that in our rasterizer too, which I do not know
how to solve short of oversampling. Perhaps, Raph or David have some
thoughts on how to deal with pixels where contours intersect and
coverage is calculated wrongly. Whoever let intersections into
variations fonts should also have some ideas on how to rasterize those
unless the decision was made hastily.

I still doubt that variation fonts have legs. They were dead in the
water for 20 years are still too complex to survive, IMHO.



Re: Logging Library-Week 1

2020-06-01 Thread Werner LEMBERG


[Please try to write plain text e-mails that don't rely on HTML
 formatting.]


Hello Priyesh,

> The coding period has begun, and now I will begin exploring the
> logging libraries.  According to my proposal, I have given 3 weeks
> for the exploring phase.  I will keep updating you about the
> progress per week.

OK.

> According to me, these are the requirements:
>
>1. Do not change how the current logging library marks the error
>and tracing logs.

Basically, this is a good assumption.  However, this rule is not cast
in stone if there are good reasons for a change (whatever they may
be).

>2. Formatting of log messages:
>
>  a. Displaying the value of FT_COMPONENT macro.
>  b. Displaying the timestamp.
>
>3. User should be able to
>
>  a. Dynamically change the log levels.
>  b. Dynamically redirect the logs to the desired output.
>
>4. The library should definitely have Windows support.

This looks like a good summary of what has been discussed so far.


Werner



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

2020-06-01 Thread Werner LEMBERG


>> However there is an issue with the program, the glyphs which
>> contain intersecting contours have an issue.  (example:
>> https://imgur.com/MxJfAwY)
> 
> The intersecting contours used to be discouraged and [are] still
> quite rare.  [...]

This is no longer true: Variation fonts have officially re-introduced
intersecting contours.  In other words, it is absolutely necessary to
cover this case.


Werner



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

2020-06-01 Thread Alexei Podtelezhnikov
Hi Anuj,

> 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.

I like the style. Looks good.

> However there is an issue with the program, the glyphs which contain 
> intersecting contours have an issue.
> (example: https://imgur.com/MxJfAwY)

The intersecting contours used to be discouraged and still quite rare.
In general, you should assume that fonts have reasonable shapes
without intersections or wrong contour orientations. It is more
important that your code deals with thin stems and cursive fonts with
tiny details like serifs.

> 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?

We only have 
https://www.freetype.org/freetype2/docs/reference/ft2-outline_processing.html#ft_outline_get_orientation
You can cut the outline into individual contours manually. Keep in
mind that the orientation is different for TrueType and Type1/CFF
fonts.

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

Have you figured out FT_Fixed arithmetic? You still use floats in your
code. I think you should convert to FT_Fixed first.

Best,
Alexei



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

2020-06-01 Thread Anuj Verma
Hello Werner,



*> 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.*

In that case I will start integrating the feature in FreeType. I have
decided to create a new renderer module and add a render mode accordingly.
And since I have a standalone implementation for generating SDF from
outlines,
I will go ahead and do that first and later I will do it for bitmaps.

Thanks,

Anuj