<div dir="ltr">Fixed the div-by-zero. Thanks.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Sep 16, 2017 at 10:12 PM, Adrian Johnson <span dir="ltr"><<a href="mailto:ajohnson@redneon.com" target="_blank">ajohnson@redneon.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 17/09/17 02:57, Matthias Clasen wrote:<br>
> On Fri, Sep 15, 2017 at 6:51 AM, Adrian Johnson <<a href="mailto:ajohnson@redneon.com">ajohnson@redneon.com</a><br>
</span><span class="">> <mailto:<a href="mailto:ajohnson@redneon.com">ajohnson@redneon.com</a>>> wrote:<br>
><br>
><br>
><br>
> We really need a test case for this. It is hard to review code I<br>
> can't test.<br>
><br>
><br>
> I've added a minimal testcase here:<br>
><br>
> <a href="https://github.com/matthiasclasen/cairo/tree/wip/matthiasc/font-variations" rel="noreferrer" target="_blank">https://github.com/<wbr>matthiasclasen/cairo/tree/wip/<wbr>matthiasc/font-variations</a><br>
><br>
> It promptly found a freetype bug :-)<br>
<br>
</span>I built the latest freetype, Behdad's fontconfig branch, and your branch.<br>
<br>
First problem I had was the variation test ignores the status. See<br>
attached patch.<br>
<br>
After fixing that and ensuring I had the correct font installed I got a<br>
crash in fontconfig.<br>
<br>
fcfreetype.c line 1313 divide by zero<br>
<br>
1312: double default_value = master->axis[i].def / (double) (1 << 16);<br>
1313: double mult = value / default_value;<br>
<br>
The Adobe Variable Font Prototype font has a 'CNTR' axis with a default<br>
value of 0.<br>
<br>
Some more comments on your patch:<br>
<br>
In cairo-font-options.c you are adding a new function<br>
_intern_string_hash() which is almost identical to the<br>
_intern_string_hash() in cairo-misc.c Any reason why the cairo-misc.c<br>
version can't be used?<br>
<br>
I've attached a patch that refactors the float parsing code from<br>
cff-subset into a new function: _cairo_strtod(). So you can now use this<br>
for a C locale strtod.<br>
<br>
In cairo_ft_apply_variations(), strtod() returns a double so just make<br>
'value' have type double instead of float.<br>
<br>
+/**<br>
+ * cairo_font_options_get_<wbr>variations:<br>
+ * @options: a #cairo_font_options_t<br>
+ *<br>
+ * Gets the OpenType font variations for the font options object.<br>
+ * See cairo_font_options_set_<wbr>variations() for details about the<br>
+ * string format.<br>
+ *<br>
+ * Return value: the font variations for the font options object. The<br>
+ * returned string belongs to the @options and must not be modified.<br>
+ * It is valid until the @options struct is modified.<br>
<br>
Should this be "It is valid until either the font options object is<br>
destroyed or the font variations in this object is modified with<br>
cairo_font_options_set_<wbr>variations()"?<br>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">behdad<br><a href="http://behdad.org/" target="_blank">http://behdad.org/</a></div>
</div>