Re: OpenType font variations and cairo

Matthias Clasen <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <CAFwd_vDCQ-gwS0uaPvzH19vD1jwt+Z-f7SUeSPgAKoVzyD4xCQ@mail.gmail.com>
On Fri, Sep 22, 2017 at 1:10 AM, Werner LEMBERG <[email protected]> wrote:

>
> > One of my tests happens to set the axes to the coords of a named
> > instance.  freetype takes that as a signal to turn the FT_Face into
> > a named instance,
>
> It sets the named instance index in `face->face_index', that's all.
>
> > and then the next test that doesn't explicitly sets a weight value
> > gets the named instance coordinate instead of the axis default.
>
> This part I don't understand.  Please elaborate.  What are you doing
> code-wise, what do you expect, and what does FreeType?
>
>
For each test, I create a new cairo_scaled_font instance, using the same
fontconfig pattern and different font options (this is where the test input
goes):

    pattern = FcPatternBuild (NULL,
                              FC_FAMILY, FcTypeString, (FcChar8*)"Adobe
Variable Font Prototype",
                              NULL);
    font_face = cairo_ft_font_face_create_for_pattern (pattern);
    cairo_font_options_set_variations (options, input);
    scaled_font = cairo_scaled_font_create (font_face, &matrix, &matrix,
options);

and then I pull out the FT_Face, and I find that I get the same one every
time, since
cairo caches them:

    ft_face = cairo_ft_scaled_font_lock_face (scaled_font);

But now, the nature of the cached object changes underneath us (sometimes
it represents a
named instance, and sometimes it doesn't). And the code applying the font
options to
changes its behavior depending on this, which leads to a mess. We need to
either

a) not cache a changing object
b) take the named instanceness into account for caching
c) ignore the named instanceness when applying font options

Behdad ?

-- 
cairo mailing list
[email protected]
https://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.