[Webkit-unassigned] [Bug 192151] [FreeType] Add initial implementation of variation fonts

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Dec 6 10:41:46 PST 2018


https://bugs.webkit.org/show_bug.cgi?id=192151

--- Comment #12 from Myles C. Maxfield <mmaxfield at apple.com> ---
Comment on attachment 356597
  --> https://bugs.webkit.org/attachment.cgi?id=356597
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=356597&action=review

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

Is this a header file? I'm confused.

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

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20181206/0c7c30d9/attachment.html>


More information about the webkit-unassigned mailing list