[Webkit-unassigned] [Bug 192151] [FreeType] Add initial implementation of variation fonts
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Dec 10 01:19:50 PST 2018
https://bugs.webkit.org/show_bug.cgi?id=192151
--- Comment #16 from Carlos Garcia Campos <cgarcia at igalia.com> ---
(In reply to Myles C. Maxfield from comment #12)
> Comment on attachment 356597 [details]
> 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.
Yes, freetype is weird.
> > 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.
Yes, I plan to refactor it once I add the clamp and normalization part, but I still don't understand how that works.
--
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/20181210/2ccdf3ae/attachment.html>
More information about the webkit-unassigned
mailing list