Expand font-weight and font-stretch to take any number
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 6 Mar 2017 21:40:31 +0000 (21:40 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 6 Mar 2017 21:40:31 +0000 (21:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=168889

Reviewed by Simon Fraser.

Source/WebCore:

This patch expands parsing support for font-weight and font-stretch so that they can accept
numbers in addition to the keyword values they accepted previously. Eventually, these numbers
will be used as inputs to select variation fonts; however, in this patch, the values are just
parsed and held in our internal data model. This means that this patch doesn't actually change
the general behavior of WebKit; instead, it parses new values, outputs them (via
getComputedStyle() and similar functions), and provides them as input to our preexisting font
selection algorithm.

This patch doesn't actually modify anything algorithmically, and therefore, it doesn't include
any additional tests for the font selection algorithm. Instead, it tests the parsing of the
newly accepted values (both input and output).

Because our internal data model needs to hold numbers now, this patch also completely eliminates
the FontWidth, FontItalic, and FontTraitsMask enum values in favor of FontSelectionValues (which
can hold numbers instead of individual enum values). Therefore, every place which we were using
these enum values is migrated in this patch to using FontSelectionValues instead.

Tests: fast/text/font-selection-font-face-parse.html
       fast/text/font-selection-font-loading-api-parse.html
       fast/text/font-style-parse.html
       fast/text/font-weight-parse.html

* accessibility/AccessibilityRenderObject.cpp: Migrate off of old enum types.
(WebCore::AccessibilityRenderObject::hasBoldFont):
(WebCore::AccessibilityRenderObject::hasItalicFont):
(WebCore::AccessibilityRenderObject::hasPlainText):
* accessibility/atk/WebKitAccessibleInterfaceText.cpp: Ditto.
(getAttributeSetForAccessibilityObject):
* css/CSSComputedStyleDeclaration.cpp: Output newly parsed values.
(WebCore::fontWeightFromStyle):
(WebCore::fontStretchFromStyle):
(WebCore::fontStyleFromStyle):
(WebCore::fontShorthandValueForSelectionProperties):
(WebCore::ComputedStyleExtractor::propertyValue):
* css/CSSFontFace.cpp: Migrate off old enum types.
(WebCore::calculateWeightRange):
(WebCore::CSSFontFace::setWeight):
(WebCore::calculateStretchRange):
(WebCore::CSSFontFace::setStretch):
(WebCore::calculateStyleRange):
(WebCore::CSSFontFace::setStyle):
(WebCore::CSSFontFace::calculateStyleMask): Deleted.
(WebCore::CSSFontFace::calculateWeightMask): Deleted.
(WebCore::CSSFontFace::calculateStretch): Deleted.
* css/CSSFontFace.h:
* css/CSSFontFaceSet.cpp: Migrate off old enum types.
(WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered):
(WebCore::calculateWeightValue):
(WebCore::calculateStretchValue):
(WebCore::calculateStyleValue):
(WebCore::computeFontSelectionRequest):
(WebCore::CSSFontFaceSet::matchingFaces):
(WebCore::CSSFontFaceSet::fontFace):
(WebCore::computeFontTraitsMask): Deleted.
(WebCore::computeFontStretch): Deleted.
* css/CSSFontFaceSet.h:
* css/CSSFontSelector.cpp: Migrate off old enum types.
(WebCore::CSSFontSelector::fontRangesForFamily):
* css/CSSPrimitiveValueMappings.h: font-weight and font-style are no longer
keyword properties.
(WebCore::CSSPrimitiveValue::operator FontWeight): Deleted.
(WebCore::CSSPrimitiveValue::operator FontItalic): Deleted.
* css/CSSProperties.json: Use the same infrastructure for all three of the
font selection properties.
* css/CSSSegmentedFontFace.cpp: Migrate off old enum types.
(WebCore::CSSSegmentedFontFace::fontRanges):
* css/CSSValueKeywords.in: The 100-based font-weight values are now represented
as real numbers.
* css/FontFace.cpp: Update the string output functions for the new values.
(WebCore::rangeIsSingleValue):
(WebCore::FontFace::style):
(WebCore::FontFace::weight):
(WebCore::FontFace::stretch):
* css/StyleBuilderConverter.h: Use CSSValue conversion functions to convert
to our new data model.
(WebCore::StyleBuilderConverter::convertFontWeight):
(WebCore::StyleBuilderConverter::convertFontStretch):
(WebCore::StyleBuilderConverter::convertFontStyle):
* css/StyleBuilderCustom.h: font-weight is no longer a completely custom
property.
(WebCore::StyleBuilderCustom::applyInitialFontWeight): Deleted.
(WebCore::StyleBuilderCustom::applyInheritFontWeight): Deleted.
(WebCore::StyleBuilderCustom::applyValueFontWeight): Deleted.
* css/parser/CSSParserFastPaths.cpp: font-style is no longer a keyword property.
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
(WebCore::CSSParserFastPaths::isKeywordPropertyID):
* css/parser/CSSPropertyParser.cpp: Parse the new values in the font selection
properties.
(WebCore::consumeFontWeightKeywordValue):
(WebCore::consumeFontWeightCSS21):
(WebCore::consumeFontWeight):
(WebCore::consumeFontStyleKeywordValue):
(WebCore::consumeFontStyle):
(WebCore::CSSPropertyParser::parseSingleValue):
(WebCore::CSSPropertyParser::parseFontFaceDescriptor):
(WebCore::CSSPropertyParser::consumeSystemFont):
(WebCore::CSSPropertyParser::consumeFont):
* editing/EditingStyle.cpp: Migrate off old enum types.
(WebCore::fontWeightIsBold):
* editing/mac/EditorMac.mm: Ditto.
(WebCore::Editor::applyFontStyles):
* platform/graphics/FontCache.h: Unify our font selection values into
their enclosing struct, FontSelectionCapabilities. Also, clean up utility
functions.
* platform/graphics/FontCascade.cpp: Migrate off old enum types.
(WebCore::FontCascade::FontCascade):
* platform/graphics/FontCascade.h: Ditto.
(WebCore::FontCascade::italic):
(WebCore::FontCascade::weight):
* platform/graphics/FontDescription.cpp: Ditto.
(WebCore::FontDescription::FontDescription):
(WebCore::FontCascadeDescription::lighterWeight):
(WebCore::FontCascadeDescription::bolderWeight):
(WebCore::FontDescription::traitsMask): Deleted.
* platform/graphics/FontDescription.h: Migrate off old enum types.
(WebCore::FontDescription::italic):
(WebCore::FontDescription::stretch):
(WebCore::FontDescription::weight):
(WebCore::FontDescription::fontSelectionRequest):
(WebCore::FontDescription::computedPixelSize):
(WebCore::FontDescription::setItalic):
(WebCore::FontDescription::setStretch):
(WebCore::FontDescription::setIsItalic):
(WebCore::FontDescription::setWeight):
(WebCore::FontDescription::operator==):
(WebCore::FontCascadeDescription::lighterWeight):
(WebCore::FontCascadeDescription::bolderWeight):
(WebCore::FontCascadeDescription::initialItalic):
(WebCore::FontCascadeDescription::initialWeight):
(WebCore::FontCascadeDescription::initialStretch):
* platform/graphics/FontSelectionAlgorithm.cpp: Delete code which was only
present to convert from the old enum types to the new FontSelectionRequest
type.
(WebCore::fontSelectionRequestForTraitsMask): Deleted.
(WebCore::initialFontSelectionCapabilitiesForTraitsMask): Deleted.
(WebCore::fontSelectionCapabilitiesForTraitsMask): Deleted.
* platform/graphics/FontSelectionAlgorithm.h: Migrate to new named functions
for special values.
(WebCore::isItalic):
(WebCore::boldWeightValue):
(WebCore::normalWeightValue):
(WebCore::isFontWeightBold):
(WebCore::normalStretchValue):
(WebCore::FontSelectionRequest::FontSelectionRequest):
* platform/graphics/cocoa/FontCacheCoreText.cpp: Migrate all platforms which
compile this file to know about FontDatabase. This simplifies the interaction
between @font-face fonts and installed fonts. Also, migrate off old enum types.
(WebCore::stretchFromCoreTextTraits):
(WebCore::fontWeightFromCoreText):
(WebCore::capabilitiesForFontDescriptor):
(WebCore::FontCache::getFontSelectionCapabilitiesInFamily):
(WebCore::platformFontLookupWithFamily):
(WebCore::invalidateFontCache):
(WebCore::fontWithFamily):
(WebCore::FontCache::createFontPlatformData):
(WebCore::lookupFallbackFont):
(WebCore::toTraitsMask): Deleted.
(WebCore::isFontWeightBold): Deleted.
(WebCore::toCoreTextFontWeight): Deleted.
(): Deleted.
(WebCore::FontDatabase::capabilitiesForFontDescriptor): Deleted.
(WebCore::calculateFontSelectionRequest): Deleted.
* platform/graphics/freetype/FontCacheFreeType.cpp: Migrate off old enum types.
(WebCore::FontCache::getFontSelectionCapabilitiesInFamily):
(WebCore::fontWeightToFontconfigWeight):
(): Deleted.
* platform/graphics/freetype/FontPlatformDataFreeType.cpp: Ditto.
(WebCore::FontPlatformData::FontPlatformData):
* platform/graphics/ios/FontCacheIOS.mm: Ditto.
(WebCore::baseSystemFontDescriptor):
(WebCore::systemFontModificationAttributes):
(WebCore::systemFontDescriptor):
(WebCore::platformFontWithFamilySpecialCase):
(WebCore::FontCache::weightOfCTFont): Deleted.
* platform/graphics/mac/FontCacheMac.mm: Ditto.
(WebCore::toNSFontWeight):
(WebCore::platformFontWithFamilySpecialCase):
* platform/graphics/win/FontCacheWin.cpp: Ditto.
(WebCore::toGDIFontWeight):
(WebCore::traitsInFamilyEnumProc):
(WebCore::FontCache::getFontSelectionCapabilitiesInFamily):
(): Deleted.
* platform/mock/MockRealtimeVideoSource.cpp: Ditto.
(WebCore::MockRealtimeVideoSource::applySize):
* platform/text/TextFlags.h: Delete old enum types.
* platform/win/DragImageWin.cpp: Migrate off old enum types.
(WebCore::dragLabelFont):
* rendering/RenderEmbeddedObject.cpp: Ditto.
(WebCore::RenderEmbeddedObject::getReplacementTextGeometry):
* rendering/RenderThemeGtk.cpp: Ditto.
(WebCore::RenderThemeGtk::updateCachedSystemFontDescription):
* rendering/RenderThemeIOS.mm: Ditto.
(WebCore::RenderThemeIOS::updateCachedSystemFontDescription):
* rendering/RenderThemeMac.mm: Ditto.
(WebCore::toFontWeight):
* rendering/RenderThemeWin.cpp: Ditto.
(WebCore::fillFontDescription):

Source/WebKit/mac:

Migrate off old enum types.

* WebCoreSupport/PopupMenuMac.mm:
(PopupMenuMac::populate):
* WebView/WebHTMLView.mm:
(fontNameForDescription):
* WebView/WebView.mm:
(-[WebView updateTextTouchBar]):

Source/WebKit/win:

Migrate off old enum types.

* WebKitGraphics.cpp:
(makeFont):

Source/WebKit2:

Migrate off old enum types.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::editorState):

Tools:

Migrate off old enum types.

* TestWebKitAPI/Tests/WebCore/FontCache.cpp:
(TestWebKitAPI::createPlatformFont):
(TestWebKitAPI::compareFonts):
(TestWebKitAPI::TEST_F):

LayoutTests:

* fast/text/font-selection-font-face-parse-expected.txt: Added.
* fast/text/font-selection-font-face-parse.html: Added.
* fast/text/font-selection-font-loading-api-parse-expected.txt: Added.
* fast/text/font-selection-font-loading-api-parse.html: Added.
* fast/text/font-stretch-parse-expected.txt:
* fast/text/font-stretch-parse.html:
* fast/text/font-style-parse-expected.txt: Copied from LayoutTests/fast/text/font-stretch-parse-expected.txt.
* fast/text/font-style-parse.html: Added.
* fast/text/font-weight-parse-expected.txt: Copied from LayoutTests/fast/text/font-stretch-parse-expected.txt.
* fast/text/font-weight-parse.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213464 268f45cc-cd09-0410-ab3c-d52691b4dbfc

65 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/text/font-selection-font-face-parse-expected.txt [new file with mode: 0644]
LayoutTests/fast/text/font-selection-font-face-parse.html [new file with mode: 0644]
LayoutTests/fast/text/font-selection-font-loading-api-parse-expected.txt [new file with mode: 0644]
LayoutTests/fast/text/font-selection-font-loading-api-parse.html [new file with mode: 0644]
LayoutTests/fast/text/font-stretch-parse-expected.txt
LayoutTests/fast/text/font-stretch-parse.html
LayoutTests/fast/text/font-style-parse-expected.txt [new file with mode: 0644]
LayoutTests/fast/text/font-style-parse.html [new file with mode: 0644]
LayoutTests/fast/text/font-weight-parse-expected.txt [new file with mode: 0644]
LayoutTests/fast/text/font-weight-parse.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/accessibility/AccessibilityRenderObject.cpp
Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSFontFace.cpp
Source/WebCore/css/CSSFontFace.h
Source/WebCore/css/CSSFontFaceSet.cpp
Source/WebCore/css/CSSFontFaceSet.h
Source/WebCore/css/CSSFontSelector.cpp
Source/WebCore/css/CSSPrimitiveValueMappings.h
Source/WebCore/css/CSSProperties.json
Source/WebCore/css/CSSSegmentedFontFace.cpp
Source/WebCore/css/CSSValueKeywords.in
Source/WebCore/css/FontFace.cpp
Source/WebCore/css/FontSelectionValueInlines.h [new file with mode: 0644]
Source/WebCore/css/StyleBuilderConverter.h
Source/WebCore/css/StyleBuilderCustom.h
Source/WebCore/css/parser/CSSParserFastPaths.cpp
Source/WebCore/css/parser/CSSPropertyParser.cpp
Source/WebCore/editing/EditingStyle.cpp
Source/WebCore/editing/mac/EditorMac.mm
Source/WebCore/platform/graphics/FontCache.h
Source/WebCore/platform/graphics/FontCascade.cpp
Source/WebCore/platform/graphics/FontCascade.h
Source/WebCore/platform/graphics/FontDescription.cpp
Source/WebCore/platform/graphics/FontDescription.h
Source/WebCore/platform/graphics/FontSelectionAlgorithm.cpp
Source/WebCore/platform/graphics/FontSelectionAlgorithm.h
Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp
Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp
Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp
Source/WebCore/platform/graphics/ios/FontCacheIOS.mm
Source/WebCore/platform/graphics/mac/FontCacheMac.mm
Source/WebCore/platform/graphics/win/FontCacheWin.cpp
Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp
Source/WebCore/platform/text/TextFlags.h
Source/WebCore/platform/win/DragImageWin.cpp
Source/WebCore/rendering/RenderEmbeddedObject.cpp
Source/WebCore/rendering/RenderThemeGtk.cpp
Source/WebCore/rendering/RenderThemeIOS.mm
Source/WebCore/rendering/RenderThemeMac.mm
Source/WebCore/rendering/RenderThemeWin.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/PopupMenuMac.mm
Source/WebKit/mac/WebView/WebHTMLView.mm
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit/win/ChangeLog
Source/WebKit/win/DOMCoreClasses.cpp
Source/WebKit/win/WebKitGraphics.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebCore/FontCache.cpp

index 9bf3452..8c7c38d 100644 (file)
@@ -1,3 +1,21 @@
+2017-03-06  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        Expand font-weight and font-stretch to take any number
+        https://bugs.webkit.org/show_bug.cgi?id=168889
+
+        Reviewed by Simon Fraser.
+
+        * fast/text/font-selection-font-face-parse-expected.txt: Added.
+        * fast/text/font-selection-font-face-parse.html: Added.
+        * fast/text/font-selection-font-loading-api-parse-expected.txt: Added.
+        * fast/text/font-selection-font-loading-api-parse.html: Added.
+        * fast/text/font-stretch-parse-expected.txt:
+        * fast/text/font-stretch-parse.html:
+        * fast/text/font-style-parse-expected.txt: Copied from LayoutTests/fast/text/font-stretch-parse-expected.txt.
+        * fast/text/font-style-parse.html: Added.
+        * fast/text/font-weight-parse-expected.txt: Copied from LayoutTests/fast/text/font-stretch-parse-expected.txt.
+        * fast/text/font-weight-parse.html: Added.
+
 2017-03-06  Carlos Alberto Lopez Perez  <clopez@igalia.com>
 
         [GTK] Mark fast/parser/adoption-agency-unload-iframe-4.html as timing out on platform GTK.
diff --git a/LayoutTests/fast/text/font-selection-font-face-parse-expected.txt b/LayoutTests/fast/text/font-selection-font-face-parse-expected.txt
new file mode 100644 (file)
index 0000000..d49d2c7
--- /dev/null
@@ -0,0 +1,49 @@
+PASS weightTestSheet.cssRules[0].style.fontWeight is "1"
+PASS weightTestSheet.cssRules[1].style.fontWeight is "100"
+PASS weightTestSheet.cssRules[2].style.fontWeight is "200"
+PASS weightTestSheet.cssRules[3].style.fontWeight is "300"
+PASS weightTestSheet.cssRules[4].style.fontWeight is "400"
+PASS weightTestSheet.cssRules[5].style.fontWeight is "normal"
+PASS weightTestSheet.cssRules[6].style.fontWeight is "500"
+PASS weightTestSheet.cssRules[7].style.fontWeight is "600"
+PASS weightTestSheet.cssRules[8].style.fontWeight is "700"
+PASS weightTestSheet.cssRules[9].style.fontWeight is "bold"
+PASS weightTestSheet.cssRules[10].style.fontWeight is "800"
+PASS weightTestSheet.cssRules[11].style.fontWeight is "900"
+PASS weightTestSheet.cssRules[12].style.fontWeight is ""
+PASS weightTestSheet.cssRules[13].style.fontWeight is ""
+PASS weightTestSheet.cssRules[14].style.fontWeight is ""
+PASS weightTestSheet.cssRules[15].style.fontWeight is "7"
+PASS weightTestSheet.cssRules[16].style.fontWeight is "300"
+PASS weightTestSheet.cssRules[17].style.fontWeight is "200"
+PASS stretchTestSheet.cssRules[0].style.fontStretch is "1%"
+PASS stretchTestSheet.cssRules[1].style.fontStretch is "2"
+PASS stretchTestSheet.cssRules[2].style.fontStretch is "ultra-condensed"
+PASS stretchTestSheet.cssRules[3].style.fontStretch is "extra-condensed"
+PASS stretchTestSheet.cssRules[4].style.fontStretch is "condensed"
+PASS stretchTestSheet.cssRules[5].style.fontStretch is "semi-condensed"
+PASS stretchTestSheet.cssRules[6].style.fontStretch is "normal"
+PASS stretchTestSheet.cssRules[7].style.fontStretch is "semi-expanded"
+PASS stretchTestSheet.cssRules[8].style.fontStretch is "expanded"
+PASS stretchTestSheet.cssRules[9].style.fontStretch is "extra-expanded"
+PASS stretchTestSheet.cssRules[10].style.fontStretch is "ultra-expanded"
+PASS stretchTestSheet.cssRules[11].style.fontStretch is ""
+PASS stretchTestSheet.cssRules[12].style.fontStretch is ""
+PASS stretchTestSheet.cssRules[13].style.fontStretch is "7"
+PASS styleTestSheet.cssRules[0].style.fontStyle is "1deg"
+PASS styleTestSheet.cssRules[1].style.fontStyle is "200grad"
+PASS styleTestSheet.cssRules[2].style.fontStyle is "6.28318rad"
+PASS styleTestSheet.cssRules[3].style.fontStyle is "4turn"
+PASS styleTestSheet.cssRules[4].style.fontStyle is "5"
+PASS styleTestSheet.cssRules[5].style.fontStyle is "20"
+PASS styleTestSheet.cssRules[6].style.fontStyle is "italic"
+PASS styleTestSheet.cssRules[7].style.fontStyle is "oblique"
+PASS styleTestSheet.cssRules[8].style.fontStyle is "normal"
+PASS styleTestSheet.cssRules[9].style.fontStyle is ""
+PASS styleTestSheet.cssRules[10].style.fontStyle is ""
+PASS styleTestSheet.cssRules[11].style.fontStyle is "7"
+PASS styleTestSheet.cssRules[12].style.fontStyle is "calc(1441deg)"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/text/font-selection-font-face-parse.html b/LayoutTests/fast/text/font-selection-font-face-parse.html
new file mode 100644 (file)
index 0000000..c096aac
--- /dev/null
@@ -0,0 +1,203 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<style id="weightTest">
+@font-face {
+    font-weight: 1;
+}
+@font-face {
+    font-weight: 100;
+}
+@font-face {
+    font-weight: 200;
+}
+@font-face {
+    font-weight: 300;
+}
+@font-face {
+    font-weight: 400;
+}
+@font-face {
+    font-weight: normal;
+}
+@font-face {
+    font-weight: 500;
+}
+@font-face {
+    font-weight: 600;
+}
+@font-face {
+    font-weight: 700;
+}
+@font-face {
+    font-weight: bold;
+}
+@font-face {
+    font-weight: 800;
+}
+@font-face {
+    font-weight: 900;
+}
+@font-face {
+    font-weight: garbage;
+}
+@font-face {
+    font-weight: initial;
+}
+@font-face {
+}
+@font-face {
+    font-weight: calc(3 + 4);
+}
+@font-face {
+    font-weight: calc(100 + 200);
+}
+@font-face {
+    font-weight: calc(150 + 50);
+}
+</style>
+
+<style id="stretchTest">
+@font-face {
+    font-stretch: 1%;
+}
+@font-face {
+    font-stretch: 2;
+}
+@font-face {
+    font-stretch: ultra-condensed;
+}
+@font-face {
+    font-stretch: extra-condensed;
+}
+@font-face {
+    font-stretch: condensed;
+}
+@font-face {
+    font-stretch: semi-condensed;
+}
+@font-face {
+    font-stretch: normal;
+}
+@font-face {
+    font-stretch: semi-expanded;
+}
+@font-face {
+    font-stretch: expanded;
+}
+@font-face {
+    font-stretch: extra-expanded;
+}
+@font-face {
+    font-stretch: ultra-expanded;
+}
+@font-face {
+    font-stretch: garbage;
+}
+@font-face {
+    font-stretch: initial;
+}
+@font-face {
+    font-stretch: calc(3 + 4);
+}
+</style>
+
+<style id="styleTest">
+@font-face {
+    font-style: oblique 1deg;
+}
+@font-face {
+    font-style: oblique 200grad;
+}
+@font-face {
+    font-style: oblique 6.28318rad;
+}
+@font-face {
+    font-style: oblique 4turn;
+}
+@font-face {
+    font-style: oblique 5;
+}
+@font-face {
+    font-style: oblique 20;
+}
+@font-face {
+    font-style: italic;
+}
+@font-face {
+    font-style: oblique;
+}
+@font-face {
+    font-style: normal;
+}
+@font-face {
+    font-style: garbage;
+}
+@font-face {
+    font-style: initial;
+}
+@font-face {
+    font-style: oblique calc(3 + 4);
+}
+@font-face {
+    font-style: oblique calc(4turn + 1deg);
+}
+</style>
+</head>
+<body>
+<script>
+var weightTestSheet = document.getElementById("weightTest").sheet;
+shouldBeEqualToString("weightTestSheet.cssRules[0].style.fontWeight", "1");
+shouldBeEqualToString("weightTestSheet.cssRules[1].style.fontWeight", "100");
+shouldBeEqualToString("weightTestSheet.cssRules[2].style.fontWeight", "200");
+shouldBeEqualToString("weightTestSheet.cssRules[3].style.fontWeight", "300");
+shouldBeEqualToString("weightTestSheet.cssRules[4].style.fontWeight", "400");
+shouldBeEqualToString("weightTestSheet.cssRules[5].style.fontWeight", "normal");
+shouldBeEqualToString("weightTestSheet.cssRules[6].style.fontWeight", "500");
+shouldBeEqualToString("weightTestSheet.cssRules[7].style.fontWeight", "600");
+shouldBeEqualToString("weightTestSheet.cssRules[8].style.fontWeight", "700");
+shouldBeEqualToString("weightTestSheet.cssRules[9].style.fontWeight", "bold");
+shouldBeEqualToString("weightTestSheet.cssRules[10].style.fontWeight", "800");
+shouldBeEqualToString("weightTestSheet.cssRules[11].style.fontWeight", "900");
+shouldBeEqualToString("weightTestSheet.cssRules[12].style.fontWeight", "");
+shouldBeEqualToString("weightTestSheet.cssRules[13].style.fontWeight", "");
+shouldBeEqualToString("weightTestSheet.cssRules[14].style.fontWeight", "");
+shouldBeEqualToString("weightTestSheet.cssRules[15].style.fontWeight", "7");
+shouldBeEqualToString("weightTestSheet.cssRules[16].style.fontWeight", "300");
+shouldBeEqualToString("weightTestSheet.cssRules[17].style.fontWeight", "200");
+
+var stretchTestSheet = document.getElementById("stretchTest").sheet;
+shouldBeEqualToString("stretchTestSheet.cssRules[0].style.fontStretch", "1%");
+shouldBeEqualToString("stretchTestSheet.cssRules[1].style.fontStretch", "2");
+shouldBeEqualToString("stretchTestSheet.cssRules[2].style.fontStretch", "ultra-condensed");
+shouldBeEqualToString("stretchTestSheet.cssRules[3].style.fontStretch", "extra-condensed");
+shouldBeEqualToString("stretchTestSheet.cssRules[4].style.fontStretch", "condensed");
+shouldBeEqualToString("stretchTestSheet.cssRules[5].style.fontStretch", "semi-condensed");
+shouldBeEqualToString("stretchTestSheet.cssRules[6].style.fontStretch", "normal");
+shouldBeEqualToString("stretchTestSheet.cssRules[7].style.fontStretch", "semi-expanded");
+shouldBeEqualToString("stretchTestSheet.cssRules[8].style.fontStretch", "expanded");
+shouldBeEqualToString("stretchTestSheet.cssRules[9].style.fontStretch", "extra-expanded");
+shouldBeEqualToString("stretchTestSheet.cssRules[10].style.fontStretch", "ultra-expanded");
+shouldBeEqualToString("stretchTestSheet.cssRules[11].style.fontStretch", "");
+shouldBeEqualToString("stretchTestSheet.cssRules[12].style.fontStretch", "");
+shouldBeEqualToString("stretchTestSheet.cssRules[13].style.fontStretch", "7");
+
+var styleTestSheet = document.getElementById("styleTest").sheet;
+shouldBeEqualToString("styleTestSheet.cssRules[0].style.fontStyle", "1deg");
+shouldBeEqualToString("styleTestSheet.cssRules[1].style.fontStyle", "200grad");
+shouldBeEqualToString("styleTestSheet.cssRules[2].style.fontStyle", "6.28318rad");
+shouldBeEqualToString("styleTestSheet.cssRules[3].style.fontStyle", "4turn");
+shouldBeEqualToString("styleTestSheet.cssRules[4].style.fontStyle", "5");
+shouldBeEqualToString("styleTestSheet.cssRules[5].style.fontStyle", "20");
+shouldBeEqualToString("styleTestSheet.cssRules[6].style.fontStyle", "italic");
+shouldBeEqualToString("styleTestSheet.cssRules[7].style.fontStyle", "oblique");
+shouldBeEqualToString("styleTestSheet.cssRules[8].style.fontStyle", "normal");
+shouldBeEqualToString("styleTestSheet.cssRules[9].style.fontStyle", "");
+shouldBeEqualToString("styleTestSheet.cssRules[10].style.fontStyle", "");
+shouldBeEqualToString("styleTestSheet.cssRules[11].style.fontStyle", "7");
+shouldBeEqualToString("styleTestSheet.cssRules[12].style.fontStyle", "calc(1441deg)");
+</script>
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/fast/text/font-selection-font-loading-api-parse-expected.txt b/LayoutTests/fast/text/font-selection-font-loading-api-parse-expected.txt
new file mode 100644 (file)
index 0000000..46e5ec1
--- /dev/null
@@ -0,0 +1,48 @@
+PASS setFontFaceWeight(fontFace, '1') is "1"
+PASS setFontFaceWeight(fontFace, '100') is "100"
+PASS setFontFaceWeight(fontFace, '200') is "200"
+PASS setFontFaceWeight(fontFace, '300') is "300"
+PASS setFontFaceWeight(fontFace, '400') is "normal"
+PASS setFontFaceWeight(fontFace, 'normal') is "normal"
+PASS setFontFaceWeight(fontFace, '500') is "500"
+PASS setFontFaceWeight(fontFace, '600') is "600"
+PASS setFontFaceWeight(fontFace, '700') is "bold"
+PASS setFontFaceWeight(fontFace, 'bold') is "bold"
+PASS setFontFaceWeight(fontFace, '800') is "800"
+PASS setFontFaceWeight(fontFace, '900') is "900"
+PASS setFontFaceWeight(fontFace, 'garbage') threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS setFontFaceWeight(fontFace, 'initial') threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS setFontFaceWeight(fontFace, 'calc(3 + 4)') is "7"
+PASS setFontFaceWeight(fontFace, 'calc(100 + 200)') is "300"
+PASS setFontFaceWeight(fontFace, 'calc(150 + 50)') is "200"
+PASS setFontFaceStretch(fontFace, '1%') is "1%"
+PASS setFontFaceStretch(fontFace, '2') is "2%"
+PASS setFontFaceStretch(fontFace, 'ultra-condensed') is "ultra-condensed"
+PASS setFontFaceStretch(fontFace, 'extra-condensed') is "extra-condensed"
+PASS setFontFaceStretch(fontFace, 'condensed') is "condensed"
+PASS setFontFaceStretch(fontFace, 'semi-condensed') is "semi-condensed"
+PASS setFontFaceStretch(fontFace, 'normal') is "normal"
+PASS setFontFaceStretch(fontFace, 'semi-expanded') is "semi-expanded"
+PASS setFontFaceStretch(fontFace, 'expanded') is "expanded"
+PASS setFontFaceStretch(fontFace, 'extra-expanded') is "extra-expanded"
+PASS setFontFaceStretch(fontFace, 'ultra-expanded') is "ultra-expanded"
+PASS setFontFaceStretch(fontFace, 'garbage') threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS setFontFaceStretch(fontFace, 'initial') threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS setFontFaceStretch(fontFace, 'calc(3 + 4)') is "7%"
+PASS setFontFaceStyle(fontFace, 'oblique 1deg') is "oblique 1deg"
+PASS setFontFaceStyle(fontFace, 'oblique 200grad') is "oblique 180deg"
+PASS setFontFaceStyle(fontFace, 'oblique 6.28318rad') is "oblique 359.750000deg"
+PASS setFontFaceStyle(fontFace, 'oblique 4turn') is "oblique 1440deg"
+PASS setFontFaceStyle(fontFace, 'oblique 5') is "oblique 5deg"
+PASS setFontFaceStyle(fontFace, 'oblique 20') is "italic"
+PASS setFontFaceStyle(fontFace, 'italic') is "italic"
+PASS setFontFaceStyle(fontFace, 'oblique') is "italic"
+PASS setFontFaceStyle(fontFace, 'normal') is "normal"
+PASS setFontFaceStyle(fontFace, 'garbage') threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS setFontFaceStyle(fontFace, 'initial') threw exception SyntaxError (DOM Exception 12): The string did not match the expected pattern..
+PASS setFontFaceStyle(fontFace, 'oblique calc(3 + 4)') is "oblique 7deg"
+PASS setFontFaceStyle(fontFace, 'oblique calc(4turn + 1deg)') is "oblique 1441deg"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/text/font-selection-font-loading-api-parse.html b/LayoutTests/fast/text/font-selection-font-loading-api-parse.html
new file mode 100644 (file)
index 0000000..d0f72cd
--- /dev/null
@@ -0,0 +1,73 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body>
+<script>
+function setFontFaceWeight(fontFace, weight) {
+    fontFace.weight = weight;
+    return fontFace.weight;
+}
+
+function setFontFaceStretch(fontFace, stretch) {
+    fontFace.stretch = stretch;
+    return fontFace.stretch;
+}
+
+function setFontFaceStyle(fontFace, style) {
+    fontFace.style = style;
+    return fontFace.style;
+}
+
+var fontFace = new FontFace("asdf", "url('notreal')");
+shouldBeEqualToString("setFontFaceWeight(fontFace, '1')", "1");
+shouldBeEqualToString("setFontFaceWeight(fontFace, '100')", "100");
+shouldBeEqualToString("setFontFaceWeight(fontFace, '200')", "200");
+shouldBeEqualToString("setFontFaceWeight(fontFace, '300')", "300");
+shouldBeEqualToString("setFontFaceWeight(fontFace, '400')", "normal");
+shouldBeEqualToString("setFontFaceWeight(fontFace, 'normal')", "normal");
+shouldBeEqualToString("setFontFaceWeight(fontFace, '500')", "500");
+shouldBeEqualToString("setFontFaceWeight(fontFace, '600')", "600");
+shouldBeEqualToString("setFontFaceWeight(fontFace, '700')", "bold");
+shouldBeEqualToString("setFontFaceWeight(fontFace, 'bold')", "bold");
+shouldBeEqualToString("setFontFaceWeight(fontFace, '800')", "800");
+shouldBeEqualToString("setFontFaceWeight(fontFace, '900')", "900");
+shouldThrow("setFontFaceWeight(fontFace, 'garbage')");
+shouldThrow("setFontFaceWeight(fontFace, 'initial')");
+shouldBeEqualToString("setFontFaceWeight(fontFace, 'calc(3 + 4)')", "7");
+shouldBeEqualToString("setFontFaceWeight(fontFace, 'calc(100 + 200)')", "300");
+shouldBeEqualToString("setFontFaceWeight(fontFace, 'calc(150 + 50)')", "200");
+
+shouldBeEqualToString("setFontFaceStretch(fontFace, '1%')", "1%");
+shouldBeEqualToString("setFontFaceStretch(fontFace, '2')", "2%");
+shouldBeEqualToString("setFontFaceStretch(fontFace, 'ultra-condensed')", "ultra-condensed");
+shouldBeEqualToString("setFontFaceStretch(fontFace, 'extra-condensed')", "extra-condensed");
+shouldBeEqualToString("setFontFaceStretch(fontFace, 'condensed')", "condensed");
+shouldBeEqualToString("setFontFaceStretch(fontFace, 'semi-condensed')", "semi-condensed");
+shouldBeEqualToString("setFontFaceStretch(fontFace, 'normal')", "normal");
+shouldBeEqualToString("setFontFaceStretch(fontFace, 'semi-expanded')", "semi-expanded");
+shouldBeEqualToString("setFontFaceStretch(fontFace, 'expanded')", "expanded");
+shouldBeEqualToString("setFontFaceStretch(fontFace, 'extra-expanded')", "extra-expanded");
+shouldBeEqualToString("setFontFaceStretch(fontFace, 'ultra-expanded')", "ultra-expanded");
+shouldThrow("setFontFaceStretch(fontFace, 'garbage')");
+shouldThrow("setFontFaceStretch(fontFace, 'initial')");
+shouldBeEqualToString("setFontFaceStretch(fontFace, 'calc(3 + 4)')", "7%");
+
+shouldBeEqualToString("setFontFaceStyle(fontFace, 'oblique 1deg')", "oblique 1deg");
+shouldBeEqualToString("setFontFaceStyle(fontFace, 'oblique 200grad')", "oblique 180deg");
+shouldBeEqualToString("setFontFaceStyle(fontFace, 'oblique 6.28318rad')", "oblique 359.750000deg");
+shouldBeEqualToString("setFontFaceStyle(fontFace, 'oblique 4turn')", "oblique 1440deg");
+shouldBeEqualToString("setFontFaceStyle(fontFace, 'oblique 5')", "oblique 5deg");
+shouldBeEqualToString("setFontFaceStyle(fontFace, 'oblique 20')", "italic");
+shouldBeEqualToString("setFontFaceStyle(fontFace, 'italic')", "italic");
+shouldBeEqualToString("setFontFaceStyle(fontFace, 'oblique')", "italic");
+shouldBeEqualToString("setFontFaceStyle(fontFace, 'normal')", "normal");
+shouldThrow("setFontFaceStyle(fontFace, 'garbage')");
+shouldThrow("setFontFaceStyle(fontFace, 'initial')");
+shouldBeEqualToString("setFontFaceStyle(fontFace, 'oblique calc(3 + 4)')", "oblique 7deg");
+shouldBeEqualToString("setFontFaceStyle(fontFace, 'oblique calc(4turn + 1deg)')", "oblique 1441deg");
+</script>
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
\ No newline at end of file
index a910734..d48143d 100644 (file)
@@ -19,8 +19,8 @@ PASS window.getComputedStyle(document.getElementById('test18')).fontStretch is "
 PASS window.getComputedStyle(document.getElementById('test19')).fontStretch is "normal"
 PASS window.getComputedStyle(document.getElementById('test20')).fontStretch is "extra-expanded"
 PASS window.getComputedStyle(document.getElementById('test1')).font is "normal normal normal normal 16px/18px Times"
-PASS window.getComputedStyle(document.getElementById('test2')).font is "normal normal normal 1% 16px/18px Times"
-PASS window.getComputedStyle(document.getElementById('test3')).font is "normal normal normal 2% 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test2')).font is "16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test3')).font is "16px/18px Times"
 PASS window.getComputedStyle(document.getElementById('test4')).font is "normal normal normal ultra-condensed 16px/18px Times"
 PASS window.getComputedStyle(document.getElementById('test5')).font is "normal normal normal extra-condensed 16px/18px Times"
 PASS window.getComputedStyle(document.getElementById('test6')).font is "normal normal normal condensed 16px/18px Times"
@@ -32,7 +32,7 @@ PASS window.getComputedStyle(document.getElementById('test11')).font is "normal
 PASS window.getComputedStyle(document.getElementById('test12')).font is "normal normal normal ultra-expanded 16px/18px Times"
 PASS window.getComputedStyle(document.getElementById('test13')).font is "normal normal normal normal 16px/18px Times"
 PASS window.getComputedStyle(document.getElementById('test14')).font is "normal normal normal normal 16px/18px Times"
-PASS window.getComputedStyle(document.getElementById('test15')).font is "normal normal normal 7% 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test15')).font is "16px/18px Times"
 PASS window.getComputedStyle(document.getElementById('test16')).font is "normal normal 100 extra-condensed 48px/49px 'Helvetica Neue'"
 PASS window.getComputedStyle(document.getElementById('test17')).font is "normal normal 100 extra-condensed 48px/49px 'Helvetica Neue'"
 PASS window.getComputedStyle(document.getElementById('test18')).font is "normal normal 100 normal 48px/49px 'Helvetica Neue'"
index b7a5a02..f9df8c3 100644 (file)
@@ -49,8 +49,8 @@ shouldBeEqualToString("window.getComputedStyle(document.getElementById('test19')
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test20')).fontStretch", "extra-expanded");
 
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test1')).font", "normal normal normal normal 16px/18px Times");
-shouldBeEqualToString("window.getComputedStyle(document.getElementById('test2')).font", "normal normal normal 1% 16px/18px Times");
-shouldBeEqualToString("window.getComputedStyle(document.getElementById('test3')).font", "normal normal normal 2% 16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test2')).font", "16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test3')).font", "16px/18px Times");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test4')).font", "normal normal normal ultra-condensed 16px/18px Times");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test5')).font", "normal normal normal extra-condensed 16px/18px Times");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test6')).font", "normal normal normal condensed 16px/18px Times");
@@ -62,7 +62,7 @@ shouldBeEqualToString("window.getComputedStyle(document.getElementById('test11')
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test12')).font", "normal normal normal ultra-expanded 16px/18px Times");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test13')).font", "normal normal normal normal 16px/18px Times");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test14')).font", "normal normal normal normal 16px/18px Times");
-shouldBeEqualToString("window.getComputedStyle(document.getElementById('test15')).font", "normal normal normal 7% 16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test15')).font", "16px/18px Times");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test16')).font", "normal normal 100 extra-condensed 48px/49px 'Helvetica Neue'");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test17')).font", "normal normal 100 extra-condensed 48px/49px 'Helvetica Neue'");
 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test18')).font", "normal normal 100 normal 48px/49px 'Helvetica Neue'");
diff --git a/LayoutTests/fast/text/font-style-parse-expected.txt b/LayoutTests/fast/text/font-style-parse-expected.txt
new file mode 100644 (file)
index 0000000..60b3d5c
--- /dev/null
@@ -0,0 +1,51 @@
+PASS window.getComputedStyle(document.getElementById('test1')).fontStyle is "normal"
+PASS window.getComputedStyle(document.getElementById('test2')).fontStyle is "1deg"
+PASS window.getComputedStyle(document.getElementById('test3')).fontStyle is "180deg"
+PASS window.getComputedStyle(document.getElementById('test4')).fontStyle is "359.75deg"
+PASS window.getComputedStyle(document.getElementById('test5')).fontStyle is "1440deg"
+PASS window.getComputedStyle(document.getElementById('test6')).fontStyle is "5deg"
+PASS window.getComputedStyle(document.getElementById('test7')).fontStyle is "italic"
+PASS window.getComputedStyle(document.getElementById('test8')).fontStyle is "italic"
+PASS window.getComputedStyle(document.getElementById('test9')).fontStyle is "italic"
+PASS window.getComputedStyle(document.getElementById('test10')).fontStyle is "normal"
+PASS window.getComputedStyle(document.getElementById('test11')).fontStyle is "normal"
+PASS window.getComputedStyle(document.getElementById('test12')).fontStyle is "normal"
+PASS window.getComputedStyle(document.getElementById('test13')).fontStyle is "7deg"
+PASS window.getComputedStyle(document.getElementById('test14')).fontStyle is "1441deg"
+PASS window.getComputedStyle(document.getElementById('test15')).fontStyle is "italic"
+PASS window.getComputedStyle(document.getElementById('test16')).fontStyle is "italic"
+PASS window.getComputedStyle(document.getElementById('test17')).fontStyle is "normal"
+PASS window.getComputedStyle(document.getElementById('test18')).fontStyle is "italic"
+PASS window.getComputedStyle(document.getElementById('test19')).fontStyle is "italic"
+PASS window.getComputedStyle(document.getElementById('test20')).fontStyle is "normal"
+PASS window.getComputedStyle(document.getElementById('test1')).font is "normal normal normal normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test2')).font is "16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test3')).font is "16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test4')).font is "16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test5')).font is "16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test6')).font is "16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test7')).font is "italic normal normal normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test8')).font is "italic normal normal normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test9')).font is "italic normal normal normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test10')).font is "normal normal normal normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test11')).font is "normal normal normal normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test12')).font is "normal normal normal normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test13')).font is "16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test14')).font is "16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test15')).font is "italic normal 100 normal 48px/49px 'Helvetica Neue'"
+PASS window.getComputedStyle(document.getElementById('test16')).font is "italic normal 100 normal 48px/49px 'Helvetica Neue'"
+PASS window.getComputedStyle(document.getElementById('test17')).font is "normal normal 100 normal 48px/49px 'Helvetica Neue'"
+PASS window.getComputedStyle(document.getElementById('test18')).font is "italic normal normal normal 48px/49px 'Helvetica Neue'"
+PASS window.getComputedStyle(document.getElementById('test19')).font is "italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue'"
+PASS window.getComputedStyle(document.getElementById('test20')).font is "normal normal normal normal 16px/18px Times"
+PASS document.getElementById('test1').style.font is ""
+PASS document.getElementById('test15').style.font is "italic 100 48px/49px 'Helvetica Neue'"
+PASS document.getElementById('test16').style.font is "italic 100 48px/49px 'Helvetica Neue'"
+PASS document.getElementById('test17').style.font is "100 48px/49px 'Helvetica Neue'"
+PASS document.getElementById('test18').style.font is "italic 48px/49px 'Helvetica Neue'"
+PASS document.getElementById('test19').style.font is "italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue'"
+PASS document.getElementById('test20').style.font is ""
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/text/font-style-parse.html b/LayoutTests/fast/text/font-style-parse.html
new file mode 100644 (file)
index 0000000..9b12cae
--- /dev/null
@@ -0,0 +1,82 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body>
+<div style="font: 16px/18px 'Times';">
+<div id="test1"></div>
+<div id="test2" style="font-style: oblique 1deg;"></div>
+<div id="test3" style="font-style: oblique 200grad;"></div>
+<div id="test4" style="font-style: oblique 6.28318rad;"></div>
+<div id="test5" style="font-style: oblique 4turn;"></div>
+<div id="test6" style="font-style: oblique 5;"></div>
+<div id="test7" style="font-style: oblique 20;"></div>
+<div id="test8" style="font-style: italic;"></div>
+<div id="test9" style="font-style: oblique;"></div>
+<div id="test10" style="font-style: normal;"></div>
+<div id="test11" style="font-style: garbage;"></div>
+<div id="test12" style="font-style: initial;"></div>
+<div id="test13" style="font-style: oblique calc(3 + 4);"></div>
+<div id="test14" style="font-style: oblique calc(4turn + 1deg);"></div>
+<div id="test15" style="font: 100 italic 48px/49px 'Helvetica Neue';"></div>
+<div id="test16" style="font: italic 100 48px/49px 'Helvetica Neue';"></div>
+<div id="test17" style="font: 100 48px/49px 'Helvetica Neue';"></div>
+<div style="font-stretch: normal;"><div id="test18" style="font: italic 48px/49px 'Helvetica Neue';"></div></div>
+<div id="test19" style="font: italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue';"></div>
+<div id="test20" style="font: 13deg small-caps 123 extra-expanded 48px/49px 'Helvetica Neue';"></div>
+</div>
+<script>
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test1')).fontStyle", "normal");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test2')).fontStyle", "1deg");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test3')).fontStyle", "180deg");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test4')).fontStyle", "359.75deg");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test5')).fontStyle", "1440deg");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test6')).fontStyle", "5deg");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test7')).fontStyle", "italic");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test8')).fontStyle", "italic");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test9')).fontStyle", "italic");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test10')).fontStyle", "normal");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test11')).fontStyle", "normal");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test12')).fontStyle", "normal");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test13')).fontStyle", "7deg");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test14')).fontStyle", "1441deg");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test15')).fontStyle", "italic");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test16')).fontStyle", "italic");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test17')).fontStyle", "normal");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test18')).fontStyle", "italic");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test19')).fontStyle", "italic");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test20')).fontStyle", "normal");
+
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test1')).font", "normal normal normal normal 16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test2')).font", "16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test3')).font", "16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test4')).font", "16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test5')).font", "16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test6')).font", "16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test7')).font", "italic normal normal normal 16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test8')).font", "italic normal normal normal 16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test9')).font", "italic normal normal normal 16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test10')).font", "normal normal normal normal 16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test11')).font", "normal normal normal normal 16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test12')).font", "normal normal normal normal 16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test13')).font", "16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test14')).font", "16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test15')).font", "italic normal 100 normal 48px/49px 'Helvetica Neue'");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test16')).font", "italic normal 100 normal 48px/49px 'Helvetica Neue'");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test17')).font", "normal normal 100 normal 48px/49px 'Helvetica Neue'");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test18')).font", "italic normal normal normal 48px/49px 'Helvetica Neue'");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test19')).font", "italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue'");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test20')).font", "normal normal normal normal 16px/18px Times");
+
+shouldBeEqualToString("document.getElementById('test1').style.font", "");
+shouldBeEqualToString("document.getElementById('test15').style.font", "italic 100 48px/49px 'Helvetica Neue'");
+shouldBeEqualToString("document.getElementById('test16').style.font", "italic 100 48px/49px 'Helvetica Neue'");
+shouldBeEqualToString("document.getElementById('test17').style.font", "100 48px/49px 'Helvetica Neue'");
+shouldBeEqualToString("document.getElementById('test18').style.font", "italic 48px/49px 'Helvetica Neue'");
+shouldBeEqualToString("document.getElementById('test19').style.font", "italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue'");
+shouldBeEqualToString("document.getElementById('test20').style.font", "");
+</script>
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/font-weight-parse-expected.txt b/LayoutTests/fast/text/font-weight-parse-expected.txt
new file mode 100644 (file)
index 0000000..1509517
--- /dev/null
@@ -0,0 +1,59 @@
+PASS window.getComputedStyle(document.getElementById('test1')).fontWeight is "normal"
+PASS window.getComputedStyle(document.getElementById('test2')).fontWeight is "1"
+PASS window.getComputedStyle(document.getElementById('test3')).fontWeight is "100"
+PASS window.getComputedStyle(document.getElementById('test4')).fontWeight is "200"
+PASS window.getComputedStyle(document.getElementById('test5')).fontWeight is "300"
+PASS window.getComputedStyle(document.getElementById('test6')).fontWeight is "normal"
+PASS window.getComputedStyle(document.getElementById('test7')).fontWeight is "normal"
+PASS window.getComputedStyle(document.getElementById('test8')).fontWeight is "500"
+PASS window.getComputedStyle(document.getElementById('test9')).fontWeight is "600"
+PASS window.getComputedStyle(document.getElementById('test10')).fontWeight is "bold"
+PASS window.getComputedStyle(document.getElementById('test11')).fontWeight is "bold"
+PASS window.getComputedStyle(document.getElementById('test12')).fontWeight is "800"
+PASS window.getComputedStyle(document.getElementById('test13')).fontWeight is "900"
+PASS window.getComputedStyle(document.getElementById('test14')).fontWeight is "normal"
+PASS window.getComputedStyle(document.getElementById('test15')).fontWeight is "normal"
+PASS window.getComputedStyle(document.getElementById('test16')).fontWeight is "7"
+PASS window.getComputedStyle(document.getElementById('test17')).fontWeight is "300"
+PASS window.getComputedStyle(document.getElementById('test18')).fontWeight is "200"
+PASS window.getComputedStyle(document.getElementById('test19')).fontWeight is "100"
+PASS window.getComputedStyle(document.getElementById('test20')).fontWeight is "100"
+PASS window.getComputedStyle(document.getElementById('test21')).fontWeight is "normal"
+PASS window.getComputedStyle(document.getElementById('test22')).fontWeight is "100"
+PASS window.getComputedStyle(document.getElementById('test23')).fontWeight is "100"
+PASS window.getComputedStyle(document.getElementById('test24')).fontWeight is "normal"
+PASS window.getComputedStyle(document.getElementById('test1')).font is "normal normal normal normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test2')).font is "16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test3')).font is "normal normal 100 normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test4')).font is "normal normal 200 normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test5')).font is "normal normal 300 normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test6')).font is "normal normal normal normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test7')).font is "normal normal normal normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test8')).font is "normal normal 500 normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test9')).font is "normal normal 600 normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test10')).font is "normal normal bold normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test11')).font is "normal normal bold normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test12')).font is "normal normal 800 normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test13')).font is "normal normal 900 normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test14')).font is "normal normal normal normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test15')).font is "normal normal normal normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test16')).font is "16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test17')).font is "normal normal 300 normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test18')).font is "normal normal 200 normal 16px/18px Times"
+PASS window.getComputedStyle(document.getElementById('test19')).font is "normal normal 100 extra-condensed 48px/49px 'Helvetica Neue'"
+PASS window.getComputedStyle(document.getElementById('test20')).font is "normal normal 100 extra-condensed 48px/49px 'Helvetica Neue'"
+PASS window.getComputedStyle(document.getElementById('test21')).font is "normal normal normal extra-condensed 48px/49px 'Helvetica Neue'"
+PASS window.getComputedStyle(document.getElementById('test22')).font is "normal normal 100 normal 48px/49px 'Helvetica Neue'"
+PASS window.getComputedStyle(document.getElementById('test23')).font is "italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue'"
+PASS window.getComputedStyle(document.getElementById('test24')).font is "italic small-caps normal extra-expanded 48px/49px 'Helvetica Neue'"
+PASS document.getElementById('test1').style.font is ""
+PASS document.getElementById('test19').style.font is "100 extra-condensed 48px/49px 'Helvetica Neue'"
+PASS document.getElementById('test20').style.font is "100 extra-condensed 48px/49px 'Helvetica Neue'"
+PASS document.getElementById('test21').style.font is "extra-condensed 48px/49px 'Helvetica Neue'"
+PASS document.getElementById('test22').style.font is "100 48px/49px 'Helvetica Neue'"
+PASS document.getElementById('test23').style.font is "italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue'"
+PASS document.getElementById('test24').style.font is "italic small-caps extra-expanded 48px/49px 'Helvetica Neue'"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/text/font-weight-parse.html b/LayoutTests/fast/text/font-weight-parse.html
new file mode 100644 (file)
index 0000000..3ca0991
--- /dev/null
@@ -0,0 +1,94 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body>
+<div style="font: 16px/18px 'Times';">
+<div id="test1"></div>
+<div id="test2" style="font-weight: 1;"></div>
+<div id="test3" style="font-weight: 100;"></div>
+<div id="test4" style="font-weight: 200;"></div>
+<div id="test5" style="font-weight: 300;"></div>
+<div id="test6" style="font-weight: 400;"></div>
+<div id="test7" style="font-weight: normal;"></div>
+<div id="test8" style="font-weight: 500;"></div>
+<div id="test9" style="font-weight: 600;"></div>
+<div id="test10" style="font-weight: 700;"></div>
+<div id="test11" style="font-weight: bold;"></div>
+<div id="test12" style="font-weight: 800;"></div>
+<div id="test13" style="font-weight: 900;"></div>
+<div id="test14" style="font-weight: garbage;"></div>
+<div id="test15" style="font-weight: initial;"></div>
+<div id="test16" style="font-weight: calc(3 + 4);"></div>
+<div id="test17" style="font-weight: calc(100 + 200);"></div>
+<div id="test18" style="font-weight: calc(50 + 150);"></div>
+<div id="test19" style="font: 100 extra-condensed 48px/49px 'Helvetica Neue';"></div>
+<div id="test20" style="font: extra-condensed 100 48px/49px 'Helvetica Neue';"></div>
+<div id="test21" style="font: extra-condensed 48px/49px 'Helvetica Neue';"></div>
+<div style="font-weight: 275;"><div id="test22" style="font: 100 48px/49px 'Helvetica Neue';"></div></div>
+<div id="test23" style="font: italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue';"></div>
+<div id="test24" style="font: italic small-caps 123 extra-expanded 48px/49px 'Helvetica Neue';"></div>
+</div>
+<script>
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test1')).fontWeight", "normal");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test2')).fontWeight", "1");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test3')).fontWeight", "100");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test4')).fontWeight", "200");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test5')).fontWeight", "300");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test6')).fontWeight", "normal");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test7')).fontWeight", "normal");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test8')).fontWeight", "500");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test9')).fontWeight", "600");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test10')).fontWeight", "bold");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test11')).fontWeight", "bold");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test12')).fontWeight", "800");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test13')).fontWeight", "900");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test14')).fontWeight", "normal");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test15')).fontWeight", "normal");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test16')).fontWeight", "7");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test17')).fontWeight", "300");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test18')).fontWeight", "200");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test19')).fontWeight", "100");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test20')).fontWeight", "100");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test21')).fontWeight", "normal");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test22')).fontWeight", "100");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test23')).fontWeight", "100");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test24')).fontWeight", "normal");
+
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test1')).font", "normal normal normal normal 16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test2')).font", "16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test3')).font", "normal normal 100 normal 16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test4')).font", "normal normal 200 normal 16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test5')).font", "normal normal 300 normal 16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test6')).font", "normal normal normal normal 16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test7')).font", "normal normal normal normal 16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test8')).font", "normal normal 500 normal 16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test9')).font", "normal normal 600 normal 16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test10')).font", "normal normal bold normal 16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test11')).font", "normal normal bold normal 16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test12')).font", "normal normal 800 normal 16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test13')).font", "normal normal 900 normal 16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test14')).font", "normal normal normal normal 16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test15')).font", "normal normal normal normal 16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test16')).font", "16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test17')).font", "normal normal 300 normal 16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test18')).font", "normal normal 200 normal 16px/18px Times");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test19')).font", "normal normal 100 extra-condensed 48px/49px 'Helvetica Neue'");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test20')).font", "normal normal 100 extra-condensed 48px/49px 'Helvetica Neue'");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test21')).font", "normal normal normal extra-condensed 48px/49px 'Helvetica Neue'");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test22')).font", "normal normal 100 normal 48px/49px 'Helvetica Neue'");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test23')).font", "italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue'");
+shouldBeEqualToString("window.getComputedStyle(document.getElementById('test24')).font", "italic small-caps normal extra-expanded 48px/49px 'Helvetica Neue'");
+
+shouldBeEqualToString("document.getElementById('test1').style.font", "");
+shouldBeEqualToString("document.getElementById('test19').style.font", "100 extra-condensed 48px/49px 'Helvetica Neue'");
+shouldBeEqualToString("document.getElementById('test20').style.font", "100 extra-condensed 48px/49px 'Helvetica Neue'");
+shouldBeEqualToString("document.getElementById('test21').style.font", "extra-condensed 48px/49px 'Helvetica Neue'");
+shouldBeEqualToString("document.getElementById('test22').style.font", "100 48px/49px 'Helvetica Neue'");
+shouldBeEqualToString("document.getElementById('test23').style.font", "italic small-caps 100 extra-expanded 48px/49px 'Helvetica Neue'");
+shouldBeEqualToString("document.getElementById('test24').style.font", "italic small-caps extra-expanded 48px/49px 'Helvetica Neue'");
+</script>
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
index 5692fa7..297eeb6 100644 (file)
@@ -1,3 +1,208 @@
+2017-03-06  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        Expand font-weight and font-stretch to take any number
+        https://bugs.webkit.org/show_bug.cgi?id=168889
+
+        Reviewed by Simon Fraser.
+
+        This patch expands parsing support for font-weight and font-stretch so that they can accept
+        numbers in addition to the keyword values they accepted previously. Eventually, these numbers
+        will be used as inputs to select variation fonts; however, in this patch, the values are just
+        parsed and held in our internal data model. This means that this patch doesn't actually change
+        the general behavior of WebKit; instead, it parses new values, outputs them (via
+        getComputedStyle() and similar functions), and provides them as input to our preexisting font
+        selection algorithm. 
+
+        This patch doesn't actually modify anything algorithmically, and therefore, it doesn't include
+        any additional tests for the font selection algorithm. Instead, it tests the parsing of the
+        newly accepted values (both input and output).
+
+        Because our internal data model needs to hold numbers now, this patch also completely eliminates
+        the FontWidth, FontItalic, and FontTraitsMask enum values in favor of FontSelectionValues (which
+        can hold numbers instead of individual enum values). Therefore, every place which we were using
+        these enum values is migrated in this patch to using FontSelectionValues instead.
+
+        Tests: fast/text/font-selection-font-face-parse.html
+               fast/text/font-selection-font-loading-api-parse.html
+               fast/text/font-style-parse.html
+               fast/text/font-weight-parse.html
+
+        * accessibility/AccessibilityRenderObject.cpp: Migrate off of old enum types.
+        (WebCore::AccessibilityRenderObject::hasBoldFont):
+        (WebCore::AccessibilityRenderObject::hasItalicFont):
+        (WebCore::AccessibilityRenderObject::hasPlainText):
+        * accessibility/atk/WebKitAccessibleInterfaceText.cpp: Ditto.
+        (getAttributeSetForAccessibilityObject):
+        * css/CSSComputedStyleDeclaration.cpp: Output newly parsed values.
+        (WebCore::fontWeightFromStyle):
+        (WebCore::fontStretchFromStyle):
+        (WebCore::fontStyleFromStyle):
+        (WebCore::fontShorthandValueForSelectionProperties):
+        (WebCore::ComputedStyleExtractor::propertyValue):
+        * css/CSSFontFace.cpp: Migrate off old enum types.
+        (WebCore::calculateWeightRange):
+        (WebCore::CSSFontFace::setWeight):
+        (WebCore::calculateStretchRange):
+        (WebCore::CSSFontFace::setStretch):
+        (WebCore::calculateStyleRange):
+        (WebCore::CSSFontFace::setStyle):
+        (WebCore::CSSFontFace::calculateStyleMask): Deleted.
+        (WebCore::CSSFontFace::calculateWeightMask): Deleted.
+        (WebCore::CSSFontFace::calculateStretch): Deleted.
+        * css/CSSFontFace.h:
+        * css/CSSFontFaceSet.cpp: Migrate off old enum types.
+        (WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered):
+        (WebCore::calculateWeightValue):
+        (WebCore::calculateStretchValue):
+        (WebCore::calculateStyleValue):
+        (WebCore::computeFontSelectionRequest):
+        (WebCore::CSSFontFaceSet::matchingFaces):
+        (WebCore::CSSFontFaceSet::fontFace):
+        (WebCore::computeFontTraitsMask): Deleted.
+        (WebCore::computeFontStretch): Deleted.
+        * css/CSSFontFaceSet.h:
+        * css/CSSFontSelector.cpp: Migrate off old enum types.
+        (WebCore::CSSFontSelector::fontRangesForFamily):
+        * css/CSSPrimitiveValueMappings.h: font-weight and font-style are no longer
+        keyword properties.
+        (WebCore::CSSPrimitiveValue::operator FontWeight): Deleted.
+        (WebCore::CSSPrimitiveValue::operator FontItalic): Deleted.
+        * css/CSSProperties.json: Use the same infrastructure for all three of the
+        font selection properties.
+        * css/CSSSegmentedFontFace.cpp: Migrate off old enum types.
+        (WebCore::CSSSegmentedFontFace::fontRanges):
+        * css/CSSValueKeywords.in: The 100-based font-weight values are now represented
+        as real numbers.
+        * css/FontFace.cpp: Update the string output functions for the new values.
+        (WebCore::rangeIsSingleValue):
+        (WebCore::FontFace::style):
+        (WebCore::FontFace::weight):
+        (WebCore::FontFace::stretch):
+        * css/StyleBuilderConverter.h: Use CSSValue conversion functions to convert
+        to our new data model.
+        (WebCore::StyleBuilderConverter::convertFontWeight):
+        (WebCore::StyleBuilderConverter::convertFontStretch):
+        (WebCore::StyleBuilderConverter::convertFontStyle):
+        * css/StyleBuilderCustom.h: font-weight is no longer a completely custom
+        property.
+        (WebCore::StyleBuilderCustom::applyInitialFontWeight): Deleted.
+        (WebCore::StyleBuilderCustom::applyInheritFontWeight): Deleted.
+        (WebCore::StyleBuilderCustom::applyValueFontWeight): Deleted.
+        * css/parser/CSSParserFastPaths.cpp: font-style is no longer a keyword property.
+        (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
+        (WebCore::CSSParserFastPaths::isKeywordPropertyID):
+        * css/parser/CSSPropertyParser.cpp: Parse the new values in the font selection
+        properties.
+        (WebCore::consumeFontWeightKeywordValue):
+        (WebCore::consumeFontWeightCSS21):
+        (WebCore::consumeFontWeight):
+        (WebCore::consumeFontStyleKeywordValue):
+        (WebCore::consumeFontStyle):
+        (WebCore::CSSPropertyParser::parseSingleValue):
+        (WebCore::CSSPropertyParser::parseFontFaceDescriptor):
+        (WebCore::CSSPropertyParser::consumeSystemFont):
+        (WebCore::CSSPropertyParser::consumeFont):
+        * editing/EditingStyle.cpp: Migrate off old enum types.
+        (WebCore::fontWeightIsBold):
+        * editing/mac/EditorMac.mm: Ditto.
+        (WebCore::Editor::applyFontStyles):
+        * platform/graphics/FontCache.h: Unify our font selection values into
+        their enclosing struct, FontSelectionCapabilities. Also, clean up utility
+        functions.
+        * platform/graphics/FontCascade.cpp: Migrate off old enum types.
+        (WebCore::FontCascade::FontCascade):
+        * platform/graphics/FontCascade.h: Ditto.
+        (WebCore::FontCascade::italic):
+        (WebCore::FontCascade::weight):
+        * platform/graphics/FontDescription.cpp: Ditto.
+        (WebCore::FontDescription::FontDescription):
+        (WebCore::FontCascadeDescription::lighterWeight):
+        (WebCore::FontCascadeDescription::bolderWeight):
+        (WebCore::FontDescription::traitsMask): Deleted.
+        * platform/graphics/FontDescription.h: Migrate off old enum types.
+        (WebCore::FontDescription::italic):
+        (WebCore::FontDescription::stretch):
+        (WebCore::FontDescription::weight):
+        (WebCore::FontDescription::fontSelectionRequest):
+        (WebCore::FontDescription::computedPixelSize):
+        (WebCore::FontDescription::setItalic):
+        (WebCore::FontDescription::setStretch):
+        (WebCore::FontDescription::setIsItalic):
+        (WebCore::FontDescription::setWeight):
+        (WebCore::FontDescription::operator==):
+        (WebCore::FontCascadeDescription::lighterWeight):
+        (WebCore::FontCascadeDescription::bolderWeight):
+        (WebCore::FontCascadeDescription::initialItalic):
+        (WebCore::FontCascadeDescription::initialWeight):
+        (WebCore::FontCascadeDescription::initialStretch):
+        * platform/graphics/FontSelectionAlgorithm.cpp: Delete code which was only
+        present to convert from the old enum types to the new FontSelectionRequest
+        type.
+        (WebCore::fontSelectionRequestForTraitsMask): Deleted.
+        (WebCore::initialFontSelectionCapabilitiesForTraitsMask): Deleted.
+        (WebCore::fontSelectionCapabilitiesForTraitsMask): Deleted.
+        * platform/graphics/FontSelectionAlgorithm.h: Migrate to new named functions
+        for special values.
+        (WebCore::isItalic):
+        (WebCore::boldWeightValue):
+        (WebCore::normalWeightValue):
+        (WebCore::isFontWeightBold):
+        (WebCore::normalStretchValue):
+        (WebCore::FontSelectionRequest::FontSelectionRequest):
+        * platform/graphics/cocoa/FontCacheCoreText.cpp: Migrate all platforms which
+        compile this file to know about FontDatabase. This simplifies the interaction
+        between @font-face fonts and installed fonts. Also, migrate off old enum types.
+        (WebCore::stretchFromCoreTextTraits):
+        (WebCore::fontWeightFromCoreText):
+        (WebCore::capabilitiesForFontDescriptor):
+        (WebCore::FontCache::getFontSelectionCapabilitiesInFamily):
+        (WebCore::platformFontLookupWithFamily):
+        (WebCore::invalidateFontCache):
+        (WebCore::fontWithFamily):
+        (WebCore::FontCache::createFontPlatformData):
+        (WebCore::lookupFallbackFont):
+        (WebCore::toTraitsMask): Deleted.
+        (WebCore::isFontWeightBold): Deleted.
+        (WebCore::toCoreTextFontWeight): Deleted.
+        (): Deleted.
+        (WebCore::FontDatabase::capabilitiesForFontDescriptor): Deleted.
+        (WebCore::calculateFontSelectionRequest): Deleted.
+        * platform/graphics/freetype/FontCacheFreeType.cpp: Migrate off old enum types.
+        (WebCore::FontCache::getFontSelectionCapabilitiesInFamily):
+        (WebCore::fontWeightToFontconfigWeight):
+        (): Deleted.
+        * platform/graphics/freetype/FontPlatformDataFreeType.cpp: Ditto.
+        (WebCore::FontPlatformData::FontPlatformData):
+        * platform/graphics/ios/FontCacheIOS.mm: Ditto.
+        (WebCore::baseSystemFontDescriptor):
+        (WebCore::systemFontModificationAttributes):
+        (WebCore::systemFontDescriptor):
+        (WebCore::platformFontWithFamilySpecialCase):
+        (WebCore::FontCache::weightOfCTFont): Deleted.
+        * platform/graphics/mac/FontCacheMac.mm: Ditto.
+        (WebCore::toNSFontWeight):
+        (WebCore::platformFontWithFamilySpecialCase):
+        * platform/graphics/win/FontCacheWin.cpp: Ditto.
+        (WebCore::toGDIFontWeight):
+        (WebCore::traitsInFamilyEnumProc):
+        (WebCore::FontCache::getFontSelectionCapabilitiesInFamily):
+        (): Deleted.
+        * platform/mock/MockRealtimeVideoSource.cpp: Ditto.
+        (WebCore::MockRealtimeVideoSource::applySize):
+        * platform/text/TextFlags.h: Delete old enum types.
+        * platform/win/DragImageWin.cpp: Migrate off old enum types.
+        (WebCore::dragLabelFont):
+        * rendering/RenderEmbeddedObject.cpp: Ditto.
+        (WebCore::RenderEmbeddedObject::getReplacementTextGeometry):
+        * rendering/RenderThemeGtk.cpp: Ditto.
+        (WebCore::RenderThemeGtk::updateCachedSystemFontDescription):
+        * rendering/RenderThemeIOS.mm: Ditto.
+        (WebCore::RenderThemeIOS::updateCachedSystemFontDescription):
+        * rendering/RenderThemeMac.mm: Ditto.
+        (WebCore::toFontWeight):
+        * rendering/RenderThemeWin.cpp: Ditto.
+        (WebCore::fillFontDescription):
+
 2017-03-06  Chris Dumez  <cdumez@apple.com>
 
         [iOS] Disable autoplay of silent videos in low power mode
index 19d0c77..abe9dd5 100644 (file)
                C28083411C6DC96A001451B6 /* JSFontFaceCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFontFaceCustom.cpp; sourceTree = "<group>"; };
                C2AB0AF41E6B3C6C001348C5 /* FontSelectionAlgorithm.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontSelectionAlgorithm.cpp; sourceTree = "<group>"; };
                C2AB0AF51E6B3C6C001348C5 /* FontSelectionAlgorithm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontSelectionAlgorithm.h; sourceTree = "<group>"; };
+               C2AB0B021E6DE32B001348C5 /* FontSelectionKeywordValues.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FontSelectionKeywordValues.h; sourceTree = "<group>"; };
+               C2AB0B031E6DE92C001348C5 /* FontSelectionValueInlines.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FontSelectionValueInlines.h; sourceTree = "<group>"; };
                C2F4E7881E45AEDF006D7105 /* ComplexTextController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ComplexTextController.cpp; sourceTree = "<group>"; };
                C2F4E7891E45AEDF006D7105 /* ComplexTextController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ComplexTextController.h; sourceTree = "<group>"; };
                C330A22113EC196B0000B45B /* ColorChooser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ColorChooser.h; sourceTree = "<group>"; };
                                379919951200DDF400EA041C /* WOFFFileFormat.h */,
                                C2AB0AF41E6B3C6C001348C5 /* FontSelectionAlgorithm.cpp */,
                                C2AB0AF51E6B3C6C001348C5 /* FontSelectionAlgorithm.h */,
+                               C2AB0B021E6DE32B001348C5 /* FontSelectionKeywordValues.h */,
                        );
                        path = graphics;
                        sourceTree = "<group>";
                                3FFFF9A7159D9A550020BBD5 /* WebKitCSSViewportRule.h */,
                                3F2B33E3165ABD3500E3987C /* WebKitCSSViewportRule.idl */,
                                31055BB81E4FE18900EB604E /* WebKitFontFamilyNames.in */,
+                               C2AB0B031E6DE92C001348C5 /* FontSelectionValueInlines.h */,
                        );
                        path = css;
                        sourceTree = "<group>";
index 8c6af1b..36f9aed 100644 (file)
@@ -3500,7 +3500,7 @@ bool AccessibilityRenderObject::hasBoldFont() const
     if (!m_renderer)
         return false;
     
-    return m_renderer->style().fontDescription().weight() >= FontWeightBold;
+    return isFontWeightBold(m_renderer->style().fontDescription().weight());
 }
 
 bool AccessibilityRenderObject::hasItalicFont() const
@@ -3508,7 +3508,7 @@ bool AccessibilityRenderObject::hasItalicFont() const
     if (!m_renderer)
         return false;
     
-    return m_renderer->style().fontDescription().italic() == FontItalicOn;
+    return isItalic(m_renderer->style().fontDescription().italic());
 }
 
 bool AccessibilityRenderObject::hasPlainText() const
@@ -3518,8 +3518,8 @@ bool AccessibilityRenderObject::hasPlainText() const
     
     const RenderStyle& style = m_renderer->style();
     
-    return style.fontDescription().weight() == FontWeightNormal
-        && style.fontDescription().italic() == FontItalicOff
+    return style.fontDescription().weight() == normalWeightValue()
+        && style.fontDescription().italic() == normalItalicValue()
         && style.textDecorationsInEffect() == TextDecorationNone;
 }
 
index 8c234c2..8119d08 100644 (file)
@@ -136,35 +136,7 @@ static AtkAttributeSet* getAttributeSetForAccessibilityObject(const Accessibilit
 
     result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_FAMILY_NAME), fontFamilyName.utf8().data());
 
-    int fontWeight = -1;
-    switch (style->fontCascade().weight()) {
-    case FontWeight100:
-        fontWeight = 100;
-        break;
-    case FontWeight200:
-        fontWeight = 200;
-        break;
-    case FontWeight300:
-        fontWeight = 300;
-        break;
-    case FontWeight400:
-        fontWeight = 400;
-        break;
-    case FontWeight500:
-        fontWeight = 500;
-        break;
-    case FontWeight600:
-        fontWeight = 600;
-        break;
-    case FontWeight700:
-        fontWeight = 700;
-        break;
-    case FontWeight800:
-        fontWeight = 800;
-        break;
-    case FontWeight900:
-        fontWeight = 900;
-    }
+    int fontWeight = static_cast<float>(style->fontCascade().weight());
     if (fontWeight > 0) {
         buffer.reset(g_strdup_printf("%i", fontWeight));
         result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_WEIGHT), buffer.get());
index 398d6ae..3210851 100644 (file)
@@ -56,6 +56,7 @@
 #include "DeprecatedCSSOMValue.h"
 #include "Document.h"
 #include "ExceptionCode.h"
+#include "FontSelectionValueInlines.h"
 #include "FontTaggedSettings.h"
 #include "HTMLFrameOwnerElement.h"
 #include "NodeRenderStyle.h"
@@ -1912,37 +1913,30 @@ static Ref<CSSPrimitiveValue> fontSizeFromStyle(const RenderStyle& style)
     return zoomAdjustedPixelValue(style.fontDescription().computedSize(), style);
 }
 
-static Ref<CSSPrimitiveValue> fontStyleFromStyle(const RenderStyle& style)
+static Ref<CSSPrimitiveValue> fontWeightFromStyle(const RenderStyle& style)
 {
-    if (style.fontDescription().italic())
-        return CSSValuePool::singleton().createIdentifierValue(CSSValueItalic);
-    return CSSValuePool::singleton().createIdentifierValue(CSSValueNormal);
+    auto weight = style.fontDescription().weight();
+    if (auto value = fontWeightKeyword(weight))
+        return CSSValuePool::singleton().createIdentifierValue(value.value());
+    return CSSValuePool::singleton().createValue(static_cast<float>(weight), CSSPrimitiveValue::CSS_NUMBER);
 }
 
 static Ref<CSSPrimitiveValue> fontStretchFromStyle(const RenderStyle& style)
 {
     auto stretch = style.fontDescription().stretch();
-    if (stretch == FontSelectionValue(50))
-        return CSSValuePool::singleton().createIdentifierValue(CSSValueUltraCondensed);
-    if (stretch == FontSelectionValue(62.5f))
-        return CSSValuePool::singleton().createIdentifierValue(CSSValueExtraCondensed);
-    if (stretch == FontSelectionValue(75))
-        return CSSValuePool::singleton().createIdentifierValue(CSSValueCondensed);
-    if (stretch == FontSelectionValue(87.5f))
-        return CSSValuePool::singleton().createIdentifierValue(CSSValueSemiCondensed);
-    if (stretch == FontSelectionValue(100))
-        return CSSValuePool::singleton().createIdentifierValue(CSSValueNormal);
-    if (stretch == FontSelectionValue(112.5f))
-        return CSSValuePool::singleton().createIdentifierValue(CSSValueSemiExpanded);
-    if (stretch == FontSelectionValue(125))
-        return CSSValuePool::singleton().createIdentifierValue(CSSValueExpanded);
-    if (stretch == FontSelectionValue(150))
-        return CSSValuePool::singleton().createIdentifierValue(CSSValueExtraExpanded);
-    if (stretch == FontSelectionValue(200))
-        return CSSValuePool::singleton().createIdentifierValue(CSSValueUltraExpanded);
+    if (auto keyword = fontStretchKeyword(stretch))
+        return CSSValuePool::singleton().createIdentifierValue(keyword.value());
     return CSSValuePool::singleton().createValue(static_cast<float>(stretch), CSSPrimitiveValue::CSS_PERCENTAGE);
 }
 
+static Ref<CSSPrimitiveValue> fontStyleFromStyle(const RenderStyle& style)
+{
+    auto italic = style.fontDescription().italic();
+    if (auto italicValue = fontStyleKeyword(italic))
+        return CSSValuePool::singleton().createIdentifierValue(italicValue.value());
+    return CSSValuePool::singleton().createValue(static_cast<float>(italic), CSSPrimitiveValue::CSS_DEG);
+}
+
 static Ref<CSSValue> fontVariantFromStyle(const RenderStyle& style)
 {
     if (style.fontDescription().variantSettings().isAllNormal())
@@ -2130,32 +2124,6 @@ static Ref<CSSValue> fontVariantFromStyle(const RenderStyle& style)
     return WTFMove(list);
 }
 
-static Ref<CSSPrimitiveValue> fontWeightFromStyle(const RenderStyle& style)
-{
-    switch (style.fontDescription().weight()) {
-    case FontWeight100:
-        return CSSValuePool::singleton().createIdentifierValue(CSSValue100);
-    case FontWeight200:
-        return CSSValuePool::singleton().createIdentifierValue(CSSValue200);
-    case FontWeight300:
-        return CSSValuePool::singleton().createIdentifierValue(CSSValue300);
-    case FontWeightNormal:
-        return CSSValuePool::singleton().createIdentifierValue(CSSValueNormal);
-    case FontWeight500:
-        return CSSValuePool::singleton().createIdentifierValue(CSSValue500);
-    case FontWeight600:
-        return CSSValuePool::singleton().createIdentifierValue(CSSValue600);
-    case FontWeightBold:
-        return CSSValuePool::singleton().createIdentifierValue(CSSValueBold);
-    case FontWeight800:
-        return CSSValuePool::singleton().createIdentifierValue(CSSValue800);
-    case FontWeight900:
-        return CSSValuePool::singleton().createIdentifierValue(CSSValue900);
-    }
-    ASSERT_NOT_REACHED();
-    return CSSValuePool::singleton().createIdentifierValue(CSSValueNormal);
-}
-
 static Ref<CSSValue> fontSynthesisFromStyle(const RenderStyle& style)
 {
     if (style.fontDescription().fontSynthesis() == FontSynthesisNone)
@@ -2556,6 +2524,39 @@ String ComputedStyleExtractor::customPropertyText(const String& propertyName)
     return propertyValue ? propertyValue->cssText() : emptyString();
 }
 
+static Ref<CSSFontValue> fontShorthandValueForSelectionProperties(const FontDescription& fontDescription)
+{
+    auto computedFont = CSSFontValue::create();
+
+    auto variantCaps = fontDescription.variantCaps();
+    if (variantCaps == FontVariantCaps::Small)
+        computedFont->variant = CSSValuePool::singleton().createIdentifierValue(CSSValueSmallCaps);
+    else if (variantCaps == FontVariantCaps::Normal)
+        computedFont->variant = CSSValuePool::singleton().createIdentifierValue(CSSValueNormal);
+    else
+        return CSSFontValue::create();
+
+    auto weight = fontDescription.weight();
+    if (auto value = fontWeightKeyword(weight))
+        computedFont->weight = CSSValuePool::singleton().createIdentifierValue(value.value());
+    else if (isCSS21Weight(weight))
+        computedFont->weight = CSSValuePool::singleton().createValue(static_cast<float>(weight), CSSPrimitiveValue::CSS_NUMBER);
+    else
+        return CSSFontValue::create();
+
+    if (auto keyword = fontStretchKeyword(fontDescription.stretch()))
+        computedFont->stretch = CSSValuePool::singleton().createIdentifierValue(keyword.value());
+    else
+        return CSSFontValue::create();
+
+    if (auto italic = fontStyleKeyword(fontDescription.italic()))
+        computedFont->style = CSSValuePool::singleton().createIdentifierValue(italic.value());
+    else
+        return CSSFontValue::create();
+
+    return computedFont;
+}
+
 RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID, EUpdateLayout updateLayout)
 {
     auto* styledElement = this->styledElement();
@@ -2906,14 +2907,7 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
                 return cssValuePool.createIdentifierValue(CSSValueNone);
             return cssValuePool.createValue(style->floating());
         case CSSPropertyFont: {
-            auto computedFont = CSSFontValue::create();
-            computedFont->style = fontStyleFromStyle(*style);
-            if (style->fontDescription().variantCaps() == FontVariantCaps::Small)
-                computedFont->variant = CSSValuePool::singleton().createIdentifierValue(CSSValueSmallCaps);
-            else
-                computedFont->variant = CSSValuePool::singleton().createIdentifierValue(CSSValueNormal);
-            computedFont->weight = fontWeightFromStyle(*style);
-            computedFont->stretch = fontStretchFromStyle(*style);
+            auto computedFont = fontShorthandValueForSelectionProperties(style->fontDescription());
             computedFont->size = fontSizeFromStyle(*style);
             computedFont->lineHeight = lineHeightFromStyle(*style);
             computedFont->family = fontFamilyListFromStyle(*style);
index 0348cf9..29226cb 100644 (file)
@@ -124,150 +124,111 @@ bool CSSFontFace::setFamilies(CSSValue& family)
     return true;
 }
 
-std::optional<FontTraitsMask> CSSFontFace::calculateStyleMask(CSSValue& style)
-{
-    if (!is<CSSPrimitiveValue>(style))
-        return std::nullopt;
-
-    switch (downcast<CSSPrimitiveValue>(style).valueID()) {
-    case CSSValueNormal:
-        return FontStyleNormalMask;
-    case CSSValueItalic:
-    case CSSValueOblique:
-        return FontStyleItalicMask;
-    default:
-        return FontStyleNormalMask;
-    }
-
-    return FontStyleNormalMask;
-}
-
-bool CSSFontFace::setStyle(CSSValue& style)
+static FontSelectionRange calculateWeightRange(CSSValue& value)
 {
-    if (auto mask = calculateStyleMask(style)) {
-        m_traitsMask = static_cast<FontTraitsMask>((static_cast<unsigned>(m_traitsMask) & (~FontStyleMask)) | mask.value());
-
-        if (m_cssConnection)
-            m_cssConnection->mutableProperties().setProperty(CSSPropertyFontStyle, &style);
+    // FIXME: Parse range-based values.
+    ASSERT(is<CSSPrimitiveValue>(value));
+    auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
 
-        iterateClients(m_clients, [&](Client& client) {
-            client.fontPropertyChanged(*this);
-        });
+    FontSelectionValue result;
+    if (primitiveValue.isNumber()) {
+        result = FontSelectionValue::clampFloat(primitiveValue.floatValue());
+        return { result, result };
+    }
 
-        return true;
+    ASSERT(primitiveValue.isValueID());
+    if (auto value = fontWeightValue(primitiveValue.valueID()))
+        result = value.value();
+    else {
+        ASSERT_NOT_REACHED();
+        result = normalWeightValue();
     }
-    return false;
+
+    return { result, result };
 }
 
-std::optional<FontTraitsMask> CSSFontFace::calculateWeightMask(CSSValue& weight)
-{
-    if (!is<CSSPrimitiveValue>(weight))
-        return std::nullopt;
-
-    switch (downcast<CSSPrimitiveValue>(weight).valueID()) {
-    case CSSValueBold:
-    case CSSValueBolder:
-    case CSSValue700:
-        return FontWeight700Mask;
-    case CSSValueNormal:
-    case CSSValue400:
-        return FontWeight400Mask;
-    case CSSValue900:
-        return FontWeight900Mask;
-    case CSSValue800:
-        return FontWeight800Mask;
-    case CSSValue600:
-        return FontWeight600Mask;
-    case CSSValue500:
-        return FontWeight500Mask;
-    case CSSValue300:
-        return FontWeight300Mask;
-    case CSSValueLighter:
-    case CSSValue200:
-        return FontWeight200Mask;
-    case CSSValue100:
-        return FontWeight100Mask;
-    default:
-        return FontWeight400Mask;
-    }
+void CSSFontFace::setWeight(CSSValue& weight)
+{
+    auto range = calculateWeightRange(weight);
+    setWeight(range);
 
-    return FontWeight400Mask;
+    if (m_cssConnection)
+        m_cssConnection->mutableProperties().setProperty(CSSPropertyFontWeight, &weight);
+
+    iterateClients(m_clients, [&](Client& client) {
+        client.fontPropertyChanged(*this);
+    });
 }
 
-std::optional<FontSelectionValue> CSSFontFace::calculateStretch(CSSValue& stretch)
+static FontSelectionRange calculateStretchRange(CSSValue& value)
 {
-    if (!is<CSSPrimitiveValue>(stretch))
-        return std::nullopt;
+    // FIXME: Parse range-based values.
+    ASSERT(is<CSSPrimitiveValue>(value));
+    const auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
 
-    const auto& primitiveValue = downcast<CSSPrimitiveValue>(stretch);
+    FontSelectionValue result;
     if (primitiveValue.isPercentage() || primitiveValue.isNumber()) {
-        auto value = primitiveValue.floatValue();
-        if (value < static_cast<float>(FontSelectionValue::minimumValue()))
-            return FontSelectionValue::minimumValue();
-        if (value > static_cast<float>(FontSelectionValue::maximumValue()))
-            return FontSelectionValue::maximumValue();
-        return FontSelectionValue(value);
+        result = FontSelectionValue::clampFloat(primitiveValue.floatValue());
+        return { result, result };
     }
 
-    switch (primitiveValue.valueID()) {
-    case CSSValueUltraCondensed:
-        return FontSelectionValue(50);
-    case CSSValueExtraCondensed:
-        return FontSelectionValue(62.5f);
-    case CSSValueCondensed:
-        return FontSelectionValue(75);
-    case CSSValueSemiCondensed:
-        return FontSelectionValue(87.5f);
-    case CSSValueNormal:
-        return FontSelectionValue(100);
-    case CSSValueSemiExpanded:
-        return FontSelectionValue(112.5f);
-    case CSSValueExpanded:
-        return FontSelectionValue(125);
-    case CSSValueExtraExpanded:
-        return FontSelectionValue(150);
-    case CSSValueUltraExpanded:
-        return FontSelectionValue(200);
-    default:
+    ASSERT(primitiveValue.isValueID());
+    if (auto value = fontStretchValue(primitiveValue.valueID()))
+        result = value.value();
+    else {
         ASSERT_NOT_REACHED();
-        return std::nullopt;
+        result = normalStretchValue();
     }
+
+    return { result, result };
 }
 
-bool CSSFontFace::setWeight(CSSValue& weight)
+void CSSFontFace::setStretch(CSSValue& style)
 {
-    if (auto mask = calculateWeightMask(weight)) {
-        m_traitsMask = static_cast<FontTraitsMask>((static_cast<unsigned>(m_traitsMask) & (~FontWeightMask)) | mask.value());
+    auto range = calculateStretchRange(style);
+    setStretch(range);
+
+    if (m_cssConnection)
+        m_cssConnection->mutableProperties().setProperty(CSSPropertyFontStretch, &style);
 
-        if (m_cssConnection)
-            m_cssConnection->mutableProperties().setProperty(CSSPropertyFontWeight, &weight);
+    iterateClients(m_clients, [&](Client& client) {
+        client.fontPropertyChanged(*this);
+    });
+}
 
-        iterateClients(m_clients, [&](Client& client) {
-            client.fontPropertyChanged(*this);
-        });
+static FontSelectionRange calculateItalicRange(CSSValue& value)
+{
+    // FIXME: Parse range-based values.
+    ASSERT(is<CSSPrimitiveValue>(value));
+    const auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
 
-        return true;
+    FontSelectionValue result;
+    if (primitiveValue.isAngle() || primitiveValue.isNumber() || primitiveValue.isCalculated()) {
+        result = FontSelectionValue::clampFloat(primitiveValue.floatValue(CSSPrimitiveValue::CSS_DEG));
+        return { result, result };
     }
 
-    return false;
+    ASSERT(primitiveValue.isValueID());
+    if (auto value = fontStyleValue(primitiveValue.valueID()))
+        result = value.value();
+    else {
+        ASSERT_NOT_REACHED();
+        result = normalItalicValue();
+    }
+    return { result, result };
 }
 
-bool CSSFontFace::setStretch(CSSValue& stretch)
+void CSSFontFace::setStyle(CSSValue& style)
 {
-    if (auto parsedStretch = calculateStretch(stretch)) {
-        m_stretch = FontSelectionRange(parsedStretch.value(), parsedStretch.value());
+    auto range = calculateItalicRange(style);
+    setStyle(range);
 
-        if (m_cssConnection)
-            m_cssConnection->mutableProperties().setProperty(CSSPropertyFontStretch, &stretch);
-
-        iterateClients(m_clients, [&](Client& client) {
-            client.fontPropertyChanged(*this);
-        });
-
-        return true;
-    }
+    if (m_cssConnection)
+        m_cssConnection->mutableProperties().setProperty(CSSPropertyFontStyle, &style);
 
-    return false;
+    iterateClients(m_clients, [&](Client& client) {
+        client.fontPropertyChanged(*this);
+    });
 }
 
 bool CSSFontFace::setUnicodeRange(CSSValue& unicodeRange)
index b0c2b2e..c28fce6 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "CSSFontFaceRule.h"
 #include "FontSelectionAlgorithm.h"
+#include "FontSelectionValueInlines.h"
 #include "FontTaggedSettings.h"
 #include "TextFlags.h"
 #include "Timer.h"
@@ -64,9 +65,9 @@ public:
     // FIXME: These functions don't need to have boolean return values.
     // Callers only call this with known-valid CSS values.
     bool setFamilies(CSSValue&);
-    bool setStyle(CSSValue&);
-    bool setWeight(CSSValue&);
-    bool setStretch(CSSValue&);
+    void setStyle(CSSValue&);
+    void setWeight(CSSValue&);
+    void setStretch(CSSValue&);
     bool setUnicodeRange(CSSValue&);
     bool setVariantLigatures(CSSValue&);
     bool setVariantPosition(CSSValue&);
@@ -79,22 +80,21 @@ public:
     enum class Status;
     struct UnicodeRange;
     const CSSValueList* families() const { return m_families.get(); }
-    FontTraitsMask traitsMask() const { return m_traitsMask; }
-    FontSelectionRange stretch() const { return m_stretch; }
+    FontSelectionRange weight() const { return m_fontSelectionCapabilities.weight; }
+    FontSelectionRange stretch() const { return m_fontSelectionCapabilities.width; }
+    FontSelectionRange italic() const { return m_fontSelectionCapabilities.slope; }
+    FontSelectionCapabilities fontSelectionCapabilities() const { return m_fontSelectionCapabilities; }
     const Vector<UnicodeRange>& ranges() const { return m_ranges; }
     const FontFeatureSettings& featureSettings() const { return m_featureSettings; }
     const FontVariantSettings& variantSettings() const { return m_variantSettings; }
     void setVariantSettings(const FontVariantSettings& variantSettings) { m_variantSettings = variantSettings; }
-    void setTraitsMask(FontTraitsMask traitsMask) { m_traitsMask = traitsMask; }
-    void setStretch(FontSelectionRange stretch) { m_stretch = stretch; }
+    void setWeight(FontSelectionRange weight) { m_fontSelectionCapabilities.weight = weight; }
+    void setStretch(FontSelectionRange stretch) { m_fontSelectionCapabilities.width = stretch; }
+    void setStyle(FontSelectionRange italic) { m_fontSelectionCapabilities.slope = italic; }
+    void setFontSelectionCapabilities(FontSelectionCapabilities capabilities) { m_fontSelectionCapabilities = capabilities; }
     bool isLocalFallback() const { return m_isLocalFallback; }
     Status status() const { return m_status; }
     StyleRuleFontFace* cssConnection() const { return m_cssConnection.get(); }
-    FontSelectionCapabilities fontSelectionCapabilities() const { return fontSelectionCapabilitiesForTraitsMask(m_traitsMask, m_stretch); }
-
-    static std::optional<FontTraitsMask> calculateStyleMask(CSSValue& style);
-    static std::optional<FontTraitsMask> calculateWeightMask(CSSValue& weight);
-    static std::optional<FontSelectionValue> calculateStretch(CSSValue& stretch);
 
     class Client;
     void addClient(Client&);
@@ -168,7 +168,6 @@ private:
     void timeoutFired();
 
     RefPtr<CSSValueList> m_families;
-    FontTraitsMask m_traitsMask { static_cast<FontTraitsMask>(FontStyleNormalMask | FontWeight400Mask) };
     Vector<UnicodeRange> m_ranges;
     FontFeatureSettings m_featureSettings;
     FontVariantSettings m_variantSettings;
@@ -178,8 +177,8 @@ private:
     RefPtr<StyleRuleFontFace> m_cssConnection;
     HashSet<Client*> m_clients;
     WeakPtr<FontFace> m_wrapper;
+    FontSelectionCapabilities m_fontSelectionCapabilities;
     Status m_status { Status::Pending };
-    FontSelectionRange m_stretch { FontSelectionValue(100), FontSelectionValue(100) };
     bool m_isLocalFallback { false };
     bool m_sourcesPopulated { false };
     bool m_mayBePurged { true };
index 83f6e57..34d280c 100644 (file)
@@ -101,19 +101,18 @@ void CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered(const String& famil
     if (m_locallyInstalledFacesLookupTable.contains(familyName))
         return;
 
-    Vector<FontCache::TraitsAndStretch> traitsAndStretch = FontCache::singleton().getTraitsAndStretchInFamily(familyName);
-    if (traitsAndStretch.isEmpty())
+    Vector<FontSelectionCapabilities> capabilities = FontCache::singleton().getFontSelectionCapabilitiesInFamily(familyName);
+    if (capabilities.isEmpty())
         return;
 
     Vector<Ref<CSSFontFace>> faces;
-    for (auto item : traitsAndStretch) {
+    for (auto item : capabilities) {
         Ref<CSSFontFace> face = CSSFontFace::create(nullptr, nullptr, nullptr, true);
         
         Ref<CSSValueList> familyList = CSSValueList::createCommaSeparated();
         familyList->append(CSSValuePool::singleton().createFontFamilyValue(familyName));
         face->setFamilies(familyList.get());
-        face->setTraitsMask(item.traits);
-        face->setStretch(item.stretch);
+        face->setFontSelectionCapabilities(item);
         face->adoptSource(std::make_unique<CSSFontFaceSource>(face.get(), familyName));
         ASSERT(!face->allSourcesFailed());
         faces.append(WTFMove(face));
@@ -287,40 +286,91 @@ CSSFontFace& CSSFontFaceSet::operator[](size_t i)
     return m_faces[i];
 }
 
-static std::optional<FontTraitsMask> computeFontTraitsMask(MutableStyleProperties& style)
+static std::optional<FontSelectionValue> calculateWeightValue(CSSValue& weight)
 {
-    RefPtr<CSSValue> styleValue = style.getPropertyCSSValue(CSSPropertyFontStyle).get();
-    if (!styleValue)
-        styleValue = CSSValuePool::singleton().createIdentifierValue(CSSValueNormal).ptr();
+    if (!is<CSSPrimitiveValue>(weight))
+        return std::nullopt;
 
-    FontTraitsMask styleMask;
-    if (auto styleMaskOptional = CSSFontFace::calculateStyleMask(*styleValue))
-        styleMask = styleMaskOptional.value();
-    else
+    auto& primitiveWeight = downcast<CSSPrimitiveValue>(weight);
+    if (primitiveWeight.isNumber())
+        return FontSelectionValue::clampFloat(primitiveWeight.floatValue());
+
+    if (!primitiveWeight.isValueID())
+        return std::nullopt;
+
+    if (auto value = fontWeightValue(primitiveWeight.valueID()))
+        return value.value();
+    ASSERT_NOT_REACHED();
+    return normalWeightValue();
+}
+
+static std::optional<FontSelectionValue> calculateStretchValue(CSSValue& style)
+{
+    if (!is<CSSPrimitiveValue>(style))
+        return std::nullopt;
+
+    auto& primitiveStretch = downcast<CSSPrimitiveValue>(style);
+    if (primitiveStretch.isNumber() || primitiveStretch.isPercentage())
+        return FontSelectionValue::clampFloat(primitiveStretch.floatValue());
+
+    if (!primitiveStretch.isValueID())
+        return std::nullopt;
+
+    if (auto value = fontStretchValue(primitiveStretch.valueID()))
+        return value.value();
+    return normalStretchValue();
+}
+
+static std::optional<FontSelectionValue> calculateStyleValue(CSSValue& style)
+{
+    if (!is<CSSPrimitiveValue>(style))
+        return std::nullopt;
+
+    auto& primitiveSlant = downcast<CSSPrimitiveValue>(style);
+    if (primitiveSlant.isNumber() || primitiveSlant.isAngle())
+        return FontSelectionValue::clampFloat(primitiveSlant.floatValue());
+
+    if (!primitiveSlant.isValueID())
         return std::nullopt;
 
+    if (auto value = fontStyleValue(downcast<CSSPrimitiveValue>(style).valueID()))
+        return value.value();
+    return normalItalicValue();
+}
+
+static std::optional<FontSelectionRequest> computeFontSelectionRequest(MutableStyleProperties& style)
+{
     RefPtr<CSSValue> weightValue = style.getPropertyCSSValue(CSSPropertyFontWeight).get();
     if (!weightValue)
         weightValue = CSSValuePool::singleton().createIdentifierValue(CSSValueNormal).ptr();
 
-    FontTraitsMask weightMask;
-    if (auto weightMaskOptional = CSSFontFace::calculateWeightMask(*weightValue))
-        weightMask = weightMaskOptional.value();
+    FontSelectionValue weightSelectionValue;
+    if (auto weightOptional = calculateWeightValue(*weightValue))
+        weightSelectionValue = weightOptional.value();
     else
         return std::nullopt;
 
-    return static_cast<FontTraitsMask>(static_cast<unsigned>(styleMask) | static_cast<unsigned>(weightMask));
-}
-
-static std::optional<FontSelectionValue> computeFontStretch(MutableStyleProperties& style)
-{
     RefPtr<CSSValue> stretchValue = style.getPropertyCSSValue(CSSPropertyFontStretch).get();
     if (!stretchValue)
         stretchValue = CSSValuePool::singleton().createIdentifierValue(CSSValueNormal).ptr();
 
-    if (auto stretchOptional = CSSFontFace::calculateStretch(*stretchValue))
-        return stretchOptional.value();
-    return std::nullopt;
+    FontSelectionValue stretchSelectionValue;
+    if (auto stretchOptional = calculateStretchValue(*weightValue))
+        stretchSelectionValue = stretchOptional.value();
+    else
+        return std::nullopt;
+
+    RefPtr<CSSValue> styleValue = style.getPropertyCSSValue(CSSPropertyFontStyle).get();
+    if (!styleValue)
+        styleValue = CSSValuePool::singleton().createIdentifierValue(CSSValueNormal).ptr();
+
+    FontSelectionValue styleSelectionValue;
+    if (auto styleOptional = calculateStyleValue(*styleValue))
+        styleSelectionValue = styleOptional.value();
+    else
+        return std::nullopt;
+
+    return {{ weightSelectionValue, stretchSelectionValue, styleSelectionValue }};
 }
 
 static HashSet<UChar32> codePointsFromString(StringView stringView)
@@ -346,15 +396,9 @@ ExceptionOr<Vector<std::reference_wrapper<CSSFontFace>>> CSSFontFaceSet::matchin
     if (parseResult == CSSParser::ParseResult::Error)
         return Exception { SYNTAX_ERR };
 
-    FontTraitsMask fontTraitsMask;
-    if (auto maskOptional = computeFontTraitsMask(style.get()))
-        fontTraitsMask = maskOptional.value();
-    else
-        return Exception { SYNTAX_ERR };
-
-    FontSelectionValue stretch;
-    if (auto stretchOptional = computeFontStretch(style.get()))
-        stretch = stretchOptional.value();
+    FontSelectionRequest request;
+    if (auto fontSelectionRequestOptional = computeFontSelectionRequest(style.get()))
+        request = fontSelectionRequestOptional.value();
     else
         return Exception { SYNTAX_ERR };
 
@@ -377,7 +421,7 @@ ExceptionOr<Vector<std::reference_wrapper<CSSFontFace>>> CSSFontFaceSet::matchin
     for (auto codePoint : codePointsFromString(string)) {
         bool found = false;
         for (auto& family : familyOrder) {
-            auto* faces = fontFace(fontTraitsMask, stretch, family);
+            auto* faces = fontFace(request, family);
             if (!faces)
                 continue;
             for (auto& constituentFace : faces->constituentFaces()) {
@@ -412,16 +456,16 @@ ExceptionOr<bool> CSSFontFaceSet::check(const String& font, const String& text)
     return true;
 }
 
-CSSSegmentedFontFace* CSSFontFaceSet::fontFace(FontTraitsMask traitsMask, FontSelectionValue stretch, const AtomicString& family)
+CSSSegmentedFontFace* CSSFontFaceSet::fontFace(FontSelectionRequest request, const AtomicString& family)
 {
     auto iterator = m_facesLookupTable.find(family);
     if (iterator == m_facesLookupTable.end())
         return nullptr;
     auto& familyFontFaces = iterator->value;
 
-    auto& segmentedFontFaceCache = m_cache.add(family, HashMap<unsigned, RefPtr<CSSSegmentedFontFace>>()).iterator->value;
+    auto& segmentedFontFaceCache = m_cache.add(family, FontSelectionHashMap()).iterator->value;
 
-    auto& face = segmentedFontFaceCache.add(traitsMask, nullptr).iterator->value;
+    auto& face = segmentedFontFaceCache.add(request, nullptr).iterator->value;
     if (face)
         return face.get();
 
@@ -430,8 +474,8 @@ CSSSegmentedFontFace* CSSFontFaceSet::fontFace(FontTraitsMask traitsMask, FontSe
     Vector<std::reference_wrapper<CSSFontFace>, 32> candidateFontFaces;
     for (int i = familyFontFaces.size() - 1; i >= 0; --i) {
         CSSFontFace& candidate = familyFontFaces[i];
-        unsigned candidateTraitsMask = candidate.traitsMask();
-        if ((traitsMask & FontStyleNormalMask) && !(candidateTraitsMask & FontStyleNormalMask))
+        auto capabilities = candidate.fontSelectionCapabilities();
+        if (!isItalic(request.slope) && isItalic(capabilities.slope.minimum))
             continue;
         candidateFontFaces.append(candidate);
     }
@@ -439,8 +483,8 @@ CSSSegmentedFontFace* CSSFontFaceSet::fontFace(FontTraitsMask traitsMask, FontSe
     auto localIterator = m_locallyInstalledFacesLookupTable.find(family);
     if (localIterator != m_locallyInstalledFacesLookupTable.end()) {
         for (auto& candidate : localIterator->value) {
-            unsigned candidateTraitsMask = candidate->traitsMask();
-            if ((traitsMask & FontStyleNormalMask) && !(candidateTraitsMask & FontStyleNormalMask))
+            auto capabilities = candidate->fontSelectionCapabilities();
+            if (!isItalic(request.slope) && isItalic(capabilities.slope.minimum))
                 continue;
             candidateFontFaces.append(candidate);
         }
@@ -451,7 +495,7 @@ CSSSegmentedFontFace* CSSFontFaceSet::fontFace(FontTraitsMask traitsMask, FontSe
         capabilities.reserveInitialCapacity(candidateFontFaces.size());
         for (auto& face : candidateFontFaces)
             capabilities.uncheckedAppend(face.get().fontSelectionCapabilities());
-        FontSelectionAlgorithm fontSelectionAlgorithm(fontSelectionRequestForTraitsMask(traitsMask, stretch), capabilities);
+        FontSelectionAlgorithm fontSelectionAlgorithm(request, capabilities);
         std::stable_sort(candidateFontFaces.begin(), candidateFontFaces.end(), [&fontSelectionAlgorithm](const CSSFontFace& first, const CSSFontFace& second) {
             auto firstCapabilities = first.fontSelectionCapabilities();
             auto secondCapabilities = second.fontSelectionCapabilities();
index e374e06..2b7e2eb 100644 (file)
@@ -67,7 +67,7 @@ public:
 
     ExceptionOr<bool> check(const String& font, const String& text);
 
-    CSSSegmentedFontFace* fontFace(FontTraitsMask, FontSelectionValue stretch, const AtomicString& family);
+    CSSSegmentedFontFace* fontFace(FontSelectionRequest, const AtomicString& family);
 
     enum class Status { Loading, Loaded };
     Status status() const { return m_status; }
@@ -98,7 +98,8 @@ private:
     Vector<Ref<CSSFontFace>> m_faces; // We should investigate moving m_faces to FontFaceSet and making it reference FontFaces. This may clean up the font loading design.
     HashMap<String, Vector<Ref<CSSFontFace>>, ASCIICaseInsensitiveHash> m_facesLookupTable;
     HashMap<String, Vector<Ref<CSSFontFace>>, ASCIICaseInsensitiveHash> m_locallyInstalledFacesLookupTable;
-    HashMap<String, HashMap<unsigned, RefPtr<CSSSegmentedFontFace>>, ASCIICaseInsensitiveHash> m_cache;
+    typedef HashMap<FontSelectionRequestKey, RefPtr<CSSSegmentedFontFace>, FontSelectionRequestKeyHash, WTF::SimpleClassHashTraits<FontSelectionRequestKey>> FontSelectionHashMap;
+    HashMap<String, FontSelectionHashMap, ASCIICaseInsensitiveHash> m_cache;
     HashMap<StyleRuleFontFace*, CSSFontFace*> m_constituentCSSConnections;
     size_t m_facesPartitionIndex { 0 }; // All entries in m_faces before this index are CSS-connected.
     Status m_status { Status::Loaded };
index 49be912..fe07600 100644 (file)
@@ -182,12 +182,9 @@ void CSSFontSelector::addFontFaceRule(StyleRuleFontFace& fontFaceRule, bool isIn
 
     if (!fontFace->setFamilies(*fontFamily))
         return;
-    if (!fontFace->setStyle(*fontStyle))
-        return;
-    if (!fontFace->setWeight(*fontWeight))
-        return;
-    if (!fontFace->setStretch(*fontStretch))
-        return;
+    fontFace->setStyle(*fontStyle);
+    fontFace->setWeight(*fontWeight);
+    fontFace->setStretch(*fontStretch);
     if (rangeList && !fontFace->setUnicodeRange(*rangeList))
         return;
     if (variantLigatures && !fontFace->setVariantLigatures(*variantLigatures))
@@ -301,7 +298,7 @@ FontRanges CSSFontSelector::fontRangesForFamily(const FontDescription& fontDescr
     bool resolveGenericFamilyFirst = familyName == standardFamily;
 
     AtomicString familyForLookup = resolveGenericFamilyFirst ? resolveGenericFamily(m_document, fontDescription, familyName) : familyName;
-    auto* face = m_cssFontFaceSet->fontFace(fontDescription.traitsMask(), fontDescription.stretch(), familyForLookup);
+    auto* face = m_cssFontFaceSet->fontFace(fontDescription.fontSelectionRequest(), familyForLookup);
     if (!face) {
         if (!resolveGenericFamilyFirst)
             familyForLookup = resolveGenericFamily(m_document, fontDescription, familyName);
index d9dbdb7..bf0da25 100644 (file)
@@ -3679,114 +3679,6 @@ template<> inline CSSPrimitiveValue::operator FontSmoothingMode() const
     return AutoSmoothing;
 }
 
-template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontWeight weight)
-    : CSSValue(PrimitiveClass)
-{
-    m_primitiveUnitType = CSS_VALUE_ID;
-    switch (weight) {
-    case FontWeight900:
-        m_value.valueID = CSSValue900;
-        return;
-    case FontWeight800:
-        m_value.valueID = CSSValue800;
-        return;
-    case FontWeight700:
-        m_value.valueID = CSSValue700;
-        return;
-    case FontWeight600:
-        m_value.valueID = CSSValue600;
-        return;
-    case FontWeight500:
-        m_value.valueID = CSSValue500;
-        return;
-    case FontWeight400:
-        m_value.valueID = CSSValue400;
-        return;
-    case FontWeight300:
-        m_value.valueID = CSSValue300;
-        return;
-    case FontWeight200:
-        m_value.valueID = CSSValue200;
-        return;
-    case FontWeight100:
-        m_value.valueID = CSSValue100;
-        return;
-    }
-
-    ASSERT_NOT_REACHED();
-    m_value.valueID = CSSValueNormal;
-}
-
-template<> inline CSSPrimitiveValue::operator FontWeight() const
-{
-    ASSERT(isValueID());
-
-    switch (m_value.valueID) {
-    case CSSValueBold:
-        return FontWeightBold;
-    case CSSValueNormal:
-        return FontWeightNormal;
-    case CSSValue900:
-        return FontWeight900;
-    case CSSValue800:
-        return FontWeight800;
-    case CSSValue700:
-        return FontWeight700;
-    case CSSValue600:
-        return FontWeight600;
-    case CSSValue500:
-        return FontWeight500;
-    case CSSValue400:
-        return FontWeight400;
-    case CSSValue300:
-        return FontWeight300;
-    case CSSValue200:
-        return FontWeight200;
-    case CSSValue100:
-        return FontWeight100;
-    default:
-        break;
-    }
-
-    ASSERT_NOT_REACHED();
-    return FontWeightNormal;
-}
-
-template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontItalic italic)
-    : CSSValue(PrimitiveClass)
-{
-    m_primitiveUnitType = CSS_VALUE_ID;
-    switch (italic) {
-    case FontItalicOff:
-        m_value.valueID = CSSValueNormal;
-        return;
-    case FontItalicOn:
-        m_value.valueID = CSSValueItalic;
-        return;
-    }
-
-    ASSERT_NOT_REACHED();
-    m_value.valueID = CSSValueNormal;
-}
-
-template<> inline CSSPrimitiveValue::operator FontItalic() const
-{
-    ASSERT(isValueID());
-
-    switch (m_value.valueID) {
-    case CSSValueOblique:
-    // FIXME: oblique is the same as italic for the moment...
-    case CSSValueItalic:
-        return FontItalicOn;
-    case CSSValueNormal:
-        return FontItalicOff;
-    default:
-        break;
-    }
-    ASSERT_NOT_REACHED();
-    return FontItalicOff;
-}
-
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontSmallCaps smallCaps)
     : CSSValue(PrimitiveClass)
 {
index 776b5f9..d20f523 100644 (file)
             "codegen-properties": {
                 "name-for-methods": "Italic",
                 "font-property": true,
-                "high-priority": true
+                "high-priority": true,
+                "converter": "FontStyle"
             },
             "specification": {
                 "category": "css-fonts",
         "font-weight": {
             "inherited": true,
             "codegen-properties": {
-                "custom": "All",
-                "high-priority": true
+                "name-for-methods": "Weight",
+                "font-property": true,
+                "high-priority": true,
+                "converter": "FontWeight"
             },
             "specification": {
                 "category": "css-fonts",
index 6213441..dcffc12 100644 (file)
@@ -107,7 +107,7 @@ static void appendFont(FontRanges& ranges, Ref<FontAccessor>&& fontAccessor, con
 
 FontRanges CSSSegmentedFontFace::fontRanges(const FontDescription& fontDescription)
 {
-    FontTraitsMask desiredTraitsMask = fontDescription.traitsMask();
+    auto desiredRequest = fontDescription.fontSelectionRequest();
 
     auto addResult = m_cache.add(FontDescriptionKey(fontDescription), FontRanges());
     auto& result = addResult.iterator->value;
@@ -117,9 +117,9 @@ FontRanges CSSSegmentedFontFace::fontRanges(const FontDescription& fontDescripti
             if (face->allSourcesFailed())
                 continue;
 
-            FontTraitsMask traitsMask = face->traitsMask();
-            bool syntheticBold = (fontDescription.fontSynthesis() & FontSynthesisWeight) && !(traitsMask & (FontWeight600Mask | FontWeight700Mask | FontWeight800Mask | FontWeight900Mask)) && (desiredTraitsMask & (FontWeight600Mask | FontWeight700Mask | FontWeight800Mask | FontWeight900Mask));
-            bool syntheticItalic = (fontDescription.fontSynthesis() & FontSynthesisStyle) && !(traitsMask & FontStyleItalicMask) && (desiredTraitsMask & FontStyleItalicMask);
+            auto selectionCapabilities = face->fontSelectionCapabilities();
+            bool syntheticBold = (fontDescription.fontSynthesis() & FontSynthesisWeight) && !isFontWeightBold(selectionCapabilities.weight.maximum) && isFontWeightBold(desiredRequest.weight);
+            bool syntheticItalic = (fontDescription.fontSynthesis() & FontSynthesisStyle) && !isItalic(selectionCapabilities.slope.maximum) && isItalic(desiredRequest.slope);
 
             // This doesn't trigger an unnecessary download because every element styled with this family will need font metrics in order to run layout.
             // Metrics used for layout come from FontRanges::fontForFirstRange(), which assumes that the first font is non-null.
index 3c9dff1..c044e48 100644 (file)
@@ -125,15 +125,7 @@ normal
 bold
 bolder
 lighter
-100
-200
-300
-400
-500
-600
-700
-800
-900
+
 //
 // CSS_PROP_FONT_SIZE:
 //
index 4c2fc59..1178387 100644 (file)
@@ -163,12 +163,11 @@ ExceptionOr<void> FontFace::setStyle(const String& style)
     if (style.isEmpty())
         return Exception { SYNTAX_ERR };
 
-    bool success = false;
-    if (auto value = parseString(style, CSSPropertyFontStyle))
-        success = m_backing->setStyle(*value);
-    if (!success)
-        return Exception { SYNTAX_ERR };
-    return { };
+    if (auto value = parseString(style, CSSPropertyFontStyle)) {
+        m_backing->setStyle(*value);
+        return { };
+    }
+    return Exception { SYNTAX_ERR };
 }
 
 ExceptionOr<void> FontFace::setWeight(const String& weight)
@@ -176,12 +175,11 @@ ExceptionOr<void> FontFace::setWeight(const String& weight)
     if (weight.isEmpty())
         return Exception { SYNTAX_ERR };
 
-    bool success = false;
-    if (auto value = parseString(weight, CSSPropertyFontWeight))
-        success = m_backing->setWeight(*value);
-    if (!success)
-        return Exception { SYNTAX_ERR };
-    return { };
+    if (auto value = parseString(weight, CSSPropertyFontWeight)) {
+        m_backing->setWeight(*value);
+        return { };
+    }
+    return Exception { SYNTAX_ERR };
 }
 
 ExceptionOr<void> FontFace::setStretch(const String& stretch)
@@ -189,12 +187,11 @@ ExceptionOr<void> FontFace::setStretch(const String& stretch)
     if (stretch.isEmpty())
         return Exception { SYNTAX_ERR };
 
-    bool success = false;
-    if (auto value = parseString(stretch, CSSPropertyFontStretch))
-        success = m_backing->setStretch(*value);
-    if (!success)
-        return Exception { SYNTAX_ERR };
-    return { };
+    if (auto value = parseString(stretch, CSSPropertyFontStretch)) {
+        m_backing->setStretch(*value);
+        return { };
+    }
+    return Exception { SYNTAX_ERR };
 }
 
 ExceptionOr<void> FontFace::setUnicodeRange(const String& unicodeRange)
@@ -283,44 +280,55 @@ String FontFace::family() const
     return m_backing->families()->cssText();
 }
 
+static inline bool rangeIsSingleValue(FontSelectionRange range, FontSelectionValue value)
+{
+    return range.minimum == value && range.maximum == value;
+};
+
 String FontFace::style() const
 {
     m_backing->updateStyleIfNeeded();
-    switch (m_backing->traitsMask() & FontStyleMask) {
-    case FontStyleNormalMask:
-        return String("normal", String::ConstructFromLiteral);
-    case FontStyleItalicMask:
-        return String("italic", String::ConstructFromLiteral);
+    auto style = m_backing->italic();
+
+    if (rangeIsSingleValue(style, italicValue()))
+        return ASCIILiteral("italic");
+    if (rangeIsSingleValue(style, normalItalicValue()))
+        return ASCIILiteral("normal");
+
+    if (style.minimum == style.maximum) {
+        auto value = static_cast<float>(style.minimum);
+        if (value >= 0) {
+            auto floored = std::floor(value);
+            if (floored == value)
+                return String::format("oblique %ddeg", static_cast<int>(floored));
+        }
+        return String::format("oblique %fdeg", static_cast<float>(style.minimum));
     }
-    ASSERT_NOT_REACHED();
-    return String("normal", String::ConstructFromLiteral);
+
+    return String::format("oblique %fdeg-%fdeg", static_cast<float>(style.minimum), static_cast<float>(style.maximum));
 }
 
 String FontFace::weight() const
 {
     m_backing->updateStyleIfNeeded();
-    switch (m_backing->traitsMask() & FontWeightMask) {
-    case FontWeight100Mask:
-        return String("100", String::ConstructFromLiteral);
-    case FontWeight200Mask:
-        return String("200", String::ConstructFromLiteral);
-    case FontWeight300Mask:
-        return String("300", String::ConstructFromLiteral);
-    case FontWeight400Mask:
-        return String("normal", String::ConstructFromLiteral);
-    case FontWeight500Mask:
-        return String("500", String::ConstructFromLiteral);
-    case FontWeight600Mask:
-        return String("600", String::ConstructFromLiteral);
-    case FontWeight700Mask:
-        return String("bold", String::ConstructFromLiteral);
-    case FontWeight800Mask:
-        return String("800", String::ConstructFromLiteral);
-    case FontWeight900Mask:
-        return String("900", String::ConstructFromLiteral);
+    auto weight = m_backing->weight();
+
+    if (rangeIsSingleValue(weight, normalWeightValue()))
+        return ASCIILiteral("normal");
+    if (rangeIsSingleValue(weight, boldWeightValue()))
+        return ASCIILiteral("bold");
+
+    if (weight.minimum == weight.maximum) {
+        auto value = static_cast<float>(weight.minimum);
+        if (value >= 0) {
+            auto floored = std::floor(value);
+            if (floored == value)
+                return String::format("%d", static_cast<int>(floored));
+        }
+        return String::format("%f", static_cast<float>(weight.minimum));
     }
-    ASSERT_NOT_REACHED();
-    return String("normal", String::ConstructFromLiteral);
+
+    return String::format("%f-%f", static_cast<float>(weight.minimum), static_cast<float>(weight.maximum));
 }
 
 String FontFace::stretch() const
@@ -328,30 +336,36 @@ String FontFace::stretch() const
     m_backing->updateStyleIfNeeded();
     auto stretch = m_backing->stretch();
 
-    auto rangeIsSingleValue = [](FontSelectionRange range, FontSelectionValue value) -> bool {
-        return range.minimum == value && range.maximum == value;
-    };
-
-    if (rangeIsSingleValue(stretch, FontSelectionValue(50)))
+    if (rangeIsSingleValue(stretch, ultraCondensedStretchValue()))
         return ASCIILiteral("ultra-condensed");
-    if (rangeIsSingleValue(stretch, FontSelectionValue(62.5f)))
+    if (rangeIsSingleValue(stretch, extraCondensedStretchValue()))
         return ASCIILiteral("extra-condensed");
-    if (rangeIsSingleValue(stretch, FontSelectionValue(75)))
+    if (rangeIsSingleValue(stretch, condensedStretchValue()))
         return ASCIILiteral("condensed");
-    if (rangeIsSingleValue(stretch, FontSelectionValue(87.5f)))
+    if (rangeIsSingleValue(stretch, semiCondensedStretchValue()))
         return ASCIILiteral("semi-condensed");
-    if (rangeIsSingleValue(stretch, FontSelectionValue(100)))
+    if (rangeIsSingleValue(stretch, normalStretchValue()))
         return ASCIILiteral("normal");
-    if (rangeIsSingleValue(stretch, FontSelectionValue(112.5f)))
+    if (rangeIsSingleValue(stretch, semiExpandedStretchValue()))
         return ASCIILiteral("semi-expanded");
-    if (rangeIsSingleValue(stretch, FontSelectionValue(125)))
+    if (rangeIsSingleValue(stretch, expandedStretchValue()))
         return ASCIILiteral("expanded");
-    if (rangeIsSingleValue(stretch, FontSelectionValue(150)))
+    if (rangeIsSingleValue(stretch, extraExpandedStretchValue()))
         return ASCIILiteral("extra-expanded");
-    if (rangeIsSingleValue(stretch, FontSelectionValue(200)))
+    if (rangeIsSingleValue(stretch, ultraExpandedStretchValue()))
         return ASCIILiteral("ultra-expanded");
 
-    return String::format("%f-%f", static_cast<float>(stretch.minimum), static_cast<float>(stretch.maximum));
+    if (stretch.minimum == stretch.maximum) {
+        auto value = static_cast<float>(stretch.minimum);
+        if (value >= 0) {
+            auto floored = std::floor(value);
+            if (floored == value)
+                return String::format("%d%%", static_cast<int>(floored));
+        }
+        return String::format("%f%%", static_cast<float>(stretch.minimum));
+    }
+
+    return String::format("%f%%-%f%%", static_cast<float>(stretch.minimum), static_cast<float>(stretch.maximum));
 }
 
 String FontFace::unicodeRange() const
diff --git a/Source/WebCore/css/FontSelectionValueInlines.h b/Source/WebCore/css/FontSelectionValueInlines.h
new file mode 100644 (file)
index 0000000..00fdb4e
--- /dev/null
@@ -0,0 +1,146 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "CSSValueKeywords.h"
+#include "FontSelectionAlgorithm.h"
+
+namespace WebCore {
+
+inline bool isCSS21Weight(FontSelectionValue weight)
+{
+    return weight == FontSelectionValue(100)
+        || weight == FontSelectionValue(200)
+        || weight == FontSelectionValue(300)
+        || weight == FontSelectionValue(400)
+        || weight == FontSelectionValue(500)
+        || weight == FontSelectionValue(600)
+        || weight == FontSelectionValue(700)
+        || weight == FontSelectionValue(800)
+        || weight == FontSelectionValue(900);
+}
+
+inline bool isCSS21Weight(int weight)
+{
+    return !((weight % 100) || weight < 100 || weight > 900);
+}
+
+inline std::optional<CSSValueID> fontWeightKeyword(FontSelectionValue weight)
+{
+    if (weight == normalWeightValue())
+        return CSSValueNormal;
+    if (weight == boldWeightValue())
+        return CSSValueBold;
+    return std::nullopt;
+}
+
+inline std::optional<FontSelectionValue> fontWeightValue(CSSValueID value)
+{
+    switch (value) {
+    case CSSValueNormal:
+        return normalWeightValue();
+    case CSSValueBold:
+    case CSSValueBolder:
+        return boldWeightValue();
+    case CSSValueLighter:
+        return lightWeightValue();
+    default:
+        return std::nullopt;
+    }
+}
+
+inline std::optional<CSSValueID> fontStretchKeyword(FontSelectionValue stretch)
+{
+    if (stretch == ultraCondensedStretchValue())
+        return CSSValueUltraCondensed;
+    if (stretch == extraCondensedStretchValue())
+        return CSSValueExtraCondensed;
+    if (stretch == condensedStretchValue())
+        return CSSValueCondensed;
+    if (stretch == semiCondensedStretchValue())
+        return CSSValueSemiCondensed;
+    if (stretch == normalStretchValue())
+        return CSSValueNormal;
+    if (stretch == semiExpandedStretchValue())
+        return CSSValueSemiExpanded;
+    if (stretch == expandedStretchValue())
+        return CSSValueExpanded;
+    if (stretch == extraExpandedStretchValue())
+        return CSSValueExtraExpanded;
+    if (stretch == ultraExpandedStretchValue())
+        return CSSValueUltraExpanded;
+    return std::nullopt;
+}
+
+inline std::optional<FontSelectionValue> fontStretchValue(CSSValueID value)
+{
+    switch (value) {
+    case CSSValueUltraCondensed:
+        return ultraCondensedStretchValue();
+    case CSSValueExtraCondensed:
+        return extraCondensedStretchValue();
+    case CSSValueCondensed:
+        return condensedStretchValue();
+    case CSSValueSemiCondensed:
+        return semiCondensedStretchValue();
+    case CSSValueNormal:
+        return normalStretchValue();
+    case CSSValueSemiExpanded:
+        return semiExpandedStretchValue();
+    case CSSValueExpanded:
+        return expandedStretchValue();
+    case CSSValueExtraExpanded:
+        return extraExpandedStretchValue();
+    case CSSValueUltraExpanded:
+        return ultraExpandedStretchValue();
+    default:
+        return std::nullopt;
+    }
+}
+
+inline std::optional<CSSValueID> fontStyleKeyword(FontSelectionValue style)
+{
+    if (style == normalItalicValue())
+        return CSSValueNormal;
+    if (style == italicValue())
+        return CSSValueItalic;
+    return std::nullopt;
+}
+
+inline std::optional<FontSelectionValue> fontStyleValue(CSSValueID value)
+{
+    switch (value) {
+    case CSSValueNormal:
+        return normalItalicValue();
+    case CSSValueOblique:
+    case CSSValueItalic:
+        return italicValue();
+    default:
+        return std::nullopt;
+    }
+}
+
+}
index 05a0d6e..d28a8ca 100644 (file)
@@ -40,6 +40,7 @@
 #include "CSSImageValue.h"
 #include "CSSPrimitiveValue.h"
 #include "CSSReflectValue.h"
+#include "FontSelectionValueInlines.h"
 #include "Frame.h"
 #include "LayoutUnit.h"
 #include "Length.h"
@@ -114,7 +115,9 @@ public:
     static bool convertOverflowScrolling(StyleResolver&, const CSSValue&);
 #endif
     static FontFeatureSettings convertFontFeatureSettings(StyleResolver&, const CSSValue&);
+    static FontSelectionValue convertFontWeight(StyleResolver&, const CSSValue&);
     static FontSelectionValue convertFontStretch(StyleResolver&, const CSSValue&);
+    static FontSelectionValue convertFontStyle(StyleResolver&, const CSSValue&);
 #if ENABLE(VARIATION_FONTS)
     static FontVariationSettings convertFontVariationSettings(StyleResolver&, const CSSValue&);
 #endif
@@ -1154,46 +1157,60 @@ inline FontFeatureSettings StyleBuilderConverter::convertFontFeatureSettings(Sty
     return settings;
 }
 
-inline FontSelectionValue StyleBuilderConverter::convertFontStretch(StyleResolver&, const CSSValue& value)
+inline FontSelectionValue StyleBuilderConverter::convertFontWeight(StyleResolver& styleResolver, const CSSValue& value)
 {
     ASSERT(is<CSSPrimitiveValue>(value));
-    const auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
-    if (primitiveValue.isPercentage() || primitiveValue.isNumber()) {
-        auto value = primitiveValue.floatValue();
-        if (value <= static_cast<float>(FontSelectionValue::maximumValue())
-            && value >= static_cast<float>(FontSelectionValue::minimumValue()))
-            return FontSelectionValue(value);
-        if (value < static_cast<float>(FontSelectionValue::minimumValue()))
-            return FontSelectionValue::minimumValue();
-        ASSERT(value > static_cast<float>(FontSelectionValue::maximumValue()));
-        return FontSelectionValue::maximumValue();
-    }
+    auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
 
+    if (primitiveValue.isNumber())
+        return FontSelectionValue::clampFloat(primitiveValue.floatValue());
+
+    ASSERT(primitiveValue.isValueID());
     switch (primitiveValue.valueID()) {
-    case CSSValueUltraCondensed:
-        return FontSelectionValue(50);
-    case CSSValueExtraCondensed:
-        return FontSelectionValue(62.5f);
-    case CSSValueCondensed:
-        return FontSelectionValue(75);
-    case CSSValueSemiCondensed:
-        return FontSelectionValue(87.5f);
     case CSSValueNormal:
-        return FontSelectionValue(100);
-    case CSSValueSemiExpanded:
-        return FontSelectionValue(112.5f);
-    case CSSValueExpanded:
-        return FontSelectionValue(125);
-    case CSSValueExtraExpanded:
-        return FontSelectionValue(150);
-    case CSSValueUltraExpanded:
-        return FontSelectionValue(200);
+        return normalWeightValue();
+    case CSSValueBold:
+        return boldWeightValue();
+    case CSSValueBolder:
+        return FontCascadeDescription::bolderWeight(styleResolver.parentStyle()->fontDescription().weight());
+    case CSSValueLighter:
+        return FontCascadeDescription::lighterWeight(styleResolver.parentStyle()->fontDescription().weight());
     default:
         ASSERT_NOT_REACHED();
-        return FontSelectionValue(100);
+        return normalWeightValue();
     }
 }
 
+inline FontSelectionValue StyleBuilderConverter::convertFontStretch(StyleResolver&, const CSSValue& value)
+{
+    ASSERT(is<CSSPrimitiveValue>(value));
+    const auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
+
+    if (primitiveValue.isPercentage() || primitiveValue.isNumber())
+        return FontSelectionValue::clampFloat(primitiveValue.floatValue());
+
+    ASSERT(primitiveValue.isValueID());
+    if (auto value = fontStretchValue(primitiveValue.valueID()))
+        return value.value();
+    ASSERT_NOT_REACHED();
+    return normalStretchValue();
+}
+
+inline FontSelectionValue StyleBuilderConverter::convertFontStyle(StyleResolver&, const CSSValue& value)
+{
+    ASSERT(is<CSSPrimitiveValue>(value));
+    const auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
+
+    if (primitiveValue.isAngle() || primitiveValue.isNumber() || primitiveValue.isCalculated())
+        return FontSelectionValue::clampFloat(primitiveValue.floatValue(CSSPrimitiveValue::CSS_DEG));
+
+    ASSERT(primitiveValue.isValueID());
+    if (auto value = fontStyleValue(primitiveValue.valueID()))
+        return value.value();
+    ASSERT_NOT_REACHED();
+    return normalItalicValue();
+}
+
 #if ENABLE(VARIATION_FONTS)
 inline FontVariationSettings StyleBuilderConverter::convertFontVariationSettings(StyleResolver&, const CSSValue& value)
 {
index c066760..861a7ba 100644 (file)
@@ -81,7 +81,6 @@ public:
     DECLARE_PROPERTY_CUSTOM_HANDLERS(Fill);
     DECLARE_PROPERTY_CUSTOM_HANDLERS(FontFamily);
     DECLARE_PROPERTY_CUSTOM_HANDLERS(FontSize);
-    DECLARE_PROPERTY_CUSTOM_HANDLERS(FontWeight);
 #if ENABLE(CSS_IMAGE_RESOLUTION)
     DECLARE_PROPERTY_CUSTOM_HANDLERS(ImageResolution);
 #endif
@@ -1295,42 +1294,6 @@ inline void StyleBuilderCustom::applyValueWebkitSvgShadow(StyleResolver& styleRe
     svgStyle.setShadow(std::make_unique<ShadowData>(location, blur, 0, Normal, false, color.isValid() ? color : Color::transparent));
 }
 
-inline void StyleBuilderCustom::applyInitialFontWeight(StyleResolver& styleResolver)
-{
-    auto fontDescription = styleResolver.fontDescription();
-    fontDescription.setWeight(FontWeightNormal);
-    styleResolver.setFontDescription(fontDescription);
-}
-
-inline void StyleBuilderCustom::applyInheritFontWeight(StyleResolver& styleResolver)
-{
-    auto fontDescription = styleResolver.fontDescription();
-    fontDescription.setWeight(styleResolver.parentFontDescription().weight());
-    styleResolver.setFontDescription(fontDescription);
-}
-
-inline void StyleBuilderCustom::applyValueFontWeight(StyleResolver& styleResolver, CSSValue& value)
-{
-    auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
-    auto fontDescription = styleResolver.fontDescription();
-    switch (primitiveValue.valueID()) {
-    case CSSValueInvalid:
-        ASSERT_NOT_REACHED();
-        break;
-    case CSSValueBolder:
-        fontDescription.setWeight(styleResolver.parentStyle()->fontDescription().weight());
-        fontDescription.setWeight(fontDescription.bolderWeight());
-        break;
-    case CSSValueLighter:
-        fontDescription.setWeight(styleResolver.parentStyle()->fontDescription().weight());
-        fontDescription.setWeight(fontDescription.lighterWeight());
-        break;
-    default:
-        fontDescription.setWeight(primitiveValue);
-    }
-    styleResolver.setFontDescription(fontDescription);
-}
-
 inline void StyleBuilderCustom::applyInitialColumnGap(StyleResolver& styleResolver)
 {
     styleResolver.style()->setHasNormalColumnGap();
index bf16172..eb9b8b8 100644 (file)
@@ -559,8 +559,6 @@ bool CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyID propertyId
         return valueID == CSSValueShow || valueID == CSSValueHide;
     case CSSPropertyFloat: // left | right | none
         return valueID == CSSValueLeft || valueID == CSSValueRight || valueID == CSSValueNone;
-    case CSSPropertyFontStyle: // normal | italic | oblique
-        return valueID == CSSValueNormal || valueID == CSSValueItalic || valueID == CSSValueOblique;
     case CSSPropertyImageRendering: // auto | optimizeContrast | pixelated | optimizeSpeed | crispEdges | optimizeQuality | webkit-crispEdges
         return valueID == CSSValueAuto || valueID == CSSValueOptimizeSpeed || valueID == CSSValueOptimizeQuality || valueID == CSSValueWebkitCrispEdges || valueID == CSSValueWebkitOptimizeContrast || valueID == CSSValueCrispEdges || valueID == CSSValuePixelated;
 #if ENABLE(CSS_COMPOSITING)
@@ -831,7 +829,6 @@ bool CSSParserFastPaths::isKeywordPropertyID(CSSPropertyID propertyId)
     case CSSPropertyFlexDirection:
     case CSSPropertyFlexWrap:
     case CSSPropertyFloat:
-    case CSSPropertyFontStyle:
     case CSSPropertyFontVariantAlternates:
     case CSSPropertyFontVariantCaps:
     case CSSPropertyFontVariantPosition:
index f2eabc7..5566243 100644 (file)
@@ -864,17 +864,28 @@ static RefPtr<CSSPrimitiveValue> consumeFontVariantCSS21(CSSParserTokenRange& ra
     return consumeIdent<CSSValueNormal, CSSValueSmallCaps>(range);
 }
 
-static RefPtr<CSSPrimitiveValue> consumeFontWeight(CSSParserTokenRange& range)
+static RefPtr<CSSPrimitiveValue> consumeFontWeightKeywordValue(CSSParserTokenRange& range)
 {
-    const CSSParserToken& token = range.peek();
-    if (token.id() >= CSSValueNormal && token.id() <= CSSValueLighter)
-        return consumeIdent(range);
+    return consumeIdent<CSSValueNormal, CSSValueBold, CSSValueBolder, CSSValueLighter>(range);
+}
+
+static RefPtr<CSSPrimitiveValue> consumeFontWeightCSS21(CSSParserTokenRange& range)
+{
+    if (auto result = consumeFontWeightKeywordValue(range))
+        return result;
     int weight;
     if (!consumePositiveIntegerRaw(range, weight))
         return nullptr;
-    if ((weight % 100) || weight < 100 || weight > 900)
+    if (!isCSS21Weight(weight))
         return nullptr;
-    return CSSValuePool::singleton().createIdentifierValue(static_cast<CSSValueID>(CSSValue100 + weight / 100 - 1));
+    return CSSValuePool::singleton().createValue(weight, CSSPrimitiveValue::CSS_NUMBER);
+}
+
+static RefPtr<CSSPrimitiveValue> consumeFontWeight(CSSParserTokenRange& range)
+{
+    if (auto result = consumeFontWeightKeywordValue(range))
+        return result;
+    return consumeNumber(range, ValueRangeAll);
 }
 
 static RefPtr<CSSPrimitiveValue> consumeFontStretchKeywordValue(CSSParserTokenRange& range)
@@ -891,6 +902,28 @@ static RefPtr<CSSPrimitiveValue> consumeFontStretch(CSSParserTokenRange& range)
     return consumeNumber(range, ValueRangeAll);
 }
 
+static RefPtr<CSSPrimitiveValue> consumeFontStyleKeywordValue(CSSParserTokenRange& range)
+{
+    return consumeIdent<CSSValueNormal, CSSValueItalic, CSSValueOblique>(range);
+}
+
+static RefPtr<CSSPrimitiveValue> consumeFontStyle(CSSParserTokenRange& range, CSSParserMode cssParserMode)
+{
+    if (auto result = consumeFontStyleKeywordValue(range)) {
+        if (result->valueID() == CSSValueOblique) {
+            if (range.atEnd())
+                return result;
+            if (auto angle = consumeAngle(range, cssParserMode))
+                return angle;
+            if (auto number = consumeNumber(range, ValueRangeAll))
+                return number;
+            return nullptr;
+        }
+        return result;
+    }
+    return nullptr;
+}
+
 static String concatenateFamilyName(CSSParserTokenRange& range)
 {
     StringBuilder builder;
@@ -3666,6 +3699,8 @@ RefPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSPropertyID property, CSS
         return consumeFontWeight(m_range);
     case CSSPropertyFontStretch:
         return consumeFontStretch(m_range);
+    case CSSPropertyFontStyle:
+        return consumeFontStyle(m_range, m_context.mode);
     case CSSPropertyFontSynthesis:
         return consumeFontSynthesis(m_range);
 #if ENABLE(VARIATION_FONTS)
@@ -4184,16 +4219,18 @@ bool CSSPropertyParser::parseFontFaceDescriptor(CSSPropertyID propId)
     case CSSPropertyUnicodeRange:
         parsedValue = consumeFontFaceUnicodeRange(m_range);
         break;
+    case CSSPropertyFontWeight:
+        // FIXME: Parse range-based values.
+        parsedValue = consumeFontWeight(m_range);
+        break;
     case CSSPropertyFontStretch:
+        // FIXME: Parse range-based values.
         parsedValue = consumeFontStretch(m_range);
         break;
-    case CSSPropertyFontStyle: {
-        CSSValueID id = m_range.consumeIncludingWhitespace().id();
-        if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(propId, id, m_context.mode))
-            return false;
-        parsedValue = CSSValuePool::singleton().createIdentifierValue(id);
+    case CSSPropertyFontStyle:
+        // FIXME: Parse range-based values.
+        parsedValue = consumeFontStyle(m_range, m_context.mode);
         break;
-    }
     case CSSPropertyFontVariantCaps:
         parsedValue = consumeFontVariantCaps(m_range);
         break;
@@ -4214,9 +4251,6 @@ bool CSSPropertyParser::parseFontFaceDescriptor(CSSPropertyID propId)
         break;
     case CSSPropertyFontVariant:
         return consumeFontVariantShorthand(false);
-    case CSSPropertyFontWeight:
-        parsedValue = consumeFontWeight(m_range);
-        break;
     case CSSPropertyFontFeatureSettings:
         parsedValue = consumeFontFeatureSettings(m_range);
         break;
@@ -4243,8 +4277,8 @@ bool CSSPropertyParser::consumeSystemFont(bool important)
     if (!fontDescription.isAbsoluteSize())
         return false;
     
-    addProperty(CSSPropertyFontStyle, CSSPropertyFont, CSSValuePool::singleton().createIdentifierValue(fontDescription.italic() == FontItalicOn ? CSSValueItalic : CSSValueNormal), important);
-    addProperty(CSSPropertyFontWeight, CSSPropertyFont, CSSValuePool::singleton().createValue(fontDescription.weight()), important);
+    addProperty(CSSPropertyFontStyle, CSSPropertyFont, CSSValuePool::singleton().createIdentifierValue(isItalic(fontDescription.italic()) ? CSSValueItalic : CSSValueNormal), important);
+    addProperty(CSSPropertyFontWeight, CSSPropertyFont, CSSValuePool::singleton().createValue(static_cast<float>(fontDescription.weight())), important);
     addProperty(CSSPropertyFontSize, CSSPropertyFont, CSSValuePool::singleton().createValue(fontDescription.specifiedSize(), CSSPrimitiveValue::CSS_PX), important);
     Ref<CSSValueList> fontFamilyList = CSSValueList::createCommaSeparated();
     fontFamilyList->append(CSSValuePool::singleton().createFontFamilyValue(fontDescription.familyAt(0), FromSystemFontID::Yes));
@@ -4274,9 +4308,10 @@ bool CSSPropertyParser::consumeFont(bool important)
 
     while (!m_range.atEnd()) {
         CSSValueID id = m_range.peek().id();
-        if (!fontStyle && CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyFontStyle, id, m_context.mode)) {
-            fontStyle = consumeIdent(m_range);
-            continue;
+        if (!fontStyle) {
+            fontStyle = consumeFontStyleKeywordValue(m_range);
+            if (fontStyle)
+                continue;
         }
         if (!fontVariantCaps && (id == CSSValueNormal || id == CSSValueSmallCaps)) {
             // Font variant in the shorthand is particular, it only accepts normal or small-caps.
@@ -4286,7 +4321,7 @@ bool CSSPropertyParser::consumeFont(bool important)
                 continue;
         }
         if (!fontWeight) {
-            fontWeight = consumeFontWeight(m_range);
+            fontWeight = consumeFontWeightCSS21(m_range);
             if (fontWeight)
                 continue;
         }
index 553525a..e7db4e5 100644 (file)
@@ -1738,28 +1738,18 @@ static bool fontWeightIsBold(CSSValue& fontWeight)
     if (!is<CSSPrimitiveValue>(fontWeight))
         return false;
 
-    // Because b tag can only bold text, there are only two states in plain html: bold and not bold.
-    // Collapse all other values to either one of these two states for editing purposes.
-    switch (downcast<CSSPrimitiveValue>(fontWeight).valueID()) {
-        case CSSValue100:
-        case CSSValue200:
-        case CSSValue300:
-        case CSSValue400:
-        case CSSValue500:
+    auto& primitiveValue = downcast<CSSPrimitiveValue>(fontWeight);
+    switch (primitiveValue.valueID()) {
         case CSSValueNormal:
             return false;
         case CSSValueBold:
-        case CSSValue600:
-        case CSSValue700:
-        case CSSValue800:
-        case CSSValue900:
             return true;
         default:
             break;
     }
 
-    ASSERT_NOT_REACHED(); // For CSSValueBolder and CSSValueLighter
-    return false;
+    ASSERT(primitiveValue.isNumber());
+    return primitiveValue.floatValue() >= static_cast<float>(boldThreshold());
 }
 
 template<typename T>
index 3d70b8c..e9f4c38 100644 (file)
@@ -492,7 +492,7 @@ void Editor::applyFontStyles(const String& fontFamily, double fontSize, unsigned
     Ref<MutableStyleProperties> style = MutableStyleProperties::create();
     style->setProperty(CSSPropertyFontFamily, cssValuePool.createFontFamilyValue(fontFamily));
     style->setProperty(CSSPropertyFontStyle, (fontTraits & NSFontItalicTrait) ? CSSValueItalic : CSSValueNormal);
-    style->setProperty(CSSPropertyFontWeight, cssValuePool.createValue(fontTraits & NSFontBoldTrait ? FontWeightBold : FontWeightNormal));
+    style->setProperty(CSSPropertyFontWeight, (fontTraits & NSFontBoldTrait) ? CSSValueBold : CSSValueNormal);
     style->setProperty(CSSPropertyFontSize, cssValuePool.createValue(fontSize, CSSPrimitiveValue::CSS_PX));
     applyStyleToSelection(style.ptr(), EditActionSetFont);
 }
index 5dc3d8d..51adb0b 100644 (file)
@@ -188,9 +188,6 @@ public:
     Vector<String> systemFontFamilies();
     void platformInit();
 
-#if PLATFORM(IOS)
-    static float weightOfCTFont(CTFontRef);
-#endif
 #if PLATFORM(COCOA)
     WEBCORE_EXPORT static void setFontWhitelist(const Vector<String>&);
 #endif
@@ -203,11 +200,7 @@ public:
 
     // This function exists so CSSFontSelector can have a unified notion of preinstalled fonts and @font-face.
     // It comes into play when you create an @font-face which shares a family name as a preinstalled font.
-    struct TraitsAndStretch {
-        FontTraitsMask traits;
-        FontSelectionRange stretch;
-    };
-    Vector<TraitsAndStretch> getTraitsAndStretchInFamily(const AtomicString&);
+    Vector<FontSelectionCapabilities> getFontSelectionCapabilitiesInFamily(const AtomicString&);
 
     WEBCORE_EXPORT RefPtr<Font> fontForFamily(const FontDescription&, const AtomicString&, const FontFeatureSettings* fontFaceFeatures = nullptr, const FontVariantSettings* fontFaceVariantSettings = nullptr, bool checkingAlternateName = false);
     WEBCORE_EXPORT Ref<Font> lastResortFallbackFont(const FontDescription&);
@@ -286,13 +279,11 @@ struct SynthesisPair {
 };
 
 RetainPtr<CTFontRef> preparePlatformFont(CTFontRef, TextRenderingMode, const FontFeatureSettings* fontFaceFeatures, const FontVariantSettings* fontFaceVariantSettings, const FontFeatureSettings& features, const FontVariantSettings&, const FontVariationSettings&);
-FontWeight fontWeightFromCoreText(CGFloat weight);
-uint16_t toCoreTextFontWeight(FontWeight);
-bool isFontWeightBold(FontWeight);
 SynthesisPair computeNecessarySynthesis(CTFontRef, const FontDescription&, bool isPlatformFont = false);
-RetainPtr<CTFontRef> platformFontWithFamilySpecialCase(const AtomicString& family, FontWeight, CTFontSymbolicTraits, float size);
-RetainPtr<CTFontRef> platformFontWithFamily(const AtomicString& family, CTFontSymbolicTraits, FontWeight, TextRenderingMode, float size);
+RetainPtr<CTFontRef> platformFontWithFamilySpecialCase(const AtomicString& family, FontSelectionRequest, float size);
+RetainPtr<CTFontRef> platformFontWithFamily(const AtomicString& family, FontSelectionRequest, TextRenderingMode, float size);
 bool requiresCustomFallbackFont(UChar32 character);
+FontSelectionCapabilities capabilitiesForFontDescriptor(CTFontDescriptorRef);
 
 #else
 
index 0fac643..6641388 100644 (file)
@@ -121,7 +121,7 @@ FontCascade::FontCascade(const FontPlatformData& fontData, FontSmoothingMode fon
     m_fontDescription.setSpecifiedSize(CTFontGetSize(fontData.font()));
     m_fontDescription.setComputedSize(CTFontGetSize(fontData.font()));
     m_fontDescription.setIsItalic(CTFontGetSymbolicTraits(fontData.font()) & kCTFontTraitItalic);
-    m_fontDescription.setWeight((CTFontGetSymbolicTraits(fontData.font()) & kCTFontTraitBold) ? FontWeightBold : FontWeightNormal);
+    m_fontDescription.setWeight((CTFontGetSymbolicTraits(fontData.font()) & kCTFontTraitBold) ? boldWeightValue() : normalWeightValue());
 #endif
 }
 
index 92d8786..3762e48 100644 (file)
@@ -164,8 +164,8 @@ public:
     unsigned familyCount() const { return m_fontDescription.familyCount(); }
     const AtomicString& familyAt(unsigned i) const { return m_fontDescription.familyAt(i); }
 
-    FontItalic italic() const { return m_fontDescription.italic(); }
-    FontWeight weight() const { return m_fontDescription.weight(); }
+    FontSelectionValue italic() const { return m_fontDescription.italic(); }
+    FontSelectionValue weight() const { return m_fontDescription.weight(); }
     FontWidthVariant widthVariant() const { return m_fontDescription.widthVariant(); }
 
     bool isPlatformFont() const { return m_fonts->isForPlatformFont(); }
index 8efd69d..ac59e1b 100644 (file)
@@ -42,7 +42,8 @@ struct SameSizeAsFontCascadeDescription {
     char c;
 #endif
     AtomicString string;
-    float size[2];
+    int16_t fontSelectionRequest[3];
+    float size;
     unsigned bitfields1;
     unsigned bitfields2 : 22;
     void* array;
@@ -53,11 +54,10 @@ struct SameSizeAsFontCascadeDescription {
 COMPILE_ASSERT(sizeof(FontCascadeDescription) == sizeof(SameSizeAsFontCascadeDescription), FontCascadeDescription_should_stay_small);
 
 FontDescription::FontDescription()
-    : m_orientation(Horizontal)
+    : m_fontSelectionRequest(FontCascadeDescription::initialWeight(), FontCascadeDescription::initialStretch(), FontCascadeDescription::initialItalic())
+    , m_orientation(Horizontal)
     , m_nonCJKGlyphOrientation(static_cast<unsigned>(NonCJKGlyphOrientation::Mixed))
     , m_widthVariant(RegularWidth)
-    , m_italic(FontItalicOff)
-    , m_weight(FontWeightNormal)
     , m_renderingMode(static_cast<unsigned>(FontRenderingMode::Normal))
     , m_textRendering(AutoTextRendering)
     , m_script(USCRIPT_COMMON)
@@ -80,13 +80,6 @@ FontDescription::FontDescription()
 {
 }
 
-FontTraitsMask FontDescription::traitsMask() const
-{
-    return static_cast<FontTraitsMask>((m_italic ? FontStyleItalicMask : FontStyleNormalMask)
-        | (FontWeight100Mask << (m_weight - FontWeight100)));
-    
-}
-
 void FontDescription::setLocale(const AtomicString& locale)
 {
     m_locale = locale;
@@ -102,48 +95,26 @@ FontCascadeDescription::FontCascadeDescription()
 {
 }
 
-FontWeight FontCascadeDescription::lighterWeight(void) const
+FontSelectionValue FontCascadeDescription::lighterWeight(FontSelectionValue weight)
 {
-    switch (weight()) {
-    case FontWeight100:
-    case FontWeight200:
-    case FontWeight300:
-    case FontWeight400:
-    case FontWeight500:
-        return FontWeight100;
-
-    case FontWeight600:
-    case FontWeight700:
-        return FontWeight400;
-
-    case FontWeight800:
-    case FontWeight900:
-        return FontWeight700;
-    }
-    ASSERT_NOT_REACHED();
-    return FontWeightNormal;
+    if (weight < FontSelectionValue(100))
+        return weight;
+    if (weight < FontSelectionValue(550))
+        return FontSelectionValue(100);
+    if (weight < FontSelectionValue(750))
+        return FontSelectionValue(400);
+    return FontSelectionValue(700);
 }
 
-FontWeight FontCascadeDescription::bolderWeight(void) const
+FontSelectionValue FontCascadeDescription::bolderWeight(FontSelectionValue weight)
 {
-    switch (weight()) {
-    case FontWeight100:
-    case FontWeight200:
-    case FontWeight300:
-        return FontWeight400;
-
-    case FontWeight400:
-    case FontWeight500:
-        return FontWeight700;
-
-    case FontWeight600:
-    case FontWeight700:
-    case FontWeight800:
-    case FontWeight900:
-        return FontWeight900;
-    }
-    ASSERT_NOT_REACHED();
-    return FontWeightNormal;
+    if (weight < FontSelectionValue(350))
+        return FontSelectionValue(400);
+    if (weight < FontSelectionValue(550))
+        return FontSelectionValue(700);
+    if (weight < FontSelectionValue(900))
+        return FontSelectionValue(900);
+    return weight;
 }
 
 #if ENABLE(TEXT_AUTOSIZING)
index 9a9464c..5e03cbb 100644 (file)
@@ -46,12 +46,11 @@ public:
     bool operator!=(const FontDescription& other) const { return !(*this == other); }
 
     float computedSize() const { return m_computedSize; }
-    FontItalic italic() const { return static_cast<FontItalic>(m_italic); }
-    FontSelectionValue stretch() const { return m_stretch; }
+    FontSelectionValue italic() const { return m_fontSelectionRequest.slope; }
+    FontSelectionValue stretch() const { return m_fontSelectionRequest.width; }
+    FontSelectionValue weight() const { return m_fontSelectionRequest.weight; }
+    FontSelectionRequest fontSelectionRequest() const { return m_fontSelectionRequest; }
     int computedPixelSize() const { return int(m_computedSize + 0.5f); }
-    FontWeight weight() const { return static_cast<FontWeight>(m_weight); }
-    FontWeight lighterWeight() const;
-    FontWeight bolderWeight() const;
     FontRenderingMode renderingMode() const { return static_cast<FontRenderingMode>(m_renderingMode); }
     TextRenderingMode textRenderingMode() const { return static_cast<TextRenderingMode>(m_textRendering); }
     UScriptCode script() const { return static_cast<UScriptCode>(m_script); }
@@ -98,10 +97,10 @@ public:
     }
 
     void setComputedSize(float s) { m_computedSize = clampToFloat(s); }
-    void setItalic(FontItalic i) { m_italic = i; }
-    void setStretch(FontSelectionValue stretch) { m_stretch = stretch; }
-    void setIsItalic(bool i) { setItalic(i ? FontItalicOn : FontItalicOff); }
-    void setWeight(FontWeight w) { m_weight = w; }
+    void setItalic(FontSelectionValue italic) { m_fontSelectionRequest.slope = italic; }
+    void setStretch(FontSelectionValue stretch) { m_fontSelectionRequest.width = stretch; }
+    void setIsItalic(bool i) { setItalic(i ? italicValue() : normalItalicValue()); }
+    void setWeight(FontSelectionValue weight) { m_fontSelectionRequest.weight = weight; }
     void setRenderingMode(FontRenderingMode mode) { m_renderingMode = static_cast<unsigned>(mode); }
     void setTextRenderingMode(TextRenderingMode rendering) { m_textRendering = rendering; }
     void setOrientation(FontOrientation orientation) { m_orientation = orientation; }
@@ -129,21 +128,17 @@ public:
     void setVariantEastAsianWidth(FontVariantEastAsianWidth variant) { m_variantEastAsianWidth = static_cast<unsigned>(variant); }
     void setVariantEastAsianRuby(FontVariantEastAsianRuby variant) { m_variantEastAsianRuby = static_cast<unsigned>(variant); }
 
-    FontTraitsMask traitsMask() const;
-
 private:
     // FIXME: Investigate moving these into their own object on the heap (to save memory).
     FontFeatureSettings m_featureSettings;
     FontVariationSettings m_variationSettings;
     AtomicString m_locale;
 
+    FontSelectionRequest m_fontSelectionRequest;
     float m_computedSize { 0 }; // Computed size adjusted for the minimum font size and the zoom factor.
-    FontSelectionValue m_stretch { 100 }; // Stretch, or "width," of the font
     unsigned m_orientation : 1; // FontOrientation - Whether the font is rendering on a horizontal line or a vertical line.
     unsigned m_nonCJKGlyphOrientation : 1; // NonCJKGlyphOrientation - Only used by vertical text. Determines the default orientation for non-ideograph glyphs.
     unsigned m_widthVariant : 2; // FontWidthVariant
-    unsigned m_italic : 1; // FontItalic
-    unsigned m_weight : 8; // FontWeight
     unsigned m_renderingMode : 1; // Used to switch between CG and GDI text on Windows.
     unsigned m_textRendering : 2; // TextRenderingMode
     unsigned m_script : 7; // Used to help choose an appropriate font for generic font families.
@@ -168,9 +163,7 @@ private:
 inline bool FontDescription::operator==(const FontDescription& other) const
 {
     return m_computedSize == other.m_computedSize
-        && m_stretch == other.m_stretch
-        && m_italic == other.m_italic
-        && m_weight == other.m_weight
+        && m_fontSelectionRequest == other.m_fontSelectionRequest
         && m_renderingMode == other.m_renderingMode
         && m_textRendering == other.m_textRendering
         && m_orientation == other.m_orientation
@@ -214,8 +207,10 @@ public:
 
     float specifiedSize() const { return m_specifiedSize; }
     bool isAbsoluteSize() const { return m_isAbsoluteSize; }
-    FontWeight lighterWeight() const;
-    FontWeight bolderWeight() const;
+    FontSelectionValue lighterWeight() const { return lighterWeight(weight()); }
+    FontSelectionValue bolderWeight() const { return bolderWeight(weight()); }
+    static FontSelectionValue lighterWeight(FontSelectionValue);
+    static FontSelectionValue bolderWeight(FontSelectionValue);
 
     // only use fixed default size when there is only one font family, and that family is "monospace"
     bool useFixedDefaultSize() const { return familyCount() == 1 && firstFamily() == monospaceFamily; }
@@ -265,8 +260,9 @@ public:
 #endif
 
     // Initial values for font properties.
-    static FontItalic initialItalic() { return FontItalicOff; }
-    static FontSelectionValue initialStretch() { return FontSelectionValue(100); }
+    static FontSelectionValue initialItalic() { return normalItalicValue(); }
+    static FontSelectionValue initialWeight() { return normalWeightValue(); }
+    static FontSelectionValue initialStretch() { return normalStretchValue(); }
     static FontSmallCaps initialSmallCaps() { return FontSmallCapsOff; }
     static Kerning initialKerning() { return Kerning::Auto; }
     static FontSmoothingMode initialFontSmoothing() { return AutoSmoothing; }
index 643dec7..97fd2a9 100644 (file)
@@ -35,7 +35,7 @@ auto FontSelectionAlgorithm::stretchDistance(FontSelectionCapabilities capabilit
     if (width.includes(m_request.width))
         return { FontSelectionValue(), m_request.width };
 
-    if (m_request.width >= FontSelectionValue(100)) {
+    if (m_request.width >= normalStretchValue()) {
         if (width.minimum > m_request.width)
             return { width.minimum - m_request.width, width.minimum };
         ASSERT(width.maximum < m_request.width);
@@ -152,88 +152,4 @@ size_t FontSelectionAlgorithm::indexOfBestCapabilities()
     return result.value_or(0);
 }
 
-FontSelectionRequest fontSelectionRequestForTraitsMask(FontTraitsMask traitsMask, FontSelectionValue stretch)
-{
-    FontSelectionRequest result;
-    if (traitsMask & FontWeight100Mask)
-        result.weight = FontSelectionValue(100);
-    else if (traitsMask & FontWeight200Mask)
-        result.weight = FontSelectionValue(200);
-    else if (traitsMask & FontWeight300Mask)
-        result.weight = FontSelectionValue(300);
-    else if (traitsMask & FontWeight400Mask)
-        result.weight = FontSelectionValue(400);
-    else if (traitsMask & FontWeight500Mask)
-        result.weight = FontSelectionValue(500);
-    else if (traitsMask & FontWeight600Mask)
-        result.weight = FontSelectionValue(600);
-    else if (traitsMask & FontWeight700Mask)
-        result.weight = FontSelectionValue(700);
-    else if (traitsMask & FontWeight800Mask)
-        result.weight = FontSelectionValue(800);
-    else {
-        ASSERT(traitsMask & FontWeight900Mask);
-        result.weight = FontSelectionValue(900);
-    }
-
-    result.width = stretch;
-
-    if (traitsMask & FontStyleNormalMask)
-        result.slope = FontSelectionValue();
-    else {
-        ASSERT(traitsMask & FontStyleItalicMask);
-        result.slope = italicThreshold();
-    }
-
-    return result;
-}
-
-static FontSelectionCapabilities initialFontSelectionCapabilitiesForTraitsMask(FontTraitsMask traitsMask)
-{
-    FontSelectionCapabilities result;
-    if (traitsMask & FontWeight100Mask)
-        result.weight = { FontSelectionValue(100), FontSelectionValue(100) };
-    else if (traitsMask & FontWeight200Mask)
-        result.weight = { FontSelectionValue(200), FontSelectionValue(200) };
-    else if (traitsMask & FontWeight300Mask)
-        result.weight = { FontSelectionValue(300), FontSelectionValue(300) };
-    else if (traitsMask & FontWeight400Mask)
-        result.weight = { FontSelectionValue(400), FontSelectionValue(400) };
-    else if (traitsMask & FontWeight500Mask)
-        result.weight = { FontSelectionValue(500), FontSelectionValue(500) };
-    else if (traitsMask & FontWeight600Mask)
-        result.weight = { FontSelectionValue(600), FontSelectionValue(600) };
-    else if (traitsMask & FontWeight700Mask)
-        result.weight = { FontSelectionValue(700), FontSelectionValue(700) };
-    else if (traitsMask & FontWeight800Mask)
-        result.weight = { FontSelectionValue(800), FontSelectionValue(800) };
-    else {
-        ASSERT(traitsMask & FontWeight900Mask);
-        result.weight = { FontSelectionValue(900), FontSelectionValue(900) };
-    }
-
-    if (traitsMask & FontStyleNormalMask)
-        result.slope = { FontSelectionValue(), FontSelectionValue() };
-    else {
-        ASSERT(traitsMask & FontStyleItalicMask);
-        result.slope = { italicThreshold(), italicThreshold() };
-    }
-
-    return result;
-}
-
-FontSelectionCapabilities fontSelectionCapabilitiesForTraitsMask(FontTraitsMask traitsMask, FontSelectionValue stretch)
-{
-    FontSelectionCapabilities result = initialFontSelectionCapabilitiesForTraitsMask(traitsMask);
-    result.width = { stretch, stretch };
-    return result;
-}
-
-FontSelectionCapabilities fontSelectionCapabilitiesForTraitsMask(FontTraitsMask traitsMask, FontSelectionRange stretch)
-{
-    FontSelectionCapabilities result = initialFontSelectionCapabilitiesForTraitsMask(traitsMask);
-    result.width = stretch;
-    return result;
-}
-
 }
index 8d6afb1..6527481 100644 (file)
@@ -88,6 +88,15 @@ public:
         return result.get();
     }
 
+    static FontSelectionValue clampFloat(float value)
+    {
+        if (value < static_cast<float>(FontSelectionValue::minimumValue()))
+            return FontSelectionValue::minimumValue();
+        if (value > static_cast<float>(FontSelectionValue::maximumValue()))
+            return FontSelectionValue::maximumValue();
+        return FontSelectionValue(value);
+    }
+
 private:
     enum class RawTag { RawTag };
 
@@ -161,18 +170,112 @@ static inline FontSelectionValue italicThreshold()
     return result.get();
 }
 
+static inline bool isItalic(FontSelectionValue fontWeight)
+{
+    return fontWeight >= italicThreshold();
+}
+
+static inline FontSelectionValue normalItalicValue()
+{
+    static NeverDestroyed<FontSelectionValue> result = FontSelectionValue();
+    return result.get();
+}
+
+static inline FontSelectionValue italicValue()
+{
+    static NeverDestroyed<FontSelectionValue> result = FontSelectionValue(20);
+    return result.get();
+}
+
 static inline FontSelectionValue boldThreshold()
 {
     static NeverDestroyed<FontSelectionValue> result = FontSelectionValue(600);
     return result.get();
 }
 
+static inline FontSelectionValue boldWeightValue()
+{
+    static NeverDestroyed<FontSelectionValue> result = FontSelectionValue(700);
+    return result.get();
+}
+
+static inline FontSelectionValue normalWeightValue()
+{
+    static NeverDestroyed<FontSelectionValue> result = FontSelectionValue(400);
+    return result.get();
+}
+
+static inline FontSelectionValue lightWeightValue()
+{
+    static NeverDestroyed<FontSelectionValue> result = FontSelectionValue(200);
+    return result.get();
+}
+
+static inline bool isFontWeightBold(FontSelectionValue fontWeight)
+{
+    return fontWeight >= boldThreshold();
+}
+
 static inline FontSelectionValue weightSearchThreshold()
 {
     static NeverDestroyed<FontSelectionValue> result = FontSelectionValue(500);
     return result.get();
 }
 
+static inline FontSelectionValue ultraCondensedStretchValue()
+{
+    static NeverDestroyed<FontSelectionValue> result = FontSelectionValue(50);
+    return result.get();
+}
+
+static inline FontSelectionValue extraCondensedStretchValue()
+{
+    static NeverDestroyed<FontSelectionValue> result = FontSelectionValue(62.5f);
+    return result.get();
+}
+
+static inline FontSelectionValue condensedStretchValue()
+{
+    static NeverDestroyed<FontSelectionValue> result = FontSelectionValue(75);
+    return result.get();
+}
+
+static inline FontSelectionValue semiCondensedStretchValue()
+{
+    static NeverDestroyed<FontSelectionValue> result = FontSelectionValue(87.5f);
+    return result.get();
+}
+
+static inline FontSelectionValue normalStretchValue()
+{
+    static NeverDestroyed<FontSelectionValue> result = FontSelectionValue(100);
+    return result.get();
+}
+
+static inline FontSelectionValue semiExpandedStretchValue()
+{
+    static NeverDestroyed<FontSelectionValue> result = FontSelectionValue(112.5f);
+    return result.get();
+}
+
+static inline FontSelectionValue expandedStretchValue()
+{
+    static NeverDestroyed<FontSelectionValue> result = FontSelectionValue(125);
+    return result.get();
+}
+
+static inline FontSelectionValue extraExpandedStretchValue()
+{
+    static NeverDestroyed<FontSelectionValue> result = FontSelectionValue(150);
+    return result.get();
+}
+
+static inline FontSelectionValue ultraExpandedStretchValue()
+{
+    static NeverDestroyed<FontSelectionValue> result = FontSelectionValue(200);
+    return result.get();
+}
+
 // [Inclusive, Inclusive]
 struct FontSelectionRange {
     FontSelectionRange(FontSelectionValue minimum, FontSelectionValue maximum)
@@ -214,6 +317,15 @@ struct FontSelectionRange {
 };
 
 struct FontSelectionRequest {
+    FontSelectionRequest() = default;
+
+    FontSelectionRequest(FontSelectionValue weight, FontSelectionValue width, FontSelectionValue slope)
+        : weight(weight)
+        , width(width)
+        , slope(slope)
+    {
+    }
+
     bool operator==(const FontSelectionRequest& other) const
     {
         return weight == other.weight
@@ -289,9 +401,9 @@ struct FontSelectionCapabilities {
         slope.expand(capabilities.slope);
     }
 
-    FontSelectionRange weight { FontSelectionValue(400), FontSelectionValue(400) };
-    FontSelectionRange width { FontSelectionValue(100), FontSelectionValue(100) };
-    FontSelectionRange slope { FontSelectionValue(), FontSelectionValue() };
+    FontSelectionRange weight { normalWeightValue(), normalWeightValue() };
+    FontSelectionRange width { normalStretchValue(), normalStretchValue() };
+    FontSelectionRange slope { normalItalicValue(), normalItalicValue() };
 };
 
 class FontSelectionAlgorithm {
@@ -358,8 +470,4 @@ private:
     std::unique_ptr<bool[]> m_filter;
 };
 
-FontSelectionRequest fontSelectionRequestForTraitsMask(FontTraitsMask, FontSelectionValue stretch);
-FontSelectionCapabilities fontSelectionCapabilitiesForTraitsMask(FontTraitsMask, FontSelectionValue stretch);
-FontSelectionCapabilities fontSelectionCapabilitiesForTraitsMask(FontTraitsMask, FontSelectionRange stretch);
-
 }
index ad0918f..f9e2fd8 100644 (file)
@@ -551,83 +551,6 @@ RetainPtr<CTFontRef> preparePlatformFont(CTFontRef originalFont, TextRenderingMo
     return result;
 }
 
-FontWeight fontWeightFromCoreText(CGFloat weight)
-{
-    if (weight < -0.6)
-        return FontWeight100;
-    if (weight < -0.365)
-        return FontWeight200;
-    if (weight < -0.115)
-        return FontWeight300;
-    if (weight <  0.130)
-        return FontWeight400;
-    if (weight <  0.235)
-        return FontWeight500;
-    if (weight <  0.350)
-        return FontWeight600;
-    if (weight <  0.500)
-        return FontWeight700;
-    if (weight <  0.700)
-        return FontWeight800;
-    return FontWeight900;
-}
-
-static inline FontTraitsMask toTraitsMask(CTFontSymbolicTraits ctFontTraits, CGFloat weight)
-{
-    FontTraitsMask weightMask;
-    switch (fontWeightFromCoreText(weight)) {
-    case FontWeight100:
-        weightMask = FontWeight100Mask;
-        break;
-    case FontWeight200:
-        weightMask = FontWeight200Mask;
-        break;
-    case FontWeight300:
-        weightMask = FontWeight300Mask;
-        break;
-    case FontWeight400:
-        weightMask = FontWeight400Mask;
-        break;
-    case FontWeight500:
-        weightMask = FontWeight500Mask;
-        break;
-    case FontWeight600:
-        weightMask = FontWeight600Mask;
-        break;
-    case FontWeight700:
-        weightMask = FontWeight700Mask;
-        break;
-    case FontWeight800:
-        weightMask = FontWeight800Mask;
-        break;
-    case FontWeight900:
-        weightMask = FontWeight900Mask;
-        break;
-    }
-    return static_cast<FontTraitsMask>(((ctFontTraits & kCTFontTraitItalic) ? FontStyleItalicMask : FontStyleNormalMask) | weightMask);
-}
-
-bool isFontWeightBold(FontWeight fontWeight)
-{
-    return fontWeight >= FontWeight600;
-}
-
-uint16_t toCoreTextFontWeight(FontWeight fontWeight)
-{
-    static const int coreTextFontWeights[] = {
-        100, // FontWeight100
-        200, // FontWeight200
-        300, // FontWeight300
-        400, // FontWeight400
-        500, // FontWeight500
-        600, // FontWeight600
-        700, // FontWeight700
-        800, // FontWeight800
-        900, // FontWeight900
-    };
-    return coreTextFontWeights[fontWeight];
-}
-
 RefPtr<Font> FontCache::similarFont(const FontDescription& description, const AtomicString& family)
 {
     // Attempt to find an appropriate font using a match based on the presence of keywords in
@@ -672,40 +595,7 @@ static FontSelectionValue stretchFromCoreTextTraits(CFDictionaryRef traits)
         ASSERT_UNUSED(success, success);
         return FontSelectionValue(ctWidth < 0.5 ? ctWidth * 50 + 100 : ctWidth * 150 + 50);
     }
-    return FontSelectionValue(100);
-}
-
-auto FontCache::getTraitsAndStretchInFamily(const AtomicString& familyName) -> Vector<TraitsAndStretch>
-{
-    auto familyNameStr = familyName.string().createCFString();
-    CFTypeRef keys[] = { kCTFontFamilyNameAttribute };
-    CFTypeRef values[] = { familyNameStr.get() };
-    auto attributes = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, keys, values, WTF_ARRAY_LENGTH(keys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
-    auto fontDescriptor = adoptCF(CTFontDescriptorCreateWithAttributes(attributes.get()));
-    auto matchedDescriptors = adoptCF(CTFontDescriptorCreateMatchingFontDescriptors(fontDescriptor.get(), nullptr));
-    if (!matchedDescriptors)
-        return { };
-
-    CFIndex numMatches = CFArrayGetCount(matchedDescriptors.get());
-    if (!numMatches)
-        return { };
-
-    Vector<TraitsAndStretch> result;
-    result.reserveInitialCapacity(numMatches);
-    for (CFIndex i = 0; i < numMatches; ++i) {
-        auto traits = adoptCF((CFDictionaryRef)CTFontDescriptorCopyAttribute((CTFontDescriptorRef)CFArrayGetValueAtIndex(matchedDescriptors.get(), i), kCTFontTraitsAttribute));
-        CFNumberRef resultRef = (CFNumberRef)CFDictionaryGetValue(traits.get(), kCTFontSymbolicTrait);
-        CFNumberRef weightRef = (CFNumberRef)CFDictionaryGetValue(traits.get(), kCTFontWeightTrait);
-        if (resultRef && weightRef) {
-            CTFontSymbolicTraits symbolicTraits;
-            CFNumberGetValue(resultRef, kCFNumberIntType, &symbolicTraits);
-            CGFloat weight = 0;
-            CFNumberGetValue(weightRef, kCFNumberCGFloatType, &weight);
-            auto stretch = stretchFromCoreTextTraits(traits.get());
-            result.uncheckedAppend({ toTraitsMask(symbolicTraits, weight), { stretch, stretch } });
-        }
-    }
-    return result;
+    return normalStretchValue();
 }
 
 static void invalidateFontCache();
@@ -801,7 +691,28 @@ static inline bool isSystemFont(const AtomicString& family)
     return family[0] == '.';
 }
 
-#if !SHOULD_USE_CORE_TEXT_FONT_LOOKUP
+#if SHOULD_USE_CORE_TEXT_FONT_LOOKUP
+static FontSelectionValue fontWeightFromCoreText(CGFloat weight)
+{
+    if (weight < -0.6)
+        return FontSelectionValue(100);
+    if (weight < -0.365)
+        return FontSelectionValue(200);
+    if (weight < -0.115)
+        return FontSelectionValue(300);
+    if (weight <  0.130)
+        return FontSelectionValue(400);
+    if (weight <  0.235)
+        return FontSelectionValue(500);
+    if (weight <  0.350)
+        return FontSelectionValue(600);
+    if (weight <  0.500)
+        return FontSelectionValue(700);
+    if (weight <  0.700)
+        return FontSelectionValue(800);
+    return FontSelectionValue(900);
+}
+#endif
 
 class FontDatabase {
 public:
@@ -899,49 +810,62 @@ public:
         m_postScriptNameToFontDescriptors.clear();
     }
 
-    static FontSelectionCapabilities capabilitiesForFontDescriptor(CTFontDescriptorRef fontDescriptor)
-    {
-        if (!fontDescriptor)
-            return { };
-
-        auto traits = adoptCF(static_cast<CFDictionaryRef>(CTFontDescriptorCopyAttribute(fontDescriptor, kCTFontTraitsAttribute)));
-        FontSelectionValue width;
-        FontSelectionValue slant;
-        FontSelectionValue weight;
-        if (traits) {
-            width = stretchFromCoreTextTraits(traits.get());
-
-            auto symbolicTraitsNumber = static_cast<CFNumberRef>(CFDictionaryGetValue(traits.get(), kCTFontSymbolicTrait));
-            if (symbolicTraitsNumber) {
-                int32_t symbolicTraits;
-                auto success = CFNumberGetValue(symbolicTraitsNumber, kCFNumberSInt32Type, &symbolicTraits);
-                ASSERT_UNUSED(success, success);
-                slant = symbolicTraits & kCTFontTraitItalic ? italicThreshold() : FontSelectionValue();
-            }
+private:
+    friend class NeverDestroyed<FontDatabase>;
+
+    FontDatabase() = default;
+
+    HashMap<String, InstalledFontFamily> m_familyNameToFontDescriptors;
+    HashMap<String, InstalledFont> m_postScriptNameToFontDescriptors;
+};
+
+FontSelectionCapabilities capabilitiesForFontDescriptor(CTFontDescriptorRef fontDescriptor)
+{
+    if (!fontDescriptor)
+        return { };
+
+    auto traits = adoptCF(static_cast<CFDictionaryRef>(CTFontDescriptorCopyAttribute(fontDescriptor, kCTFontTraitsAttribute)));
+    FontSelectionValue width;
+    FontSelectionValue slant;
+    FontSelectionValue weight;
+    if (traits) {
+        width = stretchFromCoreTextTraits(traits.get());
+
+        auto symbolicTraitsNumber = static_cast<CFNumberRef>(CFDictionaryGetValue(traits.get(), kCTFontSymbolicTrait));
+        if (symbolicTraitsNumber) {
+            int32_t symbolicTraits;
+            auto success = CFNumberGetValue(symbolicTraitsNumber, kCFNumberSInt32Type, &symbolicTraits);
+            ASSERT_UNUSED(success, success);
+            slant = symbolicTraits & kCTFontTraitItalic ? italicValue() : normalItalicValue();
         }
 
-        auto weightNumber = adoptCF(static_cast<CFNumberRef>(CTFontDescriptorCopyAttribute(fontDescriptor, kCTFontCSSWeightAttribute)));
+#if SHOULD_USE_CORE_TEXT_FONT_LOOKUP
+        auto weightNumber = static_cast<CFNumberRef>(CFDictionaryGetValue(traits.get(), kCTFontWeightTrait));
         if (weightNumber) {
-            float cssWeight;
-            auto success = CFNumberGetValue(weightNumber.get(), kCFNumberFloatType, &cssWeight);
+            CGFloat ctWeight;
+            auto success = CFNumberGetValue(weightNumber, kCFNumberCGFloatType, &ctWeight);
             ASSERT_UNUSED(success, success);
-            weight = FontSelectionValue(cssWeight);
+            weight = fontWeightFromCoreText(ctWeight);
         }
-
-        // FIXME: Educate this function about font variations.
-
-        return { { weight, weight }, { width, width }, { slant, slant } };
+#endif
     }
 
-private:
-    friend class NeverDestroyed<FontDatabase>;
+#if !SHOULD_USE_CORE_TEXT_FONT_LOOKUP
+    auto weightNumber = adoptCF(static_cast<CFNumberRef>(CTFontDescriptorCopyAttribute(fontDescriptor, kCTFontCSSWeightAttribute)));
+    if (weightNumber) {
+        float cssWeight;
+        auto success = CFNumberGetValue(weightNumber.get(), kCFNumberFloatType, &cssWeight);
+        ASSERT_UNUSED(success, success);
+        weight = FontSelectionValue(cssWeight);
+    }
+#endif
 
-    FontDatabase() = default;
+    // FIXME: Educate this function about font variations.
 
-    HashMap<String, InstalledFontFamily> m_familyNameToFontDescriptors;
-    HashMap<String, InstalledFont> m_postScriptNameToFontDescriptors;
-};
+    return { { weight, weight }, { width, width }, { slant, slant } };
+}
 
+#if !SHOULD_USE_CORE_TEXT_FONT_LOOKUP
 static const FontDatabase::InstalledFont* findClosestFont(const FontDatabase::InstalledFontFamily& familyFonts, FontSelectionRequest fontSelectionRequest)
 {
     Vector<FontSelectionCapabilities> capabilities;
@@ -951,65 +875,30 @@ static const FontDatabase::InstalledFont* findClosestFont(const FontDatabase::In
     FontSelectionAlgorithm fontSelectionAlgorithm(fontSelectionRequest, capabilities, familyFonts.capabilities);
     return &familyFonts.installedFonts[fontSelectionAlgorithm.indexOfBestCapabilities()];
 }
+#endif
 
-static FontSelectionRequest calculateFontSelectionRequest(CTFontSymbolicTraits requestedTraits, FontWeight weight, FontSelectionValue stretch)
+Vector<FontSelectionCapabilities> FontCache::getFontSelectionCapabilitiesInFamily(const AtomicString& familyName)
 {
-    FontSelectionRequest result;
-    switch (weight) {
-    case FontWeight100:
-        result.weight = FontSelectionValue(100);
-        break;
-    case FontWeight200:
-        result.weight = FontSelectionValue(200);
-        break;
-    case FontWeight300:
-        result.weight = FontSelectionValue(300);
-        break;
-    case FontWeight400:
-        result.weight = FontSelectionValue(400);
-        break;
-    case FontWeight500:
-        result.weight = FontSelectionValue(500);
-        break;
-    case FontWeight600:
-        result.weight = FontSelectionValue(600);
-        break;
-    case FontWeight700:
-        result.weight = FontSelectionValue(700);
-        break;
-    case FontWeight800:
-        result.weight = FontSelectionValue(800);
-        break;
-    case FontWeight900:
-        result.weight = FontSelectionValue(900);
-        break;
-    default:
-        ASSERT_NOT_REACHED();
-        result.weight = FontSelectionValue(400);
-        break;
-    }
-
-    result.width = stretch;
-
-    if (requestedTraits & kCTFontTraitItalic)
-        result.slope = italicThreshold();
-    else
-        result.slope = FontSelectionValue();
+    const auto& fonts = FontDatabase::singleton().collectionForFamily(familyName.string());
+    if (fonts.isEmpty())
+        return { };
 
+    Vector<FontSelectionCapabilities> result;
+    result.reserveInitialCapacity(fonts.size());
+    for (const auto& font : fonts.installedFonts)
+        result.uncheckedAppend(font.capabilities);
     return result;
 }
 
-#endif // !SHOULD_USE_CORE_TEXT_FONT_LOOKUP
-
-static RetainPtr<CTFontRef> platformFontLookupWithFamily(const AtomicString& family, CTFontSymbolicTraits requestedTraits, FontWeight weight, FontSelectionValue stretch, float size)
+static RetainPtr<CTFontRef> platformFontLookupWithFamily(const AtomicString& family, FontSelectionRequest request, float size)
 {
     const auto& whitelist = fontWhitelist();
     if (!isSystemFont(family) && whitelist.size() && !whitelist.contains(family))
         return nullptr;
 
 #if SHOULD_USE_CORE_TEXT_FONT_LOOKUP
-    UNUSED_PARAM(stretch);
-    return adoptCF(CTFontCreateForCSS(family.string().createCFString().get(), toCoreTextFontWeight(weight), requestedTraits, size));
+    CTFontSymbolicTraits traits = (isFontWeightBold(request.weight) ? kCTFontTraitBold : 0) | (isItalic(request.slope) ? kCTFontTraitItalic : 0);
+    return adoptCF(CTFontCreateForCSS(family.string().createCFString().get(), static_cast<float>(request.weight), traits, size));
 #else
     const auto& familyFonts = FontDatabase::singleton().collectionForFamily(family.string());
     if (familyFonts.isEmpty()) {
@@ -1023,15 +912,15 @@ static RetainPtr<CTFontRef> platformFontLookupWithFamily(const AtomicString& fam
         const auto& postScriptFont = FontDatabase::singleton().fontForPostScriptName(family);
         if (!postScriptFont.fontDescriptor)
             return nullptr;
-        if (((requestedTraits & kCTFontTraitItalic) && postScriptFont.capabilities.slope.maximum < italicThreshold())
-            || (weight >= FontWeight600 && postScriptFont.capabilities.weight.maximum < boldThreshold())) {
+        if ((isItalic(request.slope) && !isItalic(postScriptFont.capabilities.slope.maximum))
+            || (isFontWeightBold(request.weight) && !isFontWeightBold(postScriptFont.capabilities.weight.maximum))) {
             auto postScriptFamilyName = adoptCF(static_cast<CFStringRef>(CTFontDescriptorCopyAttribute(postScriptFont.fontDescriptor.get(), kCTFontFamilyNameAttribute)));
             if (!postScriptFamilyName)
                 return nullptr;
             const auto& familyFonts = FontDatabase::singleton().collectionForFamily(String(postScriptFamilyName.get()));
             if (familyFonts.isEmpty())
                 return nullptr;
-            if (const auto* installedFont = findClosestFont(familyFonts, calculateFontSelectionRequest(requestedTraits, weight, stretch))) {
+            if (const auto* installedFont = findClosestFont(familyFonts, request)) {
                 if (!installedFont->fontDescriptor)
                     return nullptr;
                 return adoptCF(CTFontCreateWithFontDescriptor(installedFont->fontDescriptor.get(), size, nullptr));
@@ -1041,7 +930,7 @@ static RetainPtr<CTFontRef> platformFontLookupWithFamily(const AtomicString& fam
         return adoptCF(CTFontCreateWithFontDescriptor(postScriptFont.fontDescriptor.get(), size, nullptr));
     }
 
-    if (const auto* installedFont = findClosestFont(familyFonts, calculateFontSelectionRequest(requestedTraits, weight, stretch)))
+    if (const auto* installedFont = findClosestFont(familyFonts, request))
         return adoptCF(CTFontCreateWithFontDescriptor(installedFont->fontDescriptor.get(), size, nullptr));
 
     return nullptr;
@@ -1057,21 +946,19 @@ static void invalidateFontCache()
         return;
     }
 
-#if !SHOULD_USE_CORE_TEXT_FONT_LOOKUP
     FontDatabase::singleton().clear();
-#endif
 
     FontCache::singleton().invalidate();
 }
 
-static RetainPtr<CTFontRef> fontWithFamily(const AtomicString& family, CTFontSymbolicTraits desiredTraits, FontWeight weight, FontSelectionValue stretch, const FontFeatureSettings& featureSettings, const FontVariantSettings& variantSettings, const FontVariationSettings& variationSettings, const FontFeatureSettings* fontFaceFeatures, const FontVariantSettings* fontFaceVariantSettings, const TextRenderingMode& textRenderingMode, float size)
+static RetainPtr<CTFontRef> fontWithFamily(const AtomicString& family, FontSelectionRequest request, const FontFeatureSettings& featureSettings, const FontVariantSettings& variantSettings, const FontVariationSettings& variationSettings, const FontFeatureSettings* fontFaceFeatures, const FontVariantSettings* fontFaceVariantSettings, const TextRenderingMode& textRenderingMode, float size)
 {
     if (family.isEmpty())
         return nullptr;
 
-    auto foundFont = platformFontWithFamilySpecialCase(family, weight, desiredTraits, size);
+    auto foundFont = platformFontWithFamilySpecialCase(family, request, size);
     if (!foundFont)
-        foundFont = platformFontLookupWithFamily(family, desiredTraits, weight, stretch, size);
+        foundFont = platformFontLookupWithFamily(family, request, size);
     return preparePlatformFont(foundFont.get(), textRenderingMode, fontFaceFeatures, fontFaceVariantSettings, featureSettings, variantSettings, variationSettings);
 }
 
@@ -1109,10 +996,9 @@ static void autoActivateFont(const String& name, CGFloat size)
 
 std::unique_ptr<FontPlatformData> FontCache::createFontPlatformData(const FontDescription& fontDescription, const AtomicString& family, const FontFeatureSettings* fontFaceFeatures, const FontVariantSettings* fontFaceVariantSettings)
 {
-    CTFontSymbolicTraits traits = computeTraits(fontDescription);
     float size = fontDescription.computedPixelSize();
 
-    auto font = fontWithFamily(family, traits, fontDescription.weight(), fontDescription.stretch(), fontDescription.featureSettings(), fontDescription.variantSettings(), fontDescription.variationSettings(), fontFaceFeatures, fontFaceVariantSettings, fontDescription.textRenderingMode(), size);
+    auto font = fontWithFamily(family, fontDescription.fontSelectionRequest(), fontDescription.featureSettings(), fontDescription.variantSettings(), fontDescription.variationSettings(), fontFaceFeatures, fontFaceVariantSettings, fontDescription.textRenderingMode(), size);
 
 #if PLATFORM(MAC)
     if (!font) {
@@ -1123,7 +1009,7 @@ std::unique_ptr<FontPlatformData> FontCache::createFontPlatformData(const FontDe
         // Ignore the result because we want to use our own algorithm to actually find the font.
         autoActivateFont(family.string(), size);
 
-        font = fontWithFamily(family, traits, fontDescription.weight(), fontDescription.stretch(), fontDescription.featureSettings(), fontDescription.variantSettings(), fontDescription.variationSettings(), fontFaceFeatures, fontFaceVariantSettings, fontDescription.textRenderingMode(), size);
+        font = fontWithFamily(family, fontDescription.fontSelectionRequest(), fontDescription.featureSettings(), fontDescription.variantSettings(), fontDescription.variationSettings(), fontFaceFeatures, fontFaceVariantSettings, fontDescription.textRenderingMode(), size);
     }
 #endif
 
@@ -1161,7 +1047,7 @@ static inline bool isArabicCharacter(UChar character)
 }
 #endif
 
-static RetainPtr<CTFontRef> lookupFallbackFont(CTFontRef font, FontWeight fontWeight, const AtomicString& locale, const UChar* characters, unsigned length)
+static RetainPtr<CTFontRef> lookupFallbackFont(CTFontRef font, FontSelectionValue fontWeight, const AtomicString& locale, const UChar* characters, unsigned length)
 {
     ASSERT(length > 0);
 
index bd5ad64..7b6cb1c 100644 (file)
@@ -138,7 +138,7 @@ Ref<Font> FontCache::lastResortFallbackFont(const FontDescription& fontDescripti
     RELEASE_ASSERT_NOT_REACHED();
 }
 
-auto FontCache::getTraitsAndStretchInFamily(const AtomicString& familyName) -> Vector<TraitsAndStretch>
+Vector<FontSelectionCapabilities> FontCache::getFontSelectionCapabilitiesInFamily(const AtomicString& familyName)
 {
     return { };
 }
@@ -163,31 +163,25 @@ static String getFamilyNameStringFromFamily(const AtomicString& family)
     return "";
 }
 
-static int fontWeightToFontconfigWeight(FontWeight weight)
+static int fontWeightToFontconfigWeight(FontSelectionValue weight)
 {
-    switch (weight) {
-    case FontWeight100:
+    if (weight < FontSelectionValue(150))
         return FC_WEIGHT_THIN;
-    case FontWeight200:
+    if (weight < FontSelectionValue(250))
         return FC_WEIGHT_ULTRALIGHT;
-    case FontWeight300:
+    if (weight < FontSelectionValue(350))
         return FC_WEIGHT_LIGHT;
-    case FontWeight400:
+    if (weight < FontSelectionValue(450))
         return FC_WEIGHT_REGULAR;
-    case FontWeight500:
+    if (weight < FontSelectionValue(550))
         return FC_WEIGHT_MEDIUM;
-    case FontWeight600:
+    if (weight < FontSelectionValue(650))
         return FC_WEIGHT_SEMIBOLD;
-    case FontWeight700:
+    if (weight < FontSelectionValue(750))
         return FC_WEIGHT_BOLD;
-    case FontWeight800:
+    if (weight < FontSelectionValue(850))
         return FC_WEIGHT_EXTRABOLD;
-    case FontWeight900:
-        return FC_WEIGHT_ULTRABLACK;
-    default:
-        ASSERT_NOT_REACHED();
-        return FC_WEIGHT_REGULAR;
-    }
+    return FC_WEIGHT_ULTRABLACK;
 }
 
 // This is based on Chromium BSD code from Skia (src/ports/SkFontMgr_fontconfig.cpp). It is a
index b8ec73c..4819775 100644 (file)
@@ -149,7 +149,7 @@ FontPlatformData::FontPlatformData(FcPattern* pattern, const FontDescription& fo
         m_fixedWidth = true;
 
     bool descriptionAllowsSyntheticBold = fontDescription.fontSynthesis() & FontSynthesisWeight;
-    if (descriptionAllowsSyntheticBold && fontDescription.weight() >= FontWeightBold) {
+    if (descriptionAllowsSyntheticBold && isFontWeightBold(fontDescription.weight())) {
         // The FC_EMBOLDEN property instructs us to fake the boldness of the font.
         FcBool fontConfigEmbolden = FcFalse;
         if (FcPatternGetBool(pattern, FC_EMBOLDEN, 0, &fontConfigEmbolden) == FcResultMatch)
index 133e9d0..309f9c4 100644 (file)
@@ -79,26 +79,15 @@ Ref<Font> FontCache::lastResortFallbackFont(const FontDescription& fontDescripti
     return *fontForFamily(fontDescription, AtomicString(".PhoneFallback", AtomicString::ConstructFromLiteral));
 }
 
-float FontCache::weightOfCTFont(CTFontRef font)
-{
-    RetainPtr<CFDictionaryRef> traits = adoptCF(CTFontCopyTraits(font));
-
-    CFNumberRef resultRef = (CFNumberRef)CFDictionaryGetValue(traits.get(), kCTFontWeightTrait);
-    float result = 0;
-    CFNumberGetValue(resultRef, kCFNumberFloatType, &result);
-
-    return result;
-}
-
-static RetainPtr<CTFontDescriptorRef> baseSystemFontDescriptor(FontWeight weight, bool bold, float size)
+static RetainPtr<CTFontDescriptorRef> baseSystemFontDescriptor(FontSelectionValue weight, bool bold, float size)
 {
     CTFontUIFontType fontType = kCTFontUIFontSystem;
-    if (weight > FontWeight300) {
+    if (weight >= FontSelectionValue(350)) {
         if (bold)
             fontType = kCTFontUIFontEmphasizedSystem;
-    } else if (weight > FontWeight200)
+    } else if (weight >= FontSelectionValue(250))
         fontType = static_cast<CTFontUIFontType>(kCTFontUIFontSystemLight);
-    else if (weight > FontWeight100)
+    else if (weight >= FontSelectionValue(150))
         fontType = static_cast<CTFontUIFontType>(kCTFontUIFontSystemThin);
     else
         fontType = static_cast<CTFontUIFontType>(kCTFontUIFontSystemUltraLight);
@@ -106,23 +95,30 @@ static RetainPtr<CTFontDescriptorRef> baseSystemFontDescriptor(FontWeight weight
 }
 
 #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000
-static RetainPtr<NSDictionary> systemFontModificationAttributes(FontWeight weight, bool italic)
+static RetainPtr<NSDictionary> systemFontModificationAttributes(FontSelectionValue weight, bool italic)
 {
     RetainPtr<NSMutableDictionary> traitsDictionary = adoptNS([[NSMutableDictionary alloc] init]);
 
-    ASSERT(weight >= FontWeight100 && weight <= FontWeight900);
-    float ctWeights[] = {
-        static_cast<float>(kCTFontWeightUltraLight),
-        static_cast<float>(kCTFontWeightThin),
-        static_cast<float>(kCTFontWeightLight),
-        static_cast<float>(kCTFontWeightRegular),
-        static_cast<float>(kCTFontWeightMedium),
-        static_cast<float>(kCTFontWeightSemibold),
-        static_cast<float>(kCTFontWeightBold),
-        static_cast<float>(kCTFontWeightHeavy),
-        static_cast<float>(kCTFontWeightBlack)
-    };
-    [traitsDictionary setObject:[NSNumber numberWithFloat:ctWeights[weight]] forKey:static_cast<NSString *>(kCTFontWeightTrait)];
+    float ctWeight = kCTFontWeightRegular;
+    if (weight < FontSelectionValue(150))
+        ctWeight = kCTFontWeightUltraLight;
+    else if (weight < FontSelectionValue(250))
+        ctWeight = kCTFontWeightThin;
+    else if (weight < FontSelectionValue(350))
+        ctWeight = kCTFontWeightLight;
+    else if (weight < FontSelectionValue(450))
+        ctWeight = kCTFontWeightRegular;
+    else if (weight < FontSelectionValue(550))
+        ctWeight = kCTFontWeightMedium;
+    else if (weight < FontSelectionValue(650))
+        ctWeight = kCTFontWeightSemibold;
+    else if (weight < FontSelectionValue(750))
+        ctWeight = kCTFontWeightBold;
+    else if (weight < FontSelectionValue(850))
+        ctWeight = kCTFontWeightHeavy;
+    else
+        ctWeight = kCTFontWeightBlack;
+    [traitsDictionary setObject:[NSNumber numberWithFloat:ctWeight] forKey:static_cast<NSString *>(kCTFontWeightTrait)];
 
     [traitsDictionary setObject:@YES forKey:static_cast<NSString *>(kCTFontUIFontDesignTrait)];
 
@@ -133,7 +129,7 @@ static RetainPtr<NSDictionary> systemFontModificationAttributes(FontWeight weigh
 }
 #endif
 
-static RetainPtr<CTFontDescriptorRef> systemFontDescriptor(FontWeight weight, bool bold, bool italic, float size)
+static RetainPtr<CTFontDescriptorRef> systemFontDescriptor(FontSelectionValue weight, bool bold, bool italic, float size)
 {
     RetainPtr<CTFontDescriptorRef> fontDescriptor = baseSystemFontDescriptor(weight, bold, size);
 #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000
@@ -146,10 +142,10 @@ static RetainPtr<CTFontDescriptorRef> systemFontDescriptor(FontWeight weight, bo
 #endif
 }
 
-RetainPtr<CTFontRef> platformFontWithFamilySpecialCase(const AtomicString& family, FontWeight weight, CTFontSymbolicTraits traits, float size)
+RetainPtr<CTFontRef> platformFontWithFamilySpecialCase(const AtomicString& family, FontSelectionRequest request, float size)
 {
     if (family.startsWith("UICTFontTextStyle")) {
-        traits &= (kCTFontBoldTrait | kCTFontItalicTrait);
+        CTFontSymbolicTraits traits = (isFontWeightBold(request.weight) ? kCTFontTraitBold : 0) | (isItalic(request.slope) ? kCTFontTraitItalic : 0);
         RetainPtr<CFStringRef> familyNameStr = family.string().createCFString();
         RetainPtr<CTFontDescriptorRef> fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(familyNameStr.get(), RenderThemeIOS::contentSizeCategory(), nullptr));
         if (traits)
@@ -159,7 +155,7 @@ RetainPtr<CTFontRef> platformFontWithFamilySpecialCase(const AtomicString& famil
     }
 
     if (equalLettersIgnoringASCIICase(family, "-webkit-system-font") || equalLettersIgnoringASCIICase(family, "-apple-system") || equalLettersIgnoringASCIICase(family, "-apple-system-font") || equalLettersIgnoringASCIICase(family, "system-ui")) {
-        return adoptCF(CTFontCreateWithFontDescriptor(systemFontDescriptor(weight, traits & kCTFontTraitBold, traits & kCTFontTraitItalic, size).get(), size, nullptr));
+        return adoptCF(CTFontCreateWithFontDescriptor(systemFontDescriptor(request.weight, isFontWeightBold(request.weight), isItalic(request.slope), size).get(), size, nullptr));
     }
 
     if (equalLettersIgnoringASCIICase(family, "-apple-system-monospaced-numbers")) {
index 76571c8..4c1098b 100644 (file)
@@ -52,28 +52,35 @@ namespace WebCore {
 
 #if PLATFORM(MAC)
 
-static CGFloat toNSFontWeight(FontWeight fontWeight)
+static CGFloat toNSFontWeight(FontSelectionValue fontWeight)
 {
-    static const CGFloat nsFontWeights[] = {
-        NSFontWeightUltraLight,
-        NSFontWeightThin,
-        NSFontWeightLight,
-        NSFontWeightRegular,
-        NSFontWeightMedium,
-        NSFontWeightSemibold,
-        NSFontWeightBold,
-        NSFontWeightHeavy,
-        NSFontWeightBlack
-    };
-    ASSERT(fontWeight >= 0 && fontWeight <= 8);
-    return nsFontWeights[fontWeight];
+    if (fontWeight < FontSelectionValue(150))
+        return NSFontWeightUltraLight;
+    if (fontWeight < FontSelectionValue(250))
+        return NSFontWeightThin;
+    if (fontWeight < FontSelectionValue(350))
+        return NSFontWeightLight;
+    if (fontWeight < FontSelectionValue(450))
+        return NSFontWeightRegular;
+    if (fontWeight < FontSelectionValue(550))
+        return NSFontWeightMedium;
+    if (fontWeight < FontSelectionValue(650))
+        return NSFontWeightSemibold;
+    if (fontWeight < FontSelectionValue(750))
+        return NSFontWeightBold;
+    if (fontWeight < FontSelectionValue(850))
+        return NSFontWeightHeavy;
+    return NSFontWeightBlack;
 }
 
-RetainPtr<CTFontRef> platformFontWithFamilySpecialCase(const AtomicString& family, FontWeight weight, CTFontSymbolicTraits desiredTraits, float size)
+RetainPtr<CTFontRef> platformFontWithFamilySpecialCase(const AtomicString& family, FontSelectionRequest request, float size)
 {
     if (equalLettersIgnoringASCIICase(family, "-webkit-system-font") || equalLettersIgnoringASCIICase(family, "-apple-system") || equalLettersIgnoringASCIICase(family, "-apple-system-font") || equalLettersIgnoringASCIICase(family, "system-ui")) {
-        RetainPtr<CTFontRef> result = toCTFont([NSFont systemFontOfSize:size weight:toNSFontWeight(weight)]);
-        if (desiredTraits & kCTFontItalicTrait) {
+        RetainPtr<CTFontRef> result = toCTFont([NSFont systemFontOfSize:size weight:toNSFontWeight(request.weight)]);
+        if (isItalic(request.slope)) {
+            CTFontSymbolicTraits desiredTraits = kCTFontItalicTrait;
+            if (isFontWeightBold(request.weight))
+                desiredTraits |= kCTFontBoldTrait;
             if (auto italicizedFont = adoptCF(CTFontCreateCopyWithSymbolicTraits(result.get(), size, nullptr, desiredTraits, desiredTraits)))
                 result = italicizedFont;
         }
index 4ac60ac..bfe8138 100644 (file)
@@ -398,20 +398,25 @@ Ref<Font> FontCache::lastResortFallbackFont(const FontDescription& fontDescripti
     return *simpleFont;
 }
 
-static LONG toGDIFontWeight(FontWeight fontWeight)
+static LONG toGDIFontWeight(FontSelectionValue fontWeight)
 {
-    static LONG gdiFontWeights[] = {
-        FW_THIN,        // FontWeight100
-        FW_EXTRALIGHT,  // FontWeight200
-        FW_LIGHT,       // FontWeight300
-        FW_NORMAL,      // FontWeight400
-        FW_MEDIUM,      // FontWeight500
-        FW_SEMIBOLD,    // FontWeight600
-        FW_BOLD,        // FontWeight700
-        FW_EXTRABOLD,   // FontWeight800
-        FW_HEAVY        // FontWeight900
-    };
-    return gdiFontWeights[fontWeight];
+    if (fontWeight < FontSelectionValue(150))
+        return FW_THIN;
+    if (fontWeight < FontSelectionValue(250))
+        return FW_EXTRALIGHT;
+    if (fontWeight < FontSelectionValue(350))
+        return FW_LIGHT;
+    if (fontWeight < FontSelectionValue(450))
+        return FW_NORMAL;
+    if (fontWeight < FontSelectionValue(550))
+        return FW_MEDIUM;
+    if (fontWeight < FontSelectionValue(650))
+        return FW_SEMIBOLD;
+    if (fontWeight < FontSelectionValue(750))
+        return FW_BOLD;
+    if (fontWeight < FontSelectionValue(850))
+        return FW_EXTRABOLD;
+    return FW_HEAVY;
 }
 
 static inline bool isGDIFontWeightBold(LONG gdiFontWeight)
@@ -536,30 +541,57 @@ struct TraitsInFamilyProcData {
     }
 
     const AtomicString& m_familyName;
-    HashSet<unsigned> m_traitsMasks;
+    Vector<FontSelectionCapabilities> m_capabilities;
 };
 
 static int CALLBACK traitsInFamilyEnumProc(CONST LOGFONT* logFont, CONST TEXTMETRIC* metrics, DWORD fontType, LPARAM lParam)
 {
     TraitsInFamilyProcData* procData = reinterpret_cast<TraitsInFamilyProcData*>(lParam);
 
-    unsigned traitsMask = 0;
-    traitsMask |= logFont->lfItalic ? FontStyleItalicMask : FontStyleNormalMask;
-    LONG weight = adjustedGDIFontWeight(logFont->lfWeight, procData->m_familyName);
-    traitsMask |= weight == FW_THIN ? FontWeight100Mask :
-        weight == FW_EXTRALIGHT ? FontWeight200Mask :
-        weight == FW_LIGHT ? FontWeight300Mask :
-        weight == FW_NORMAL ? FontWeight400Mask :
-        weight == FW_MEDIUM ? FontWeight500Mask :
-        weight == FW_SEMIBOLD ? FontWeight600Mask :
-        weight == FW_BOLD ? FontWeight700Mask :
-        weight == FW_EXTRABOLD ? FontWeight800Mask :
-                                 FontWeight900Mask;
-    procData->m_traitsMasks.add(traitsMask);
+    FontSelectionValue italic = logFont->lfItalic ? italicThreshold() : FontSelectionValue();
+
+    FontSelectionValue weight;
+    switch (adjustedGDIFontWeight(logFont->lfWeight, procData->m_familyName)) {
+    case FW_THIN:
+        weight = FontSelectionValue(100);
+        break;
+    case FW_EXTRALIGHT:
+        weight = FontSelectionValue(200);
+        break;
+    case FW_LIGHT:
+        weight = FontSelectionValue(300);
+        break;
+    case FW_NORMAL:
+        weight = FontSelectionValue(400);
+        break;
+    case FW_MEDIUM:
+        weight = FontSelectionValue(500);
+        break;
+    case FW_SEMIBOLD:
+        weight = FontSelectionValue(600);
+        break;
+    case FW_BOLD:
+        weight = FontSelectionValue(700);
+        break;
+    case FW_EXTRABOLD:
+        weight = FontSelectionValue(800);
+        break;
+    default:
+        weight = FontSelectionValue(900);
+        break;
+    }
+
+    FontSelectionValue stretch = normalStretchValue();
+
+    FontSelectionCapabilities result;
+    result.weight = FontSelectionRange(weight, weight);
+    result.width = FontSelectionRange(stretch, stretch);
+    result.slope = FontSelectionRange(italic, italic);
+    procData->m_capabilities.append(WTFMove(result));
     return 1;
 }
 
-auto FontCache::getTraitsAndStretchInFamily(const AtomicString& familyName) -> Vector<TraitsAndStretch>
+Vector<FontSelectionCapabilities> FontCache::getFontSelectionCapabilitiesInFamily(const AtomicString& familyName)
 {
     HWndDC hdc(0);
 
@@ -572,10 +604,10 @@ auto FontCache::getTraitsAndStretchInFamily(const AtomicString& familyName) -> V
 
     TraitsInFamilyProcData procData(familyName);
     EnumFontFamiliesEx(hdc, &logFont, traitsInFamilyEnumProc, reinterpret_cast<LPARAM>(&procData), 0);
-    Vector<TraitsAndStretch> result;
-    result.reserveInitialCapacity(procData.m_traitsMasks.size());
-    for (unsigned mask : procData.m_traitsMasks)
-        result.uncheckedAppend({ static_cast<FontTraitsMask>(mask), FontSelectionRange(FontSelectionValue(), FontSelectionValue()) });
+    Vector<FontSelectionCapabilities> result;
+    result.reserveInitialCapacity(procData.m_capabilities.size());
+    for (auto capabilities : procData.m_capabilities)
+        result.uncheckedAppend(capabilities);
     return result;
 }
 
index da39e4e..56c607a 100644 (file)
@@ -149,7 +149,7 @@ bool MockRealtimeVideoSource::applySize(const IntSize& size)
     fontDescription.setOneFamily("Courier");
     fontDescription.setSpecifiedSize(m_baseFontSize);
     fontDescription.setComputedSize(m_baseFontSize);
-    fontDescription.setWeight(FontWeight500);
+    fontDescription.setWeight(FontSelectionValue(500));
 
     m_timeFont = FontCascade(fontDescription, 0, 0);
     m_timeFont.update(nullptr);
index 554c8d9..63a9f8c 100644 (file)
@@ -340,62 +340,11 @@ const unsigned FontWidthVariantWidth = 2;
 
 COMPILE_ASSERT(!(LastFontWidthVariant >> FontWidthVariantWidth), FontWidthVariantWidth_is_correct);
 
-enum FontWeight {
-    FontWeight100,
-    FontWeight200,
-    FontWeight300,
-    FontWeight400,
-    FontWeight500,
-    FontWeight600,
-    FontWeight700,
-    FontWeight800,
-    FontWeight900,
-    FontWeightNormal = FontWeight400,
-    FontWeightBold = FontWeight700
-};
-
-enum FontItalic {
-    FontItalicOff = 0,
-    FontItalicOn = 1
-};
-
 enum FontSmallCaps {
     FontSmallCapsOff = 0,
     FontSmallCapsOn = 1
 };
 
-enum {
-    FontStyleNormalBit = 0,
-    FontStyleItalicBit,
-    FontWeight100Bit,
-    FontWeight200Bit,
-    FontWeight300Bit,
-    FontWeight400Bit,
-    FontWeight500Bit,
-    FontWeight600Bit,
-    FontWeight700Bit,
-    FontWeight800Bit,
-    FontWeight900Bit,
-    FontTraitsMaskWidth
-};
-
-enum FontTraitsMask {
-    FontStyleNormalMask = 1 << FontStyleNormalBit,
-    FontStyleItalicMask = 1 << FontStyleItalicBit,
-    FontStyleMask = FontStyleNormalMask | FontStyleItalicMask,
-
-    FontWeight100Mask = 1 << FontWeight100Bit,
-    FontWeight200Mask = 1 << FontWeight200Bit,
-    FontWeight300Mask = 1 << FontWeight300Bit,
-    FontWeight400Mask = 1 << FontWeight400Bit,
-    FontWeight500Mask = 1 << FontWeight500Bit,
-    FontWeight600Mask = 1 << FontWeight600Bit,
-    FontWeight700Mask = 1 << FontWeight700Bit,
-    FontWeight800Mask = 1 << FontWeight800Bit,
-    FontWeight900Mask = 1 << FontWeight900Bit,
-    FontWeightMask = FontWeight100Mask | FontWeight200Mask | FontWeight300Mask | FontWeight400Mask | FontWeight500Mask | FontWeight600Mask | FontWeight700Mask | FontWeight800Mask | FontWeight900Mask
-};
-
 enum class Kerning {
     Auto,
     Normal,
index 1abc008..6399ea2 100644 (file)
@@ -111,7 +111,7 @@ static FontCascade dragLabelFont(int size, bool bold, FontRenderingMode renderin
     SystemParametersInfo(SPI_GETNONCLIENTMETRICS, metrics.cbSize, &metrics, 0);
 
     FontCascadeDescription description;
-    description.setWeight(bold ? FontWeightBold : FontWeightNormal);
+    description.setWeight(bold ? boldWeightValue() : normalWeightValue());
     description.setOneFamily(metrics.lfSmCaptionFont.lfFaceName);
     description.setSpecifiedSize((float)size);
     description.setComputedSize((float)size);
index 482b5dd..b320534 100644 (file)
@@ -352,7 +352,7 @@ bool RenderEmbeddedObject::getReplacementTextGeometry(const LayoutPoint& accumul
 
     FontCascadeDescription fontDescription;
     RenderTheme::defaultTheme()->systemFont(CSSValueWebkitSmallControl, fontDescription);
-    fontDescription.setWeight(FontWeightBold);
+    fontDescription.setWeight(boldWeightValue());
     fontDescription.setRenderingMode(settings().fontRenderingMode());
     fontDescription.setComputedSize(12);
     font = FontCascade(fontDescription, 0, 0);
index b737fb8..f560000 100644 (file)
@@ -110,8 +110,8 @@ void RenderThemeGtk::updateCachedSystemFontDescription(CSSValueID, FontCascadeDe
 
     fontDescription.setSpecifiedSize(size);
     fontDescription.setIsAbsoluteSize(true);
-    fontDescription.setWeight(FontWeightNormal);
-    fontDescription.setItalic(FontItalicOff);
+    fontDescription.setWeight(normalWeightValue());
+    fontDescription.setItalic(FontSelectionValue());
     pango_font_description_free(pangoDescription);
 }
 
index 2af7831..c794d0b 100644 (file)
@@ -1273,12 +1273,12 @@ void RenderThemeIOS::updateCachedSystemFontDescription(CSSValueID valueID, FontC
 
     ASSERT(fontDescriptor);
     RetainPtr<CTFontRef> font = adoptCF(CTFontCreateWithFontDescriptor(fontDescriptor.get(), 0, nullptr));
-    font = preparePlatformFont(font.get(), fontDescription.textRenderingMode(), nullptr, nullptr, fontDescription.featureSettings(), fontDescription.variantSettings(), fontDescription.variationSettings());
     fontDescription.setIsAbsoluteSize(true);
     fontDescription.setOneFamily(textStyle);
     fontDescription.setSpecifiedSize(CTFontGetSize(font.get()));
-    fontDescription.setWeight(fontWeightFromCoreText(FontCache::weightOfCTFont(font.get())));
-    fontDescription.setItalic(FontItalicOff);
+    auto capabilities = capabilitiesForFontDescriptor(adoptCF(CTFontCopyFontDescriptor(font.get())).get());
+    fontDescription.setWeight(capabilities.weight.minimum);
+    fontDescription.setItalic(normalItalicValue());
 }
 
 #if ENABLE(VIDEO)
index 20e3168..f80e2c9 100644 (file)
@@ -357,7 +357,7 @@ Color RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor() const
     return platformInactiveSelectionBackgroundColor();
 }
 
-static FontWeight toFontWeight(NSInteger appKitFontWeight)
+static FontSelectionValue toFontWeight(NSInteger appKitFontWeight)
 {
     ASSERT(appKitFontWeight > 0 && appKitFontWeight < 15);
     if (appKitFontWeight > 14)
@@ -365,21 +365,21 @@ static FontWeight toFontWeight(NSInteger appKitFontWeight)
     else if (appKitFontWeight < 1)
         appKitFontWeight = 1;
 
-    static const FontWeight fontWeights[] = {
-        FontWeight100,
-        FontWeight100,
-        FontWeight200,
-        FontWeight300,
-        FontWeight400,
-        FontWeight500,
-        FontWeight600,
-        FontWeight600,
-        FontWeight700,
-        FontWeight800,
-        FontWeight800,
-        FontWeight900,
-        FontWeight900,
-        FontWeight900
+    static const FontSelectionValue fontWeights[] = {
+        FontSelectionValue(100),
+        FontSelectionValue(100),
+        FontSelectionValue(200),
+        FontSelectionValue(300),
+        FontSelectionValue(400),
+        FontSelectionValue(500),
+        FontSelectionValue(600),
+        FontSelectionValue(600),
+        FontSelectionValue(700),
+        FontSelectionValue(800),
+        FontSelectionValue(800),
+        FontSelectionValue(900),
+        FontSelectionValue(900),
+        FontSelectionValue(900)
     };
     return fontWeights[appKitFontWeight - 1];
 }
index 2eeeea6..e98ff30 100644 (file)
@@ -324,7 +324,7 @@ static void fillFontDescription(FontCascadeDescription& fontDescription, LOGFONT
     fontDescription.setIsAbsoluteSize(true);
     fontDescription.setOneFamily(String(logFont.lfFaceName));
     fontDescription.setSpecifiedSize(fontSize);
-    fontDescription.setWeight(logFont.lfWeight >= 700 ? FontWeightBold : FontWeightNormal); // FIXME: Use real weight.
+    fontDescription.setWeight(logFont.lfWeight >= 700 ? boldWeightValue() : normalWeightValue()); // FIXME: Use real weight.
     fontDescription.setIsItalic(logFont.lfItalic);
 }
 
index 786ce3b..62277e4 100644 (file)
@@ -1,3 +1,19 @@
+2017-03-06  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        Expand font-weight and font-stretch to take any number
+        https://bugs.webkit.org/show_bug.cgi?id=168889
+
+        Reviewed by Simon Fraser.
+
+        Migrate off old enum types.
+
+        * WebCoreSupport/PopupMenuMac.mm:
+        (PopupMenuMac::populate):
+        * WebView/WebHTMLView.mm:
+        (fontNameForDescription):
+        * WebView/WebView.mm:
+        (-[WebView updateTextTouchBar]):
+
 2017-03-03  Dean Jackson  <dino@apple.com>
 
         Add WebGPU compile flag and experimental feature flag
index 630ad85..56797b0 100644 (file)
@@ -84,7 +84,7 @@ void PopupMenuMac::populate()
             RetainPtr<CTFontRef> font = style.font().primaryFont().getCTFont();
             if (!font) {
                 CGFloat size = style.font().primaryFont().platformData().size();
-                font = adoptCF(CTFontCreateUIFontForLanguage(style.font().weight() < FontWeightBold ? kCTFontUIFontSystem : kCTFontUIFontEmphasizedSystem, size, nullptr));
+                font = adoptCF(CTFontCreateUIFontForLanguage(isFontWeightBold(style.font().weight()) ? kCTFontUIFontEmphasizedSystem : kCTFontUIFontSystem, size, nullptr));
             }
             [attributes setObject:toNSFont(font.get()) forKey:NSFontAttributeName];
         }
index 81654d4..ffe75f5 100644 (file)
@@ -5629,7 +5629,7 @@ static RetainPtr<CFStringRef> fontNameForDescription(NSString *familyName, BOOL
     // Find the font the same way the rendering code would later if it encountered this CSS.
     FontDescription fontDescription;
     fontDescription.setIsItalic(italic);
-    fontDescription.setWeight(bold ? FontWeight900 : FontWeight500);
+    fontDescription.setWeight(bold ? FontSelectionValue(900) : FontSelectionValue(500));
     RefPtr<Font> font = FontCache::singleton().fontForFamily(fontDescription, familyName);
     return adoptCF(CTFontCopyPostScriptName(font->getCTFont()));
 }
index b5ed3e5..78f4747 100644 (file)
@@ -9618,8 +9618,8 @@ static NSTextAlignment nsTextAlignmentFromRenderStyle(const RenderStyle* style)
         if (!selection.isNone()) {
             Node* nodeToRemove;
             if (auto* style = Editor::styleForSelectionStart(coreFrame, nodeToRemove)) {
-                [_private->_textTouchBarItemController setTextIsBold:(style->fontCascade().weight() >= FontWeightBold)];
-                [_private->_textTouchBarItemController setTextIsItalic:(style->fontCascade().italic() == FontItalicOn)];
+                [_private->_textTouchBarItemController setTextIsBold:isFontWeightBold(style->fontCascade().weight())];
+                [_private->_textTouchBarItemController setTextIsItalic:isItalic(style->fontCascade().italic())];
 
                 RefPtr<EditingStyle> typingStyle = coreFrame->selection().typingStyle();
                 if (typingStyle && typingStyle->style()) {
index 0d4731d..072ee86 100644 (file)
@@ -1,3 +1,15 @@
+2017-03-06  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        Expand font-weight and font-stretch to take any number
+        https://bugs.webkit.org/show_bug.cgi?id=168889
+
+        Reviewed by Simon Fraser.
+
+        Migrate off old enum types.
+
+        * WebKitGraphics.cpp:
+        (makeFont):
+
 2017-03-02  Sam Weinig  <sam@webkit.org>
 
         Rename htmlediting.h/cpp to Editing.h/cpp
index 07862b1..91fe364 100644 (file)
@@ -1294,7 +1294,7 @@ HRESULT DOMElement::font(_Out_ WebFontDescription* webFontDescription)
     webFontDescription->family = familyCharactersBuffer;
     webFontDescription->familyLength = family.length();
     webFontDescription->size = fontDescription.computedSize();
-    webFontDescription->bold = fontDescription.weight() >= WebCore::FontWeight600;
+    webFontDescription->bold = isFontWeightBold(fontDescription.weight());
     webFontDescription->italic = fontDescription.italic();
 
     return S_OK;
index 0cfdff9..9a210e4 100644 (file)
@@ -57,7 +57,7 @@ static FontCascade makeFont(const WebFontDescription& description)
     f.setSpecifiedSize(description.size);
     f.setComputedSize(description.size);
     f.setIsItalic(description.italic);
-    f.setWeight(description.bold ? FontWeightBold : FontWeightNormal);
+    f.setWeight(description.bold ? boldWeightValue() : normalWeightValue());
     f.setIsAbsoluteSize(true);
 
     FontSmoothingType smoothingType;
index 47666f8..1f8e471 100644 (file)
@@ -1,3 +1,15 @@
+2017-03-06  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        Expand font-weight and font-stretch to take any number
+        https://bugs.webkit.org/show_bug.cgi?id=168889
+
+        Reviewed by Simon Fraser.
+
+        Migrate off old enum types.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::editorState):
+
 2017-03-06  Andreas Kling  <akling@apple.com>
 
         [iOS] Report domains crashing under memory pressure via enhanced privacy logging.
index be30cdd..8f88d9a 100644 (file)
@@ -831,9 +831,9 @@ EditorState WebPage::editorState(IncludePostLayoutDataHint shouldIncludePostLayo
         if (!selection.isNone()) {
             Node* nodeToRemove;
             if (auto* style = Editor::styleForSelectionStart(&frame, nodeToRemove)) {
-                if (style->fontCascade().weight() >= FontWeightBold)
+                if (isFontWeightBold(style->fontCascade().weight()))
                     postLayoutData.typingAttributes |= AttributeBold;
-                if (style->fontCascade().italic() == FontItalicOn)
+                if (isItalic(style->fontCascade().italic()))
                     postLayoutData.typingAttributes |= AttributeItalics;
 
                 RefPtr<EditingStyle> typingStyle = frame.selection().typingStyle();
index 1ada24a..27c82d9 100644 (file)
@@ -1,3 +1,17 @@
+2017-03-06  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        Expand font-weight and font-stretch to take any number
+        https://bugs.webkit.org/show_bug.cgi?id=168889
+
+        Reviewed by Simon Fraser.
+
+        Migrate off old enum types.
+
+        * TestWebKitAPI/Tests/WebCore/FontCache.cpp:
+        (TestWebKitAPI::createPlatformFont):
+        (TestWebKitAPI::compareFonts):
+        (TestWebKitAPI::TEST_F):
+
 2017-03-06  Yusuke Suzuki  <utatane.tea@gmail.com>
 
         [GTK][JSCOnly] Enable WebAssembly on Linux environment
index 6558f7c..cc071fb 100644 (file)
@@ -49,13 +49,13 @@ public:
     }
 };
 
-static std::unique_ptr<FontPlatformData> createPlatformFont(const char* familyName, FontWeight weight, FontItalic italic, float stretch, float size)
+static std::unique_ptr<FontPlatformData> createPlatformFont(const char* familyName, float weight, float italic, float stretch, float size)
 {
     AtomicString familyNameString(familyName);
     FontCascadeDescription description;
     description.setOneFamily(familyNameString);
-    description.setWeight(weight);
-    description.setItalic(italic);
+    description.setWeight(FontSelectionValue(weight));
+    description.setItalic(FontSelectionValue(italic));
     description.setStretch(FontSelectionValue(stretch));
     description.setComputedSize(size);
 
@@ -63,7 +63,7 @@ static std::unique_ptr<FontPlatformData> createPlatformFont(const char* familyNa
     return fontCache.createFontPlatformDataForTesting(description, familyNameString);
 }
 
-static bool compareFonts(const char* familyName, FontWeight weight, FontItalic italic, float stretch, CFStringRef expectedPostScriptName)
+static bool compareFonts(const char* familyName, float weight, float italic, float stretch, CFStringRef expectedPostScriptName)
 {
     float size = 80;
     auto platformFont = createPlatformFont(familyName, weight, italic, stretch, size);
@@ -73,1346 +73,1346 @@ static bool compareFonts(const char* familyName, FontWeight weight, FontItalic i
 
 TEST_F(FontCacheTest, FontLookupFromFamilyName)
 {
-    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", FontWeight100, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Thin")));
-    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", FontWeight100, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Thin")));
-    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", FontWeight200, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-UltraLight")));
-    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", FontWeight200, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-UltraLight")));
-    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", FontWeight300, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Light")));
-    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", FontWeight300, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Light")));
-    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", FontWeight400, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Regular")));
-    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", FontWeight400, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Regular")));
-    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", FontWeight500, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Medium")));
-    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", FontWeight500, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Medium")));
-    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", FontWeight600, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-SemiBold")));
-    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", FontWeight600, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-SemiBold")));
-    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", FontWeight700, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Bold")));
-    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", FontWeight700, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Bold")));
-    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", FontWeight800, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-ExtraBold")));
-    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", FontWeight800, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-ExtraBold")));
-    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", FontWeight900, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Heavy")));
-    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", FontWeight900, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Heavy")));
-    EXPECT_TRUE(compareFonts("Arial", FontWeight100, FontItalicOff, 100, CFSTR("ArialMT")));
-    EXPECT_TRUE(compareFonts("Arial", FontWeight100, FontItalicOn , 100, CFSTR("Arial-ItalicMT")));
-    EXPECT_TRUE(compareFonts("Arial", FontWeight200, FontItalicOff, 100, CFSTR("ArialMT")));
-    EXPECT_TRUE(compareFonts("Arial", FontWeight200, FontItalicOn , 100, CFSTR("Arial-ItalicMT")));
-    EXPECT_TRUE(compareFonts("Arial", FontWeight300, FontItalicOff, 100, CFSTR("ArialMT")));
-    EXPECT_TRUE(compareFonts("Arial", FontWeight300, FontItalicOn , 100, CFSTR("Arial-ItalicMT")));
-    EXPECT_TRUE(compareFonts("Arial", FontWeight400, FontItalicOff, 100, CFSTR("ArialMT")));
-    EXPECT_TRUE(compareFonts("Arial", FontWeight400, FontItalicOn , 100, CFSTR("Arial-ItalicMT")));
-    EXPECT_TRUE(compareFonts("Arial", FontWeight500, FontItalicOff, 100, CFSTR("ArialMT")));
-    EXPECT_TRUE(compareFonts("Arial", FontWeight500, FontItalicOn , 100, CFSTR("Arial-ItalicMT")));
-    EXPECT_TRUE(compareFonts("Arial", FontWeight600, FontItalicOff, 100, CFSTR("Arial-BoldMT")));
-    EXPECT_TRUE(compareFonts("Arial", FontWeight600, FontItalicOn , 100, CFSTR("Arial-BoldItalicMT")));
-    EXPECT_TRUE(compareFonts("Arial", FontWeight700, FontItalicOff, 100, CFSTR("Arial-BoldMT")));
-    EXPECT_TRUE(compareFonts("Arial", FontWeight700, FontItalicOn , 100, CFSTR("Arial-BoldItalicMT")));
-    EXPECT_TRUE(compareFonts("Arial", FontWeight800, FontItalicOff, 100, CFSTR("Arial-BoldMT")));
-    EXPECT_TRUE(compareFonts("Arial", FontWeight800, FontItalicOn , 100, CFSTR("Arial-BoldItalicMT")));
-    EXPECT_TRUE(compareFonts("Arial", FontWeight900, FontItalicOff, 100, CFSTR("Arial-BoldMT")));
-    EXPECT_TRUE(compareFonts("Arial", FontWeight900, FontItalicOn , 100, CFSTR("Arial-BoldItalicMT")));
-    EXPECT_TRUE(compareFonts("Avenir Next", FontWeight100, FontItalicOff, 100, CFSTR("AvenirNext-UltraLight")));
-    EXPECT_TRUE(compareFonts("Avenir Next", FontWeight100, FontItalicOn , 100, CFSTR("AvenirNext-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("Avenir Next", FontWeight200, FontItalicOff, 100, CFSTR("AvenirNext-UltraLight")));
-    EXPECT_TRUE(compareFonts("Avenir Next", FontWeight200, FontItalicOn , 100, CFSTR("AvenirNext-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("Avenir Next", FontWeight300, FontItalicOff, 100, CFSTR("AvenirNext-UltraLight")));
-    EXPECT_TRUE(compareFonts("Avenir Next", FontWeight300, FontItalicOn , 100, CFSTR("AvenirNext-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("Avenir Next", FontWeight400, FontItalicOff, 100, CFSTR("AvenirNext-Regular")));
-    EXPECT_TRUE(compareFonts("Avenir Next", FontWeight400, FontItalicOn , 100, CFSTR("AvenirNext-Italic")));
-    EXPECT_TRUE(compareFonts("Avenir Next", FontWeight500, FontItalicOff, 100, CFSTR("AvenirNext-Medium")));
-    EXPECT_TRUE(compareFonts("Avenir Next", FontWeight500, FontItalicOn , 100, CFSTR("AvenirNext-MediumItalic")));
-    EXPECT_TRUE(compareFonts("Avenir Next", FontWeight600, FontItalicOff, 100, CFSTR("AvenirNext-DemiBold")));
-    EXPECT_TRUE(compareFonts("Avenir Next", FontWeight600, FontItalicOn , 100, CFSTR("AvenirNext-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("Avenir Next", FontWeight700, FontItalicOff, 100, CFSTR("AvenirNext-Bold")));
-    EXPECT_TRUE(compareFonts("Avenir Next", FontWeight700, FontItalicOn , 100, CFSTR("AvenirNext-BoldItalic")));
-    EXPECT_TRUE(compareFonts("Avenir Next", FontWeight800, FontItalicOff, 100, CFSTR("AvenirNext-Heavy")));
-    EXPECT_TRUE(compareFonts("Avenir Next", FontWeight800, FontItalicOn , 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("Avenir Next", FontWeight900, FontItalicOff, 100, CFSTR("AvenirNext-Heavy")));
-    EXPECT_TRUE(compareFonts("Avenir Next", FontWeight900, FontItalicOn , 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("Avenir", FontWeight100, FontItalicOff, 100, CFSTR("Avenir-Light")));
-    EXPECT_TRUE(compareFonts("Avenir", FontWeight100, FontItalicOn , 100, CFSTR("Avenir-LightOblique")));
-    EXPECT_TRUE(compareFonts("Avenir", FontWeight200, FontItalicOff, 100, CFSTR("Avenir-Light")));
-    EXPECT_TRUE(compareFonts("Avenir", FontWeight200, FontItalicOn , 100, CFSTR("Avenir-LightOblique")));
-    EXPECT_TRUE(compareFonts("Avenir", FontWeight300, FontItalicOff, 100, CFSTR("Avenir-Light")));
-    EXPECT_TRUE(compareFonts("Avenir", FontWeight300, FontItalicOn , 100, CFSTR("Avenir-LightOblique")));
-    EXPECT_TRUE(compareFonts("Avenir", FontWeight400, FontItalicOff, 100, CFSTR("Avenir-Book")));
-    EXPECT_TRUE(compareFonts("Avenir", FontWeight400, FontItalicOn , 100, CFSTR("Avenir-BookOblique")));
-    EXPECT_TRUE(compareFonts("Avenir", FontWeight500, FontItalicOff, 100, CFSTR("Avenir-Medium")));
-    EXPECT_TRUE(compareFonts("Avenir", FontWeight500, FontItalicOn , 100, CFSTR("Avenir-MediumOblique")));
-    EXPECT_TRUE(compareFonts("Avenir", FontWeight600, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir", FontWeight600, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir", FontWeight700, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir", FontWeight700, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir", FontWeight800, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir", FontWeight800, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir", FontWeight900, FontItalicOff, 100, CFSTR("Avenir-Heavy")));
-    EXPECT_TRUE(compareFonts("Avenir", FontWeight900, FontItalicOn , 100, CFSTR("Avenir-HeavyOblique")));
-    EXPECT_TRUE(compareFonts("Baskerville", FontWeight100, FontItalicOff, 100, CFSTR("Baskerville")));
-    EXPECT_TRUE(compareFonts("Baskerville", FontWeight100, FontItalicOn , 100, CFSTR("Baskerville-Italic")));
-    EXPECT_TRUE(compareFonts("Baskerville", FontWeight200, FontItalicOff, 100, CFSTR("Baskerville")));
-    EXPECT_TRUE(compareFonts("Baskerville", FontWeight200, FontItalicOn , 100, CFSTR("Baskerville-Italic")));
-    EXPECT_TRUE(compareFonts("Baskerville", FontWeight300, FontItalicOff, 100, CFSTR("Baskerville")));
-    EXPECT_TRUE(compareFonts("Baskerville", FontWeight300, FontItalicOn , 100, CFSTR("Baskerville-Italic")));
-    EXPECT_TRUE(compareFonts("Baskerville", FontWeight400, FontItalicOff, 100, CFSTR("Baskerville")));
-    EXPECT_TRUE(compareFonts("Baskerville", FontWeight400, FontItalicOn , 100, CFSTR("Baskerville-Italic")));
-    EXPECT_TRUE(compareFonts("Baskerville", FontWeight500, FontItalicOff, 100, CFSTR("Baskerville")));
-    EXPECT_TRUE(compareFonts("Baskerville", FontWeight500, FontItalicOn , 100, CFSTR("Baskerville-Italic")));
-    EXPECT_TRUE(compareFonts("Baskerville", FontWeight600, FontItalicOff, 100, CFSTR("Baskerville-SemiBold")));
-    EXPECT_TRUE(compareFonts("Baskerville", FontWeight600, FontItalicOn , 100, CFSTR("Baskerville-SemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("Baskerville", FontWeight700, FontItalicOff, 100, CFSTR("Baskerville-Bold")));
-    EXPECT_TRUE(compareFonts("Baskerville", FontWeight700, FontItalicOn , 100, CFSTR("Baskerville-BoldItalic")));
-    EXPECT_TRUE(compareFonts("Baskerville", FontWeight800, FontItalicOff, 100, CFSTR("Baskerville-Bold")));
-    EXPECT_TRUE(compareFonts("Baskerville", FontWeight800, FontItalicOn , 100, CFSTR("Baskerville-BoldItalic")));
-    EXPECT_TRUE(compareFonts("Baskerville", FontWeight900, FontItalicOff, 100, CFSTR("Baskerville-Bold")));
-    EXPECT_TRUE(compareFonts("Baskerville", FontWeight900, FontItalicOn , 100, CFSTR("Baskerville-BoldItalic")));
-    EXPECT_TRUE(compareFonts("Didot", FontWeight100, FontItalicOff, 100, CFSTR("Didot")));
-    EXPECT_TRUE(compareFonts("Didot", FontWeight100, FontItalicOn , 100, CFSTR("Didot-Italic")));
-    EXPECT_TRUE(compareFonts("Didot", FontWeight200, FontItalicOff, 100, CFSTR("Didot")));
-    EXPECT_TRUE(compareFonts("Didot", FontWeight200, FontItalicOn , 100, CFSTR("Didot-Italic")));
-    EXPECT_TRUE(compareFonts("Didot", FontWeight300, FontItalicOff, 100, CFSTR("Didot")));
-    EXPECT_TRUE(compareFonts("Didot", FontWeight300, FontItalicOn , 100, CFSTR("Didot-Italic")));
-    EXPECT_TRUE(compareFonts("Didot", FontWeight400, FontItalicOff, 100, CFSTR("Didot")));
-    EXPECT_TRUE(compareFonts("Didot", FontWeight400, FontItalicOn , 100, CFSTR("Didot-Italic")));
-    EXPECT_TRUE(compareFonts("Didot", FontWeight500, FontItalicOff, 100, CFSTR("Didot")));
-    EXPECT_TRUE(compareFonts("Didot", FontWeight500, FontItalicOn , 100, CFSTR("Didot-Italic")));
-    EXPECT_TRUE(compareFonts("Didot", FontWeight600, FontItalicOff, 100, CFSTR("Didot-Bold")));
-    EXPECT_TRUE(compareFonts("Didot", FontWeight600, FontItalicOn , 100, CFSTR("Didot-Italic")));
-    EXPECT_TRUE(compareFonts("Didot", FontWeight700, FontItalicOff, 100, CFSTR("Didot-Bold")));
-    EXPECT_TRUE(compareFonts("Didot", FontWeight700, FontItalicOn , 100, CFSTR("Didot-Italic")));
-    EXPECT_TRUE(compareFonts("Didot", FontWeight800, FontItalicOff, 100, CFSTR("Didot-Bold")));
-    EXPECT_TRUE(compareFonts("Didot", FontWeight800, FontItalicOn , 100, CFSTR("Didot-Italic")));
-    EXPECT_TRUE(compareFonts("Didot", FontWeight900, FontItalicOff, 100, CFSTR("Didot-Bold")));
-    EXPECT_TRUE(compareFonts("Didot", FontWeight900, FontItalicOn , 100, CFSTR("Didot-Italic")));
-    EXPECT_TRUE(compareFonts("Futura", FontWeight100, FontItalicOff, 100, CFSTR("Futura-Medium")));
-    EXPECT_TRUE(compareFonts("Futura", FontWeight100, FontItalicOn , 100, CFSTR("Futura-MediumItalic")));
-    EXPECT_TRUE(compareFonts("Futura", FontWeight200, FontItalicOff, 100, CFSTR("Futura-Medium")));
-    EXPECT_TRUE(compareFonts("Futura", FontWeight200, FontItalicOn , 100, CFSTR("Futura-MediumItalic")));
-    EXPECT_TRUE(compareFonts("Futura", FontWeight300, FontItalicOff, 100, CFSTR("Futura-Medium")));
-    EXPECT_TRUE(compareFonts("Futura", FontWeight300, FontItalicOn , 100, CFSTR("Futura-MediumItalic")));
-    EXPECT_TRUE(compareFonts("Futura", FontWeight400, FontItalicOff, 100, CFSTR("Futura-Medium")));
-    EXPECT_TRUE(compareFonts("Futura", FontWeight400, FontItalicOn , 100, CFSTR("Futura-MediumItalic")));
-    EXPECT_TRUE(compareFonts("Futura", FontWeight500, FontItalicOff, 100, CFSTR("Futura-Medium")));
-    EXPECT_TRUE(compareFonts("Futura", FontWeight500, FontItalicOn , 100, CFSTR("Futura-MediumItalic")));
-    EXPECT_TRUE(compareFonts("Futura", FontWeight600, FontItalicOff, 100, CFSTR("Futura-Bold")));
-    EXPECT_TRUE(compareFonts("Futura", FontWeight600, FontItalicOn , 100, CFSTR("Futura-MediumItalic")));
-    EXPECT_TRUE(compareFonts("Futura", FontWeight700, FontItalicOff, 100, CFSTR("Futura-Bold")));
-    EXPECT_TRUE(compareFonts("Futura", FontWeight700, FontItalicOn , 100, CFSTR("Futura-MediumItalic")));
-    EXPECT_TRUE(compareFonts("Futura", FontWeight800, FontItalicOff, 100, CFSTR("Futura-Bold")));
-    EXPECT_TRUE(compareFonts("Futura", FontWeight800, FontItalicOn , 100, CFSTR("Futura-MediumItalic")));
-    EXPECT_TRUE(compareFonts("Futura", FontWeight900, FontItalicOff, 100, CFSTR("Futura-Bold")));
-    EXPECT_TRUE(compareFonts("Futura", FontWeight900, FontItalicOn , 100, CFSTR("Futura-MediumItalic")));
-    EXPECT_TRUE(compareFonts("Helvetica Neue", FontWeight100, FontItalicOff, 100, CFSTR("HelveticaNeue-UltraLight")));
-    EXPECT_TRUE(compareFonts("Helvetica Neue", FontWeight100, FontItalicOn , 100, CFSTR("HelveticaNeue-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("Helvetica Neue", FontWeight200, FontItalicOff, 100, CFSTR("HelveticaNeue-Thin")));
-    EXPECT_TRUE(compareFonts("Helvetica Neue", FontWeight200, FontItalicOn , 100, CFSTR("HelveticaNeue-ThinItalic")));
-    EXPECT_TRUE(compareFonts("Helvetica Neue", FontWeight300, FontItalicOff, 100, CFSTR("HelveticaNeue-Light")));
-    EXPECT_TRUE(compareFonts("Helvetica Neue", FontWeight300, FontItalicOn , 100, CFSTR("HelveticaNeue-LightItalic")));
-    EXPECT_TRUE(compareFonts("Helvetica Neue", FontWeight400, FontItalicOff, 100, CFSTR("HelveticaNeue")));
-    EXPECT_TRUE(compareFonts("Helvetica Neue", FontWeight400, FontItalicOn , 100, CFSTR("HelveticaNeue-Italic")));
-    EXPECT_TRUE(compareFonts("Helvetica Neue", FontWeight500, FontItalicOff, 100, CFSTR("HelveticaNeue-Medium")));
-    EXPECT_TRUE(compareFonts("Helvetica Neue", FontWeight500, FontItalicOn , 100, CFSTR("HelveticaNeue-MediumItalic")));
-    EXPECT_TRUE(compareFonts("Helvetica Neue", FontWeight600, FontItalicOff, 100, CFSTR("HelveticaNeue-Bold")));
-    EXPECT_TRUE(compareFonts("Helvetica Neue", FontWeight600, FontItalicOn , 100, CFSTR("HelveticaNeue-BoldItalic")));
-    EXPECT_TRUE(compareFonts("Helvetica Neue", FontWeight700, FontItalicOff, 100, CFSTR("HelveticaNeue-Bold")));
-    EXPECT_TRUE(compareFonts("Helvetica Neue", FontWeight700, FontItalicOn , 100, CFSTR("HelveticaNeue-BoldItalic")));
-    EXPECT_TRUE(compareFonts("Helvetica Neue", FontWeight800, FontItalicOff, 100, CFSTR("HelveticaNeue-Bold")));
-    EXPECT_TRUE(compareFonts("Helvetica Neue", FontWeight800, FontItalicOn , 100, CFSTR("HelveticaNeue-BoldItalic")));
-    EXPECT_TRUE(compareFonts("Helvetica Neue", FontWeight900, FontItalicOff, 100, CFSTR("HelveticaNeue-Bold")));
-    EXPECT_TRUE(compareFonts("Helvetica Neue", FontWeight900, FontItalicOn , 100, CFSTR("HelveticaNeue-BoldItalic")));
-    EXPECT_TRUE(compareFonts("Helvetica", FontWeight100, FontItalicOff, 100, CFSTR("Helvetica-Light")));
-    EXPECT_TRUE(compareFonts("Helvetica", FontWeight100, FontItalicOn , 100, CFSTR("Helvetica-LightOblique")));
-    EXPECT_TRUE(compareFonts("Helvetica", FontWeight200, FontItalicOff, 100, CFSTR("Helvetica-Light")));
-    EXPECT_TRUE(compareFonts("Helvetica", FontWeight200, FontItalicOn , 100, CFSTR("Helvetica-LightOblique")));
-    EXPECT_TRUE(compareFonts("Helvetica", FontWeight300, FontItalicOff, 100, CFSTR("Helvetica-Light")));
-    EXPECT_TRUE(compareFonts("Helvetica", FontWeight300, FontItalicOn , 100, CFSTR("Helvetica-LightOblique")));
-    EXPECT_TRUE(compareFonts("Helvetica", FontWeight400, FontItalicOff, 100, CFSTR("Helvetica")));
-    EXPECT_TRUE(compareFonts("Helvetica", FontWeight400, FontItalicOn , 100, CFSTR("Helvetica-Oblique")));
-    EXPECT_TRUE(compareFonts("Helvetica", FontWeight500, FontItalicOff, 100, CFSTR("Helvetica")));
-    EXPECT_TRUE(compareFonts("Helvetica", FontWeight500, FontItalicOn , 100, CFSTR("Helvetica-Oblique")));
-    EXPECT_TRUE(compareFonts("Helvetica", FontWeight600, FontItalicOff, 100, CFSTR("Helvetica-Bold")));
-    EXPECT_TRUE(compareFonts("Helvetica", FontWeight600, FontItalicOn , 100, CFSTR("Helvetica-BoldOblique")));
-    EXPECT_TRUE(compareFonts("Helvetica", FontWeight700, FontItalicOff, 100, CFSTR("Helvetica-Bold")));
-    EXPECT_TRUE(compareFonts("Helvetica", FontWeight700, FontItalicOn , 100, CFSTR("Helvetica-BoldOblique")));
-    EXPECT_TRUE(compareFonts("Helvetica", FontWeight800, FontItalicOff, 100, CFSTR("Helvetica-Bold")));
-    EXPECT_TRUE(compareFonts("Helvetica", FontWeight800, FontItalicOn , 100, CFSTR("Helvetica-BoldOblique")));
-    EXPECT_TRUE(compareFonts("Helvetica", FontWeight900, FontItalicOff, 100, CFSTR("Helvetica-Bold")));
-    EXPECT_TRUE(compareFonts("Helvetica", FontWeight900, FontItalicOn , 100, CFSTR("Helvetica-BoldOblique")));
-    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", FontWeight100, FontItalicOff, 100, CFSTR("HiraKakuStdN-W8")));
-    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", FontWeight100, FontItalicOn , 100, CFSTR("HiraKakuStdN-W8")));
-    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", FontWeight200, FontItalicOff, 100, CFSTR("HiraKakuStdN-W8")));
-    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", FontWeight200, FontItalicOn , 100, CFSTR("HiraKakuStdN-W8")));
-    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", FontWeight300, FontItalicOff, 100, CFSTR("HiraKakuStdN-W8")));
-    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", FontWeight300, FontItalicOn , 100, CFSTR("HiraKakuStdN-W8")));
-    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", FontWeight400, FontItalicOff, 100, CFSTR("HiraKakuStdN-W8")));
-    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", FontWeight400, FontItalicOn , 100, CFSTR("HiraKakuStdN-W8")));
-    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", FontWeight500, FontItalicOff, 100, CFSTR("HiraKakuStdN-W8")));
-    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", FontWeight500, FontItalicOn , 100, CFSTR("HiraKakuStdN-W8")));
-    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", FontWeight600, FontItalicOff, 100, CFSTR("HiraKakuStdN-W8")));
-    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", FontWeight600, FontItalicOn , 100, CFSTR("HiraKakuStdN-W8")));
-    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", FontWeight700, FontItalicOff, 100, CFSTR("HiraKakuStdN-W8")));
-    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", FontWeight700, FontItalicOn , 100, CFSTR("HiraKakuStdN-W8")));
-    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", FontWeight800, FontItalicOff, 100, CFSTR("HiraKakuStdN-W8")));
-    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", FontWeight800, FontItalicOn , 100, CFSTR("HiraKakuStdN-W8")));
-    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", FontWeight900, FontItalicOff, 100, CFSTR("HiraKakuStdN-W8")));
-    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", FontWeight900, FontItalicOn , 100, CFSTR("HiraKakuStdN-W8")));
-    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", FontWeight100, FontItalicOff, 100, CFSTR("HiraMaruProN-W4")));
-    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", FontWeight100, FontItalicOn , 100, CFSTR("HiraMaruProN-W4")));
-    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", FontWeight200, FontItalicOff, 100, CFSTR("HiraMaruProN-W4")));
-    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", FontWeight200, FontItalicOn , 100, CFSTR("HiraMaruProN-W4")));
-    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", FontWeight300, FontItalicOff, 100, CFSTR("HiraMaruProN-W4")));
-    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", FontWeight300, FontItalicOn , 100, CFSTR("HiraMaruProN-W4")));
-    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", FontWeight400, FontItalicOff, 100, CFSTR("HiraMaruProN-W4")));
-    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", FontWeight400, FontItalicOn , 100, CFSTR("HiraMaruProN-W4")));
-    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", FontWeight500, FontItalicOff, 100, CFSTR("HiraMaruProN-W4")));
-    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", FontWeight500, FontItalicOn , 100, CFSTR("HiraMaruProN-W4")));
-    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", FontWeight600, FontItalicOff, 100, CFSTR("HiraMaruProN-W4")));
-    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", FontWeight600, FontItalicOn , 100, CFSTR("HiraMaruProN-W4")));
-    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", FontWeight700, FontItalicOff, 100, CFSTR("HiraMaruProN-W4")));
-    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", FontWeight700, FontItalicOn , 100, CFSTR("HiraMaruProN-W4")));
-    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", FontWeight800, FontItalicOff, 100, CFSTR("HiraMaruProN-W4")));
-    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", FontWeight800, FontItalicOn , 100, CFSTR("HiraMaruProN-W4")));
-    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", FontWeight900, FontItalicOff, 100, CFSTR("HiraMaruProN-W4")));
-    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", FontWeight900, FontItalicOn , 100, CFSTR("HiraMaruProN-W4")));
-    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", FontWeight100, FontItalicOff, 100, CFSTR("HiraMinProN-W3")));
-    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", FontWeight100, FontItalicOn , 100, CFSTR("HiraMinProN-W3")));
-    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", FontWeight200, FontItalicOff, 100, CFSTR("HiraMinProN-W3")));
-    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", FontWeight200, FontItalicOn , 100, CFSTR("HiraMinProN-W3")));
-    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", FontWeight300, FontItalicOff, 100, CFSTR("HiraMinProN-W3")));
-    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", FontWeight300, FontItalicOn , 100, CFSTR("HiraMinProN-W3")));
-    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", FontWeight400, FontItalicOff, 100, CFSTR("HiraMinProN-W3")));
-    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", FontWeight400, FontItalicOn , 100, CFSTR("HiraMinProN-W3")));
-    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", FontWeight500, FontItalicOff, 100, CFSTR("HiraMinProN-W3")));
-    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", FontWeight500, FontItalicOn , 100, CFSTR("HiraMinProN-W3")));
-    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", FontWeight600, FontItalicOff, 100, CFSTR("HiraMinProN-W6")));
-    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", FontWeight600, FontItalicOn , 100, CFSTR("HiraMinProN-W6")));
-    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", FontWeight700, FontItalicOff, 100, CFSTR("HiraMinProN-W6")));
-    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", FontWeight700, FontItalicOn , 100, CFSTR("HiraMinProN-W6")));
-    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", FontWeight800, FontItalicOff, 100, CFSTR("HiraMinProN-W6")));
-    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", FontWeight800, FontItalicOn , 100, CFSTR("HiraMinProN-W6")));
-    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", FontWeight900, FontItalicOff, 100, CFSTR("HiraMinProN-W6")));
-    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", FontWeight900, FontItalicOn , 100, CFSTR("HiraMinProN-W6")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans GB", FontWeight100, FontItalicOff, 100, CFSTR("HiraginoSansGB-W3")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans GB", FontWeight100, FontItalicOn , 100, CFSTR("HiraginoSansGB-W3")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans GB", FontWeight200, FontItalicOff, 100, CFSTR("HiraginoSansGB-W3")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans GB", FontWeight200, FontItalicOn , 100, CFSTR("HiraginoSansGB-W3")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans GB", FontWeight300, FontItalicOff, 100, CFSTR("HiraginoSansGB-W3")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans GB", FontWeight300, FontItalicOn , 100, CFSTR("HiraginoSansGB-W3")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans GB", FontWeight400, FontItalicOff, 100, CFSTR("HiraginoSansGB-W3")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans GB", FontWeight400, FontItalicOn , 100, CFSTR("HiraginoSansGB-W3")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans GB", FontWeight500, FontItalicOff, 100, CFSTR("HiraginoSansGB-W3")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans GB", FontWeight500, FontItalicOn , 100, CFSTR("HiraginoSansGB-W3")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans GB", FontWeight600, FontItalicOff, 100, CFSTR("HiraginoSansGB-W6")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans GB", FontWeight600, FontItalicOn , 100, CFSTR("HiraginoSansGB-W6")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans GB", FontWeight700, FontItalicOff, 100, CFSTR("HiraginoSansGB-W6")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans GB", FontWeight700, FontItalicOn , 100, CFSTR("HiraginoSansGB-W6")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans GB", FontWeight800, FontItalicOff, 100, CFSTR("HiraginoSansGB-W6")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans GB", FontWeight800, FontItalicOn , 100, CFSTR("HiraginoSansGB-W6")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans GB", FontWeight900, FontItalicOff, 100, CFSTR("HiraginoSansGB-W6")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans GB", FontWeight900, FontItalicOn , 100, CFSTR("HiraginoSansGB-W6")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans", FontWeight100, FontItalicOff, 100, CFSTR("HiraginoSans-W0")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans", FontWeight100, FontItalicOn , 100, CFSTR("HiraginoSans-W0")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans", FontWeight200, FontItalicOff, 100, CFSTR("HiraginoSans-W1")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans", FontWeight200, FontItalicOn , 100, CFSTR("HiraginoSans-W1")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans", FontWeight300, FontItalicOff, 100, CFSTR("HiraginoSans-W3")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans", FontWeight300, FontItalicOn , 100, CFSTR("HiraginoSans-W3")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans", FontWeight400, FontItalicOff, 100, CFSTR("HiraginoSans-W4")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans", FontWeight400, FontItalicOn , 100, CFSTR("HiraginoSans-W4")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans", FontWeight500, FontItalicOff, 100, CFSTR("HiraginoSans-W5")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans", FontWeight500, FontItalicOn , 100, CFSTR("HiraginoSans-W5")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans", FontWeight600, FontItalicOff, 100, CFSTR("HiraginoSans-W6")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans", FontWeight600, FontItalicOn , 100, CFSTR("HiraginoSans-W6")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans", FontWeight700, FontItalicOff, 100, CFSTR("HiraginoSans-W7")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans", FontWeight700, FontItalicOn , 100, CFSTR("HiraginoSans-W7")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans", FontWeight800, FontItalicOff, 100, CFSTR("HiraginoSans-W8")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans", FontWeight800, FontItalicOn , 100, CFSTR("HiraginoSans-W8")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans", FontWeight900, FontItalicOff, 100, CFSTR("HiraginoSans-W9")));
-    EXPECT_TRUE(compareFonts("Hiragino Sans", FontWeight900, FontItalicOn , 100, CFSTR("HiraginoSans-W9")));
-    EXPECT_TRUE(compareFonts("Hoefler Text", FontWeight100, FontItalicOff, 100, CFSTR("HoeflerText-Regular")));
-    EXPECT_TRUE(compareFonts("Hoefler Text", FontWeight100, FontItalicOn , 100, CFSTR("HoeflerText-Italic")));
-    EXPECT_TRUE(compareFonts("Hoefler Text", FontWeight200, FontItalicOff, 100, CFSTR("HoeflerText-Regular")));
-    EXPECT_TRUE(compareFonts("Hoefler Text", FontWeight200, FontItalicOn , 100, CFSTR("HoeflerText-Italic")));
-    EXPECT_TRUE(compareFonts("Hoefler Text", FontWeight300, FontItalicOff, 100, CFSTR("HoeflerText-Regular")));
-    EXPECT_TRUE(compareFonts("Hoefler Text", FontWeight300, FontItalicOn , 100, CFSTR("HoeflerText-Italic")));
-    EXPECT_TRUE(compareFonts("Hoefler Text", FontWeight400, FontItalicOff, 100, CFSTR("HoeflerText-Regular")));
-    EXPECT_TRUE(compareFonts("Hoefler Text", FontWeight400, FontItalicOn , 100, CFSTR("HoeflerText-Italic")));
-    EXPECT_TRUE(compareFonts("Hoefler Text", FontWeight500, FontItalicOff, 100, CFSTR("HoeflerText-Regular")));
-    EXPECT_TRUE(compareFonts("Hoefler Text", FontWeight500, FontItalicOn , 100, CFSTR("HoeflerText-Italic")));
-    EXPECT_TRUE(compareFonts("Hoefler Text", FontWeight600, FontItalicOff, 100, CFSTR("HoeflerText-Black")));
-    EXPECT_TRUE(compareFonts("Hoefler Text", FontWeight600, FontItalicOn , 100, CFSTR("HoeflerText-BlackItalic")));
-    EXPECT_TRUE(compareFonts("Hoefler Text", FontWeight700, FontItalicOff, 100, CFSTR("HoeflerText-Black")));
-    EXPECT_TRUE(compareFonts("Hoefler Text", FontWeight700, FontItalicOn , 100, CFSTR("HoeflerText-BlackItalic")));
-    EXPECT_TRUE(compareFonts("Hoefler Text", FontWeight800, FontItalicOff, 100, CFSTR("HoeflerText-Black")));
-    EXPECT_TRUE(compareFonts("Hoefler Text", FontWeight800, FontItalicOn , 100, CFSTR("HoeflerText-BlackItalic")));
-    EXPECT_TRUE(compareFonts("Hoefler Text", FontWeight900, FontItalicOff, 100, CFSTR("HoeflerText-Black")));
-    EXPECT_TRUE(compareFonts("Hoefler Text", FontWeight900, FontItalicOn , 100, CFSTR("HoeflerText-BlackItalic")));
-    EXPECT_TRUE(compareFonts("Lucida Grande", FontWeight100, FontItalicOff, 100, CFSTR("LucidaGrande")));
-    EXPECT_TRUE(compareFonts("Lucida Grande", FontWeight100, FontItalicOn , 100, CFSTR("LucidaGrande")));
-    EXPECT_TRUE(compareFonts("Lucida Grande", FontWeight200, FontItalicOff, 100, CFSTR("LucidaGrande")));
-    EXPECT_TRUE(compareFonts("Lucida Grande", FontWeight200, FontItalicOn , 100, CFSTR("LucidaGrande")));
-    EXPECT_TRUE(compareFonts("Lucida Grande", FontWeight300, FontItalicOff, 100, CFSTR("LucidaGrande")));
-    EXPECT_TRUE(compareFonts("Lucida Grande", FontWeight300, FontItalicOn , 100, CFSTR("LucidaGrande")));
-    EXPECT_TRUE(compareFonts("Lucida Grande", FontWeight400, FontItalicOff, 100, CFSTR("LucidaGrande")));
-    EXPECT_TRUE(compareFonts("Lucida Grande", FontWeight400, FontItalicOn , 100, CFSTR("LucidaGrande")));
-    EXPECT_TRUE(compareFonts("Lucida Grande", FontWeight500, FontItalicOff, 100, CFSTR("LucidaGrande")));
-    EXPECT_TRUE(compareFonts("Lucida Grande", FontWeight500, FontItalicOn , 100, CFSTR("LucidaGrande")));
-    EXPECT_TRUE(compareFonts("Lucida Grande", FontWeight600, FontItalicOff, 100, CFSTR("LucidaGrande-Bold")));
-    EXPECT_TRUE(compareFonts("Lucida Grande", FontWeight600, FontItalicOn , 100, CFSTR("LucidaGrande-Bold")));
-    EXPECT_TRUE(compareFonts("Lucida Grande", FontWeight700, FontItalicOff, 100, CFSTR("LucidaGrande-Bold")));
-    EXPECT_TRUE(compareFonts("Lucida Grande", FontWeight700, FontItalicOn , 100, CFSTR("LucidaGrande-Bold")));
-    EXPECT_TRUE(compareFonts("Lucida Grande", FontWeight800, FontItalicOff, 100, CFSTR("LucidaGrande-Bold")));
-    EXPECT_TRUE(compareFonts("Lucida Grande", FontWeight800, FontItalicOn , 100, CFSTR("LucidaGrande-Bold")));
-    EXPECT_TRUE(compareFonts("Lucida Grande", FontWeight900, FontItalicOff, 100, CFSTR("LucidaGrande-Bold")));
-    EXPECT_TRUE(compareFonts("Lucida Grande", FontWeight900, FontItalicOn , 100, CFSTR("LucidaGrande-Bold")));
-    EXPECT_TRUE(compareFonts("Optima", FontWeight100, FontItalicOff, 100, CFSTR("Optima-Regular")));
-    EXPECT_TRUE(compareFonts("Optima", FontWeight100, FontItalicOn , 100, CFSTR("Optima-Italic")));
-    EXPECT_TRUE(compareFonts("Optima", FontWeight200, FontItalicOff, 100, CFSTR("Optima-Regular")));
-    EXPECT_TRUE(compareFonts("Optima", FontWeight200, FontItalicOn , 100, CFSTR("Optima-Italic")));
-    EXPECT_TRUE(compareFonts("Optima", FontWeight300, FontItalicOff, 100, CFSTR("Optima-Regular")));
-    EXPECT_TRUE(compareFonts("Optima", FontWeight300, FontItalicOn , 100, CFSTR("Optima-Italic")));
-    EXPECT_TRUE(compareFonts("Optima", FontWeight400, FontItalicOff, 100, CFSTR("Optima-Regular")));
-    EXPECT_TRUE(compareFonts("Optima", FontWeight400, FontItalicOn , 100, CFSTR("Optima-Italic")));
-    EXPECT_TRUE(compareFonts("Optima", FontWeight500, FontItalicOff, 100, CFSTR("Optima-Regular")));
-    EXPECT_TRUE(compareFonts("Optima", FontWeight500, FontItalicOn , 100, CFSTR("Optima-Italic")));
-    EXPECT_TRUE(compareFonts("Optima", FontWeight600, FontItalicOff, 100, CFSTR("Optima-Bold")));
-    EXPECT_TRUE(compareFonts("Optima", FontWeight600, FontItalicOn , 100, CFSTR("Optima-BoldItalic")));
-    EXPECT_TRUE(compareFonts("Optima", FontWeight700, FontItalicOff, 100, CFSTR("Optima-Bold")));
-    EXPECT_TRUE(compareFonts("Optima", FontWeight700, FontItalicOn , 100, CFSTR("Optima-BoldItalic")));
-    EXPECT_TRUE(compareFonts("Optima", FontWeight800, FontItalicOff, 100, CFSTR("Optima-ExtraBlack")));
-    EXPECT_TRUE(compareFonts("Optima", FontWeight800, FontItalicOn , 100, CFSTR("Optima-BoldItalic")));
-    EXPECT_TRUE(compareFonts("Optima", FontWeight900, FontItalicOff, 100, CFSTR("Optima-ExtraBlack")));
-    EXPECT_TRUE(compareFonts("Optima", FontWeight900, FontItalicOn , 100, CFSTR("Optima-BoldItalic")));
-    EXPECT_TRUE(compareFonts("PingFang HK", FontWeight100, FontItalicOff, 100, CFSTR("PingFangHK-Ultralight")));
-    EXPECT_TRUE(compareFonts("PingFang HK", FontWeight100, FontItalicOn , 100, CFSTR("PingFangHK-Ultralight")));
-    EXPECT_TRUE(compareFonts("PingFang HK", FontWeight200, FontItalicOff, 100, CFSTR("PingFangHK-Thin")));
-    EXPECT_TRUE(compareFonts("PingFang HK", FontWeight200, FontItalicOn , 100, CFSTR("PingFangHK-Thin")));
-    EXPECT_TRUE(compareFonts("PingFang HK", FontWeight300, FontItalicOff, 100, CFSTR("PingFangHK-Light")));
-    EXPECT_TRUE(compareFonts("PingFang HK", FontWeight300, FontItalicOn , 100, CFSTR("PingFangHK-Light")));
-    EXPECT_TRUE(compareFonts("PingFang HK", FontWeight400, FontItalicOff, 100, CFSTR("PingFangHK-Regular")));
-    EXPECT_TRUE(compareFonts("PingFang HK", FontWeight400, FontItalicOn , 100, CFSTR("PingFangHK-Regular")));
-    EXPECT_TRUE(compareFonts("PingFang HK", FontWeight500, FontItalicOff, 100, CFSTR("PingFangHK-Medium")));
-    EXPECT_TRUE(compareFonts("PingFang HK", FontWeight500, FontItalicOn , 100, CFSTR("PingFangHK-Medium")));
-    EXPECT_TRUE(compareFonts("PingFang HK", FontWeight600, FontItalicOff, 100, CFSTR("PingFangHK-Semibold")));
-    EXPECT_TRUE(compareFonts("PingFang HK", FontWeight600, FontItalicOn , 100, CFSTR("PingFangHK-Semibold")));
-    EXPECT_TRUE(compareFonts("PingFang HK", FontWeight700, FontItalicOff, 100, CFSTR("PingFangHK-Semibold")));
-    EXPECT_TRUE(compareFonts("PingFang HK", FontWeight700, FontItalicOn , 100, CFSTR("PingFangHK-Semibold")));
-    EXPECT_TRUE(compareFonts("PingFang HK", FontWeight800, FontItalicOff, 100, CFSTR("PingFangHK-Semibold")));
-    EXPECT_TRUE(compareFonts("PingFang HK", FontWeight800, FontItalicOn , 100, CFSTR("PingFangHK-Semibold")));
-    EXPECT_TRUE(compareFonts("PingFang HK", FontWeight900, FontItalicOff, 100, CFSTR("PingFangHK-Semibold")));
-    EXPECT_TRUE(compareFonts("PingFang HK", FontWeight900, FontItalicOn , 100, CFSTR("PingFangHK-Semibold")));
-    EXPECT_TRUE(compareFonts("PingFang SC", FontWeight100, FontItalicOff, 100, CFSTR("PingFangSC-Ultralight")));
-    EXPECT_TRUE(compareFonts("PingFang SC", FontWeight100, FontItalicOn , 100, CFSTR("PingFangSC-Ultralight")));
-    EXPECT_TRUE(compareFonts("PingFang SC", FontWeight200, FontItalicOff, 100, CFSTR("PingFangSC-Thin")));
-    EXPECT_TRUE(compareFonts("PingFang SC", FontWeight200, FontItalicOn , 100, CFSTR("PingFangSC-Thin")));
-    EXPECT_TRUE(compareFonts("PingFang SC", FontWeight300, FontItalicOff, 100, CFSTR("PingFangSC-Light")));
-    EXPECT_TRUE(compareFonts("PingFang SC", FontWeight300, FontItalicOn , 100, CFSTR("PingFangSC-Light")));
-    EXPECT_TRUE(compareFonts("PingFang SC", FontWeight400, FontItalicOff, 100, CFSTR("PingFangSC-Regular")));
-    EXPECT_TRUE(compareFonts("PingFang SC", FontWeight400, FontItalicOn , 100, CFSTR("PingFangSC-Regular")));
-    EXPECT_TRUE(compareFonts("PingFang SC", FontWeight500, FontItalicOff, 100, CFSTR("PingFangSC-Medium")));
-    EXPECT_TRUE(compareFonts("PingFang SC", FontWeight500, FontItalicOn , 100, CFSTR("PingFangSC-Medium")));
-    EXPECT_TRUE(compareFonts("PingFang SC", FontWeight600, FontItalicOff, 100, CFSTR("PingFangSC-Semibold")));
-    EXPECT_TRUE(compareFonts("PingFang SC", FontWeight600, FontItalicOn , 100, CFSTR("PingFangSC-Semibold")));
-    EXPECT_TRUE(compareFonts("PingFang SC", FontWeight700, FontItalicOff, 100, CFSTR("PingFangSC-Semibold")));
-    EXPECT_TRUE(compareFonts("PingFang SC", FontWeight700, FontItalicOn , 100, CFSTR("PingFangSC-Semibold")));
-    EXPECT_TRUE(compareFonts("PingFang SC", FontWeight800, FontItalicOff, 100, CFSTR("PingFangSC-Semibold")));
-    EXPECT_TRUE(compareFonts("PingFang SC", FontWeight800, FontItalicOn , 100, CFSTR("PingFangSC-Semibold")));
-    EXPECT_TRUE(compareFonts("PingFang SC", FontWeight900, FontItalicOff, 100, CFSTR("PingFangSC-Semibold")));
-    EXPECT_TRUE(compareFonts("PingFang SC", FontWeight900, FontItalicOn , 100, CFSTR("PingFangSC-Semibold")));
-    EXPECT_TRUE(compareFonts("PingFang TC", FontWeight100, FontItalicOff, 100, CFSTR("PingFangTC-Ultralight")));
-    EXPECT_TRUE(compareFonts("PingFang TC", FontWeight100, FontItalicOn , 100, CFSTR("PingFangTC-Ultralight")));
-    EXPECT_TRUE(compareFonts("PingFang TC", FontWeight200, FontItalicOff, 100, CFSTR("PingFangTC-Thin")));
-    EXPECT_TRUE(compareFonts("PingFang TC", FontWeight200, FontItalicOn , 100, CFSTR("PingFangTC-Thin")));
-    EXPECT_TRUE(compareFonts("PingFang TC", FontWeight300, FontItalicOff, 100, CFSTR("PingFangTC-Light")));
-    EXPECT_TRUE(compareFonts("PingFang TC", FontWeight300, FontItalicOn , 100, CFSTR("PingFangTC-Light")));
-    EXPECT_TRUE(compareFonts("PingFang TC", FontWeight400, FontItalicOff, 100, CFSTR("PingFangTC-Regular")));
-    EXPECT_TRUE(compareFonts("PingFang TC", FontWeight400, FontItalicOn , 100, CFSTR("PingFangTC-Regular")));
-    EXPECT_TRUE(compareFonts("PingFang TC", FontWeight500, FontItalicOff, 100, CFSTR("PingFangTC-Medium")));
-    EXPECT_TRUE(compareFonts("PingFang TC", FontWeight500, FontItalicOn , 100, CFSTR("PingFangTC-Medium")));
-    EXPECT_TRUE(compareFonts("PingFang TC", FontWeight600, FontItalicOff, 100, CFSTR("PingFangTC-Semibold")));
-    EXPECT_TRUE(compareFonts("PingFang TC", FontWeight600, FontItalicOn , 100, CFSTR("PingFangTC-Semibold")));
-    EXPECT_TRUE(compareFonts("PingFang TC", FontWeight700, FontItalicOff, 100, CFSTR("PingFangTC-Semibold")));
-    EXPECT_TRUE(compareFonts("PingFang TC", FontWeight700, FontItalicOn , 100, CFSTR("PingFangTC-Semibold")));
-    EXPECT_TRUE(compareFonts("PingFang TC", FontWeight800, FontItalicOff, 100, CFSTR("PingFangTC-Semibold")));
-    EXPECT_TRUE(compareFonts("PingFang TC", FontWeight800, FontItalicOn , 100, CFSTR("PingFangTC-Semibold")));
-    EXPECT_TRUE(compareFonts("PingFang TC", FontWeight900, FontItalicOff, 100, CFSTR("PingFangTC-Semibold")));
-    EXPECT_TRUE(compareFonts("PingFang TC", FontWeight900, FontItalicOn , 100, CFSTR("PingFangTC-Semibold")));
-    EXPECT_TRUE(compareFonts("Times New Roman", FontWeight100, FontItalicOff, 100, CFSTR("TimesNewRomanPSMT")));
-    EXPECT_TRUE(compareFonts("Times New Roman", FontWeight100, FontItalicOn , 100, CFSTR("TimesNewRomanPS-ItalicMT")));
-    EXPECT_TRUE(compareFonts("Times New Roman", FontWeight200, FontItalicOff, 100, CFSTR("TimesNewRomanPSMT")));
-    EXPECT_TRUE(compareFonts("Times New Roman", FontWeight200, FontItalicOn , 100, CFSTR("TimesNewRomanPS-ItalicMT")));
-    EXPECT_TRUE(compareFonts("Times New Roman", FontWeight300, FontItalicOff, 100, CFSTR("TimesNewRomanPSMT")));
-    EXPECT_TRUE(compareFonts("Times New Roman", FontWeight300, FontItalicOn , 100, CFSTR("TimesNewRomanPS-ItalicMT")));
-    EXPECT_TRUE(compareFonts("Times New Roman", FontWeight400, FontItalicOff, 100, CFSTR("TimesNewRomanPSMT")));
-    EXPECT_TRUE(compareFonts("Times New Roman", FontWeight400, FontItalicOn , 100, CFSTR("TimesNewRomanPS-ItalicMT")));
-    EXPECT_TRUE(compareFonts("Times New Roman", FontWeight500, FontItalicOff, 100, CFSTR("TimesNewRomanPSMT")));
-    EXPECT_TRUE(compareFonts("Times New Roman", FontWeight500, FontItalicOn , 100, CFSTR("TimesNewRomanPS-ItalicMT")));
-    EXPECT_TRUE(compareFonts("Times New Roman", FontWeight600, FontItalicOff, 100, CFSTR("TimesNewRomanPS-BoldMT")));
-    EXPECT_TRUE(compareFonts("Times New Roman", FontWeight600, FontItalicOn , 100, CFSTR("TimesNewRomanPS-BoldItalicMT")));
-    EXPECT_TRUE(compareFonts("Times New Roman", FontWeight700, FontItalicOff, 100, CFSTR("TimesNewRomanPS-BoldMT")));
-    EXPECT_TRUE(compareFonts("Times New Roman", FontWeight700, FontItalicOn , 100, CFSTR("TimesNewRomanPS-BoldItalicMT")));
-    EXPECT_TRUE(compareFonts("Times New Roman", FontWeight800, FontItalicOff, 100, CFSTR("TimesNewRomanPS-BoldMT")));
-    EXPECT_TRUE(compareFonts("Times New Roman", FontWeight800, FontItalicOn , 100, CFSTR("TimesNewRomanPS-BoldItalicMT")));
-    EXPECT_TRUE(compareFonts("Times New Roman", FontWeight900, FontItalicOff, 100, CFSTR("TimesNewRomanPS-BoldMT")));
-    EXPECT_TRUE(compareFonts("Times New Roman", FontWeight900, FontItalicOn , 100, CFSTR("TimesNewRomanPS-BoldItalicMT")));
-    EXPECT_TRUE(compareFonts("Times", FontWeight100, FontItalicOff, 100, CFSTR("Times-Roman")));
-    EXPECT_TRUE(compareFonts("Times", FontWeight100, FontItalicOn , 100, CFSTR("Times-Italic")));
-    EXPECT_TRUE(compareFonts("Times", FontWeight200, FontItalicOff, 100, CFSTR("Times-Roman")));
-    EXPECT_TRUE(compareFonts("Times", FontWeight200, FontItalicOn , 100, CFSTR("Times-Italic")));
-    EXPECT_TRUE(compareFonts("Times", FontWeight300, FontItalicOff, 100, CFSTR("Times-Roman")));
-    EXPECT_TRUE(compareFonts("Times", FontWeight300, FontItalicOn , 100, CFSTR("Times-Italic")));
-    EXPECT_TRUE(compareFonts("Times", FontWeight400, FontItalicOff, 100, CFSTR("Times-Roman")));
-    EXPECT_TRUE(compareFonts("Times", FontWeight400, FontItalicOn , 100, CFSTR("Times-Italic")));
-    EXPECT_TRUE(compareFonts("Times", FontWeight500, FontItalicOff, 100, CFSTR("Times-Roman")));
-    EXPECT_TRUE(compareFonts("Times", FontWeight500, FontItalicOn , 100, CFSTR("Times-Italic")));
-    EXPECT_TRUE(compareFonts("Times", FontWeight600, FontItalicOff, 100, CFSTR("Times-Bold")));
-    EXPECT_TRUE(compareFonts("Times", FontWeight600, FontItalicOn , 100, CFSTR("Times-BoldItalic")));
-    EXPECT_TRUE(compareFonts("Times", FontWeight700, FontItalicOff, 100, CFSTR("Times-Bold")));
-    EXPECT_TRUE(compareFonts("Times", FontWeight700, FontItalicOn , 100, CFSTR("Times-BoldItalic")));
-    EXPECT_TRUE(compareFonts("Times", FontWeight800, FontItalicOff, 100, CFSTR("Times-Bold")));
-    EXPECT_TRUE(compareFonts("Times", FontWeight800, FontItalicOn , 100, CFSTR("Times-BoldItalic")));
-    EXPECT_TRUE(compareFonts("Times", FontWeight900, FontItalicOff, 100, CFSTR("Times-Bold")));
-    EXPECT_TRUE(compareFonts("Times", FontWeight900, FontItalicOn , 100, CFSTR("Times-BoldItalic")));
-    EXPECT_TRUE(compareFonts("Helvetica Neue", FontWeight700, FontItalicOff, 87.5, CFSTR("HelveticaNeue-CondensedBold")));
-    EXPECT_TRUE(compareFonts("Helvetica Neue", FontWeight800, FontItalicOff, 87.5, CFSTR("HelveticaNeue-CondensedBlack")));
-    EXPECT_TRUE(compareFonts("Helvetica Neue", FontWeight900, FontItalicOff, 87.5, CFSTR("HelveticaNeue-CondensedBlack")));
-    EXPECT_TRUE(compareFonts("Helvetica Neue", FontWeight700, FontItalicOff, 75, CFSTR("HelveticaNeue-CondensedBold")));
-    EXPECT_TRUE(compareFonts("Helvetica Neue", FontWeight800, FontItalicOff, 75, CFSTR("HelveticaNeue-CondensedBlack")));
-    EXPECT_TRUE(compareFonts("Helvetica Neue", FontWeight900, FontItalicOff, 75, CFSTR("HelveticaNeue-CondensedBlack")));
-    EXPECT_TRUE(compareFonts("Helvetica Neue", FontWeight700, FontItalicOn , 87.5, CFSTR("HelveticaNeue-CondensedBold")));
-    EXPECT_TRUE(compareFonts("Helvetica Neue", FontWeight800, FontItalicOn , 87.5, CFSTR("HelveticaNeue-CondensedBlack")));
-    EXPECT_TRUE(compareFonts("Helvetica Neue", FontWeight900, FontItalicOn , 87.5, CFSTR("HelveticaNeue-CondensedBlack")));
-    EXPECT_TRUE(compareFonts("Helvetica Neue", FontWeight700, FontItalicOn , 75, CFSTR("HelveticaNeue-CondensedBold")));
-    EXPECT_TRUE(compareFonts("Helvetica Neue", FontWeight800, FontItalicOn , 75, CFSTR("HelveticaNeue-CondensedBlack")));
-    EXPECT_TRUE(compareFonts("Helvetica Neue", FontWeight900, FontItalicOn , 75, CFSTR("HelveticaNeue-CondensedBlack")));
-    EXPECT_TRUE(compareFonts("Futura", FontWeight500, FontItalicOff, 87.5, CFSTR("Futura-CondensedMedium")));
-    EXPECT_TRUE(compareFonts("Futura", FontWeight500, FontItalicOn , 87.5, CFSTR("Futura-CondensedMedium")));
-    EXPECT_TRUE(compareFonts("Futura", FontWeight600, FontItalicOff, 87.5, CFSTR("Futura-CondensedExtraBold")));
-    EXPECT_TRUE(compareFonts("Futura", FontWeight600, FontItalicOn , 87.5, CFSTR("Futura-CondensedExtraBold")));
-    EXPECT_TRUE(compareFonts("Futura", FontWeight700, FontItalicOff, 87.5, CFSTR("Futura-CondensedExtraBold")));
-    EXPECT_TRUE(compareFonts("Futura", FontWeight700, FontItalicOn , 87.5, CFSTR("Futura-CondensedExtraBold")));
-    EXPECT_TRUE(compareFonts("Futura", FontWeight800, FontItalicOff, 87.5, CFSTR("Futura-CondensedExtraBold")));
-    EXPECT_TRUE(compareFonts("Futura", FontWeight800, FontItalicOn , 87.5, CFSTR("Futura-CondensedExtraBold")));
-    EXPECT_TRUE(compareFonts("Futura", FontWeight900, FontItalicOff, 87.5, CFSTR("Futura-CondensedExtraBold")));
-    EXPECT_TRUE(compareFonts("Futura", FontWeight900, FontItalicOn , 87.5, CFSTR("Futura-CondensedExtraBold")));
+    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", 100, 0 , 100, CFSTR("AppleSDGothicNeo-Thin")));
+    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", 100, 20, 100, CFSTR("AppleSDGothicNeo-Thin")));
+    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", 200, 0 , 100, CFSTR("AppleSDGothicNeo-UltraLight")));
+    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", 200, 20, 100, CFSTR("AppleSDGothicNeo-UltraLight")));
+    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", 300, 0 , 100, CFSTR("AppleSDGothicNeo-Light")));
+    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", 300, 20, 100, CFSTR("AppleSDGothicNeo-Light")));
+    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", 400, 0 , 100, CFSTR("AppleSDGothicNeo-Regular")));
+    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", 400, 20, 100, CFSTR("AppleSDGothicNeo-Regular")));
+    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", 500, 0 , 100, CFSTR("AppleSDGothicNeo-Medium")));
+    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", 500, 20, 100, CFSTR("AppleSDGothicNeo-Medium")));
+    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", 600, 0 , 100, CFSTR("AppleSDGothicNeo-SemiBold")));
+    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", 600, 20, 100, CFSTR("AppleSDGothicNeo-SemiBold")));
+    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", 700, 0 , 100, CFSTR("AppleSDGothicNeo-Bold")));
+    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", 700, 20, 100, CFSTR("AppleSDGothicNeo-Bold")));
+    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", 800, 0 , 100, CFSTR("AppleSDGothicNeo-ExtraBold")));
+    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", 800, 20, 100, CFSTR("AppleSDGothicNeo-ExtraBold")));
+    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", 900, 0 , 100, CFSTR("AppleSDGothicNeo-Heavy")));
+    EXPECT_TRUE(compareFonts("Apple SD Gothic Neo", 900, 20, 100, CFSTR("AppleSDGothicNeo-Heavy")));
+    EXPECT_TRUE(compareFonts("Arial", 100, 0 , 100, CFSTR("ArialMT")));
+    EXPECT_TRUE(compareFonts("Arial", 100, 20, 100, CFSTR("Arial-ItalicMT")));
+    EXPECT_TRUE(compareFonts("Arial", 200, 0 , 100, CFSTR("ArialMT")));
+    EXPECT_TRUE(compareFonts("Arial", 200, 20, 100, CFSTR("Arial-ItalicMT")));
+    EXPECT_TRUE(compareFonts("Arial", 300, 0 , 100, CFSTR("ArialMT")));
+    EXPECT_TRUE(compareFonts("Arial", 300, 20, 100, CFSTR("Arial-ItalicMT")));
+    EXPECT_TRUE(compareFonts("Arial", 400, 0 , 100, CFSTR("ArialMT")));
+    EXPECT_TRUE(compareFonts("Arial", 400, 20, 100, CFSTR("Arial-ItalicMT")));
+    EXPECT_TRUE(compareFonts("Arial", 500, 0 , 100, CFSTR("ArialMT")));
+    EXPECT_TRUE(compareFonts("Arial", 500, 20, 100, CFSTR("Arial-ItalicMT")));
+    EXPECT_TRUE(compareFonts("Arial", 600, 0 , 100, CFSTR("Arial-BoldMT")));
+    EXPECT_TRUE(compareFonts("Arial", 600, 20, 100, CFSTR("Arial-BoldItalicMT")));
+    EXPECT_TRUE(compareFonts("Arial", 700, 0 , 100, CFSTR("Arial-BoldMT")));
+    EXPECT_TRUE(compareFonts("Arial", 700, 20, 100, CFSTR("Arial-BoldItalicMT")));
+    EXPECT_TRUE(compareFonts("Arial", 800, 0 , 100, CFSTR("Arial-BoldMT")));
+    EXPECT_TRUE(compareFonts("Arial", 800, 20, 100, CFSTR("Arial-BoldItalicMT")));
+    EXPECT_TRUE(compareFonts("Arial", 900, 0 , 100, CFSTR("Arial-BoldMT")));
+    EXPECT_TRUE(compareFonts("Arial", 900, 20, 100, CFSTR("Arial-BoldItalicMT")));
+    EXPECT_TRUE(compareFonts("Avenir Next", 100, 0 , 100, CFSTR("AvenirNext-UltraLight")));
+    EXPECT_TRUE(compareFonts("Avenir Next", 100, 20, 100, CFSTR("AvenirNext-UltraLightItalic")));
+    EXPECT_TRUE(compareFonts("Avenir Next", 200, 0 , 100, CFSTR("AvenirNext-UltraLight")));
+    EXPECT_TRUE(compareFonts("Avenir Next", 200, 20, 100, CFSTR("AvenirNext-UltraLightItalic")));
+    EXPECT_TRUE(compareFonts("Avenir Next", 300, 0 , 100, CFSTR("AvenirNext-UltraLight")));
+    EXPECT_TRUE(compareFonts("Avenir Next", 300, 20, 100, CFSTR("AvenirNext-UltraLightItalic")));
+    EXPECT_TRUE(compareFonts("Avenir Next", 400, 0 , 100, CFSTR("AvenirNext-Regular")));
+    EXPECT_TRUE(compareFonts("Avenir Next", 400, 20, 100, CFSTR("AvenirNext-Italic")));
+    EXPECT_TRUE(compareFonts("Avenir Next", 500, 0 , 100, CFSTR("AvenirNext-Medium")));
+    EXPECT_TRUE(compareFonts("Avenir Next", 500, 20, 100, CFSTR("AvenirNext-MediumItalic")));
+    EXPECT_TRUE(compareFonts("Avenir Next", 600, 0 , 100, CFSTR("AvenirNext-DemiBold")));
+    EXPECT_TRUE(compareFonts("Avenir Next", 600, 20, 100, CFSTR("AvenirNext-DemiBoldItalic")));
+    EXPECT_TRUE(compareFonts("Avenir Next", 700, 0 , 100, CFSTR("AvenirNext-Bold")));
+    EXPECT_TRUE(compareFonts("Avenir Next", 700, 20, 100, CFSTR("AvenirNext-BoldItalic")));
+    EXPECT_TRUE(compareFonts("Avenir Next", 800, 0 , 100, CFSTR("AvenirNext-Heavy")));
+    EXPECT_TRUE(compareFonts("Avenir Next", 800, 20, 100, CFSTR("AvenirNext-HeavyItalic")));
+    EXPECT_TRUE(compareFonts("Avenir Next", 900, 0 , 100, CFSTR("AvenirNext-Heavy")));
+    EXPECT_TRUE(compareFonts("Avenir Next", 900, 20, 100, CFSTR("AvenirNext-HeavyItalic")));
+    EXPECT_TRUE(compareFonts("Avenir", 100, 0 , 100, CFSTR("Avenir-Light")));
+    EXPECT_TRUE(compareFonts("Avenir", 100, 20, 100, CFSTR("Avenir-LightOblique")));
+    EXPECT_TRUE(compareFonts("Avenir", 200, 0 , 100, CFSTR("Avenir-Light")));
+    EXPECT_TRUE(compareFonts("Avenir", 200, 20, 100, CFSTR("Avenir-LightOblique")));
+    EXPECT_TRUE(compareFonts("Avenir", 300, 0 , 100, CFSTR("Avenir-Light")));
+    EXPECT_TRUE(compareFonts("Avenir", 300, 20, 100, CFSTR("Avenir-LightOblique")));
+    EXPECT_TRUE(compareFonts("Avenir", 400, 0 , 100, CFSTR("Avenir-Book")));
+    EXPECT_TRUE(compareFonts("Avenir", 400, 20, 100, CFSTR("Avenir-BookOblique")));
+    EXPECT_TRUE(compareFonts("Avenir", 500, 0 , 100, CFSTR("Avenir-Medium")));
+    EXPECT_TRUE(compareFonts("Avenir", 500, 20, 100, CFSTR("Avenir-MediumOblique")));
+    EXPECT_TRUE(compareFonts("Avenir", 600, 0 , 100, CFSTR("Avenir-Black")));
+    EXPECT_TRUE(compareFonts("Avenir", 600, 20, 100, CFSTR("Avenir-BlackOblique")));
+    EXPECT_TRUE(compareFonts("Avenir", 700, 0 , 100, CFSTR("Avenir-Black")));
+    EXPECT_TRUE(compareFonts("Avenir", 700, 20, 100, CFSTR("Avenir-BlackOblique")));
+    EXPECT_TRUE(compareFonts("Avenir", 800, 0 , 100, CFSTR("Avenir-Black")));
+    EXPECT_TRUE(compareFonts("Avenir", 800, 20, 100, CFSTR("Avenir-BlackOblique")));
+    EXPECT_TRUE(compareFonts("Avenir", 900, 0 , 100, CFSTR("Avenir-Heavy")));
+    EXPECT_TRUE(compareFonts("Avenir", 900, 20, 100, CFSTR("Avenir-HeavyOblique")));
+    EXPECT_TRUE(compareFonts("Baskerville", 100, 0 , 100, CFSTR("Baskerville")));
+    EXPECT_TRUE(compareFonts("Baskerville", 100, 20, 100, CFSTR("Baskerville-Italic")));
+    EXPECT_TRUE(compareFonts("Baskerville", 200, 0 , 100, CFSTR("Baskerville")));
+    EXPECT_TRUE(compareFonts("Baskerville", 200, 20, 100, CFSTR("Baskerville-Italic")));
+    EXPECT_TRUE(compareFonts("Baskerville", 300, 0 , 100, CFSTR("Baskerville")));
+    EXPECT_TRUE(compareFonts("Baskerville", 300, 20, 100, CFSTR("Baskerville-Italic")));
+    EXPECT_TRUE(compareFonts("Baskerville", 400, 0 , 100, CFSTR("Baskerville")));
+    EXPECT_TRUE(compareFonts("Baskerville", 400, 20, 100, CFSTR("Baskerville-Italic")));
+    EXPECT_TRUE(compareFonts("Baskerville", 500, 0 , 100, CFSTR("Baskerville")));
+    EXPECT_TRUE(compareFonts("Baskerville", 500, 20, 100, CFSTR("Baskerville-Italic")));
+    EXPECT_TRUE(compareFonts("Baskerville", 600, 0 , 100, CFSTR("Baskerville-SemiBold")));
+    EXPECT_TRUE(compareFonts("Baskerville", 600, 20, 100, CFSTR("Baskerville-SemiBoldItalic")));
+    EXPECT_TRUE(compareFonts("Baskerville", 700, 0 , 100, CFSTR("Baskerville-Bold")));
+    EXPECT_TRUE(compareFonts("Baskerville", 700, 20, 100, CFSTR("Baskerville-BoldItalic")));
+    EXPECT_TRUE(compareFonts("Baskerville", 800, 0 , 100, CFSTR("Baskerville-Bold")));
+    EXPECT_TRUE(compareFonts("Baskerville", 800, 20, 100, CFSTR("Baskerville-BoldItalic")));
+    EXPECT_TRUE(compareFonts("Baskerville", 900, 0 , 100, CFSTR("Baskerville-Bold")));
+    EXPECT_TRUE(compareFonts("Baskerville", 900, 20, 100, CFSTR("Baskerville-BoldItalic")));
+    EXPECT_TRUE(compareFonts("Didot", 100, 0 , 100, CFSTR("Didot")));
+    EXPECT_TRUE(compareFonts("Didot", 100, 20, 100, CFSTR("Didot-Italic")));
+    EXPECT_TRUE(compareFonts("Didot", 200, 0 , 100, CFSTR("Didot")));
+    EXPECT_TRUE(compareFonts("Didot", 200, 20, 100, CFSTR("Didot-Italic")));
+    EXPECT_TRUE(compareFonts("Didot", 300, 0 , 100, CFSTR("Didot")));
+    EXPECT_TRUE(compareFonts("Didot", 300, 20, 100, CFSTR("Didot-Italic")));
+    EXPECT_TRUE(compareFonts("Didot", 400, 0 , 100, CFSTR("Didot")));
+    EXPECT_TRUE(compareFonts("Didot", 400, 20, 100, CFSTR("Didot-Italic")));
+    EXPECT_TRUE(compareFonts("Didot", 500, 0 , 100, CFSTR("Didot")));
+    EXPECT_TRUE(compareFonts("Didot", 500, 20, 100, CFSTR("Didot-Italic")));
+    EXPECT_TRUE(compareFonts("Didot", 600, 0 , 100, CFSTR("Didot-Bold")));
+    EXPECT_TRUE(compareFonts("Didot", 600, 20, 100, CFSTR("Didot-Italic")));
+    EXPECT_TRUE(compareFonts("Didot", 700, 0 , 100, CFSTR("Didot-Bold")));
+    EXPECT_TRUE(compareFonts("Didot", 700, 20, 100, CFSTR("Didot-Italic")));
+    EXPECT_TRUE(compareFonts("Didot", 800, 0 , 100, CFSTR("Didot-Bold")));
+    EXPECT_TRUE(compareFonts("Didot", 800, 20, 100, CFSTR("Didot-Italic")));
+    EXPECT_TRUE(compareFonts("Didot", 900, 0 , 100, CFSTR("Didot-Bold")));
+    EXPECT_TRUE(compareFonts("Didot", 900, 20, 100, CFSTR("Didot-Italic")));
+    EXPECT_TRUE(compareFonts("Futura", 100, 0 , 100, CFSTR("Futura-Medium")));
+    EXPECT_TRUE(compareFonts("Futura", 100, 20, 100, CFSTR("Futura-MediumItalic")));
+    EXPECT_TRUE(compareFonts("Futura", 200, 0 , 100, CFSTR("Futura-Medium")));
+    EXPECT_TRUE(compareFonts("Futura", 200, 20, 100, CFSTR("Futura-MediumItalic")));
+    EXPECT_TRUE(compareFonts("Futura", 300, 0 , 100, CFSTR("Futura-Medium")));
+    EXPECT_TRUE(compareFonts("Futura", 300, 20, 100, CFSTR("Futura-MediumItalic")));
+    EXPECT_TRUE(compareFonts("Futura", 400, 0 , 100, CFSTR("Futura-Medium")));
+    EXPECT_TRUE(compareFonts("Futura", 400, 20, 100, CFSTR("Futura-MediumItalic")));
+    EXPECT_TRUE(compareFonts("Futura", 500, 0 , 100, CFSTR("Futura-Medium")));
+    EXPECT_TRUE(compareFonts("Futura", 500, 20, 100, CFSTR("Futura-MediumItalic")));
+    EXPECT_TRUE(compareFonts("Futura", 600, 0 , 100, CFSTR("Futura-Bold")));
+    EXPECT_TRUE(compareFonts("Futura", 600, 20, 100, CFSTR("Futura-MediumItalic")));
+    EXPECT_TRUE(compareFonts("Futura", 700, 0 , 100, CFSTR("Futura-Bold")));
+    EXPECT_TRUE(compareFonts("Futura", 700, 20, 100, CFSTR("Futura-MediumItalic")));
+    EXPECT_TRUE(compareFonts("Futura", 800, 0 , 100, CFSTR("Futura-Bold")));
+    EXPECT_TRUE(compareFonts("Futura", 800, 20, 100, CFSTR("Futura-MediumItalic")));
+    EXPECT_TRUE(compareFonts("Futura", 900, 0 , 100, CFSTR("Futura-Bold")));
+    EXPECT_TRUE(compareFonts("Futura", 900, 20, 100, CFSTR("Futura-MediumItalic")));
+    EXPECT_TRUE(compareFonts("Helvetica Neue", 100, 0 , 100, CFSTR("HelveticaNeue-UltraLight")));
+    EXPECT_TRUE(compareFonts("Helvetica Neue", 100, 20, 100, CFSTR("HelveticaNeue-UltraLightItalic")));
+    EXPECT_TRUE(compareFonts("Helvetica Neue", 200, 0 , 100, CFSTR("HelveticaNeue-Thin")));
+    EXPECT_TRUE(compareFonts("Helvetica Neue", 200, 20, 100, CFSTR("HelveticaNeue-ThinItalic")));
+    EXPECT_TRUE(compareFonts("Helvetica Neue", 300, 0 , 100, CFSTR("HelveticaNeue-Light")));
+    EXPECT_TRUE(compareFonts("Helvetica Neue", 300, 20, 100, CFSTR("HelveticaNeue-LightItalic")));
+    EXPECT_TRUE(compareFonts("Helvetica Neue", 400, 0 , 100, CFSTR("HelveticaNeue")));
+    EXPECT_TRUE(compareFonts("Helvetica Neue", 400, 20, 100, CFSTR("HelveticaNeue-Italic")));
+    EXPECT_TRUE(compareFonts("Helvetica Neue", 500, 0 , 100, CFSTR("HelveticaNeue-Medium")));
+    EXPECT_TRUE(compareFonts("Helvetica Neue", 500, 20, 100, CFSTR("HelveticaNeue-MediumItalic")));
+    EXPECT_TRUE(compareFonts("Helvetica Neue", 600, 0 , 100, CFSTR("HelveticaNeue-Bold")));
+    EXPECT_TRUE(compareFonts("Helvetica Neue", 600, 20, 100, CFSTR("HelveticaNeue-BoldItalic")));
+    EXPECT_TRUE(compareFonts("Helvetica Neue", 700, 0 , 100, CFSTR("HelveticaNeue-Bold")));
+    EXPECT_TRUE(compareFonts("Helvetica Neue", 700, 20, 100, CFSTR("HelveticaNeue-BoldItalic")));
+    EXPECT_TRUE(compareFonts("Helvetica Neue", 800, 0 , 100, CFSTR("HelveticaNeue-Bold")));
+    EXPECT_TRUE(compareFonts("Helvetica Neue", 800, 20, 100, CFSTR("HelveticaNeue-BoldItalic")));
+    EXPECT_TRUE(compareFonts("Helvetica Neue", 900, 0 , 100, CFSTR("HelveticaNeue-Bold")));
+    EXPECT_TRUE(compareFonts("Helvetica Neue", 900, 20, 100, CFSTR("HelveticaNeue-BoldItalic")));
+    EXPECT_TRUE(compareFonts("Helvetica", 100, 0 , 100, CFSTR("Helvetica-Light")));
+    EXPECT_TRUE(compareFonts("Helvetica", 100, 20, 100, CFSTR("Helvetica-LightOblique")));
+    EXPECT_TRUE(compareFonts("Helvetica", 200, 0 , 100, CFSTR("Helvetica-Light")));
+    EXPECT_TRUE(compareFonts("Helvetica", 200, 20, 100, CFSTR("Helvetica-LightOblique")));
+    EXPECT_TRUE(compareFonts("Helvetica", 300, 0 , 100, CFSTR("Helvetica-Light")));
+    EXPECT_TRUE(compareFonts("Helvetica", 300, 20, 100, CFSTR("Helvetica-LightOblique")));
+    EXPECT_TRUE(compareFonts("Helvetica", 400, 0 , 100, CFSTR("Helvetica")));
+    EXPECT_TRUE(compareFonts("Helvetica", 400, 20, 100, CFSTR("Helvetica-Oblique")));
+    EXPECT_TRUE(compareFonts("Helvetica", 500, 0 , 100, CFSTR("Helvetica")));
+    EXPECT_TRUE(compareFonts("Helvetica", 500, 20, 100, CFSTR("Helvetica-Oblique")));
+    EXPECT_TRUE(compareFonts("Helvetica", 600, 0 , 100, CFSTR("Helvetica-Bold")));
+    EXPECT_TRUE(compareFonts("Helvetica", 600, 20, 100, CFSTR("Helvetica-BoldOblique")));
+    EXPECT_TRUE(compareFonts("Helvetica", 700, 0 , 100, CFSTR("Helvetica-Bold")));
+    EXPECT_TRUE(compareFonts("Helvetica", 700, 20, 100, CFSTR("Helvetica-BoldOblique")));
+    EXPECT_TRUE(compareFonts("Helvetica", 800, 0 , 100, CFSTR("Helvetica-Bold")));
+    EXPECT_TRUE(compareFonts("Helvetica", 800, 20, 100, CFSTR("Helvetica-BoldOblique")));
+    EXPECT_TRUE(compareFonts("Helvetica", 900, 0 , 100, CFSTR("Helvetica-Bold")));
+    EXPECT_TRUE(compareFonts("Helvetica", 900, 20, 100, CFSTR("Helvetica-BoldOblique")));
+    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", 100, 0 , 100, CFSTR("HiraKakuStdN-W8")));
+    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", 100, 20, 100, CFSTR("HiraKakuStdN-W8")));
+    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", 200, 0 , 100, CFSTR("HiraKakuStdN-W8")));
+    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", 200, 20, 100, CFSTR("HiraKakuStdN-W8")));
+    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", 300, 0 , 100, CFSTR("HiraKakuStdN-W8")));
+    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", 300, 20, 100, CFSTR("HiraKakuStdN-W8")));
+    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", 400, 0 , 100, CFSTR("HiraKakuStdN-W8")));
+    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", 400, 20, 100, CFSTR("HiraKakuStdN-W8")));
+    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", 500, 0 , 100, CFSTR("HiraKakuStdN-W8")));
+    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", 500, 20, 100, CFSTR("HiraKakuStdN-W8")));
+    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", 600, 0 , 100, CFSTR("HiraKakuStdN-W8")));
+    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", 600, 20, 100, CFSTR("HiraKakuStdN-W8")));
+    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", 700, 0 , 100, CFSTR("HiraKakuStdN-W8")));
+    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", 700, 20, 100, CFSTR("HiraKakuStdN-W8")));
+    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", 800, 0 , 100, CFSTR("HiraKakuStdN-W8")));
+    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", 800, 20, 100, CFSTR("HiraKakuStdN-W8")));
+    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", 900, 0 , 100, CFSTR("HiraKakuStdN-W8")));
+    EXPECT_TRUE(compareFonts("Hiragino Kaku Gothic StdN", 900, 20, 100, CFSTR("HiraKakuStdN-W8")));
+    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", 100, 0 , 100, CFSTR("HiraMaruProN-W4")));
+    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", 100, 20, 100, CFSTR("HiraMaruProN-W4")));
+    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", 200, 0 , 100, CFSTR("HiraMaruProN-W4")));
+    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", 200, 20, 100, CFSTR("HiraMaruProN-W4")));
+    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", 300, 0 , 100, CFSTR("HiraMaruProN-W4")));
+    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", 300, 20, 100, CFSTR("HiraMaruProN-W4")));
+    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", 400, 0 , 100, CFSTR("HiraMaruProN-W4")));
+    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", 400, 20, 100, CFSTR("HiraMaruProN-W4")));
+    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", 500, 0 , 100, CFSTR("HiraMaruProN-W4")));
+    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", 500, 20, 100, CFSTR("HiraMaruProN-W4")));
+    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", 600, 0 , 100, CFSTR("HiraMaruProN-W4")));
+    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", 600, 20, 100, CFSTR("HiraMaruProN-W4")));
+    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", 700, 0 , 100, CFSTR("HiraMaruProN-W4")));
+    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", 700, 20, 100, CFSTR("HiraMaruProN-W4")));
+    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", 800, 0 , 100, CFSTR("HiraMaruProN-W4")));
+    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", 800, 20, 100, CFSTR("HiraMaruProN-W4")));
+    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", 900, 0 , 100, CFSTR("HiraMaruProN-W4")));
+    EXPECT_TRUE(compareFonts("Hiragino Maru Gothic ProN", 900, 20, 100, CFSTR("HiraMaruProN-W4")));
+    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", 100, 0 , 100, CFSTR("HiraMinProN-W3")));
+    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", 100, 20, 100, CFSTR("HiraMinProN-W3")));
+    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", 200, 0 , 100, CFSTR("HiraMinProN-W3")));
+    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", 200, 20, 100, CFSTR("HiraMinProN-W3")));
+    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", 300, 0 , 100, CFSTR("HiraMinProN-W3")));
+    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", 300, 20, 100, CFSTR("HiraMinProN-W3")));
+    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", 400, 0 , 100, CFSTR("HiraMinProN-W3")));
+    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", 400, 20, 100, CFSTR("HiraMinProN-W3")));
+    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", 500, 0 , 100, CFSTR("HiraMinProN-W3")));
+    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", 500, 20, 100, CFSTR("HiraMinProN-W3")));
+    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", 600, 0 , 100, CFSTR("HiraMinProN-W6")));
+    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", 600, 20, 100, CFSTR("HiraMinProN-W6")));
+    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", 700, 0 , 100, CFSTR("HiraMinProN-W6")));
+    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", 700, 20, 100, CFSTR("HiraMinProN-W6")));
+    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", 800, 0 , 100, CFSTR("HiraMinProN-W6")));
+    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", 800, 20, 100, CFSTR("HiraMinProN-W6")));
+    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", 900, 0 , 100, CFSTR("HiraMinProN-W6")));
+    EXPECT_TRUE(compareFonts("Hiragino Mincho ProN", 900, 20, 100, CFSTR("HiraMinProN-W6")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans GB", 100, 0 , 100, CFSTR("HiraginoSansGB-W3")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans GB", 100, 20, 100, CFSTR("HiraginoSansGB-W3")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans GB", 200, 0 , 100, CFSTR("HiraginoSansGB-W3")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans GB", 200, 20, 100, CFSTR("HiraginoSansGB-W3")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans GB", 300, 0 , 100, CFSTR("HiraginoSansGB-W3")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans GB", 300, 20, 100, CFSTR("HiraginoSansGB-W3")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans GB", 400, 0 , 100, CFSTR("HiraginoSansGB-W3")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans GB", 400, 20, 100, CFSTR("HiraginoSansGB-W3")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans GB", 500, 0 , 100, CFSTR("HiraginoSansGB-W3")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans GB", 500, 20, 100, CFSTR("HiraginoSansGB-W3")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans GB", 600, 0 , 100, CFSTR("HiraginoSansGB-W6")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans GB", 600, 20, 100, CFSTR("HiraginoSansGB-W6")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans GB", 700, 0 , 100, CFSTR("HiraginoSansGB-W6")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans GB", 700, 20, 100, CFSTR("HiraginoSansGB-W6")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans GB", 800, 0 , 100, CFSTR("HiraginoSansGB-W6")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans GB", 800, 20, 100, CFSTR("HiraginoSansGB-W6")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans GB", 900, 0 , 100, CFSTR("HiraginoSansGB-W6")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans GB", 900, 20, 100, CFSTR("HiraginoSansGB-W6")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans", 100, 0 , 100, CFSTR("HiraginoSans-W0")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans", 100, 20, 100, CFSTR("HiraginoSans-W0")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans", 200, 0 , 100, CFSTR("HiraginoSans-W1")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans", 200, 20, 100, CFSTR("HiraginoSans-W1")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans", 300, 0 , 100, CFSTR("HiraginoSans-W3")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans", 300, 20, 100, CFSTR("HiraginoSans-W3")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans", 400, 0 , 100, CFSTR("HiraginoSans-W4")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans", 400, 20, 100, CFSTR("HiraginoSans-W4")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans", 500, 0 , 100, CFSTR("HiraginoSans-W5")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans", 500, 20, 100, CFSTR("HiraginoSans-W5")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans", 600, 0 , 100, CFSTR("HiraginoSans-W6")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans", 600, 20, 100, CFSTR("HiraginoSans-W6")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans", 700, 0 , 100, CFSTR("HiraginoSans-W7")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans", 700, 20, 100, CFSTR("HiraginoSans-W7")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans", 800, 0 , 100, CFSTR("HiraginoSans-W8")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans", 800, 20, 100, CFSTR("HiraginoSans-W8")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans", 900, 0 , 100, CFSTR("HiraginoSans-W9")));
+    EXPECT_TRUE(compareFonts("Hiragino Sans", 900, 20, 100, CFSTR("HiraginoSans-W9")));
+    EXPECT_TRUE(compareFonts("Hoefler Text", 100, 0 , 100, CFSTR("HoeflerText-Regular")));
+    EXPECT_TRUE(compareFonts("Hoefler Text", 100, 20, 100, CFSTR("HoeflerText-Italic")));
+    EXPECT_TRUE(compareFonts("Hoefler Text", 200, 0 , 100, CFSTR("HoeflerText-Regular")));
+    EXPECT_TRUE(compareFonts("Hoefler Text", 200, 20, 100, CFSTR("HoeflerText-Italic")));
+    EXPECT_TRUE(compareFonts("Hoefler Text", 300, 0 , 100, CFSTR("HoeflerText-Regular")));
+    EXPECT_TRUE(compareFonts("Hoefler Text", 300, 20, 100, CFSTR("HoeflerText-Italic")));
+    EXPECT_TRUE(compareFonts("Hoefler Text", 400, 0 , 100, CFSTR("HoeflerText-Regular")));
+    EXPECT_TRUE(compareFonts("Hoefler Text", 400, 20, 100, CFSTR("HoeflerText-Italic")));
+    EXPECT_TRUE(compareFonts("Hoefler Text", 500, 0 , 100, CFSTR("HoeflerText-Regular")));
+    EXPECT_TRUE(compareFonts("Hoefler Text", 500, 20, 100, CFSTR("HoeflerText-Italic")));
+    EXPECT_TRUE(compareFonts("Hoefler Text", 600, 0 , 100, CFSTR("HoeflerText-Black")));
+    EXPECT_TRUE(compareFonts("Hoefler Text", 600, 20, 100, CFSTR("HoeflerText-BlackItalic")));
+    EXPECT_TRUE(compareFonts("Hoefler Text", 700, 0 , 100, CFSTR("HoeflerText-Black")));
+    EXPECT_TRUE(compareFonts("Hoefler Text", 700, 20, 100, CFSTR("HoeflerText-BlackItalic")));
+    EXPECT_TRUE(compareFonts("Hoefler Text", 800, 0 , 100, CFSTR("HoeflerText-Black")));
+    EXPECT_TRUE(compareFonts("Hoefler Text", 800, 20, 100, CFSTR("HoeflerText-BlackItalic")));
+    EXPECT_TRUE(compareFonts("Hoefler Text", 900, 0 , 100, CFSTR("HoeflerText-Black")));
+    EXPECT_TRUE(compareFonts("Hoefler Text", 900, 20, 100, CFSTR("HoeflerText-BlackItalic")));
+    EXPECT_TRUE(compareFonts("Lucida Grande", 100, 0 , 100, CFSTR("LucidaGrande")));
+    EXPECT_TRUE(compareFonts("Lucida Grande", 100, 20, 100, CFSTR("LucidaGrande")));
+    EXPECT_TRUE(compareFonts("Lucida Grande", 200, 0 , 100, CFSTR("LucidaGrande")));
+    EXPECT_TRUE(compareFonts("Lucida Grande", 200, 20, 100, CFSTR("LucidaGrande")));
+    EXPECT_TRUE(compareFonts("Lucida Grande", 300, 0 , 100, CFSTR("LucidaGrande")));
+    EXPECT_TRUE(compareFonts("Lucida Grande", 300, 20, 100, CFSTR("LucidaGrande")));
+    EXPECT_TRUE(compareFonts("Lucida Grande", 400, 0 , 100, CFSTR("LucidaGrande")));
+    EXPECT_TRUE(compareFonts("Lucida Grande", 400, 20, 100, CFSTR("LucidaGrande")));
+    EXPECT_TRUE(compareFonts("Lucida Grande", 500, 0 , 100, CFSTR("LucidaGrande")));
+    EXPECT_TRUE(compareFonts("Lucida Grande", 500, 20, 100, CFSTR("LucidaGrande")));
+    EXPECT_TRUE(compareFonts("Lucida Grande", 600, 0 , 100, CFSTR("LucidaGrande-Bold")));
+    EXPECT_TRUE(compareFonts("Lucida Grande", 600, 20, 100, CFSTR("LucidaGrande-Bold")));
+    EXPECT_TRUE(compareFonts("Lucida Grande", 700, 0 , 100, CFSTR("LucidaGrande-Bold")));
+    EXPECT_TRUE(compareFonts("Lucida Grande", 700, 20, 100, CFSTR("LucidaGrande-Bold")));
+    EXPECT_TRUE(compareFonts("Lucida Grande", 800, 0 , 100, CFSTR("LucidaGrande-Bold")));
+    EXPECT_TRUE(compareFonts("Lucida Grande", 800, 20, 100, CFSTR("LucidaGrande-Bold")));
+    EXPECT_TRUE(compareFonts("Lucida Grande", 900, 0 , 100, CFSTR("LucidaGrande-Bold")));
+    EXPECT_TRUE(compareFonts("Lucida Grande", 900, 20, 100, CFSTR("LucidaGrande-Bold")));
+    EXPECT_TRUE(compareFonts("Optima", 100, 0 , 100, CFSTR("Optima-Regular")));
+    EXPECT_TRUE(compareFonts("Optima", 100, 20, 100, CFSTR("Optima-Italic")));
+    EXPECT_TRUE(compareFonts("Optima", 200, 0 , 100, CFSTR("Optima-Regular")));
+    EXPECT_TRUE(compareFonts("Optima", 200, 20, 100, CFSTR("Optima-Italic")));
+    EXPECT_TRUE(compareFonts("Optima", 300, 0 , 100, CFSTR("Optima-Regular")));
+    EXPECT_TRUE(compareFonts("Optima", 300, 20, 100, CFSTR("Optima-Italic")));
+    EXPECT_TRUE(compareFonts("Optima", 400, 0 , 100, CFSTR("Optima-Regular")));
+    EXPECT_TRUE(compareFonts("Optima", 400, 20, 100, CFSTR("Optima-Italic")));
+    EXPECT_TRUE(compareFonts("Optima", 500, 0 , 100, CFSTR("Optima-Regular")));
+    EXPECT_TRUE(compareFonts("Optima", 500, 20, 100, CFSTR("Optima-Italic")));
+    EXPECT_TRUE(compareFonts("Optima", 600, 0 , 100, CFSTR("Optima-Bold")));
+    EXPECT_TRUE(compareFonts("Optima", 600, 20, 100, CFSTR("Optima-BoldItalic")));
+    EXPECT_TRUE(compareFonts("Optima", 700, 0 , 100, CFSTR("Optima-Bold")));
+    EXPECT_TRUE(compareFonts("Optima", 700, 20, 100, CFSTR("Optima-BoldItalic")));
+    EXPECT_TRUE(compareFonts("Optima", 800, 0 , 100, CFSTR("Optima-ExtraBlack")));
+    EXPECT_TRUE(compareFonts("Optima", 800, 20, 100, CFSTR("Optima-BoldItalic")));
+    EXPECT_TRUE(compareFonts("Optima", 900, 0 , 100, CFSTR("Optima-ExtraBlack")));
+    EXPECT_TRUE(compareFonts("Optima", 900, 20, 100, CFSTR("Optima-BoldItalic")));
+    EXPECT_TRUE(compareFonts("PingFang HK", 100, 0 , 100, CFSTR("PingFangHK-Ultralight")));
+    EXPECT_TRUE(compareFonts("PingFang HK", 100, 20, 100, CFSTR("PingFangHK-Ultralight")));
+    EXPECT_TRUE(compareFonts("PingFang HK", 200, 0 , 100, CFSTR("PingFangHK-Thin")));
+    EXPECT_TRUE(compareFonts("PingFang HK", 200, 20, 100, CFSTR("PingFangHK-Thin")));
+    EXPECT_TRUE(compareFonts("PingFang HK", 300, 0 , 100, CFSTR("PingFangHK-Light")));
+    EXPECT_TRUE(compareFonts("PingFang HK", 300, 20, 100, CFSTR("PingFangHK-Light")));
+    EXPECT_TRUE(compareFonts("PingFang HK", 400, 0 , 100, CFSTR("PingFangHK-Regular")));
+    EXPECT_TRUE(compareFonts("PingFang HK", 400, 20, 100, CFSTR("PingFangHK-Regular")));
+    EXPECT_TRUE(compareFonts("PingFang HK", 500, 0 , 100, CFSTR("PingFangHK-Medium")));
+    EXPECT_TRUE(compareFonts("PingFang HK", 500, 20, 100, CFSTR("PingFangHK-Medium")));
+    EXPECT_TRUE(compareFonts("PingFang HK", 600, 0 , 100, CFSTR("PingFangHK-Semibold")));
+    EXPECT_TRUE(compareFonts("PingFang HK", 600, 20, 100, CFSTR("PingFangHK-Semibold")));
+    EXPECT_TRUE(compareFonts("PingFang HK", 700, 0 , 100, CFSTR("PingFangHK-Semibold")));
+    EXPECT_TRUE(compareFonts("PingFang HK", 700, 20, 100, CFSTR("PingFangHK-Semibold")));
+    EXPECT_TRUE(compareFonts("PingFang HK", 800, 0 , 100, CFSTR("PingFangHK-Semibold")));
+    EXPECT_TRUE(compareFonts("PingFang HK", 800, 20, 100, CFSTR("PingFangHK-Semibold")));
+    EXPECT_TRUE(compareFonts("PingFang HK", 900, 0 , 100, CFSTR("PingFangHK-Semibold")));
+    EXPECT_TRUE(compareFonts("PingFang HK", 900, 20, 100, CFSTR("PingFangHK-Semibold")));
+    EXPECT_TRUE(compareFonts("PingFang SC", 100, 0 , 100, CFSTR("PingFangSC-Ultralight")));
+    EXPECT_TRUE(compareFonts("PingFang SC", 100, 20, 100, CFSTR("PingFangSC-Ultralight")));
+    EXPECT_TRUE(compareFonts("PingFang SC", 200, 0 , 100, CFSTR("PingFangSC-Thin")));
+    EXPECT_TRUE(compareFonts("PingFang SC", 200, 20, 100, CFSTR("PingFangSC-Thin")));
+    EXPECT_TRUE(compareFonts("PingFang SC", 300, 0 , 100, CFSTR("PingFangSC-Light")));
+    EXPECT_TRUE(compareFonts("PingFang SC", 300, 20, 100, CFSTR("PingFangSC-Light")));
+    EXPECT_TRUE(compareFonts("PingFang SC", 400, 0 , 100, CFSTR("PingFangSC-Regular")));
+    EXPECT_TRUE(compareFonts("PingFang SC", 400, 20, 100, CFSTR("PingFangSC-Regular")));
+    EXPECT_TRUE(compareFonts("PingFang SC", 500, 0 , 100, CFSTR("PingFangSC-Medium")));
+    EXPECT_TRUE(compareFonts("PingFang SC", 500, 20, 100, CFSTR("PingFangSC-Medium")));
+    EXPECT_TRUE(compareFonts("PingFang SC", 600, 0 , 100, CFSTR("PingFangSC-Semibold")));
+    EXPECT_TRUE(compareFonts("PingFang SC", 600, 20, 100, CFSTR("PingFangSC-Semibold")));
+    EXPECT_TRUE(compareFonts("PingFang SC", 700, 0 , 100, CFSTR("PingFangSC-Semibold")));
+    EXPECT_TRUE(compareFonts("PingFang SC", 700, 20, 100, CFSTR("PingFangSC-Semibold")));
+    EXPECT_TRUE(compareFonts("PingFang SC", 800, 0 , 100, CFSTR("PingFangSC-Semibold")));
+    EXPECT_TRUE(compareFonts("PingFang SC", 800, 20, 100, CFSTR("PingFangSC-Semibold")));
+    EXPECT_TRUE(compareFonts("PingFang SC", 900, 0 , 100, CFSTR("PingFangSC-Semibold")));
+    EXPECT_TRUE(compareFonts("PingFang SC", 900, 20, 100, CFSTR("PingFangSC-Semibold")));
+    EXPECT_TRUE(compareFonts("PingFang TC", 100, 0 , 100, CFSTR("PingFangTC-Ultralight")));
+    EXPECT_TRUE(compareFonts("PingFang TC", 100, 20, 100, CFSTR("PingFangTC-Ultralight")));
+    EXPECT_TRUE(compareFonts("PingFang TC", 200, 0 , 100, CFSTR("PingFangTC-Thin")));
+    EXPECT_TRUE(compareFonts("PingFang TC", 200, 20, 100, CFSTR("PingFangTC-Thin")));
+    EXPECT_TRUE(compareFonts("PingFang TC", 300, 0 , 100, CFSTR("PingFangTC-Light")));
+    EXPECT_TRUE(compareFonts("PingFang TC", 300, 20, 100, CFSTR("PingFangTC-Light")));
+    EXPECT_TRUE(compareFonts("PingFang TC", 400, 0 , 100, CFSTR("PingFangTC-Regular")));
+    EXPECT_TRUE(compareFonts("PingFang TC", 400, 20, 100, CFSTR("PingFangTC-Regular")));
+    EXPECT_TRUE(compareFonts("PingFang TC", 500, 0 , 100, CFSTR("PingFangTC-Medium")));
+    EXPECT_TRUE(compareFonts("PingFang TC", 500, 20, 100, CFSTR("PingFangTC-Medium")));
+    EXPECT_TRUE(compareFonts("PingFang TC", 600, 0 , 100, CFSTR("PingFangTC-Semibold")));
+    EXPECT_TRUE(compareFonts("PingFang TC", 600, 20, 100, CFSTR("PingFangTC-Semibold")));
+    EXPECT_TRUE(compareFonts("PingFang TC", 700, 0 , 100, CFSTR("PingFangTC-Semibold")));
+    EXPECT_TRUE(compareFonts("PingFang TC", 700, 20, 100, CFSTR("PingFangTC-Semibold")));
+    EXPECT_TRUE(compareFonts("PingFang TC", 800, 0 , 100, CFSTR("PingFangTC-Semibold")));
+    EXPECT_TRUE(compareFonts("PingFang TC", 800, 20, 100, CFSTR("PingFangTC-Semibold")));
+    EXPECT_TRUE(compareFonts("PingFang TC", 900, 0 , 100, CFSTR("PingFangTC-Semibold")));
+    EXPECT_TRUE(compareFonts("PingFang TC", 900, 20, 100, CFSTR("PingFangTC-Semibold")));
+    EXPECT_TRUE(compareFonts("Times New Roman", 100, 0 , 100, CFSTR("TimesNewRomanPSMT")));
+    EXPECT_TRUE(compareFonts("Times New Roman", 100, 20, 100, CFSTR("TimesNewRomanPS-ItalicMT")));
+    EXPECT_TRUE(compareFonts("Times New Roman", 200, 0 , 100, CFSTR("TimesNewRomanPSMT")));
+    EXPECT_TRUE(compareFonts("Times New Roman", 200, 20, 100, CFSTR("TimesNewRomanPS-ItalicMT")));
+    EXPECT_TRUE(compareFonts("Times New Roman", 300, 0 , 100, CFSTR("TimesNewRomanPSMT")));
+    EXPECT_TRUE(compareFonts("Times New Roman", 300, 20, 100, CFSTR("TimesNewRomanPS-ItalicMT")));
+    EXPECT_TRUE(compareFonts("Times New Roman", 400, 0 , 100, CFSTR("TimesNewRomanPSMT")));
+    EXPECT_TRUE(compareFonts("Times New Roman", 400, 20, 100, CFSTR("TimesNewRomanPS-ItalicMT")));
+    EXPECT_TRUE(compareFonts("Times New Roman", 500, 0 , 100, CFSTR("TimesNewRomanPSMT")));
+    EXPECT_TRUE(compareFonts("Times New Roman", 500, 20, 100, CFSTR("TimesNewRomanPS-ItalicMT")));
+    EXPECT_TRUE(compareFonts("Times New Roman", 600, 0 , 100, CFSTR("TimesNewRomanPS-BoldMT")));
+    EXPECT_TRUE(compareFonts("Times New Roman", 600, 20, 100, CFSTR("TimesNewRomanPS-BoldItalicMT")));
+    EXPECT_TRUE(compareFonts("Times New Roman", 700, 0 , 100, CFSTR("TimesNewRomanPS-BoldMT")));
+    EXPECT_TRUE(compareFonts("Times New Roman", 700, 20, 100, CFSTR("TimesNewRomanPS-BoldItalicMT")));
+    EXPECT_TRUE(compareFonts("Times New Roman", 800, 0 , 100, CFSTR("TimesNewRomanPS-BoldMT")));
+    EXPECT_TRUE(compareFonts("Times New Roman", 800, 20, 100, CFSTR("TimesNewRomanPS-BoldItalicMT")));
+    EXPECT_TRUE(compareFonts("Times New Roman", 900, 0 , 100, CFSTR("TimesNewRomanPS-BoldMT")));
+    EXPECT_TRUE(compareFonts("Times New Roman", 900, 20, 100, CFSTR("TimesNewRomanPS-BoldItalicMT")));
+    EXPECT_TRUE(compareFonts("Times", 100, 0 , 100, CFSTR("Times-Roman")));
+    EXPECT_TRUE(compareFonts("Times", 100, 20, 100, CFSTR("Times-Italic")));
+    EXPECT_TRUE(compareFonts("Times", 200, 0 , 100, CFSTR("Times-Roman")));
+    EXPECT_TRUE(compareFonts("Times", 200, 20, 100, CFSTR("Times-Italic")));
+    EXPECT_TRUE(compareFonts("Times", 300, 0 , 100, CFSTR("Times-Roman")));
+    EXPECT_TRUE(compareFonts("Times", 300, 20, 100, CFSTR("Times-Italic")));
+    EXPECT_TRUE(compareFonts("Times", 400, 0 , 100, CFSTR("Times-Roman")));
+    EXPECT_TRUE(compareFonts("Times", 400, 20, 100, CFSTR("Times-Italic")));
+    EXPECT_TRUE(compareFonts("Times", 500, 0 , 100, CFSTR("Times-Roman")));
+    EXPECT_TRUE(compareFonts("Times", 500, 20, 100, CFSTR("Times-Italic")));
+    EXPECT_TRUE(compareFonts("Times", 600, 0 , 100, CFSTR("Times-Bold")));
+    EXPECT_TRUE(compareFonts("Times", 600, 20, 100, CFSTR("Times-BoldItalic")));
+    EXPECT_TRUE(compareFonts("Times", 700, 0 , 100, CFSTR("Times-Bold")));
+    EXPECT_TRUE(compareFonts("Times", 700, 20, 100, CFSTR("Times-BoldItalic")));
+    EXPECT_TRUE(compareFonts("Times", 800, 0 , 100, CFSTR("Times-Bold")));
+    EXPECT_TRUE(compareFonts("Times", 800, 20, 100, CFSTR("Times-BoldItalic")));
+    EXPECT_TRUE(compareFonts("Times", 900, 0 , 100, CFSTR("Times-Bold")));
+    EXPECT_TRUE(compareFonts("Times", 900, 20, 100, CFSTR("Times-BoldItalic")));
+    EXPECT_TRUE(compareFonts("Helvetica Neue", 700, 0 , 87.5, CFSTR("HelveticaNeue-CondensedBold")));
+    EXPECT_TRUE(compareFonts("Helvetica Neue", 800, 0 , 87.5, CFSTR("HelveticaNeue-CondensedBlack")));
+    EXPECT_TRUE(compareFonts("Helvetica Neue", 900, 0 , 87.5, CFSTR("HelveticaNeue-CondensedBlack")));
+    EXPECT_TRUE(compareFonts("Helvetica Neue", 700, 0 , 75, CFSTR("HelveticaNeue-CondensedBold")));
+    EXPECT_TRUE(compareFonts("Helvetica Neue", 800, 0 , 75, CFSTR("HelveticaNeue-CondensedBlack")));
+    EXPECT_TRUE(compareFonts("Helvetica Neue", 900, 0 , 75, CFSTR("HelveticaNeue-CondensedBlack")));
+    EXPECT_TRUE(compareFonts("Helvetica Neue", 700, 20, 87.5, CFSTR("HelveticaNeue-CondensedBold")));
+    EXPECT_TRUE(compareFonts("Helvetica Neue", 800, 20, 87.5, CFSTR("HelveticaNeue-CondensedBlack")));
+    EXPECT_TRUE(compareFonts("Helvetica Neue", 900, 20, 87.5, CFSTR("HelveticaNeue-CondensedBlack")));
+    EXPECT_TRUE(compareFonts("Helvetica Neue", 700, 20, 75, CFSTR("HelveticaNeue-CondensedBold")));
+    EXPECT_TRUE(compareFonts("Helvetica Neue", 800, 20, 75, CFSTR("HelveticaNeue-CondensedBlack")));
+    EXPECT_TRUE(compareFonts("Helvetica Neue", 900, 20, 75, CFSTR("HelveticaNeue-CondensedBlack")));
+    EXPECT_TRUE(compareFonts("Futura", 500, 0 , 87.5, CFSTR("Futura-CondensedMedium")));
+    EXPECT_TRUE(compareFonts("Futura", 500, 20, 87.5, CFSTR("Futura-CondensedMedium")));
+    EXPECT_TRUE(compareFonts("Futura", 600, 0 , 87.5, CFSTR("Futura-CondensedExtraBold")));
+    EXPECT_TRUE(compareFonts("Futura", 600, 20, 87.5, CFSTR("Futura-CondensedExtraBold")));
+    EXPECT_TRUE(compareFonts("Futura", 700, 0 , 87.5, CFSTR("Futura-CondensedExtraBold")));
+    EXPECT_TRUE(compareFonts("Futura", 700, 20, 87.5, CFSTR("Futura-CondensedExtraBold")));
+    EXPECT_TRUE(compareFonts("Futura", 800, 0 , 87.5, CFSTR("Futura-CondensedExtraBold")));
+    EXPECT_TRUE(compareFonts("Futura", 800, 20, 87.5, CFSTR("Futura-CondensedExtraBold")));
+    EXPECT_TRUE(compareFonts("Futura", 900, 0 , 87.5, CFSTR("Futura-CondensedExtraBold")));
+    EXPECT_TRUE(compareFonts("Futura", 900, 20, 87.5, CFSTR("Futura-CondensedExtraBold")));
 }
 
 TEST_F(FontCacheTest, FontLookupFromPostScriptName)
 {
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Bold", FontWeight100, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Bold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Bold", FontWeight100, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Thin")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Bold", FontWeight200, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Bold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Bold", FontWeight200, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-UltraLight")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Bold", FontWeight300, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Bold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Bold", FontWeight300, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Light")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Bold", FontWeight400, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Bold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Bold", FontWeight400, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Regular")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Bold", FontWeight500, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Bold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Bold", FontWeight500, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Medium")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Bold", FontWeight600, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Bold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Bold", FontWeight600, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-SemiBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Bold", FontWeight700, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Bold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Bold", FontWeight700, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Bold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Bold", FontWeight800, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Bold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Bold", FontWeight800, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-ExtraBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Bold", FontWeight900, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Bold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Bold", FontWeight900, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Heavy")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-ExtraBold", FontWeight100, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-ExtraBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-ExtraBold", FontWeight100, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Thin")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-ExtraBold", FontWeight200, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-ExtraBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-ExtraBold", FontWeight200, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-UltraLight")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-ExtraBold", FontWeight300, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-ExtraBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-ExtraBold", FontWeight300, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Light")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-ExtraBold", FontWeight400, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-ExtraBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-ExtraBold", FontWeight400, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Regular")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-ExtraBold", FontWeight500, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-ExtraBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-ExtraBold", FontWeight500, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Medium")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-ExtraBold", FontWeight600, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-ExtraBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-ExtraBold", FontWeight600, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-SemiBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-ExtraBold", FontWeight700, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-ExtraBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-ExtraBold", FontWeight700, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Bold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-ExtraBold", FontWeight800, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-ExtraBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-ExtraBold", FontWeight800, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-ExtraBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-ExtraBold", FontWeight900, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-ExtraBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-ExtraBold", FontWeight900, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Heavy")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Heavy", FontWeight100, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Heavy")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Heavy", FontWeight100, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Thin")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Heavy", FontWeight200, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Heavy")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Heavy", FontWeight200, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-UltraLight")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Heavy", FontWeight300, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Heavy")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Heavy", FontWeight300, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Light")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Heavy", FontWeight400, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Heavy")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Heavy", FontWeight400, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Regular")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Heavy", FontWeight500, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Heavy")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Heavy", FontWeight500, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Medium")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Heavy", FontWeight600, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Heavy")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Heavy", FontWeight600, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-SemiBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Heavy", FontWeight700, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Heavy")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Heavy", FontWeight700, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Bold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Heavy", FontWeight800, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Heavy")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Heavy", FontWeight800, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-ExtraBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Heavy", FontWeight900, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Heavy")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Heavy", FontWeight900, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Heavy")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Light", FontWeight100, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Light")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Light", FontWeight100, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Thin")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Light", FontWeight200, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Light")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Light", FontWeight200, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-UltraLight")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Light", FontWeight300, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Light")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Light", FontWeight300, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Light")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Light", FontWeight400, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Light")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Light", FontWeight400, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Regular")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Light", FontWeight500, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Light")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Light", FontWeight500, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Medium")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Light", FontWeight600, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-SemiBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Light", FontWeight600, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-SemiBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Light", FontWeight700, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Bold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Light", FontWeight700, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Bold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Light", FontWeight800, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-ExtraBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Light", FontWeight800, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-ExtraBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Light", FontWeight900, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Heavy")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Light", FontWeight900, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Heavy")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Medium", FontWeight100, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Medium")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Medium", FontWeight100, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Thin")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Medium", FontWeight200, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Medium")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Medium", FontWeight200, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-UltraLight")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Medium", FontWeight300, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Medium")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Medium", FontWeight300, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Light")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Medium", FontWeight400, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Medium")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Medium", FontWeight400, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Regular")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Medium", FontWeight500, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Medium")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Medium", FontWeight500, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Medium")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Medium", FontWeight600, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-SemiBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Medium", FontWeight600, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-SemiBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Medium", FontWeight700, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Bold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Medium", FontWeight700, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Bold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Medium", FontWeight800, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-ExtraBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Medium", FontWeight800, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-ExtraBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Medium", FontWeight900, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Heavy")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Medium", FontWeight900, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Heavy")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Regular", FontWeight100, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Regular")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Regular", FontWeight100, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Thin")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Regular", FontWeight200, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Regular")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Regular", FontWeight200, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-UltraLight")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Regular", FontWeight300, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Regular")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Regular", FontWeight300, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Light")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Regular", FontWeight400, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Regular")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Regular", FontWeight400, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Regular")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Regular", FontWeight500, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Regular")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Regular", FontWeight500, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Medium")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Regular", FontWeight600, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-SemiBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Regular", FontWeight600, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-SemiBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Regular", FontWeight700, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Bold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Regular", FontWeight700, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Bold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Regular", FontWeight800, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-ExtraBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Regular", FontWeight800, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-ExtraBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Regular", FontWeight900, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Heavy")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Regular", FontWeight900, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Heavy")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-SemiBold", FontWeight100, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-SemiBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-SemiBold", FontWeight100, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Thin")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-SemiBold", FontWeight200, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-SemiBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-SemiBold", FontWeight200, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-UltraLight")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-SemiBold", FontWeight300, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-SemiBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-SemiBold", FontWeight300, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Light")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-SemiBold", FontWeight400, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-SemiBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-SemiBold", FontWeight400, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Regular")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-SemiBold", FontWeight500, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-SemiBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-SemiBold", FontWeight500, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Medium")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-SemiBold", FontWeight600, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-SemiBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-SemiBold", FontWeight600, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-SemiBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-SemiBold", FontWeight700, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-SemiBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-SemiBold", FontWeight700, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Bold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-SemiBold", FontWeight800, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-SemiBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-SemiBold", FontWeight800, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-ExtraBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-SemiBold", FontWeight900, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-SemiBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-SemiBold", FontWeight900, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Heavy")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Thin", FontWeight100, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Thin")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Thin", FontWeight100, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Thin")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Thin", FontWeight200, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Thin")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Thin", FontWeight200, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-UltraLight")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Thin", FontWeight300, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Thin")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Thin", FontWeight300, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Light")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Thin", FontWeight400, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Thin")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Thin", FontWeight400, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Regular")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Thin", FontWeight500, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Thin")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Thin", FontWeight500, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Medium")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Thin", FontWeight600, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-SemiBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Thin", FontWeight600, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-SemiBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Thin", FontWeight700, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Bold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Thin", FontWeight700, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Bold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Thin", FontWeight800, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-ExtraBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Thin", FontWeight800, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-ExtraBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Thin", FontWeight900, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Heavy")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-Thin", FontWeight900, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Heavy")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-UltraLight", FontWeight100, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-UltraLight")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-UltraLight", FontWeight100, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Thin")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-UltraLight", FontWeight200, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-UltraLight")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-UltraLight", FontWeight200, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-UltraLight")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-UltraLight", FontWeight300, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-UltraLight")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-UltraLight", FontWeight300, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Light")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-UltraLight", FontWeight400, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-UltraLight")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-UltraLight", FontWeight400, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Regular")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-UltraLight", FontWeight500, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-UltraLight")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-UltraLight", FontWeight500, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Medium")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-UltraLight", FontWeight600, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-SemiBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-UltraLight", FontWeight600, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-SemiBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-UltraLight", FontWeight700, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Bold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-UltraLight", FontWeight700, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Bold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-UltraLight", FontWeight800, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-ExtraBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-UltraLight", FontWeight800, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-ExtraBold")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-UltraLight", FontWeight900, FontItalicOff, 100, CFSTR("AppleSDGothicNeo-Heavy")));
-    EXPECT_TRUE(compareFonts("AppleSDGothicNeo-UltraLight", FontWeight900, FontItalicOn , 100, CFSTR("AppleSDGothicNeo-Heavy")));
-    EXPECT_TRUE(compareFonts("Avenir-Black", FontWeight100, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir-Black", FontWeight100, FontItalicOn , 100, CFSTR("Avenir-LightOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Black", FontWeight200, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir-Black", FontWeight200, FontItalicOn , 100, CFSTR("Avenir-LightOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Black", FontWeight300, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir-Black", FontWeight300, FontItalicOn , 100, CFSTR("Avenir-LightOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Black", FontWeight400, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir-Black", FontWeight400, FontItalicOn , 100, CFSTR("Avenir-BookOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Black", FontWeight500, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir-Black", FontWeight500, FontItalicOn , 100, CFSTR("Avenir-MediumOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Black", FontWeight600, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir-Black", FontWeight600, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Black", FontWeight700, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir-Black", FontWeight700, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Black", FontWeight800, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir-Black", FontWeight800, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Black", FontWeight900, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir-Black", FontWeight900, FontItalicOn , 100, CFSTR("Avenir-HeavyOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-BlackOblique", FontWeight100, FontItalicOff, 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-BlackOblique", FontWeight100, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-BlackOblique", FontWeight200, FontItalicOff, 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-BlackOblique", FontWeight200, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-BlackOblique", FontWeight300, FontItalicOff, 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-BlackOblique", FontWeight300, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-BlackOblique", FontWeight400, FontItalicOff, 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-BlackOblique", FontWeight400, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-BlackOblique", FontWeight500, FontItalicOff, 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-BlackOblique", FontWeight500, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-BlackOblique", FontWeight600, FontItalicOff, 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-BlackOblique", FontWeight600, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-BlackOblique", FontWeight700, FontItalicOff, 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-BlackOblique", FontWeight700, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-BlackOblique", FontWeight800, FontItalicOff, 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-BlackOblique", FontWeight800, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-BlackOblique", FontWeight900, FontItalicOff, 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-BlackOblique", FontWeight900, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Book", FontWeight100, FontItalicOff, 100, CFSTR("Avenir-Book")));
-    EXPECT_TRUE(compareFonts("Avenir-Book", FontWeight100, FontItalicOn , 100, CFSTR("Avenir-LightOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Book", FontWeight200, FontItalicOff, 100, CFSTR("Avenir-Book")));
-    EXPECT_TRUE(compareFonts("Avenir-Book", FontWeight200, FontItalicOn , 100, CFSTR("Avenir-LightOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Book", FontWeight300, FontItalicOff, 100, CFSTR("Avenir-Book")));
-    EXPECT_TRUE(compareFonts("Avenir-Book", FontWeight300, FontItalicOn , 100, CFSTR("Avenir-LightOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Book", FontWeight400, FontItalicOff, 100, CFSTR("Avenir-Book")));
-    EXPECT_TRUE(compareFonts("Avenir-Book", FontWeight400, FontItalicOn , 100, CFSTR("Avenir-BookOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Book", FontWeight500, FontItalicOff, 100, CFSTR("Avenir-Book")));
-    EXPECT_TRUE(compareFonts("Avenir-Book", FontWeight500, FontItalicOn , 100, CFSTR("Avenir-MediumOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Book", FontWeight600, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir-Book", FontWeight600, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Book", FontWeight700, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir-Book", FontWeight700, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Book", FontWeight800, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir-Book", FontWeight800, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Book", FontWeight900, FontItalicOff, 100, CFSTR("Avenir-Heavy")));
-    EXPECT_TRUE(compareFonts("Avenir-Book", FontWeight900, FontItalicOn , 100, CFSTR("Avenir-HeavyOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-BookOblique", FontWeight100, FontItalicOff, 100, CFSTR("Avenir-BookOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-BookOblique", FontWeight100, FontItalicOn , 100, CFSTR("Avenir-BookOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-BookOblique", FontWeight200, FontItalicOff, 100, CFSTR("Avenir-BookOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-BookOblique", FontWeight200, FontItalicOn , 100, CFSTR("Avenir-BookOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-BookOblique", FontWeight300, FontItalicOff, 100, CFSTR("Avenir-BookOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-BookOblique", FontWeight300, FontItalicOn , 100, CFSTR("Avenir-BookOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-BookOblique", FontWeight400, FontItalicOff, 100, CFSTR("Avenir-BookOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-BookOblique", FontWeight400, FontItalicOn , 100, CFSTR("Avenir-BookOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-BookOblique", FontWeight500, FontItalicOff, 100, CFSTR("Avenir-BookOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-BookOblique", FontWeight500, FontItalicOn , 100, CFSTR("Avenir-BookOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-BookOblique", FontWeight600, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir-BookOblique", FontWeight600, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-BookOblique", FontWeight700, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir-BookOblique", FontWeight700, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-BookOblique", FontWeight800, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir-BookOblique", FontWeight800, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-BookOblique", FontWeight900, FontItalicOff, 100, CFSTR("Avenir-Heavy")));
-    EXPECT_TRUE(compareFonts("Avenir-BookOblique", FontWeight900, FontItalicOn , 100, CFSTR("Avenir-HeavyOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Heavy", FontWeight100, FontItalicOff, 100, CFSTR("Avenir-Heavy")));
-    EXPECT_TRUE(compareFonts("Avenir-Heavy", FontWeight100, FontItalicOn , 100, CFSTR("Avenir-LightOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Heavy", FontWeight200, FontItalicOff, 100, CFSTR("Avenir-Heavy")));
-    EXPECT_TRUE(compareFonts("Avenir-Heavy", FontWeight200, FontItalicOn , 100, CFSTR("Avenir-LightOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Heavy", FontWeight300, FontItalicOff, 100, CFSTR("Avenir-Heavy")));
-    EXPECT_TRUE(compareFonts("Avenir-Heavy", FontWeight300, FontItalicOn , 100, CFSTR("Avenir-LightOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Heavy", FontWeight400, FontItalicOff, 100, CFSTR("Avenir-Heavy")));
-    EXPECT_TRUE(compareFonts("Avenir-Heavy", FontWeight400, FontItalicOn , 100, CFSTR("Avenir-BookOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Heavy", FontWeight500, FontItalicOff, 100, CFSTR("Avenir-Heavy")));
-    EXPECT_TRUE(compareFonts("Avenir-Heavy", FontWeight500, FontItalicOn , 100, CFSTR("Avenir-MediumOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Heavy", FontWeight600, FontItalicOff, 100, CFSTR("Avenir-Heavy")));
-    EXPECT_TRUE(compareFonts("Avenir-Heavy", FontWeight600, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Heavy", FontWeight700, FontItalicOff, 100, CFSTR("Avenir-Heavy")));
-    EXPECT_TRUE(compareFonts("Avenir-Heavy", FontWeight700, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Heavy", FontWeight800, FontItalicOff, 100, CFSTR("Avenir-Heavy")));
-    EXPECT_TRUE(compareFonts("Avenir-Heavy", FontWeight800, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Heavy", FontWeight900, FontItalicOff, 100, CFSTR("Avenir-Heavy")));
-    EXPECT_TRUE(compareFonts("Avenir-Heavy", FontWeight900, FontItalicOn , 100, CFSTR("Avenir-HeavyOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-HeavyOblique", FontWeight100, FontItalicOff, 100, CFSTR("Avenir-HeavyOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-HeavyOblique", FontWeight100, FontItalicOn , 100, CFSTR("Avenir-HeavyOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-HeavyOblique", FontWeight200, FontItalicOff, 100, CFSTR("Avenir-HeavyOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-HeavyOblique", FontWeight200, FontItalicOn , 100, CFSTR("Avenir-HeavyOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-HeavyOblique", FontWeight300, FontItalicOff, 100, CFSTR("Avenir-HeavyOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-HeavyOblique", FontWeight300, FontItalicOn , 100, CFSTR("Avenir-HeavyOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-HeavyOblique", FontWeight400, FontItalicOff, 100, CFSTR("Avenir-HeavyOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-HeavyOblique", FontWeight400, FontItalicOn , 100, CFSTR("Avenir-HeavyOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-HeavyOblique", FontWeight500, FontItalicOff, 100, CFSTR("Avenir-HeavyOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-HeavyOblique", FontWeight500, FontItalicOn , 100, CFSTR("Avenir-HeavyOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-HeavyOblique", FontWeight600, FontItalicOff, 100, CFSTR("Avenir-HeavyOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-HeavyOblique", FontWeight600, FontItalicOn , 100, CFSTR("Avenir-HeavyOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-HeavyOblique", FontWeight700, FontItalicOff, 100, CFSTR("Avenir-HeavyOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-HeavyOblique", FontWeight700, FontItalicOn , 100, CFSTR("Avenir-HeavyOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-HeavyOblique", FontWeight800, FontItalicOff, 100, CFSTR("Avenir-HeavyOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-HeavyOblique", FontWeight800, FontItalicOn , 100, CFSTR("Avenir-HeavyOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-HeavyOblique", FontWeight900, FontItalicOff, 100, CFSTR("Avenir-HeavyOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-HeavyOblique", FontWeight900, FontItalicOn , 100, CFSTR("Avenir-HeavyOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Light", FontWeight100, FontItalicOff, 100, CFSTR("Avenir-Light")));
-    EXPECT_TRUE(compareFonts("Avenir-Light", FontWeight100, FontItalicOn , 100, CFSTR("Avenir-LightOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Light", FontWeight200, FontItalicOff, 100, CFSTR("Avenir-Light")));
-    EXPECT_TRUE(compareFonts("Avenir-Light", FontWeight200, FontItalicOn , 100, CFSTR("Avenir-LightOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Light", FontWeight300, FontItalicOff, 100, CFSTR("Avenir-Light")));
-    EXPECT_TRUE(compareFonts("Avenir-Light", FontWeight300, FontItalicOn , 100, CFSTR("Avenir-LightOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Light", FontWeight400, FontItalicOff, 100, CFSTR("Avenir-Light")));
-    EXPECT_TRUE(compareFonts("Avenir-Light", FontWeight400, FontItalicOn , 100, CFSTR("Avenir-BookOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Light", FontWeight500, FontItalicOff, 100, CFSTR("Avenir-Light")));
-    EXPECT_TRUE(compareFonts("Avenir-Light", FontWeight500, FontItalicOn , 100, CFSTR("Avenir-MediumOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Light", FontWeight600, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir-Light", FontWeight600, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Light", FontWeight700, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir-Light", FontWeight700, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Light", FontWeight800, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir-Light", FontWeight800, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Light", FontWeight900, FontItalicOff, 100, CFSTR("Avenir-Heavy")));
-    EXPECT_TRUE(compareFonts("Avenir-Light", FontWeight900, FontItalicOn , 100, CFSTR("Avenir-HeavyOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-LightOblique", FontWeight100, FontItalicOff, 100, CFSTR("Avenir-LightOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-LightOblique", FontWeight100, FontItalicOn , 100, CFSTR("Avenir-LightOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-LightOblique", FontWeight200, FontItalicOff, 100, CFSTR("Avenir-LightOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-LightOblique", FontWeight200, FontItalicOn , 100, CFSTR("Avenir-LightOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-LightOblique", FontWeight300, FontItalicOff, 100, CFSTR("Avenir-LightOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-LightOblique", FontWeight300, FontItalicOn , 100, CFSTR("Avenir-LightOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-LightOblique", FontWeight400, FontItalicOff, 100, CFSTR("Avenir-LightOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-LightOblique", FontWeight400, FontItalicOn , 100, CFSTR("Avenir-LightOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-LightOblique", FontWeight500, FontItalicOff, 100, CFSTR("Avenir-LightOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-LightOblique", FontWeight500, FontItalicOn , 100, CFSTR("Avenir-LightOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-LightOblique", FontWeight600, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir-LightOblique", FontWeight600, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-LightOblique", FontWeight700, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir-LightOblique", FontWeight700, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-LightOblique", FontWeight800, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir-LightOblique", FontWeight800, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-LightOblique", FontWeight900, FontItalicOff, 100, CFSTR("Avenir-Heavy")));
-    EXPECT_TRUE(compareFonts("Avenir-LightOblique", FontWeight900, FontItalicOn , 100, CFSTR("Avenir-HeavyOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Medium", FontWeight100, FontItalicOff, 100, CFSTR("Avenir-Medium")));
-    EXPECT_TRUE(compareFonts("Avenir-Medium", FontWeight100, FontItalicOn , 100, CFSTR("Avenir-LightOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Medium", FontWeight200, FontItalicOff, 100, CFSTR("Avenir-Medium")));
-    EXPECT_TRUE(compareFonts("Avenir-Medium", FontWeight200, FontItalicOn , 100, CFSTR("Avenir-LightOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Medium", FontWeight300, FontItalicOff, 100, CFSTR("Avenir-Medium")));
-    EXPECT_TRUE(compareFonts("Avenir-Medium", FontWeight300, FontItalicOn , 100, CFSTR("Avenir-LightOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Medium", FontWeight400, FontItalicOff, 100, CFSTR("Avenir-Medium")));
-    EXPECT_TRUE(compareFonts("Avenir-Medium", FontWeight400, FontItalicOn , 100, CFSTR("Avenir-BookOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Medium", FontWeight500, FontItalicOff, 100, CFSTR("Avenir-Medium")));
-    EXPECT_TRUE(compareFonts("Avenir-Medium", FontWeight500, FontItalicOn , 100, CFSTR("Avenir-MediumOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Medium", FontWeight600, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir-Medium", FontWeight600, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Medium", FontWeight700, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir-Medium", FontWeight700, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Medium", FontWeight800, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir-Medium", FontWeight800, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Medium", FontWeight900, FontItalicOff, 100, CFSTR("Avenir-Heavy")));
-    EXPECT_TRUE(compareFonts("Avenir-Medium", FontWeight900, FontItalicOn , 100, CFSTR("Avenir-HeavyOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-MediumOblique", FontWeight100, FontItalicOff, 100, CFSTR("Avenir-MediumOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-MediumOblique", FontWeight100, FontItalicOn , 100, CFSTR("Avenir-MediumOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-MediumOblique", FontWeight200, FontItalicOff, 100, CFSTR("Avenir-MediumOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-MediumOblique", FontWeight200, FontItalicOn , 100, CFSTR("Avenir-MediumOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-MediumOblique", FontWeight300, FontItalicOff, 100, CFSTR("Avenir-MediumOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-MediumOblique", FontWeight300, FontItalicOn , 100, CFSTR("Avenir-MediumOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-MediumOblique", FontWeight400, FontItalicOff, 100, CFSTR("Avenir-MediumOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-MediumOblique", FontWeight400, FontItalicOn , 100, CFSTR("Avenir-MediumOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-MediumOblique", FontWeight500, FontItalicOff, 100, CFSTR("Avenir-MediumOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-MediumOblique", FontWeight500, FontItalicOn , 100, CFSTR("Avenir-MediumOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-MediumOblique", FontWeight600, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir-MediumOblique", FontWeight600, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-MediumOblique", FontWeight700, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir-MediumOblique", FontWeight700, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-MediumOblique", FontWeight800, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir-MediumOblique", FontWeight800, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-MediumOblique", FontWeight900, FontItalicOff, 100, CFSTR("Avenir-Heavy")));
-    EXPECT_TRUE(compareFonts("Avenir-MediumOblique", FontWeight900, FontItalicOn , 100, CFSTR("Avenir-HeavyOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Oblique", FontWeight100, FontItalicOff, 100, CFSTR("Avenir-Oblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Oblique", FontWeight100, FontItalicOn , 100, CFSTR("Avenir-Oblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Oblique", FontWeight200, FontItalicOff, 100, CFSTR("Avenir-Oblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Oblique", FontWeight200, FontItalicOn , 100, CFSTR("Avenir-Oblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Oblique", FontWeight300, FontItalicOff, 100, CFSTR("Avenir-Oblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Oblique", FontWeight300, FontItalicOn , 100, CFSTR("Avenir-Oblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Oblique", FontWeight400, FontItalicOff, 100, CFSTR("Avenir-Oblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Oblique", FontWeight400, FontItalicOn , 100, CFSTR("Avenir-Oblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Oblique", FontWeight500, FontItalicOff, 100, CFSTR("Avenir-Oblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Oblique", FontWeight500, FontItalicOn , 100, CFSTR("Avenir-Oblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Oblique", FontWeight600, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir-Oblique", FontWeight600, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Oblique", FontWeight700, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir-Oblique", FontWeight700, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Oblique", FontWeight800, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir-Oblique", FontWeight800, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Oblique", FontWeight900, FontItalicOff, 100, CFSTR("Avenir-Heavy")));
-    EXPECT_TRUE(compareFonts("Avenir-Oblique", FontWeight900, FontItalicOn , 100, CFSTR("Avenir-HeavyOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Roman", FontWeight100, FontItalicOff, 100, CFSTR("Avenir-Roman")));
-    EXPECT_TRUE(compareFonts("Avenir-Roman", FontWeight100, FontItalicOn , 100, CFSTR("Avenir-LightOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Roman", FontWeight200, FontItalicOff, 100, CFSTR("Avenir-Roman")));
-    EXPECT_TRUE(compareFonts("Avenir-Roman", FontWeight200, FontItalicOn , 100, CFSTR("Avenir-LightOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Roman", FontWeight300, FontItalicOff, 100, CFSTR("Avenir-Roman")));
-    EXPECT_TRUE(compareFonts("Avenir-Roman", FontWeight300, FontItalicOn , 100, CFSTR("Avenir-LightOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Roman", FontWeight400, FontItalicOff, 100, CFSTR("Avenir-Roman")));
-    EXPECT_TRUE(compareFonts("Avenir-Roman", FontWeight400, FontItalicOn , 100, CFSTR("Avenir-BookOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Roman", FontWeight500, FontItalicOff, 100, CFSTR("Avenir-Roman")));
-    EXPECT_TRUE(compareFonts("Avenir-Roman", FontWeight500, FontItalicOn , 100, CFSTR("Avenir-MediumOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Roman", FontWeight600, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir-Roman", FontWeight600, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Roman", FontWeight700, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir-Roman", FontWeight700, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Roman", FontWeight800, FontItalicOff, 100, CFSTR("Avenir-Black")));
-    EXPECT_TRUE(compareFonts("Avenir-Roman", FontWeight800, FontItalicOn , 100, CFSTR("Avenir-BlackOblique")));
-    EXPECT_TRUE(compareFonts("Avenir-Roman", FontWeight900, FontItalicOff, 100, CFSTR("Avenir-Heavy")));
-    EXPECT_TRUE(compareFonts("Avenir-Roman", FontWeight900, FontItalicOn , 100, CFSTR("Avenir-HeavyOblique")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Bold", FontWeight100, FontItalicOff, 100, CFSTR("AvenirNext-Bold")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Bold", FontWeight100, FontItalicOn , 100, CFSTR("AvenirNext-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Bold", FontWeight200, FontItalicOff, 100, CFSTR("AvenirNext-Bold")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Bold", FontWeight200, FontItalicOn , 100, CFSTR("AvenirNext-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Bold", FontWeight300, FontItalicOff, 100, CFSTR("AvenirNext-Bold")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Bold", FontWeight300, FontItalicOn , 100, CFSTR("AvenirNext-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Bold", FontWeight400, FontItalicOff, 100, CFSTR("AvenirNext-Bold")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Bold", FontWeight400, FontItalicOn , 100, CFSTR("AvenirNext-Italic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Bold", FontWeight500, FontItalicOff, 100, CFSTR("AvenirNext-Bold")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Bold", FontWeight500, FontItalicOn , 100, CFSTR("AvenirNext-MediumItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Bold", FontWeight600, FontItalicOff, 100, CFSTR("AvenirNext-Bold")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Bold", FontWeight600, FontItalicOn , 100, CFSTR("AvenirNext-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Bold", FontWeight700, FontItalicOff, 100, CFSTR("AvenirNext-Bold")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Bold", FontWeight700, FontItalicOn , 100, CFSTR("AvenirNext-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Bold", FontWeight800, FontItalicOff, 100, CFSTR("AvenirNext-Bold")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Bold", FontWeight800, FontItalicOn , 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Bold", FontWeight900, FontItalicOff, 100, CFSTR("AvenirNext-Bold")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Bold", FontWeight900, FontItalicOn , 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-BoldItalic", FontWeight100, FontItalicOff, 100, CFSTR("AvenirNext-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-BoldItalic", FontWeight100, FontItalicOn , 100, CFSTR("AvenirNext-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-BoldItalic", FontWeight200, FontItalicOff, 100, CFSTR("AvenirNext-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-BoldItalic", FontWeight200, FontItalicOn , 100, CFSTR("AvenirNext-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-BoldItalic", FontWeight300, FontItalicOff, 100, CFSTR("AvenirNext-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-BoldItalic", FontWeight300, FontItalicOn , 100, CFSTR("AvenirNext-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-BoldItalic", FontWeight400, FontItalicOff, 100, CFSTR("AvenirNext-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-BoldItalic", FontWeight400, FontItalicOn , 100, CFSTR("AvenirNext-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-BoldItalic", FontWeight500, FontItalicOff, 100, CFSTR("AvenirNext-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-BoldItalic", FontWeight500, FontItalicOn , 100, CFSTR("AvenirNext-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-BoldItalic", FontWeight600, FontItalicOff, 100, CFSTR("AvenirNext-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-BoldItalic", FontWeight600, FontItalicOn , 100, CFSTR("AvenirNext-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-BoldItalic", FontWeight700, FontItalicOff, 100, CFSTR("AvenirNext-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-BoldItalic", FontWeight700, FontItalicOn , 100, CFSTR("AvenirNext-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-BoldItalic", FontWeight800, FontItalicOff, 100, CFSTR("AvenirNext-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-BoldItalic", FontWeight800, FontItalicOn , 100, CFSTR("AvenirNext-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-BoldItalic", FontWeight900, FontItalicOff, 100, CFSTR("AvenirNext-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-BoldItalic", FontWeight900, FontItalicOn , 100, CFSTR("AvenirNext-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBold", FontWeight100, FontItalicOff, 100, CFSTR("AvenirNext-DemiBold")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBold", FontWeight100, FontItalicOn , 100, CFSTR("AvenirNext-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBold", FontWeight200, FontItalicOff, 100, CFSTR("AvenirNext-DemiBold")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBold", FontWeight200, FontItalicOn , 100, CFSTR("AvenirNext-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBold", FontWeight300, FontItalicOff, 100, CFSTR("AvenirNext-DemiBold")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBold", FontWeight300, FontItalicOn , 100, CFSTR("AvenirNext-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBold", FontWeight400, FontItalicOff, 100, CFSTR("AvenirNext-DemiBold")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBold", FontWeight400, FontItalicOn , 100, CFSTR("AvenirNext-Italic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBold", FontWeight500, FontItalicOff, 100, CFSTR("AvenirNext-DemiBold")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBold", FontWeight500, FontItalicOn , 100, CFSTR("AvenirNext-MediumItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBold", FontWeight600, FontItalicOff, 100, CFSTR("AvenirNext-DemiBold")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBold", FontWeight600, FontItalicOn , 100, CFSTR("AvenirNext-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBold", FontWeight700, FontItalicOff, 100, CFSTR("AvenirNext-DemiBold")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBold", FontWeight700, FontItalicOn , 100, CFSTR("AvenirNext-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBold", FontWeight800, FontItalicOff, 100, CFSTR("AvenirNext-DemiBold")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBold", FontWeight800, FontItalicOn , 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBold", FontWeight900, FontItalicOff, 100, CFSTR("AvenirNext-DemiBold")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBold", FontWeight900, FontItalicOn , 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBoldItalic", FontWeight100, FontItalicOff, 100, CFSTR("AvenirNext-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBoldItalic", FontWeight100, FontItalicOn , 100, CFSTR("AvenirNext-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBoldItalic", FontWeight200, FontItalicOff, 100, CFSTR("AvenirNext-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBoldItalic", FontWeight200, FontItalicOn , 100, CFSTR("AvenirNext-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBoldItalic", FontWeight300, FontItalicOff, 100, CFSTR("AvenirNext-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBoldItalic", FontWeight300, FontItalicOn , 100, CFSTR("AvenirNext-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBoldItalic", FontWeight400, FontItalicOff, 100, CFSTR("AvenirNext-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBoldItalic", FontWeight400, FontItalicOn , 100, CFSTR("AvenirNext-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBoldItalic", FontWeight500, FontItalicOff, 100, CFSTR("AvenirNext-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBoldItalic", FontWeight500, FontItalicOn , 100, CFSTR("AvenirNext-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBoldItalic", FontWeight600, FontItalicOff, 100, CFSTR("AvenirNext-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBoldItalic", FontWeight600, FontItalicOn , 100, CFSTR("AvenirNext-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBoldItalic", FontWeight700, FontItalicOff, 100, CFSTR("AvenirNext-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBoldItalic", FontWeight700, FontItalicOn , 100, CFSTR("AvenirNext-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBoldItalic", FontWeight800, FontItalicOff, 100, CFSTR("AvenirNext-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBoldItalic", FontWeight800, FontItalicOn , 100, CFSTR("AvenirNext-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBoldItalic", FontWeight900, FontItalicOff, 100, CFSTR("AvenirNext-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-DemiBoldItalic", FontWeight900, FontItalicOn , 100, CFSTR("AvenirNext-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Heavy", FontWeight100, FontItalicOff, 100, CFSTR("AvenirNext-Heavy")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Heavy", FontWeight100, FontItalicOn , 100, CFSTR("AvenirNext-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Heavy", FontWeight200, FontItalicOff, 100, CFSTR("AvenirNext-Heavy")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Heavy", FontWeight200, FontItalicOn , 100, CFSTR("AvenirNext-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Heavy", FontWeight300, FontItalicOff, 100, CFSTR("AvenirNext-Heavy")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Heavy", FontWeight300, FontItalicOn , 100, CFSTR("AvenirNext-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Heavy", FontWeight400, FontItalicOff, 100, CFSTR("AvenirNext-Heavy")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Heavy", FontWeight400, FontItalicOn , 100, CFSTR("AvenirNext-Italic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Heavy", FontWeight500, FontItalicOff, 100, CFSTR("AvenirNext-Heavy")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Heavy", FontWeight500, FontItalicOn , 100, CFSTR("AvenirNext-MediumItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Heavy", FontWeight600, FontItalicOff, 100, CFSTR("AvenirNext-Heavy")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Heavy", FontWeight600, FontItalicOn , 100, CFSTR("AvenirNext-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Heavy", FontWeight700, FontItalicOff, 100, CFSTR("AvenirNext-Heavy")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Heavy", FontWeight700, FontItalicOn , 100, CFSTR("AvenirNext-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Heavy", FontWeight800, FontItalicOff, 100, CFSTR("AvenirNext-Heavy")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Heavy", FontWeight800, FontItalicOn , 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Heavy", FontWeight900, FontItalicOff, 100, CFSTR("AvenirNext-Heavy")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Heavy", FontWeight900, FontItalicOn , 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-HeavyItalic", FontWeight100, FontItalicOff, 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-HeavyItalic", FontWeight100, FontItalicOn , 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-HeavyItalic", FontWeight200, FontItalicOff, 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-HeavyItalic", FontWeight200, FontItalicOn , 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-HeavyItalic", FontWeight300, FontItalicOff, 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-HeavyItalic", FontWeight300, FontItalicOn , 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-HeavyItalic", FontWeight400, FontItalicOff, 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-HeavyItalic", FontWeight400, FontItalicOn , 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-HeavyItalic", FontWeight500, FontItalicOff, 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-HeavyItalic", FontWeight500, FontItalicOn , 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-HeavyItalic", FontWeight600, FontItalicOff, 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-HeavyItalic", FontWeight600, FontItalicOn , 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-HeavyItalic", FontWeight700, FontItalicOff, 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-HeavyItalic", FontWeight700, FontItalicOn , 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-HeavyItalic", FontWeight800, FontItalicOff, 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-HeavyItalic", FontWeight800, FontItalicOn , 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-HeavyItalic", FontWeight900, FontItalicOff, 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-HeavyItalic", FontWeight900, FontItalicOn , 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Italic", FontWeight100, FontItalicOff, 100, CFSTR("AvenirNext-Italic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Italic", FontWeight100, FontItalicOn , 100, CFSTR("AvenirNext-Italic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Italic", FontWeight200, FontItalicOff, 100, CFSTR("AvenirNext-Italic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Italic", FontWeight200, FontItalicOn , 100, CFSTR("AvenirNext-Italic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Italic", FontWeight300, FontItalicOff, 100, CFSTR("AvenirNext-Italic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Italic", FontWeight300, FontItalicOn , 100, CFSTR("AvenirNext-Italic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Italic", FontWeight400, FontItalicOff, 100, CFSTR("AvenirNext-Italic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Italic", FontWeight400, FontItalicOn , 100, CFSTR("AvenirNext-Italic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Italic", FontWeight500, FontItalicOff, 100, CFSTR("AvenirNext-Italic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Italic", FontWeight500, FontItalicOn , 100, CFSTR("AvenirNext-Italic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Italic", FontWeight600, FontItalicOff, 100, CFSTR("AvenirNext-DemiBold")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Italic", FontWeight600, FontItalicOn , 100, CFSTR("AvenirNext-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Italic", FontWeight700, FontItalicOff, 100, CFSTR("AvenirNext-Bold")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Italic", FontWeight700, FontItalicOn , 100, CFSTR("AvenirNext-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Italic", FontWeight800, FontItalicOff, 100, CFSTR("AvenirNext-Heavy")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Italic", FontWeight800, FontItalicOn , 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Italic", FontWeight900, FontItalicOff, 100, CFSTR("AvenirNext-Heavy")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Italic", FontWeight900, FontItalicOn , 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Medium", FontWeight100, FontItalicOff, 100, CFSTR("AvenirNext-Medium")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Medium", FontWeight100, FontItalicOn , 100, CFSTR("AvenirNext-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Medium", FontWeight200, FontItalicOff, 100, CFSTR("AvenirNext-Medium")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Medium", FontWeight200, FontItalicOn , 100, CFSTR("AvenirNext-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Medium", FontWeight300, FontItalicOff, 100, CFSTR("AvenirNext-Medium")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Medium", FontWeight300, FontItalicOn , 100, CFSTR("AvenirNext-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Medium", FontWeight400, FontItalicOff, 100, CFSTR("AvenirNext-Medium")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Medium", FontWeight400, FontItalicOn , 100, CFSTR("AvenirNext-Italic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Medium", FontWeight500, FontItalicOff, 100, CFSTR("AvenirNext-Medium")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Medium", FontWeight500, FontItalicOn , 100, CFSTR("AvenirNext-MediumItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Medium", FontWeight600, FontItalicOff, 100, CFSTR("AvenirNext-DemiBold")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Medium", FontWeight600, FontItalicOn , 100, CFSTR("AvenirNext-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Medium", FontWeight700, FontItalicOff, 100, CFSTR("AvenirNext-Bold")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Medium", FontWeight700, FontItalicOn , 100, CFSTR("AvenirNext-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Medium", FontWeight800, FontItalicOff, 100, CFSTR("AvenirNext-Heavy")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Medium", FontWeight800, FontItalicOn , 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Medium", FontWeight900, FontItalicOff, 100, CFSTR("AvenirNext-Heavy")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Medium", FontWeight900, FontItalicOn , 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-MediumItalic", FontWeight100, FontItalicOff, 100, CFSTR("AvenirNext-MediumItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-MediumItalic", FontWeight100, FontItalicOn , 100, CFSTR("AvenirNext-MediumItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-MediumItalic", FontWeight200, FontItalicOff, 100, CFSTR("AvenirNext-MediumItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-MediumItalic", FontWeight200, FontItalicOn , 100, CFSTR("AvenirNext-MediumItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-MediumItalic", FontWeight300, FontItalicOff, 100, CFSTR("AvenirNext-MediumItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-MediumItalic", FontWeight300, FontItalicOn , 100, CFSTR("AvenirNext-MediumItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-MediumItalic", FontWeight400, FontItalicOff, 100, CFSTR("AvenirNext-MediumItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-MediumItalic", FontWeight400, FontItalicOn , 100, CFSTR("AvenirNext-MediumItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-MediumItalic", FontWeight500, FontItalicOff, 100, CFSTR("AvenirNext-MediumItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-MediumItalic", FontWeight500, FontItalicOn , 100, CFSTR("AvenirNext-MediumItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-MediumItalic", FontWeight600, FontItalicOff, 100, CFSTR("AvenirNext-DemiBold")));
-    EXPECT_TRUE(compareFonts("AvenirNext-MediumItalic", FontWeight600, FontItalicOn , 100, CFSTR("AvenirNext-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-MediumItalic", FontWeight700, FontItalicOff, 100, CFSTR("AvenirNext-Bold")));
-    EXPECT_TRUE(compareFonts("AvenirNext-MediumItalic", FontWeight700, FontItalicOn , 100, CFSTR("AvenirNext-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-MediumItalic", FontWeight800, FontItalicOff, 100, CFSTR("AvenirNext-Heavy")));
-    EXPECT_TRUE(compareFonts("AvenirNext-MediumItalic", FontWeight800, FontItalicOn , 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-MediumItalic", FontWeight900, FontItalicOff, 100, CFSTR("AvenirNext-Heavy")));
-    EXPECT_TRUE(compareFonts("AvenirNext-MediumItalic", FontWeight900, FontItalicOn , 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Regular", FontWeight100, FontItalicOff, 100, CFSTR("AvenirNext-Regular")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Regular", FontWeight100, FontItalicOn , 100, CFSTR("AvenirNext-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Regular", FontWeight200, FontItalicOff, 100, CFSTR("AvenirNext-Regular")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Regular", FontWeight200, FontItalicOn , 100, CFSTR("AvenirNext-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Regular", FontWeight300, FontItalicOff, 100, CFSTR("AvenirNext-Regular")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Regular", FontWeight300, FontItalicOn , 100, CFSTR("AvenirNext-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Regular", FontWeight400, FontItalicOff, 100, CFSTR("AvenirNext-Regular")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Regular", FontWeight400, FontItalicOn , 100, CFSTR("AvenirNext-Italic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Regular", FontWeight500, FontItalicOff, 100, CFSTR("AvenirNext-Regular")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Regular", FontWeight500, FontItalicOn , 100, CFSTR("AvenirNext-MediumItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Regular", FontWeight600, FontItalicOff, 100, CFSTR("AvenirNext-DemiBold")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Regular", FontWeight600, FontItalicOn , 100, CFSTR("AvenirNext-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Regular", FontWeight700, FontItalicOff, 100, CFSTR("AvenirNext-Bold")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Regular", FontWeight700, FontItalicOn , 100, CFSTR("AvenirNext-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Regular", FontWeight800, FontItalicOff, 100, CFSTR("AvenirNext-Heavy")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Regular", FontWeight800, FontItalicOn , 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Regular", FontWeight900, FontItalicOff, 100, CFSTR("AvenirNext-Heavy")));
-    EXPECT_TRUE(compareFonts("AvenirNext-Regular", FontWeight900, FontItalicOn , 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLight", FontWeight100, FontItalicOff, 100, CFSTR("AvenirNext-UltraLight")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLight", FontWeight100, FontItalicOn , 100, CFSTR("AvenirNext-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLight", FontWeight200, FontItalicOff, 100, CFSTR("AvenirNext-UltraLight")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLight", FontWeight200, FontItalicOn , 100, CFSTR("AvenirNext-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLight", FontWeight300, FontItalicOff, 100, CFSTR("AvenirNext-UltraLight")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLight", FontWeight300, FontItalicOn , 100, CFSTR("AvenirNext-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLight", FontWeight400, FontItalicOff, 100, CFSTR("AvenirNext-UltraLight")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLight", FontWeight400, FontItalicOn , 100, CFSTR("AvenirNext-Italic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLight", FontWeight500, FontItalicOff, 100, CFSTR("AvenirNext-UltraLight")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLight", FontWeight500, FontItalicOn , 100, CFSTR("AvenirNext-MediumItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLight", FontWeight600, FontItalicOff, 100, CFSTR("AvenirNext-DemiBold")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLight", FontWeight600, FontItalicOn , 100, CFSTR("AvenirNext-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLight", FontWeight700, FontItalicOff, 100, CFSTR("AvenirNext-Bold")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLight", FontWeight700, FontItalicOn , 100, CFSTR("AvenirNext-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLight", FontWeight800, FontItalicOff, 100, CFSTR("AvenirNext-Heavy")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLight", FontWeight800, FontItalicOn , 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLight", FontWeight900, FontItalicOff, 100, CFSTR("AvenirNext-Heavy")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLight", FontWeight900, FontItalicOn , 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLightItalic", FontWeight100, FontItalicOff, 100, CFSTR("AvenirNext-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLightItalic", FontWeight100, FontItalicOn , 100, CFSTR("AvenirNext-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLightItalic", FontWeight200, FontItalicOff, 100, CFSTR("AvenirNext-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLightItalic", FontWeight200, FontItalicOn , 100, CFSTR("AvenirNext-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLightItalic", FontWeight300, FontItalicOff, 100, CFSTR("AvenirNext-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLightItalic", FontWeight300, FontItalicOn , 100, CFSTR("AvenirNext-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLightItalic", FontWeight400, FontItalicOff, 100, CFSTR("AvenirNext-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLightItalic", FontWeight400, FontItalicOn , 100, CFSTR("AvenirNext-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLightItalic", FontWeight500, FontItalicOff, 100, CFSTR("AvenirNext-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLightItalic", FontWeight500, FontItalicOn , 100, CFSTR("AvenirNext-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLightItalic", FontWeight600, FontItalicOff, 100, CFSTR("AvenirNext-DemiBold")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLightItalic", FontWeight600, FontItalicOn , 100, CFSTR("AvenirNext-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLightItalic", FontWeight700, FontItalicOff, 100, CFSTR("AvenirNext-Bold")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLightItalic", FontWeight700, FontItalicOn , 100, CFSTR("AvenirNext-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLightItalic", FontWeight800, FontItalicOff, 100, CFSTR("AvenirNext-Heavy")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLightItalic", FontWeight800, FontItalicOn , 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLightItalic", FontWeight900, FontItalicOff, 100, CFSTR("AvenirNext-Heavy")));
-    EXPECT_TRUE(compareFonts("AvenirNext-UltraLightItalic", FontWeight900, FontItalicOn , 100, CFSTR("AvenirNext-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Bold", FontWeight100, FontItalicOff, 100, CFSTR("AvenirNextCondensed-Bold")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Bold", FontWeight100, FontItalicOn , 100, CFSTR("AvenirNextCondensed-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Bold", FontWeight200, FontItalicOff, 100, CFSTR("AvenirNextCondensed-Bold")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Bold", FontWeight200, FontItalicOn , 100, CFSTR("AvenirNextCondensed-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Bold", FontWeight300, FontItalicOff, 100, CFSTR("AvenirNextCondensed-Bold")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Bold", FontWeight300, FontItalicOn , 100, CFSTR("AvenirNextCondensed-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Bold", FontWeight400, FontItalicOff, 100, CFSTR("AvenirNextCondensed-Bold")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Bold", FontWeight400, FontItalicOn , 100, CFSTR("AvenirNextCondensed-Italic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Bold", FontWeight500, FontItalicOff, 100, CFSTR("AvenirNextCondensed-Bold")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Bold", FontWeight500, FontItalicOn , 100, CFSTR("AvenirNextCondensed-MediumItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Bold", FontWeight600, FontItalicOff, 100, CFSTR("AvenirNextCondensed-Bold")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Bold", FontWeight600, FontItalicOn , 100, CFSTR("AvenirNextCondensed-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Bold", FontWeight700, FontItalicOff, 100, CFSTR("AvenirNextCondensed-Bold")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Bold", FontWeight700, FontItalicOn , 100, CFSTR("AvenirNextCondensed-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Bold", FontWeight800, FontItalicOff, 100, CFSTR("AvenirNextCondensed-Bold")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Bold", FontWeight800, FontItalicOn , 100, CFSTR("AvenirNextCondensed-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Bold", FontWeight900, FontItalicOff, 100, CFSTR("AvenirNextCondensed-Bold")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Bold", FontWeight900, FontItalicOn , 100, CFSTR("AvenirNextCondensed-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-BoldItalic", FontWeight100, FontItalicOff, 100, CFSTR("AvenirNextCondensed-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-BoldItalic", FontWeight100, FontItalicOn , 100, CFSTR("AvenirNextCondensed-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-BoldItalic", FontWeight200, FontItalicOff, 100, CFSTR("AvenirNextCondensed-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-BoldItalic", FontWeight200, FontItalicOn , 100, CFSTR("AvenirNextCondensed-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-BoldItalic", FontWeight300, FontItalicOff, 100, CFSTR("AvenirNextCondensed-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-BoldItalic", FontWeight300, FontItalicOn , 100, CFSTR("AvenirNextCondensed-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-BoldItalic", FontWeight400, FontItalicOff, 100, CFSTR("AvenirNextCondensed-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-BoldItalic", FontWeight400, FontItalicOn , 100, CFSTR("AvenirNextCondensed-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-BoldItalic", FontWeight500, FontItalicOff, 100, CFSTR("AvenirNextCondensed-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-BoldItalic", FontWeight500, FontItalicOn , 100, CFSTR("AvenirNextCondensed-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-BoldItalic", FontWeight600, FontItalicOff, 100, CFSTR("AvenirNextCondensed-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-BoldItalic", FontWeight600, FontItalicOn , 100, CFSTR("AvenirNextCondensed-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-BoldItalic", FontWeight700, FontItalicOff, 100, CFSTR("AvenirNextCondensed-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-BoldItalic", FontWeight700, FontItalicOn , 100, CFSTR("AvenirNextCondensed-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-BoldItalic", FontWeight800, FontItalicOff, 100, CFSTR("AvenirNextCondensed-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-BoldItalic", FontWeight800, FontItalicOn , 100, CFSTR("AvenirNextCondensed-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-BoldItalic", FontWeight900, FontItalicOff, 100, CFSTR("AvenirNextCondensed-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-BoldItalic", FontWeight900, FontItalicOn , 100, CFSTR("AvenirNextCondensed-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBold", FontWeight100, FontItalicOff, 100, CFSTR("AvenirNextCondensed-DemiBold")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBold", FontWeight100, FontItalicOn , 100, CFSTR("AvenirNextCondensed-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBold", FontWeight200, FontItalicOff, 100, CFSTR("AvenirNextCondensed-DemiBold")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBold", FontWeight200, FontItalicOn , 100, CFSTR("AvenirNextCondensed-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBold", FontWeight300, FontItalicOff, 100, CFSTR("AvenirNextCondensed-DemiBold")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBold", FontWeight300, FontItalicOn , 100, CFSTR("AvenirNextCondensed-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBold", FontWeight400, FontItalicOff, 100, CFSTR("AvenirNextCondensed-DemiBold")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBold", FontWeight400, FontItalicOn , 100, CFSTR("AvenirNextCondensed-Italic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBold", FontWeight500, FontItalicOff, 100, CFSTR("AvenirNextCondensed-DemiBold")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBold", FontWeight500, FontItalicOn , 100, CFSTR("AvenirNextCondensed-MediumItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBold", FontWeight600, FontItalicOff, 100, CFSTR("AvenirNextCondensed-DemiBold")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBold", FontWeight600, FontItalicOn , 100, CFSTR("AvenirNextCondensed-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBold", FontWeight700, FontItalicOff, 100, CFSTR("AvenirNextCondensed-DemiBold")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBold", FontWeight700, FontItalicOn , 100, CFSTR("AvenirNextCondensed-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBold", FontWeight800, FontItalicOff, 100, CFSTR("AvenirNextCondensed-DemiBold")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBold", FontWeight800, FontItalicOn , 100, CFSTR("AvenirNextCondensed-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBold", FontWeight900, FontItalicOff, 100, CFSTR("AvenirNextCondensed-DemiBold")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBold", FontWeight900, FontItalicOn , 100, CFSTR("AvenirNextCondensed-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBoldItalic", FontWeight100, FontItalicOff, 100, CFSTR("AvenirNextCondensed-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBoldItalic", FontWeight100, FontItalicOn , 100, CFSTR("AvenirNextCondensed-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBoldItalic", FontWeight200, FontItalicOff, 100, CFSTR("AvenirNextCondensed-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBoldItalic", FontWeight200, FontItalicOn , 100, CFSTR("AvenirNextCondensed-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBoldItalic", FontWeight300, FontItalicOff, 100, CFSTR("AvenirNextCondensed-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBoldItalic", FontWeight300, FontItalicOn , 100, CFSTR("AvenirNextCondensed-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBoldItalic", FontWeight400, FontItalicOff, 100, CFSTR("AvenirNextCondensed-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBoldItalic", FontWeight400, FontItalicOn , 100, CFSTR("AvenirNextCondensed-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBoldItalic", FontWeight500, FontItalicOff, 100, CFSTR("AvenirNextCondensed-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBoldItalic", FontWeight500, FontItalicOn , 100, CFSTR("AvenirNextCondensed-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBoldItalic", FontWeight600, FontItalicOff, 100, CFSTR("AvenirNextCondensed-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBoldItalic", FontWeight600, FontItalicOn , 100, CFSTR("AvenirNextCondensed-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBoldItalic", FontWeight700, FontItalicOff, 100, CFSTR("AvenirNextCondensed-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBoldItalic", FontWeight700, FontItalicOn , 100, CFSTR("AvenirNextCondensed-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBoldItalic", FontWeight800, FontItalicOff, 100, CFSTR("AvenirNextCondensed-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBoldItalic", FontWeight800, FontItalicOn , 100, CFSTR("AvenirNextCondensed-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBoldItalic", FontWeight900, FontItalicOff, 100, CFSTR("AvenirNextCondensed-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-DemiBoldItalic", FontWeight900, FontItalicOn , 100, CFSTR("AvenirNextCondensed-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Heavy", FontWeight100, FontItalicOff, 100, CFSTR("AvenirNextCondensed-Heavy")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Heavy", FontWeight100, FontItalicOn , 100, CFSTR("AvenirNextCondensed-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Heavy", FontWeight200, FontItalicOff, 100, CFSTR("AvenirNextCondensed-Heavy")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Heavy", FontWeight200, FontItalicOn , 100, CFSTR("AvenirNextCondensed-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Heavy", FontWeight300, FontItalicOff, 100, CFSTR("AvenirNextCondensed-Heavy")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Heavy", FontWeight300, FontItalicOn , 100, CFSTR("AvenirNextCondensed-UltraLightItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Heavy", FontWeight400, FontItalicOff, 100, CFSTR("AvenirNextCondensed-Heavy")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Heavy", FontWeight400, FontItalicOn , 100, CFSTR("AvenirNextCondensed-Italic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Heavy", FontWeight500, FontItalicOff, 100, CFSTR("AvenirNextCondensed-Heavy")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Heavy", FontWeight500, FontItalicOn , 100, CFSTR("AvenirNextCondensed-MediumItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Heavy", FontWeight600, FontItalicOff, 100, CFSTR("AvenirNextCondensed-Heavy")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Heavy", FontWeight600, FontItalicOn , 100, CFSTR("AvenirNextCondensed-DemiBoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Heavy", FontWeight700, FontItalicOff, 100, CFSTR("AvenirNextCondensed-Heavy")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Heavy", FontWeight700, FontItalicOn , 100, CFSTR("AvenirNextCondensed-BoldItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Heavy", FontWeight800, FontItalicOff, 100, CFSTR("AvenirNextCondensed-Heavy")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Heavy", FontWeight800, FontItalicOn , 100, CFSTR("AvenirNextCondensed-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Heavy", FontWeight900, FontItalicOff, 100, CFSTR("AvenirNextCondensed-Heavy")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Heavy", FontWeight900, FontItalicOn , 100, CFSTR("AvenirNextCondensed-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-HeavyItalic", FontWeight100, FontItalicOff, 100, CFSTR("AvenirNextCondensed-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-HeavyItalic", FontWeight100, FontItalicOn , 100, CFSTR("AvenirNextCondensed-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-HeavyItalic", FontWeight200, FontItalicOff, 100, CFSTR("AvenirNextCondensed-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-HeavyItalic", FontWeight200, FontItalicOn , 100, CFSTR("AvenirNextCondensed-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-HeavyItalic", FontWeight300, FontItalicOff, 100, CFSTR("AvenirNextCondensed-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-HeavyItalic", FontWeight300, FontItalicOn , 100, CFSTR("AvenirNextCondensed-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-HeavyItalic", FontWeight400, FontItalicOff, 100, CFSTR("AvenirNextCondensed-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-HeavyItalic", FontWeight400, FontItalicOn , 100, CFSTR("AvenirNextCondensed-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-HeavyItalic", FontWeight500, FontItalicOff, 100, CFSTR("AvenirNextCondensed-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-HeavyItalic", FontWeight500, FontItalicOn , 100, CFSTR("AvenirNextCondensed-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-HeavyItalic", FontWeight600, FontItalicOff, 100, CFSTR("AvenirNextCondensed-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-HeavyItalic", FontWeight600, FontItalicOn , 100, CFSTR("AvenirNextCondensed-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-HeavyItalic", FontWeight700, FontItalicOff, 100, CFSTR("AvenirNextCondensed-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-HeavyItalic", FontWeight700, FontItalicOn , 100, CFSTR("AvenirNextCondensed-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-HeavyItalic", FontWeight800, FontItalicOff, 100, CFSTR("AvenirNextCondensed-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-HeavyItalic", FontWeight800, FontItalicOn , 100, CFSTR("AvenirNextCondensed-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-HeavyItalic", FontWeight900, FontItalicOff, 100, CFSTR("AvenirNextCondensed-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-HeavyItalic", FontWeight900, FontItalicOn , 100, CFSTR("AvenirNextCondensed-HeavyItalic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Italic", FontWeight100, FontItalicOff, 100, CFSTR("AvenirNextCondensed-Italic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Italic", FontWeight100, FontItalicOn , 100, CFSTR("AvenirNextCondensed-Italic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Italic", FontWeight200, FontItalicOff, 100, CFSTR("AvenirNextCondensed-Italic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Italic", FontWeight200, FontItalicOn , 100, CFSTR("AvenirNextCondensed-Italic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Italic", FontWeight300, FontItalicOff, 100, CFSTR("AvenirNextCondensed-Italic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Italic", FontWeight300, FontItalicOn , 100, CFSTR("AvenirNextCondensed-Italic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Italic", FontWeight400, FontItalicOff, 100, CFSTR("AvenirNextCondensed-Italic")));
-    EXPECT_TRUE(compareFonts("AvenirNextCondensed-Italic", FontWeight400, FontItalicOn ,&