Commit fed404ed authored by Dominik Röttsches's avatar Dominik Röttsches Committed by Commit Bot

Always use makeClone for variable font system font instantiation

Skia issue skia:9747 has a fix landed, hence we can remove the
workaround to conditionally branch to makeFromStream().

Bug: 1044966
Change-Id: I16c4401fb5463fa0deb8816e30a8480daec5a9f7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2016647
Auto-Submit: Dominik Röttsches <drott@chromium.org>
Commit-Queue: Ben Wagner <bungeman@chromium.org>
Reviewed-by: default avatarBen Wagner <bungeman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#734498}
parent d5f614c2
......@@ -13,7 +13,6 @@ namespace blink {
// standard Chrome build configuration.
static const uint32_t kBlinkLocalCTVersionNumber10_12 = 0x00090000;
static const uint32_t kBlinkLocalCTVersionNumber10_13 = 0x000A0000;
static const uint32_t kBlinkLocalCTVersionNumber10_15 = 0x000C0000;
bool CoreTextVersionSupportsVariations() {
return &CTGetCoreTextVersion &&
......@@ -27,9 +26,4 @@ bool CoreTextVersionSupportsColrCpal() {
CTGetCoreTextVersion() >= kBlinkLocalCTVersionNumber10_13;
}
bool CoreTextVersionSupportsSystemFontMakeClone() {
return &CTGetCoreTextVersion &&
CTGetCoreTextVersion() >= kBlinkLocalCTVersionNumber10_15;
}
} // namespace blink
......@@ -9,10 +9,6 @@ namespace blink {
bool CoreTextVersionSupportsVariations();
bool CoreTextVersionSupportsColrCpal();
// See https://bugs.chromium.org/p/skia/issues/detail?id=9747 - Depending on
// variation axes parameters Mac OS pre 10.15 produces broken SkTypefaces when
// using makeClone() on system fonts.
bool CoreTextVersionSupportsSystemFontMakeClone();
} // namespace blink
......
......@@ -200,19 +200,8 @@ std::unique_ptr<FontPlatformData> FontPlatformDataFromNSFont(
SkFontArguments::VariationPosition variation_design_position{
coordinates_to_set.data(), coordinates_to_set.size()};
// See https://bugs.chromium.org/p/skia/issues/detail?id=9747 - Depending on
// variation axes parameters Mac OS pre 10.15 produces broken SkTypefaces when
// using makeClone() on system fonts. Work around this issue by only using the
// more efficient makeClone() on supported versions.
if (CoreTextVersionSupportsSystemFontMakeClone()) {
typeface = typeface->makeClone(SkFontArguments().setVariationDesignPosition(
variation_design_position));
} else {
sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault());
typeface = fm->makeFromStream(typeface->openStream(nullptr)->duplicate(),
SkFontArguments().setVariationDesignPosition(
variation_design_position));
}
typeface = typeface->makeClone(
SkFontArguments().setVariationDesignPosition(variation_design_position));
return std::make_unique<FontPlatformData>(
std::move(typeface),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment