Re: OpenType font variations and cairo

Behdad Esfahbod <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <CAF63+7VObFV7YK+qRpK6kbr_PvjE_rcsX1FaR7OU7VSo-pes7A@mail.gmail.com>
On Fri, Sep 15, 2017 at 3:51 AM, Adrian Johnson <[email protected]>
wrote:

> On 15/09/17 09:29, Matthias Clasen wrote:
> > On Thu, Sep 14, 2017 at 5:54 PM, Adrian Johnson <[email protected]
> > <mailto:[email protected]>> wrote:
> >
> >     On 15/09/17 05:52, Matthias Clasen wrote:
> >     > On Thu, Sep 14, 2017 at 12:37 PM, Behdad Esfahbod
> >     > <[email protected] <mailto:[email protected]>
> >     <mailto:[email protected]
> >     <mailto:[email protected]>>> wrote:
> >     >
> >     >     Thanks Matthias.  I took a look at the patch.  Looks good!
> Minor
> >     >     comments:
> >     >
> >     >     - Moving the format towards CSS by default (no comma, no equal
> sign;
> >     >     just spaces!) while accepting both is what I do in HarfBuzz.
> Maybe
> >     >     advertise the same here,  UPDATE: I was wrong.  CSS uses comma
> as
> >     >     well.  It's the equal sign that they don't use, they use
> space.  We
> >     >     should accept both.
> >     >
> >     >
> >     > I've made the parser a bit more flexible. It now accepts
> variations like
> >     >
> >     > wdth=200,wght=300
> >     > wdth 200, wght=300
> >     > wdth 200 , wght 300
> >
> >     Does it work with decimal commas?
> >
> >
> > The patch currently uses strtod, so yes, it will parse floating point
> > numbers, but decimal separators spell trouble.
> > I could rewrite it to use strtod_l, if that is ok to use in cairo.
>
> So what happens on platforms where strtod_l is not available?
>

Then parsing fails.  But then again, this is only hooked up in the FreeType
backend right now...


> The function decode_real() in cairo-cff-subset.c has code for locale
> independent parsing of floating-point numbers. Maybe that could be
> factored out into separate function and reused.
>

Sounds good.

Where is the variations text string normally expected to come from? I
> can see the code reading the FC_FONT_VARIATIONS property but I can't
> find this in the current fontconfig git. Where is this documented?
>

I have a branch that adds that.  I'll finish it today or tomorrow and
post.  You can wait till then.

Is the text string supplied to cairo_font_options_set_variations()
> likely to be generated by sprintf or is it always read from an external
> source in C locale format?
>
> We really need a test case for this. It is hard to review code I can't
> test.
>

In a day or two I'll have cairo piece hooked-up in hb-view, and then cairo
and fontconfig bits in pango-view.  That should simplify testing.

-- 
behdad
http://behdad.org/

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