Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(397)

Unified Diff: third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp

Issue 2858573002: Use FreeType for OpenType Variations on CoreText < 10.12 (Closed)
Patch Set: Use FreeType for OpenType Variations on CoreText < 10.12 Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/mac/CoreTextVariationsSupport.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp
index dc0d44267e1148d88e9a5985fc821db3b18c7c3e..faf1f1e699ce78f18862bcbfb359e3a45c08ebf9 100644
--- a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp
+++ b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp
@@ -307,7 +307,6 @@ static hb_font_funcs_t* HarfBuzzSkiaGetFontFuncs() {
return harf_buzz_skia_font_funcs;
}
-#if !OS(MACOSX)
static hb_blob_t* HarfBuzzSkiaGetTable(hb_face_t* face,
hb_tag_t tag,
void* user_data) {
@@ -331,20 +330,25 @@ static hb_blob_t* HarfBuzzSkiaGetTable(hb_face_t* face,
HB_MEMORY_MODE_WRITABLE, buffer,
WTF::Partitions::FastFree);
}
-#endif
-#if !OS(MACOSX)
static void DeleteTypefaceStream(void* stream_asset_ptr) {
SkStreamAsset* stream_asset =
reinterpret_cast<SkStreamAsset*>(stream_asset_ptr);
delete stream_asset;
}
-#endif
hb_face_t* HarfBuzzFace::CreateFace() {
#if OS(MACOSX)
- hb_face_t* face = hb_coretext_face_create(platform_data_->CgFont());
-#else
+ // hb_face_t needs to be instantiated using the CoreText constructor for
+ // compatibility with AAT font, in which case HarfBuzz' CoreText backend is
+ // used. If we encounter a FreeType backed SkTypeface, for variable fonts on
+ // Mac OS < 10.12, follow the regular OpenType-only codepath below.
+ if (platform_data_->CgFont()) {
+ hb_face_t* face = hb_coretext_face_create(platform_data_->CgFont());
+ DCHECK(face);
+ return face;
+ }
+#endif
hb_face_t* face = nullptr;
DEFINE_STATIC_LOCAL(BooleanHistogram, zero_copy_success_histogram,
@@ -371,7 +375,7 @@ hb_face_t* HarfBuzzFace::CreateFace() {
} else {
zero_copy_success_histogram.Count(true);
}
-#endif
+
DCHECK(face);
return face;
}
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/mac/CoreTextVariationsSupport.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698