[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cairo
Subject:    Re: [cairo] OpenType font variations and cairo
From:       Matthias Clasen <matthias.clasen () gmail ! com>
Date:       2017-09-22 11:10:39
Message-ID: CAFwd_vDCQ-gwS0uaPvzH19vD1jwt+Z-f7SUeSPgAKoVzyD4xCQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On Fri, Sep 22, 2017 at 1:10 AM, Werner LEMBERG <wl@gnu.org> 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 ?

[Attachment #5 (text/html)]

<div dir="ltr">On Fri, Sep 22, 2017 at 1:10 AM, Werner LEMBERG <span dir="ltr">&lt;<a \
href="mailto:wl@gnu.org" target="_blank">wl@gnu.org</a>&gt;</span> wrote:<br><div \
class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" \
style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><span class="gmail-"><br> &gt; One of my tests \
happens to set the axes to the coords of a named<br> &gt; instance.   freetype takes \
that as a signal to turn the FT_Face into<br> &gt; a named instance,<br>
<br>
</span>It sets the named instance index in `face-&gt;face_index&#39;, that&#39;s \
all.<br> <span class="gmail-"><br>
&gt; and then the next test that doesn&#39;t explicitly sets a weight value<br>
&gt; gets the named instance coordinate instead of the axis default.<br>
<br>
</span>This part I don&#39;t understand.   Please elaborate.   What are you doing<br>
code-wise, what do you expect, and what does FreeType?<br>
<span class="gmail-HOEnZb"><font \
color="#888888"><br></font></span></blockquote><div><br></div><div>For each test, I \
create a new cairo_scaled_font instance, using the same <br></div><div>fontconfig \
pattern and different font options (this is where the test \
input</div><div>goes):<br></div><div><br></div><div>       pattern = FcPatternBuild \
(NULL,<br>                                                           FC_FAMILY, \
FcTypeString, (FcChar8*)&quot;Adobe Variable Font Prototype&quot;,<br>                \
NULL);<br>       font_face = cairo_ft_font_face_create_for_pattern \
(pattern);</div><div>       cairo_font_options_set_variations (options, \
input);</div><div>       scaled_font = cairo_scaled_font_create (font_face, \
&amp;matrix, &amp;matrix, options);<br></div><div><br></div><div>and then I pull out \
the FT_Face, and I find that I get the same one every time, since</div><div>cairo \
caches them:</div><div><br></div><div>       ft_face = cairo_ft_scaled_font_lock_face \
(scaled_font);<br></div><div><br></div><div>But now, the nature of the cached object \
changes underneath us (sometimes it represents a</div><div>named instance, and \
sometimes it doesn&#39;t). And the code applying the font options \
to</div><div>changes its behavior depending on this, which leads to a mess. We need \
to either</div><div><br></div><div>a) not cache a changing object</div><div>b) take \
the named instanceness into account for caching</div><div>c) ignore the named \
instanceness when applying font options</div><div><br></div><div>Behdad \
?<br></div><div><br></div></div></div></div>


[Attachment #6 (text/plain)]

-- 
cairo mailing list
cairo@cairographics.org
https://lists.cairographics.org/mailman/listinfo/cairo

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic