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

2020-08-03 Thread Anuj Verma
> Only FT_PIXEL_MODE_MONO is necessary to add. I do not understand how
> LCD or BGRA can be used for SDF; GRAY2 and GRAY4 are defunct.

It might be possible to convert LCD and BGRA to SDF, either using  a single
channel or by converting them to grayscale, but yeah I don't think that
will be
useful. And I will skip GRAY2 and GRAY4.

> If I understand correctly, overlaps cause unexpected discontinuity in
> SDF, which otherwise should not have any. I doubt that detecting and
> removing contour overlaps is productive. I would rather deal with the
> discontinuity directly. Perhaps there is a clever way to ignore
> smaller distances that unexpectedly have an opposite sign. The
> distance cannot change by more than the grid size. If it does, ignore
> the offending value.

Yes, overlaps cause discontinuity in both sign and distances. Detecting
unexpected opposite sign is possible, but the sign may not be opposite.
In many cases the sign is not flipped (there is no unexpected change
in sign) and the distances interpolate smoothly, in those cases it becomes
hard to find the true distances of the point.
There is a way to do it, which is done in the 'msdfgen' library, but it is
not perfect and I don't know whether it will work with subdivision
optimization
or not.
I will try to think of some other way of handling overlaps without actually
removing overlaps, but I think the most robust way to do it would be to
remove the overlaps.

Thanks,
Anuj


Re: Logging Library-GSOC

2020-08-03 Thread Alexei Podtelezhnikov
Hi Priyesh

On Mon, Aug 3, 2020 at 10:33 AM Priyesh kumar  wrote:
>
> Hi Alexei,
> Is there any update for me regarding Werner's previous mail?
>> > The dlg project contains two configurations: `Debug' and `Debug
>> > Static' on both `x64' and `Win32' platforms and will be built with
>> > FreeType, whenever FreeType is built in these configurations.  I
>> > have also added a windows batch file which is called as a pre-built
>> > event whenever dlg is built, and it takes care of copying files from
>> > `submodules/dlg' to `src/dlg'...  For `Release' and `Release Static'
>> > builds of FreeType the dlg project build will simply be skipped.
>>
>> OK.  Alexei, can you please have a look?  I have no clue about
>> Visual C, and I guess Priyesh wants to have comments.

It looks ok as far as clean separation. I don't quite understand why
you need to copy files and how to disable dlg.

Thanks,
Alexei



Re: Logging Library-GSOC

2020-08-03 Thread Priyesh kumar
Hi Alexei,
Is there any update for me regarding Werner's previous mail?

Thanks,
Priyesh

On Fri, Jul 31, 2020 at 11:42 PM Werner LEMBERG  wrote:

>
> > I have added a project under `builds/windows/vc2010/freetype.sln'
> > file to build dlg along with FreeType on Windows.
>
> Thanks.
>
> > The dlg project contains two configurations: `Debug' and `Debug
> > Static' on both `x64' and `Win32' platforms and will be built with
> > FreeType, whenever FreeType is built in these configurations.  I
> > have also added a windows batch file which is called as a pre-built
> > event whenever dlg is built, and it takes care of copying files from
> > `submodules/dlg' to `src/dlg'...  For `Release' and `Release Static'
> > builds of FreeType the dlg project build will simply be skipped.
>
> OK.  Alexei, can you please have a look?  I have no clue about
> Visual C, and I guess Priyesh wants to have comments.
>
> > And for proceeding further, I wanted to ask that do I have to add
> > the dlg project on other compilers(builds/windows/visualc,
> > builds/windows/visualce) also?
>
> No, not necessary IMHO.
>
>
> Werner
>


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

2020-08-03 Thread Alexei Podtelezhnikov
Hi Anuj,

> I have mostly completed the bitmap to SDF renderer (bsdf), there
> are only a few things remaining such as support for all pixel
> modes (currently it only work with FT_PIXEL_MODE_GRAY),

Only FT_PIXEL_MODE_MONO is necessary to add. I do not understand how
LCD or BGRA can be used for SDF; GRAY2 and GRAY4 are defunct.

> After that I have not decided what to do. I have a few things in mind (adding
> floating point support, removing overlaps [skip]

If I understand correctly, overlaps cause unexpected discontinuity in
SDF, which otherwise should not have any. I doubt that detecting and
removing contour overlaps is productive. I would rather deal with the
discontinuity directly. Perhaps there is a clever way to ignore
smaller distances that unexpectedly have an opposite sign. The
distance cannot change by more than the grid size. If it does, ignore
the offending value.

> CascadiaCode.ttf

Oh those variable fonts with overlaps...  When you read
https://docs.microsoft.com/en-us/typography/opentype/spec/glyf#simpleGlyphFlags
on OVERLAP_SIMPLE, there is a glimmer of hope: "either set this flag
in the derived glyph data, or else should merge contours to remove
overlap". So the flag is basically required in static fonts. I hope it
will be required in variable fonts too in the next version of specs.

Alexei



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

2020-08-03 Thread Anuj Verma
Hello Werner, Alexei,

I have mostly completed the bitmap to SDF renderer (bsdf), there
are only a few things remaining such as support for all pixel
modes (currently it only work with FT_PIXEL_MODE_GRAY),
and warnings etc. I did say before that the bitmap to SDF will require
less memory than the other, but that is not the case, after I read the
algorithm and implemented it, both the renderers have similar memory
requirements. The only advantage of the  bsdf renderer is that it can
handle glyphs with overlaps.

Next, I will be finishing the bsdf renderer and then writing the
documentation
for all the functions (should I write for structs as well? i.e. detailed
description
of all the members). Also is there any other kind of documentation that I
should
add ?
After that I have not decided what to do. I have a few things in mind
(adding
floating point support, removing overlaps and a few more). But we can
discuss
that once I have finished the documentation. (Also, I will keep improving
the
existing algorithms, optimizing and removing any bug that I find along the
way)

I have updated the demo (https://github.com/preversewharf45/ft2sdf-demo)
and this time I have added the help screen ('?' or F1), I have also included
a font `CascadiaCode.ttf' which is full of overlaps, so that you can compare
both the renderers.

Thanks,
Anuj