| Index: Source/platform/fonts/harfbuzz/HarfBuzzFaceCoreText.mm
|
| diff --git a/Source/platform/fonts/harfbuzz/HarfBuzzFaceCoreText.mm b/Source/platform/fonts/harfbuzz/HarfBuzzFaceCoreText.mm
|
| index 84687955f01a7ae145d05a627f0edb316210e27a..7d212341f3ac2f866249b7830599bd0eb728c21c 100644
|
| --- a/Source/platform/fonts/harfbuzz/HarfBuzzFaceCoreText.mm
|
| +++ b/Source/platform/fonts/harfbuzz/HarfBuzzFaceCoreText.mm
|
| @@ -105,6 +105,43 @@ static hb_position_t getGlyphHorizontalAdvance(hb_font_t* hbFont, void* fontData
|
| return floatToHarfBuzzPosition(advance.width + syntheticBoldOffset);
|
| }
|
|
|
| +static hb_bool_t harfBuzzGetGlyphVerticalOrigin(hb_font_t* hbFont, void* fontData, hb_codepoint_t glyph, hb_position_t* x, hb_position_t* y, void* userData)
|
| +{
|
| + FontPlatformData* fontPlatformData = reinterpret_cast<FontPlatformData*>(fontData);
|
| +
|
| + OpenTypeVerticalData* verticalData = fontPlatformData->verticalData().get();
|
| + if (!verticalData)
|
| + return false;
|
| +
|
| + // FIXME: This should be using the existing SimpleFontData or SkFontMetrics.
|
| + RefPtr<SimpleFontData> simpleFontData = SimpleFontData::create(*fontPlatformData);
|
| + float result[] = { 0, 0 };
|
| +
|
| + Glyph theGlyph = glyph;
|
| + verticalData->getVerticalTranslationsForGlyphs(simpleFontData.get(), &theGlyph, 1, result);
|
| + *x = floatToHarfBuzzPosition(-result[0]);
|
| + *y = floatToHarfBuzzPosition(-result[1]);
|
| +
|
| + return true;
|
| +}
|
| +
|
| +static hb_position_t harfBuzzGetGlyphVerticalAdvance(hb_font_t* hbFont, void* fontData, hb_codepoint_t glyph, void* userData)
|
| +{
|
| + FontPlatformData* fontPlatformData = reinterpret_cast<FontPlatformData*>(fontData);
|
| +
|
| + RefPtr<SimpleFontData> simpleFontData = SimpleFontData::create(*fontPlatformData);
|
| + OpenTypeVerticalData* verticalData = fontPlatformData->verticalData().get();
|
| +
|
| + if (!verticalData)
|
| + return floatToHarfBuzzPosition(simpleFontData->fontMetrics().height());
|
| +
|
| + // FIXME: This should be using the existing SimpleFontData or SkFontMetrics.
|
| + Glyph theGlyph = glyph;
|
| + float advanceHeight = verticalData->advanceHeight(simpleFontData.get(), theGlyph);
|
| +
|
| + return floatToHarfBuzzPosition(advanceHeight);
|
| +}
|
| +
|
| static hb_bool_t getGlyphHorizontalOrigin(hb_font_t* hbFont, void* fontData, hb_codepoint_t glyph, hb_position_t* x, hb_position_t* y, void* userData)
|
| {
|
| return true;
|
| @@ -133,6 +170,8 @@ static hb_font_funcs_t* harfBuzzCoreTextGetFontFuncs()
|
| hb_font_funcs_set_glyph_func(harfBuzzCoreTextFontFuncs, getGlyph, 0, 0);
|
| hb_font_funcs_set_glyph_h_advance_func(harfBuzzCoreTextFontFuncs, getGlyphHorizontalAdvance, 0, 0);
|
| hb_font_funcs_set_glyph_h_origin_func(harfBuzzCoreTextFontFuncs, getGlyphHorizontalOrigin, 0, 0);
|
| + hb_font_funcs_set_glyph_v_advance_func(harfBuzzCoreTextFontFuncs, harfBuzzGetGlyphVerticalAdvance, 0, 0);
|
| + hb_font_funcs_set_glyph_v_origin_func(harfBuzzCoreTextFontFuncs, harfBuzzGetGlyphVerticalOrigin, 0, 0);
|
| hb_font_funcs_set_glyph_extents_func(harfBuzzCoreTextFontFuncs, getGlyphExtents, 0, 0);
|
| hb_font_funcs_make_immutable(harfBuzzCoreTextFontFuncs);
|
| }
|
|
|