Changeset 239157 in webkit


Ignore:
Timestamp:
Dec 13, 2018 1:43:46 AM (5 years ago)
Author:
Carlos Garcia Campos
Message:

[FreeType] Remove HarfBuzzFace
https://bugs.webkit.org/show_bug.cgi?id=192589

Reviewed by Michael Catanzaro.

Source/WebCore:

This was used to share the common implementation with the chromium port, but now that only freetype based ports
use it, it can be removed and use hb_ft_face_create_cached() instead. We don't need the glyph cache either,
since we are already caching glyphs in Font.

  • platform/FreeType.cmake: Remove HarfBuzzFaceCairo.cpp and HarfBuzzFace.cpp.
  • platform/graphics/FontPlatformData.h: Remove HarfBuzzFace member.
  • platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp: Add missing include.
  • platform/graphics/freetype/FontPlatformDataFreeType.cpp:

(WebCore::FontPlatformData::operator=): Remove m_harfBuzzFace handling.
(WebCore::FontPlatformData::createOpenTypeMathHarfBuzzFont const): New funtction to create a hb_font_t for
OpenType math.

  • platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp:

(WebCore::floatToHarfBuzzPosition): Moved from HarfBuzzFaceCairo.cpp.
(WebCore::doubleToHarfBuzzPosition): Ditto.
(WebCore::harfBuzzFontFunctions): Also moved from HarfBuzzFaceCairo.cpp, but implement get_nominal/variation
functions when using HarfBuzz >= 1.2.3 and use Font::glyphForCharacter() to make it simpler.
(WebCore::fontFeatures): Moved from HarfBuzzFaceCairo.cpp.
(WebCore::findScriptForVerticalGlyphSubstitution): Moved from HarfBuzzFace.cpp.
(WebCore::ComplexTextController::collectComplexTextRunsForCharacters): Create the HarfBuzz face and font here.

  • platform/graphics/harfbuzz/HarfBuzzFace.cpp: Removed.
  • platform/graphics/harfbuzz/HarfBuzzFace.h: Removed.
  • platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp: Removed.
  • platform/graphics/harfbuzz/HbUniquePtr.h:

(WebCore::HbPtrDeleter<hb_face_t>::operator() const): Add deleter for hb_face_t.

  • platform/graphics/opentype/OpenTypeMathData.cpp:

(WebCore::OpenTypeMathData::OpenTypeMathData): Use FontPlatformData::createOpenTypeMathHarfBuzzFont().

LayoutTests:

Rebaseline test that now matches the firefox output.

  • platform/gtk/mathml/opentype/opentype-stretchy-expected.png:
  • platform/gtk/mathml/opentype/opentype-stretchy-expected.txt:
Location:
trunk
Files:
3 deleted
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r239156 r239157  
     12018-12-13  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [FreeType] Remove HarfBuzzFace
     4        https://bugs.webkit.org/show_bug.cgi?id=192589
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        Rebaseline test that now matches the firefox output.
     9
     10        * platform/gtk/mathml/opentype/opentype-stretchy-expected.png:
     11        * platform/gtk/mathml/opentype/opentype-stretchy-expected.txt:
     12
    1132018-12-12  Carlos Garcia Campos  <cgarcia@igalia.com>
    214
  • trunk/LayoutTests/platform/gtk/mathml/opentype/opentype-stretchy-expected.txt

    r239122 r239157  
    11layer at (0,0) size 800x600
    22  RenderView at (0,0) size 800x600
    3 layer at (0,0) size 800x339
    4   RenderBlock {HTML} at (0,0) size 800x339
    5     RenderBody {BODY} at (8,16) size 784x307
     3layer at (0,0) size 800x350
     4  RenderBlock {HTML} at (0,0) size 800x350
     5    RenderBody {BODY} at (8,16) size 784x318
    66      RenderBlock {P} at (0,0) size 784x35
    77        RenderMathMLMath {math} at (0,20) size 26x11
     
    3636                  text run at (0,-3) width 2: "\x{219F}"
    3737        RenderText {#text} at (0,0) size 0x0
    38       RenderBlock {P} at (0,221) size 784x86
    39         RenderMathMLMath {math} at (0,0) size 84x82
    40           RenderMathMLRow {mrow} at (0,0) size 84x82
    41             RenderMathMLOperator {mo} at (0,0) size 84x82
     38      RenderBlock {P} at (0,221) size 784x97
     39        RenderMathMLMath {math} at (0,0) size 94x93
     40          RenderMathMLRow {mrow} at (0,0) size 94x93
     41            RenderMathMLOperator {mo} at (0,0) size 94x93
    4242              RenderBlock (anonymous) at (0,0) size 10x12
    4343                RenderText {#text} at (0,6) size 10x0
  • trunk/Source/WebCore/ChangeLog

    r239156 r239157  
     12018-12-13  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [FreeType] Remove HarfBuzzFace
     4        https://bugs.webkit.org/show_bug.cgi?id=192589
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        This was used to share the common implementation with the chromium port, but now that only freetype based ports
     9        use it, it can be removed and use hb_ft_face_create_cached() instead. We don't need the glyph cache either,
     10        since we are already caching glyphs in Font.
     11
     12        * platform/FreeType.cmake: Remove HarfBuzzFaceCairo.cpp and HarfBuzzFace.cpp.
     13        * platform/graphics/FontPlatformData.h: Remove HarfBuzzFace member.
     14        * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp: Add missing include.
     15        * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
     16        (WebCore::FontPlatformData::operator=): Remove m_harfBuzzFace handling.
     17        (WebCore::FontPlatformData::createOpenTypeMathHarfBuzzFont const): New funtction to create a hb_font_t for
     18        OpenType math.
     19        * platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp:
     20        (WebCore::floatToHarfBuzzPosition): Moved from HarfBuzzFaceCairo.cpp.
     21        (WebCore::doubleToHarfBuzzPosition): Ditto.
     22        (WebCore::harfBuzzFontFunctions): Also moved from HarfBuzzFaceCairo.cpp, but implement get_nominal/variation
     23        functions when using HarfBuzz >= 1.2.3 and use Font::glyphForCharacter() to make it simpler.
     24        (WebCore::fontFeatures): Moved from HarfBuzzFaceCairo.cpp.
     25        (WebCore::findScriptForVerticalGlyphSubstitution): Moved from HarfBuzzFace.cpp.
     26        (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): Create the HarfBuzz face and font here.
     27        * platform/graphics/harfbuzz/HarfBuzzFace.cpp: Removed.
     28        * platform/graphics/harfbuzz/HarfBuzzFace.h: Removed.
     29        * platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp: Removed.
     30        * platform/graphics/harfbuzz/HbUniquePtr.h:
     31        (WebCore::HbPtrDeleter<hb_face_t>::operator() const): Add deleter for hb_face_t.
     32        * platform/graphics/opentype/OpenTypeMathData.cpp:
     33        (WebCore::OpenTypeMathData::OpenTypeMathData): Use FontPlatformData::createOpenTypeMathHarfBuzzFont().
     34
    1352018-12-12  Carlos Garcia Campos  <cgarcia@igalia.com>
    236
  • trunk/Source/WebCore/platform/FreeType.cmake

    r239122 r239157  
    1212
    1313    platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp
    14     platform/graphics/harfbuzz/HarfBuzzFace.cpp
    1514)
    1615
     
    2827    list(APPEND WebCore_SOURCES
    2928        platform/graphics/cairo/FontCairoHarfbuzzNG.cpp
    30 
    31         platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp
    3229    )
    3330endif ()
  • trunk/Source/WebCore/platform/graphics/FontPlatformData.h

    r239156 r239157  
    4141#if USE(FREETYPE)
    4242#include "FcUniquePtr.h"
    43 #include "HarfBuzzFace.h"
     43#include "HbUniquePtr.h"
    4444#include "RefPtrFontconfig.h"
    4545#include <memory>
     
    169169
    170170#if USE(FREETYPE)
    171     HarfBuzzFace& harfBuzzFace() const;
     171    HbUniquePtr<hb_font_t> createOpenTypeMathHarfBuzzFont() const;
    172172    bool hasCompatibleCharmap() const;
    173173    FcPattern* fcPattern() const;
     
    250250#if USE(FREETYPE)
    251251    RefPtr<FcPattern> m_pattern;
    252     mutable std::unique_ptr<HarfBuzzFace> m_harfBuzzFace;
    253252#endif
    254253
  • trunk/Source/WebCore/platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp

    r239156 r239157  
    3232#include <ft2build.h>
    3333#include FT_MODULE_H
     34#include <mutex>
    3435
    3536namespace WebCore {
  • trunk/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp

    r239156 r239157  
    3434#include <ft2build.h>
    3535#include FT_TRUETYPE_TABLES_H
     36#include <hb-ft.h>
     37#include <hb-ot.h>
    3638#include <wtf/MathExtras.h>
    3739#include <wtf/text/WTFString.h>
     
    145147    m_scaledFont = other.m_scaledFont;
    146148
    147     // This will be re-created on demand.
    148     m_harfBuzzFace = nullptr;
    149 
    150149    return *this;
    151150}
     
    183182    copy.buildScaledFont(cairo_scaled_font_get_font_face(copy.m_scaledFont.get()));
    184183    return copy;
    185 }
    186 
    187 HarfBuzzFace& FontPlatformData::harfBuzzFace() const
    188 {
    189     if (!m_harfBuzzFace)
    190         m_harfBuzzFace = std::make_unique<HarfBuzzFace>(const_cast<FontPlatformData&>(*this), hash());
    191     return *m_harfBuzzFace;
    192184}
    193185
     
    305297}
    306298
     299HbUniquePtr<hb_font_t> FontPlatformData::createOpenTypeMathHarfBuzzFont() const
     300{
     301    CairoFtFaceLocker cairoFtFaceLocker(m_scaledFont.get());
     302    FT_Face ftFace = cairoFtFaceLocker.ftFace();
     303    if (!ftFace)
     304        return nullptr;
     305
     306    HbUniquePtr<hb_face_t> face(hb_ft_face_create_cached(ftFace));
     307    if (!hb_ot_math_has_data(face.get()))
     308        return nullptr;
     309
     310    return HbUniquePtr<hb_font_t>(hb_font_create(face.get()));
     311}
     312
    307313} // namespace WebCore
  • trunk/Source/WebCore/platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp

    r239122 r239157  
    2727#include "ComplexTextController.h"
    2828
     29#include "CairoUtilities.h"
    2930#include "FontCascade.h"
    3031#include "HbUniquePtr.h"
    3132#include "SurrogatePairAwareTextIterator.h"
     33#include <hb-ft.h>
    3234#include <hb-icu.h>
     35#include <hb-ot.h>
     36
     37#if ENABLE(VARIATION_FONTS)
     38#include FT_MULTIPLE_MASTERS_H
     39#endif
    3340
    3441namespace WebCore {
     
    3744{
    3845    return static_cast<float>(value) / (1 << 16);
     46}
     47
     48static inline hb_position_t floatToHarfBuzzPosition(float value)
     49{
     50    return static_cast<hb_position_t>(value * (1 << 16));
     51}
     52
     53static inline hb_position_t doubleToHarfBuzzPosition(double value)
     54{
     55    return static_cast<hb_position_t>(value * (1 << 16));
     56}
     57
     58static hb_font_funcs_t* harfBuzzFontFunctions()
     59{
     60    static hb_font_funcs_t* fontFunctions = nullptr;
     61
     62    // We don't set callback functions which we can't support.
     63    // Harfbuzz will use the fallback implementation if they aren't set.
     64    if (!fontFunctions) {
     65        fontFunctions = hb_font_funcs_create();
     66#if HB_VERSION_ATLEAST(1, 2, 3)
     67        hb_font_funcs_set_nominal_glyph_func(fontFunctions, [](hb_font_t*, void* context, hb_codepoint_t unicode, hb_codepoint_t* glyph, void*) -> hb_bool_t {
     68            auto& font = *static_cast<Font*>(context);
     69            *glyph = font.glyphForCharacter(unicode);
     70            return !!*glyph;
     71        }, nullptr, nullptr);
     72
     73        hb_font_funcs_set_variation_glyph_func(fontFunctions, [](hb_font_t*, void* context, hb_codepoint_t unicode, hb_codepoint_t variation, hb_codepoint_t* glyph, void*) -> hb_bool_t {
     74            auto& font = *static_cast<Font*>(context);
     75            auto* scaledFont = font.platformData().scaledFont();
     76            ASSERT(scaledFont);
     77
     78            CairoFtFaceLocker cairoFtFaceLocker(scaledFont);
     79            if (FT_Face ftFace = cairoFtFaceLocker.ftFace()) {
     80                *glyph = FT_Face_GetCharVariantIndex(ftFace, unicode, variation);
     81                return true;
     82            }
     83            return false;
     84            }, nullptr, nullptr);
     85#else
     86        hb_font_funcs_set_glyph_func(fontFunctions, [](hb_font_t*, void* context, hb_codepoint_t unicode, hb_codepoint_t, hb_codepoint_t* glyph, void*) -> hb_bool_t {
     87            auto& font = *static_cast<Font*>(context);
     88            *glyph = font.glyphForCharacter(unicode);
     89            return !!*glyph;
     90        }, nullptr, nullptr);
     91#endif
     92        hb_font_funcs_set_glyph_h_advance_func(fontFunctions, [](hb_font_t*, void* context, hb_codepoint_t point, void*) -> hb_bool_t {
     93            auto& font = *static_cast<Font*>(context);
     94            auto* scaledFont = font.platformData().scaledFont();
     95            ASSERT(scaledFont);
     96
     97            cairo_text_extents_t glyphExtents;
     98            cairo_glyph_t glyph = { point, 0, 0 };
     99            cairo_scaled_font_glyph_extents(scaledFont, &glyph, 1, &glyphExtents);
     100
     101            bool hasVerticalGlyphs = glyphExtents.y_advance;
     102            return doubleToHarfBuzzPosition(hasVerticalGlyphs ? -glyphExtents.y_advance : glyphExtents.x_advance);
     103        }, nullptr, nullptr);
     104
     105        hb_font_funcs_set_glyph_h_origin_func(fontFunctions, [](hb_font_t*, void*, hb_codepoint_t, hb_position_t*, hb_position_t*, void*) -> hb_bool_t {
     106            // Just return true, following the way that Harfbuzz-FreeType implementation does.
     107            return true;
     108        }, nullptr, nullptr);
     109
     110        hb_font_funcs_set_glyph_extents_func(fontFunctions, [](hb_font_t*, void* context, hb_codepoint_t point, hb_glyph_extents_t* extents, void*) -> hb_bool_t {
     111            auto& font = *static_cast<Font*>(context);
     112            auto* scaledFont = font.platformData().scaledFont();
     113            ASSERT(scaledFont);
     114
     115            cairo_text_extents_t glyphExtents;
     116            cairo_glyph_t glyph = { point, 0, 0 };
     117            cairo_scaled_font_glyph_extents(scaledFont, &glyph, 1, &glyphExtents);
     118
     119            bool hasVerticalGlyphs = glyphExtents.y_advance;
     120            extents->x_bearing = doubleToHarfBuzzPosition(glyphExtents.x_bearing);
     121            extents->y_bearing = doubleToHarfBuzzPosition(hasVerticalGlyphs ? -glyphExtents.y_bearing : glyphExtents.y_bearing);
     122            extents->width = doubleToHarfBuzzPosition(hasVerticalGlyphs ? -glyphExtents.height : glyphExtents.width);
     123            extents->height = doubleToHarfBuzzPosition(hasVerticalGlyphs ? glyphExtents.width : glyphExtents.height);
     124            return true;
     125        }, nullptr, nullptr);
     126
     127        hb_font_funcs_make_immutable(fontFunctions);
     128    }
     129    return fontFunctions;
    39130}
    40131
     
    84175}
    85176
    86 static const unsigned hbEnd = static_cast<unsigned>(-1);
     177static const hb_tag_t s_vertTag = HB_TAG('v', 'e', 'r', 't');
     178static const hb_tag_t s_vrt2Tag = HB_TAG('v', 'r', 't', '2');
     179static const hb_tag_t s_kernTag = HB_TAG('k', 'e', 'r', 'n');
     180static const unsigned s_hbEnd = static_cast<unsigned>(-1);
    87181
    88182static Vector<hb_feature_t, 4> fontFeatures(const FontCascade& font, FontOrientation orientation)
     
    91185
    92186    if (orientation == FontOrientation::Vertical) {
    93         features.append({ HarfBuzzFace::vertTag, 1, 0, hbEnd });
    94         features.append({ HarfBuzzFace::vrt2Tag, 1, 0, hbEnd });
    95     }
    96 
    97     hb_feature_t kerning = { HarfBuzzFace::kernTag, 0, 0, hbEnd };
     187        features.append({ s_vertTag, 1, 0, s_hbEnd });
     188        features.append({ s_vrt2Tag, 1, 0, s_hbEnd });
     189    }
     190
     191    hb_feature_t kerning = { s_kernTag, 0, 0, s_hbEnd };
    98192    if (font.enableKerning())
    99193        kerning.value = 1;
     
    102196    for (auto& feature : font.fontDescription().featureSettings()) {
    103197        auto& tag = feature.tag();
    104         features.append({ HB_TAG(tag[0], tag[1], tag[2], tag[3]), static_cast<uint32_t>(feature.value()), 0, hbEnd });
     198        features.append({ HB_TAG(tag[0], tag[1], tag[2], tag[3]), static_cast<uint32_t>(feature.value()), 0, s_hbEnd });
    105199    }
    106200
     
    169263}
    170264
     265static hb_script_t findScriptForVerticalGlyphSubstitution(hb_face_t* face)
     266{
     267    static const unsigned maxCount = 32;
     268
     269    unsigned scriptCount = maxCount;
     270    hb_tag_t scriptTags[maxCount];
     271    hb_ot_layout_table_get_script_tags(face, HB_OT_TAG_GSUB, 0, &scriptCount, scriptTags);
     272    for (unsigned scriptIndex = 0; scriptIndex < scriptCount; ++scriptIndex) {
     273        unsigned languageCount = maxCount;
     274        hb_tag_t languageTags[maxCount];
     275        hb_ot_layout_script_get_language_tags(face, HB_OT_TAG_GSUB, scriptIndex, 0, &languageCount, languageTags);
     276        for (unsigned languageIndex = 0; languageIndex < languageCount; ++languageIndex) {
     277            unsigned featureIndex;
     278            if (hb_ot_layout_language_find_feature(face, HB_OT_TAG_GSUB, scriptIndex, languageIndex, s_vertTag, &featureIndex)
     279                || hb_ot_layout_language_find_feature(face, HB_OT_TAG_GSUB, scriptIndex, languageIndex, s_vrt2Tag, &featureIndex))
     280                return hb_ot_tag_to_script(scriptTags[scriptIndex]);
     281        }
     282    }
     283    return HB_SCRIPT_INVALID;
     284}
     285
    171286void ComplexTextController::collectComplexTextRunsForCharacters(const UChar* characters, unsigned length, unsigned stringLocation, const Font* font)
    172287{
     
    192307
    193308    const auto& fontPlatformData = font->platformData();
     309    auto* scaledFont = fontPlatformData.scaledFont();
     310    CairoFtFaceLocker cairoFtFaceLocker(scaledFont);
     311    FT_Face ftFace = cairoFtFaceLocker.ftFace();
     312    if (!ftFace)
     313        return;
     314
     315    HbUniquePtr<hb_face_t> face(hb_ft_face_create_cached(ftFace));
     316    HbUniquePtr<hb_font_t> harfBuzzFont(hb_font_create(face.get()));
     317    hb_font_set_funcs(harfBuzzFont.get(), harfBuzzFontFunctions(), const_cast<Font*>(font), nullptr);
     318    const float size = fontPlatformData.size();
     319    if (floorf(size) == size)
     320        hb_font_set_ppem(harfBuzzFont.get(), size, size);
     321    int scale = floatToHarfBuzzPosition(size);
     322    hb_font_set_scale(harfBuzzFont.get(), scale, scale);
     323
     324#if ENABLE(VARIATION_FONTS)
     325    FT_MM_Var* ftMMVar;
     326    if (!FT_Get_MM_Var(ftFace, &ftMMVar)) {
     327        Vector<FT_Fixed, 4> coords;
     328        coords.resize(ftMMVar->num_axis);
     329        if (!FT_Get_Var_Design_Coordinates(ftFace, coords.size(), coords.data())) {
     330            Vector<hb_variation_t, 4> variations(coords.size());
     331            for (FT_UInt i = 0; i < ftMMVar->num_axis; ++i) {
     332                variations[i].tag = ftMMVar->axis[i].tag;
     333                variations[i].value = coords[i] / 65536.0;
     334            }
     335            hb_font_set_variations(harfBuzzFont.get(), variations.data(), variations.size());
     336        }
     337        FT_Done_MM_Var(ftFace->glyph->library, ftMMVar);
     338    }
     339#endif
     340
     341    hb_font_make_immutable(harfBuzzFont.get());
     342
    194343    auto features = fontFeatures(m_font, fontPlatformData.orientation());
    195344    HbUniquePtr<hb_buffer_t> buffer(hb_buffer_create());
     345    if (fontPlatformData.orientation() == FontOrientation::Vertical)
     346        hb_buffer_set_script(buffer.get(), findScriptForVerticalGlyphSubstitution(face.get()));
    196347
    197348    for (unsigned i = 0; i < runCount; ++i) {
    198349        auto& run = runList[m_run.rtl() ? runCount - i - 1 : i];
    199350
    200         hb_buffer_set_script(buffer.get(), hb_icu_script_to_script(run.script));
     351        if (fontPlatformData.orientation() != FontOrientation::Vertical)
     352            hb_buffer_set_script(buffer.get(), hb_icu_script_to_script(run.script));
    201353        if (!m_mayUseNaturalWritingDirection || m_run.directionalOverride())
    202354            hb_buffer_set_direction(buffer.get(), m_run.rtl() ? HB_DIRECTION_RTL : HB_DIRECTION_LTR);
     
    207359        hb_buffer_add_utf16(buffer.get(), reinterpret_cast<const uint16_t*>(characters), length, run.startIndex, run.endIndex - run.startIndex);
    208360
    209         auto& face = fontPlatformData.harfBuzzFace();
    210         if (fontPlatformData.orientation() == FontOrientation::Vertical)
    211             face.setScriptForVerticalGlyphSubstitution(buffer.get());
    212 
    213         HbUniquePtr<hb_font_t> harfBuzzFont(face.createFont());
    214361        hb_shape(harfBuzzFont.get(), buffer.get(), features.isEmpty() ? nullptr : features.data(), features.size());
    215362        m_complexTextRuns.append(ComplexTextRun::create(buffer.get(), *font, characters, stringLocation, length, run.startIndex, run.endIndex));
  • trunk/Source/WebCore/platform/graphics/harfbuzz/HbUniquePtr.h

    r239122 r239157  
    5353};
    5454
     55template<> struct HbPtrDeleter<hb_face_t> {
     56    void operator()(hb_face_t* ptr) const
     57    {
     58        hb_face_destroy(ptr);
     59    }
     60};
     61
    5562} // namespace WebCore
    5663
  • trunk/Source/WebCore/platform/graphics/opentype/OpenTypeMathData.cpp

    r239122 r239157  
    3535#include "SharedBuffer.h"
    3636
    37 
    3837namespace WebCore {
    3938using namespace std;
     
    258257#elif USE(HARFBUZZ)
    259258OpenTypeMathData::OpenTypeMathData(const FontPlatformData& font)
    260     : m_mathFont(font.harfBuzzFace().createFont())
    261 {
    262     if (!hb_ot_math_has_data(hb_font_get_face(m_mathFont.get())))
    263         m_mathFont = nullptr;
     259    : m_mathFont(font.createOpenTypeMathHarfBuzzFont())
     260{
    264261}
    265262#elif USE(DIRECT2D)
     
    297294    return value * font.sizePerUnit();
    298295#elif USE(HARFBUZZ)
    299 float OpenTypeMathData::getMathConstant(const Font&, MathConstant constant) const
     296float OpenTypeMathData::getMathConstant(const Font& font, MathConstant constant) const
    300297{
    301298    hb_position_t value = hb_ot_math_get_constant(m_mathFont.get(), static_cast<hb_ot_math_constant_t>(constant));
     
    303300        return value / 100.0;
    304301
    305     return value / 65536.0;
     302    return value * font.sizePerUnit();
    306303#else
    307304float OpenTypeMathData::getMathConstant(const Font&, MathConstant) const
     
    327324    return mathItalicsCorrectionInfo->getItalicCorrection(*m_mathBuffer, glyph) * font.sizePerUnit();
    328325#elif USE(HARFBUZZ)
    329 float OpenTypeMathData::getItalicCorrection(const Font&, Glyph glyph) const
    330 {
    331     return hb_ot_math_get_glyph_italics_correction(m_mathFont.get(), glyph) / 65536.0;
     326float OpenTypeMathData::getItalicCorrection(const Font& font, Glyph glyph) const
     327{
     328    return hb_ot_math_get_glyph_italics_correction(m_mathFont.get(), glyph) * font.sizePerUnit();
    332329#else
    333330float OpenTypeMathData::getItalicCorrection(const Font&, Glyph) const
Note: See TracChangeset for help on using the changeset viewer.