<html>
    <head>
      <base href="https://bugs.webkit.org/">
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [FreeType] Add initial implementation of variation fonts"
   href="https://bugs.webkit.org/show_bug.cgi?id=192151#c16">Comment # 16</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [FreeType] Add initial implementation of variation fonts"
   href="https://bugs.webkit.org/show_bug.cgi?id=192151">bug 192151</a>
              from <span class="vcard"><a class="email" href="mailto:cgarcia@igalia.com" title="Carlos Garcia Campos <cgarcia@igalia.com>"> <span class="fn">Carlos Garcia Campos</span></a>
</span></b>
        <pre>(In reply to Myles C. Maxfield from <a href="show_bug.cgi?id=192151#c12">comment #12</a>)
<span class="quote">> Comment on <span class=""><a href="attachment.cgi?id=356597&action=diff" name="attach_356597" title="Patch">attachment 356597</a> <a href="attachment.cgi?id=356597&action=edit" title="Patch">[details]</a></span>
> Patch

> View in context:
> <a href="https://bugs.webkit.org/attachment.cgi?id=356597&action=review">https://bugs.webkit.org/attachment.cgi?id=356597&action=review</a>

> > Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp:46
> > +#include FT_MULTIPLE_MASTERS_H

> Is this a header file? I'm confused.</span >

Yes, freetype is weird.

<span class="quote">> > Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp:523
> > +String buildVariationSettings(FT_Face face, const FontDescription& fontDescription)
> > +{
> > +    auto defaultValues = defaultVariationValues(face);
> > +    const auto& variations = fontDescription.variationSettings();
> > +
> > +    VariationsMap variationsToBeApplied;
> > +    auto applyVariation = [&](const FontTag& tag, float value) {
> > +        auto iterator = defaultValues.find(tag);
> > +        if (iterator == defaultValues.end())
> > +            return;
> > +        float valueToApply = clampTo(value, iterator->value.minimumValue, iterator->value.maximumValue);
> > +        variationsToBeApplied.set(tag, valueToApply);
> > +    };
> > +
> > +    for (auto& variation : variations)
> > +        applyVariation(variation.tag(), variation.value());
> > +
> > +    StringBuilder builder;
> > +    for (auto& variation : variationsToBeApplied) {
> > +        if (!builder.isEmpty())
> > +            builder.append(',');
> > +        builder.append(variation.key[0]);
> > +        builder.append(variation.key[1]);
> > +        builder.append(variation.key[2]);
> > +        builder.append(variation.key[3]);
> > +        builder.append('=');
> > +        builder.appendNumber(variation.value);
> > +    }
> > +    return builder.toString();

> Can't we share this code? We could build up a HashMap and then the cocoa
> ports could re-encode it as a CFDictionary at the last minute.</span >

Yes, I plan to refactor it once I add the clamp and normalization part, but I still don't understand how that works.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>