WebKit Bugzilla
Attachment 368815 Details for
Bug 197528
: font-optical-sizing applies the wrong variation value
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Needs version check
bug-197528-20190502133838.patch (text/plain), 10.58 KB, created by
Myles C. Maxfield
on 2019-05-02 13:38:38 PDT
(
hide
)
Description:
Needs version check
Filename:
MIME Type:
Creator:
Myles C. Maxfield
Created:
2019-05-02 13:38:38 PDT
Size:
10.58 KB
patch
obsolete
>Subversion Revision: 244879 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 2446229b00348123cab158cc7ebd14d87d451937..7f0cec3ce4bd936a2d86fa9157c2025b5b8b314b 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,31 @@ >+2019-05-02 Myles C. Maxfield <mmaxfield@apple.com> >+ >+ font-optical-sizing applies the wrong variation value >+ https://bugs.webkit.org/show_bug.cgi?id=197528 >+ <rdar://problem/50152854> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ The OpenType spec says in >+ https://docs.microsoft.com/en-us/typography/opentype/spec/dvaraxistag_opsz >+ >+ "Scale interpretation: Values can be interpreted as text size, in points." >+ >+ It turns out that it means "typographic point size" which is equal to CSS pixels, not >+ CSS points. >+ >+ No new tests (OOPS!). >+ >+ * platform/graphics/cocoa/FontCacheCoreText.cpp: >+ (WebCore::preparePlatformFont): >+ (WebCore::fontWithFamily): >+ (WebCore::FontCache::systemFallbackForCharacters): >+ * platform/graphics/cocoa/FontCacheCoreText.h: >+ * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp: >+ (WebCore::FontFamilySpecificationCoreText::fontRanges const): >+ * platform/graphics/mac/FontCustomPlatformData.cpp: >+ (WebCore::FontCustomPlatformData::fontPlatformData): >+ > 2019-05-02 Jiewen Tan <jiewen_tan@apple.com> > > [WebAuthN] Add a quirk for google.com when processing AppID extension >diff --git a/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp b/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp >index 5f68b832357806abb06c462c70ea6acc3a12e111..5cd5b1ca400c64406e6abe5cdec5c4136a70363b 100644 >--- a/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp >+++ b/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp >@@ -521,14 +521,10 @@ struct FontType { > bool aatShaping { false }; > }; > >-RetainPtr<CTFontRef> preparePlatformFont(CTFontRef originalFont, const FontDescription& fontDescription, const FontFeatureSettings* fontFaceFeatures, const FontVariantSettings* fontFaceVariantSettings, FontSelectionSpecifiedCapabilities fontFaceCapabilities, float size, bool applyWeightWidthSlopeVariations) >+RetainPtr<CTFontRef> preparePlatformFont(CTFontRef originalFont, const FontDescription& fontDescription, const FontFeatureSettings* fontFaceFeatures, const FontVariantSettings* fontFaceVariantSettings, FontSelectionSpecifiedCapabilities fontFaceCapabilities, bool applyWeightWidthSlopeVariations) > { >- bool alwaysAddVariations = false; >- >- // FIXME: Remove when <rdar://problem/29859207> is fixed > #if ENABLE(VARIATION_FONTS) > auto defaultValues = defaultVariationValues(originalFont); >- alwaysAddVariations = !defaultValues.isEmpty(); > > auto fontSelectionRequest = fontDescription.fontSelectionRequest(); > auto fontOpticalSizing = fontDescription.opticalSizing(); >@@ -544,7 +540,11 @@ RetainPtr<CTFontRef> preparePlatformFont(CTFontRef originalFont, const FontDescr > const auto& variations = fontDescription.variationSettings(); > auto textRenderingMode = fontDescription.textRenderingMode(); > >- if (!originalFont || (!features.size() && (!alwaysAddVariations && variations.isEmpty()) && (textRenderingMode == TextRenderingMode::AutoTextRendering) && variantSettings.isAllNormal() >+ FontType fontType(originalFont); >+ >+ bool forceOpticalSizing = fontOpticalSizing == FontOpticalSizing::Enabled && fontType.variationType == FontType::VariationType::TrueTypeGX; >+ >+ if (!originalFont || (!features.size() && variations.isEmpty() && (textRenderingMode == TextRenderingMode::AutoTextRendering) && variantSettings.isAllNormal() && fontOpticalSizing == FontOpticalSizing::Enabled && !forceOpticalSizing > && (!fontFaceFeatures || !fontFaceFeatures->size()) && (!fontFaceVariantSettings || fontFaceVariantSettings->isAllNormal()))) > return originalFont; > >@@ -580,8 +580,6 @@ RetainPtr<CTFontRef> preparePlatformFont(CTFontRef originalFont, const FontDescr > for (auto& newFeature : features) > featuresToBeApplied.set(newFeature.tag(), newFeature.value()); > >- FontType fontType(originalFont); >- > #if ENABLE(VARIATION_FONTS) > VariationsMap variationsToBeApplied; > >@@ -619,14 +617,8 @@ RetainPtr<CTFontRef> preparePlatformFont(CTFontRef originalFont, const FontDescr > applyVariation({{'s', 'l', 'n', 't'}}, slope); > } > >- if (fontOpticalSizing == FontOpticalSizing::Enabled) { >- const float pxToPtRatio = 3.0f / 4; >- applyVariation({{'o', 'p', 's', 'z'}}, size * pxToPtRatio); >- } >- > for (auto& newVariation : variations) > applyVariation(newVariation.tag(), newVariation.value()); >- > #endif // ENABLE(VARIATION_FONTS) > > auto attributes = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); >@@ -655,11 +647,11 @@ RetainPtr<CTFontRef> preparePlatformFont(CTFontRef originalFont, const FontDescr > } > #endif > >- if (textRenderingMode == TextRenderingMode::OptimizeLegibility) { >- CGFloat size = CTFontGetSize(originalFont); >- auto sizeNumber = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberCGFloatType, &size)); >- CFDictionaryAddValue(attributes.get(), kCTFontOpticalSizeAttribute, sizeNumber.get()); >- } >+ if (forceOpticalSizing) >+ CFDictionaryAddValue(attributes.get(), kCTFontOpticalSizeAttribute, CFSTR("auto")); >+ else if (fontOpticalSizing == FontOpticalSizing::Disabled) >+ CFDictionaryAddValue(attributes.get(), kCTFontOpticalSizeAttribute, CFSTR("none")); >+ > auto descriptor = adoptCF(CTFontDescriptorCreateWithAttributes(attributes.get())); > auto result = adoptCF(CTFontCreateCopyWithAttributes(originalFont, CTFontGetSize(originalFont), nullptr, descriptor.get())); > return result; >@@ -1223,7 +1215,7 @@ static RetainPtr<CTFontRef> fontWithFamily(const AtomicString& family, const Fon > fontLookup.result = platformFontWithFamilySpecialCase(family, request, size, fontDescription.shouldAllowUserInstalledFonts()); > if (!fontLookup.result) > fontLookup = platformFontLookupWithFamily(family, request, size, fontDescription.shouldAllowUserInstalledFonts()); >- return preparePlatformFont(fontLookup.result.get(), fontDescription, fontFaceFeatures, fontFaceVariantSettings, fontFaceCapabilities, size, !fontLookup.createdFromPostScriptName); >+ return preparePlatformFont(fontLookup.result.get(), fontDescription, fontFaceFeatures, fontFaceVariantSettings, fontFaceCapabilities, !fontLookup.createdFromPostScriptName); > } > > #if PLATFORM(MAC) >@@ -1374,7 +1366,7 @@ RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& descr > m_fontNamesRequiringSystemFallbackForPrewarming.add(fullName); > > auto result = lookupFallbackFont(platformData.font(), description.weight(), description.locale(), characters, length); >- result = preparePlatformFont(result.get(), description, nullptr, nullptr, { }, description.computedSize()); >+ result = preparePlatformFont(result.get(), description, nullptr, nullptr, { }); > > if (!result) > return lastResortFallbackFont(description); >diff --git a/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.h b/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.h >index 5cf6cd29ef539b97fe53f172582f6ed0bf8b5cf4..d11db980743d518fc2eb39ed7f13ace66bf7e07b 100644 >--- a/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.h >+++ b/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.h >@@ -50,7 +50,7 @@ struct SynthesisPair { > bool needsSyntheticOblique; > }; > >-RetainPtr<CTFontRef> preparePlatformFont(CTFontRef, const FontDescription&, const FontFeatureSettings* fontFaceFeatures, const FontVariantSettings* fontFaceVariantSettings, FontSelectionSpecifiedCapabilities fontFaceCapabilities, float size, bool applyWeightWidthSlopeVariations = true); >+RetainPtr<CTFontRef> preparePlatformFont(CTFontRef, const FontDescription&, const FontFeatureSettings* fontFaceFeatures, const FontVariantSettings* fontFaceVariantSettings, FontSelectionSpecifiedCapabilities fontFaceCapabilities, bool applyWeightWidthSlopeVariations = true); > SynthesisPair computeNecessarySynthesis(CTFontRef, const FontDescription&, bool isPlatformFont = false); > RetainPtr<CTFontRef> platformFontWithFamilySpecialCase(const AtomicString& family, FontSelectionRequest, float size, AllowUserInstalledFonts); > RetainPtr<CTFontRef> platformFontWithFamily(const AtomicString& family, FontSelectionRequest, TextRenderingMode, float size); >diff --git a/Source/WebCore/platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp b/Source/WebCore/platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp >index b749cdaefefb37ac386ef9a3d1809adb71e0e5b5..c8911c4a171cda2ab8194995162ca6b07db88752 100644 >--- a/Source/WebCore/platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp >+++ b/Source/WebCore/platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp >@@ -108,7 +108,7 @@ FontRanges FontFamilySpecificationCoreText::fontRanges(const FontDescription& fo > fontForSynthesisComputation = physicalFont; > #endif > >- font = preparePlatformFont(font.get(), fontDescription, nullptr, nullptr, { }, fontDescription.computedSize()); >+ font = preparePlatformFont(font.get(), fontDescription, nullptr, nullptr, { }); > > bool syntheticBold, syntheticOblique; > std::tie(syntheticBold, syntheticOblique) = computeNecessarySynthesis(fontForSynthesisComputation.get(), fontDescription).boldObliquePair(); >diff --git a/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp b/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp >index 8c19a7fe0e6c6785fb0a0f5d455a7fedd95ff387..3d5ef09b7d9403059741d80828f518defc8423b5 100644 >--- a/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp >+++ b/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp >@@ -46,7 +46,7 @@ FontPlatformData FontCustomPlatformData::fontPlatformData(const FontDescription& > FontOrientation orientation = fontDescription.orientation(); > FontWidthVariant widthVariant = fontDescription.widthVariant(); > RetainPtr<CTFontRef> font = adoptCF(CTFontCreateWithFontDescriptor(modifiedFontDescriptor.get(), size, nullptr)); >- font = preparePlatformFont(font.get(), fontDescription, &fontFaceFeatures, &fontFaceVariantSettings, fontFaceCapabilities, fontDescription.computedSize()); >+ font = preparePlatformFont(font.get(), fontDescription, &fontFaceFeatures, &fontFaceVariantSettings, fontFaceCapabilities); > ASSERT(font); > return FontPlatformData(font.get(), size, bold, italic, orientation, widthVariant, fontDescription.textRenderingMode()); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 197528
:
368815
|
368820
|
368823
|
368826
|
368827
|
368845
|
370156
|
370173
|
370176
|
370178
|
370179
|
370255
|
370262
|
370263
|
370266
|
370269
|
370281
|
370282
|
370291
|
370470