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

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

Issue 1192473003: Revert "Add Unicode Variation Selector support to harfBuzzGetGlyph" (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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
Index: Source/platform/fonts/shaping/HarfBuzzFace.cpp
diff --git a/Source/platform/fonts/shaping/HarfBuzzFace.cpp b/Source/platform/fonts/shaping/HarfBuzzFace.cpp
index 7506eb9542911a799102d0f40b0e667347999514..c4c4d5a5e1a6aa7c010ee1f99875594b222b7d52 100644
--- a/Source/platform/fonts/shaping/HarfBuzzFace.cpp
+++ b/Source/platform/fonts/shaping/HarfBuzzFace.cpp
@@ -143,23 +143,12 @@ void HarfBuzzFace::setScriptForVerticalGlyphSubstitution(hb_buffer_t* buffer)
}
struct HarfBuzzFontData {
- HarfBuzzFontData(WTF::HashMap<uint32_t, uint16_t>* glyphCacheForFaceCacheEntry, hb_face_t* face)
+ HarfBuzzFontData(WTF::HashMap<uint32_t, uint16_t>* glyphCacheForFaceCacheEntry)
: m_glyphCacheForFaceCacheEntry(glyphCacheForFaceCacheEntry)
- , m_face(face)
- , m_hbOpenTypeFont(nullptr)
{ }
-
- ~HarfBuzzFontData()
- {
- if (m_hbOpenTypeFont)
- hb_font_destroy(m_hbOpenTypeFont);
- }
-
SkPaint m_paint;
RefPtr<SimpleFontData> m_simpleFontData;
WTF::HashMap<uint32_t, uint16_t>* m_glyphCacheForFaceCacheEntry;
- hb_face_t* m_face;
- hb_font_t* m_hbOpenTypeFont;
};
static hb_position_t SkiaScalarToHarfBuzzPosition(SkScalar value)
@@ -190,20 +179,11 @@ static void SkiaGetGlyphWidthAndExtents(SkPaint* paint, hb_codepoint_t codepoint
static hb_bool_t harfBuzzGetGlyph(hb_font_t* hbFont, void* fontData, hb_codepoint_t unicode, hb_codepoint_t variationSelector, hb_codepoint_t* glyph, void* userData)
{
- HarfBuzzFontData* hbFontData = reinterpret_cast<HarfBuzzFontData*>(fontData);
+ // Variation selectors not supported.
+ if (variationSelector)
+ return false;
- if (variationSelector) {
- // Skia does not support variation selectors, but hb does.
- // We're not fully ready to switch to hb-ot-font yet,
- // but are good enough to get glyph IDs for OpenType fonts.
- if (!hbFontData->m_hbOpenTypeFont) {
- hbFontData->m_hbOpenTypeFont = hb_font_create(hbFontData->m_face);
- hb_ot_font_set_funcs(hbFontData->m_hbOpenTypeFont);
- }
- return hb_font_get_glyph(hbFontData->m_hbOpenTypeFont, unicode, variationSelector, glyph);
- // When not found, glyph_func should return false rather than fallback to the base.
- // http://lists.freedesktop.org/archives/harfbuzz/2015-May/004888.html
- }
+ HarfBuzzFontData* hbFontData = reinterpret_cast<HarfBuzzFontData*>(fontData);
WTF::HashMap<uint32_t, uint16_t>::AddResult result = hbFontData->m_glyphCacheForFaceCacheEntry->add(unicode, 0);
if (result.isNewEntry) {
@@ -353,7 +333,7 @@ hb_face_t* HarfBuzzFace::createFace()
hb_font_t* HarfBuzzFace::createFont()
{
- HarfBuzzFontData* hbFontData = new HarfBuzzFontData(m_glyphCacheForFaceCacheEntry, m_face);
+ HarfBuzzFontData* hbFontData = new HarfBuzzFontData(m_glyphCacheForFaceCacheEntry);
m_platformData->setupPaint(&hbFontData->m_paint);
hbFontData->m_simpleFontData = FontCache::fontCache()->fontDataFromFontPlatformData(m_platformData);
ASSERT(hbFontData->m_simpleFontData);

Powered by Google App Engine
This is Rietveld 408576698