Re: OpenType font variations and cairo
Behdad Esfahbod <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <CAF63+7UoHmU9zR==s7oQFoGp7wGsCxpptt8QpPLH9fPiD_h41g@mail.gmail.com> |
On Thu, Sep 14, 2017 at 2:54 PM, Adrian Johnson <[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]>> 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? > Good point. HarfBuzz has same problem. glib has g_ascii_strtod() that always uses '.' as decimal separator. We need something like that in cairo and HarfBuzz. Such a pain :(. https://git.gnome.org/browse/glib/tree/glib/gstrfuncs.c#n687 > > > > > - Maybe make the variations member be "const char *" instead of > > "char *". > > > > > > But I'm strdup'ing and freeing it. The const will get in the way there. > > > > > > - In +cairo_font_options_set_variations(), typically in these kinds > > of functions I like copying then freeing the old value, such that > > the input can be the return value of get_variations() on the same > > object. > > > > > > Done > > > > > > - > > (((uint8_t)p[0])<<24)|(((uint8_t)p[1])<<16)|(((uint8_t) > p[2])<<8)|((uint8_t)p[3]); > > FreeType has a macro for that: FT_MAKE_TAG() > > > > > > Thanks for the reminder. Done. > > > > (Generally I find it easier pushing a tree on github and reviewing > > there; also because I can just fix stuff and push my own tree.) > > > > > > You can find the new version here: > > > > https://github.com/matthiasclasen/cairo/commits/ > wip/matthiasc/font-variations > > > > > > > > -- behdad http://behdad.org/ -- cairo mailing list [email protected] https://lists.cairographics.org/mailman/listinfo/cairo