Changeset 239101 in webkit


Ignore:
Timestamp:
Dec 12, 2018 1:19:48 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

    r239100 r239101  
     12018-12-12  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

    r221675 r239101  
    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

    r239100 r239101  
     12018-12-12  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

    r237847 r239101  
    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

    r239100 r239101  
    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

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

    r239100 r239101  
    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
     
    302294}
    303295
     296HbUniquePtr<hb_font_t> FontPlatformData::createOpenTypeMathHarfBuzzFont() const
     297{
     298    CairoFtFaceLocker cairoFtFaceLocker(m_scaledFont.get());
     299    FT_Face ftFace = cairoFtFaceLocker.ftFace();
     300    if (!ftFace)
     301        return nullptr;
     302
     303    HbUniquePtr<hb_face_t> face(hb_ft_face_create_cached(ftFace));
     304    if (!hb_ot_math_has_data(face.get()))
     305        return nullptr;
     306
     307    return HbUniquePtr<hb_font_t>(hb_font_create(face.get()));
     308}
     309
    304310} // namespace WebCore
  • trunk/Source/WebCore/platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp

    r236985 r239101  
    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>
    3335
     36#if ENABLE(VARIATION_FONTS)
     37#include FT_MULTIPLE_MASTERS_H
     38#endif
     39
    3440namespace WebCore {
    3541
     
    3743{
    3844    return static_cast<float>(value) / (1 << 16);
     45}
     46
     47static inline hb_position_t floatToHarfBuzzPosition(float value)
     48{
     49    return static_cast<hb_position_t>(value * (1 << 16));
     50}
     51
     52static inline hb_position_t doubleToHarfBuzzPosition(double value)
     53{
     54    return static_cast<hb_position_t>(value * (1 << 16));
     55}
     56
     57static hb_font_funcs_t* harfBuzzFontFunctions()
     58{
     59    static hb_font_funcs_t* fontFunctions = nullptr;
     60
     61    // We don't set callback functions which we can't support.
     62    // Harfbuzz will use the fallback implementation if they aren't set.
     63    if (!fontFunctions) {
     64        fontFunctions = hb_font_funcs_create();
     65#if HB_VERSION_ATLEAST(1, 2, 3)
     66        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 {
     67            auto& font = *static_cast<Font*>(context);
     68            *glyph = font.glyphForCharacter(unicode);
     69            return !!*glyph;
     70        }, nullptr, nullptr);
     71
     72        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 {
     73            auto& font = *static_cast<Font*>(context);
     74            auto* scaledFont = font.platformData().scaledFont();
     75            ASSERT(scaledFont);
     76
     77            CairoFtFaceLocker cairoFtFaceLocker(scaledFont);
     78            if (FT_Face ftFace = cairoFtFaceLocker.ftFace()) {
     79                *glyph = FT_Face_GetCharVariantIndex(ftFace, unicode, variation);
     80                return true;
     81            }
     82            return false;
     83            }, nullptr, nullptr);
     84#else
     85        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 {
     86            auto& font = *static_cast<Font*>(context);
     87            *glyph = font.glyphForCharacter(unicode);
     88            return !!*glyph;
     89        }, nullptr, nullptr);
     90#endif
     91        hb_font_funcs_set_glyph_h_advance_func(fontFunctions, [](hb_font_t*, void* context, hb_codepoint_t point, void*) -> hb_bool_t {
     92            auto& font = *static_cast<Font*>(context);
     93            auto* scaledFont = font.platformData().scaledFont();
     94            ASSERT(scaledFont);
     95
     96            cairo_text_extents_t glyphExtents;
     97            cairo_glyph_t glyph = { point, 0, 0 };
     98            cairo_scaled_font_glyph_extents(scaledFont, &glyph, 1, &glyphExtents);
     99
     100            bool hasVerticalGlyphs = glyphExtents.y_advance;
     101            return doubleToHarfBuzzPosition(hasVerticalGlyphs ? -glyphExtents.y_advance : glyphExtents.x_advance);
     102        }, nullptr, nullptr);
     103
     104        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 {
     105            // Just return true, following the way that Harfbuzz-FreeType implementation does.
     106            return true;
     107        }, nullptr, nullptr);
     108
     109        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 {
     110            auto& font = *static_cast<Font*>(context);
     111            auto* scaledFont = font.platformData().scaledFont();
     112            ASSERT(scaledFont);
     113
     114            cairo_text_extents_t glyphExtents;
     115            cairo_glyph_t glyph = { point, 0, 0 };
     116            cairo_scaled_font_glyph_extents(scaledFont, &glyph, 1, &glyphExtents);
     117
     118            bool hasVerticalGlyphs = glyphExtents.y_advance;
     119            extents->x_bearing = doubleToHarfBuzzPosition(glyphExtents.x_bearing);
     120            extents->y_bearing = doubleToHarfBuzzPosition(hasVerticalGlyphs ? -glyphExtents.y_bearing : glyphExtents.y_bearing);
     121            extents->width = doubleToHarfBuzzPosition(hasVerticalGlyphs ? -glyphExtents.height : glyphExtents.width);
     122            extents->height = doubleToHarfBuzzPosition(hasVerticalGlyphs ? glyphExtents.width : glyphExtents.height);
     123            return true;
     124        }, nullptr, nullptr);
     125
     126        hb_font_funcs_make_immutable(fontFunctions);
     127    }
     128    return fontFunctions;
    39129}
    40130
     
    84174}
    85175
    86 static const unsigned hbEnd = static_cast<unsigned>(-1);
     176static const hb_tag_t s_vertTag = HB_TAG('v', 'e', 'r', 't');
     177static const hb_tag_t s_vrt2Tag = HB_TAG('v', 'r', 't', '2');
     178static const hb_tag_t s_kernTag = HB_TAG('k', 'e', 'r', 'n');
     179static const unsigned s_hbEnd = static_cast<unsigned>(-1);
    87180
    88181static Vector<hb_feature_t, 4> fontFeatures(const FontCascade& font, FontOrientation orientation)
     
    91184
    92185    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 };
     186        features.append({ s_vertTag, 1, 0, s_hbEnd });
     187        features.append({ s_vrt2Tag, 1, 0, s_hbEnd });
     188    }
     189
     190    hb_feature_t kerning = { s_kernTag, 0, 0, s_hbEnd };
    98191    if (font.enableKerning())
    99192        kerning.value = 1;
     
    102195    for (auto& feature : font.fontDescription().featureSettings()) {
    103196        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 });
     197        features.append({ HB_TAG(tag[0], tag[1], tag[2], tag[3]), static_cast<uint32_t>(feature.value()), 0, s_hbEnd });
    105198    }
    106199
     
    169262}
    170263
     264static hb_script_t findScriptForVerticalGlyphSubstitution(hb_face_t* face)
     265{
     266    static const unsigned maxCount = 32;
     267
     268    unsigned scriptCount = maxCount;
     269    hb_tag_t scriptTags[maxCount];
     270    hb_ot_layout_table_get_script_tags(face, HB_OT_TAG_GSUB, 0, &scriptCount, scriptTags);
     271    for (unsigned scriptIndex = 0; scriptIndex < scriptCount; ++scriptIndex) {
     272        unsigned languageCount = maxCount;
     273        hb_tag_t languageTags[maxCount];
     274        hb_ot_layout_script_get_language_tags(face, HB_OT_TAG_GSUB, scriptIndex, 0, &languageCount, languageTags);
     275        for (unsigned languageIndex = 0; languageIndex < languageCount; ++languageIndex) {
     276            unsigned featureIndex;
     277            if (hb_ot_layout_language_find_feature(face, HB_OT_TAG_GSUB, scriptIndex, languageIndex, s_vertTag, &featureIndex)
     278                || hb_ot_layout_language_find_feature(face, HB_OT_TAG_GSUB, scriptIndex, languageIndex, s_vrt2Tag, &featureIndex))
     279                return hb_ot_tag_to_script(scriptTags[scriptIndex]);
     280        }
     281    }
     282    return HB_SCRIPT_INVALID;
     283}
     284
    171285void ComplexTextController::collectComplexTextRunsForCharacters(const UChar* characters, unsigned length, unsigned stringLocation, const Font* font)
    172286{
     
    192306
    193307    const auto& fontPlatformData = font->platformData();
     308    auto* scaledFont = fontPlatformData.scaledFont();
     309    CairoFtFaceLocker cairoFtFaceLocker(scaledFont);
     310    FT_Face ftFace = cairoFtFaceLocker.ftFace();
     311    if (!ftFace)
     312        return;
     313
     314    HbUniquePtr<hb_face_t> face(hb_ft_face_create_cached(ftFace));
     315    HbUniquePtr<hb_font_t> harfBuzzFont(hb_font_create(face.get()));
     316    hb_font_set_funcs(harfBuzzFont.get(), harfBuzzFontFunctions(), const_cast<Font*>(font), nullptr);
     317    const float size = fontPlatformData.size();
     318    if (floorf(size) == size)
     319        hb_font_set_ppem(harfBuzzFont.get(), size, size);
     320    int scale = floatToHarfBuzzPosition(size);
     321    hb_font_set_scale(harfBuzzFont.get(), scale, scale);
     322
     323#if ENABLE(VARIATION_FONTS)
     324    FT_MM_Var* ftMMVar;
     325    if (!FT_Get_MM_Var(ftFace, &ftMMVar)) {
     326        Vector<FT_Fixed, 4> coords;
     327        coords.resize(ftMMVar->num_axis);
     328        if (!FT_Get_Var_Design_Coordinates(ftFace, coords.size(), coords.data())) {
     329            Vector<hb_variation_t, 4> variations(coords.size());
     330            for (FT_UInt i = 0; i < ftMMVar->num_axis; ++i) {
     331                variations[i].tag = ftMMVar->axis[i].tag;
     332                variations[i].value = coords[i] / 65536.0;
     333            }
     334            hb_font_set_variations(harfBuzzFont.get(), variations.data(), variations.size());
     335        }
     336        FT_Done_MM_Var(ftFace->glyph->library, ftMMVar);
     337    }
     338#endif
     339
     340    hb_font_make_immutable(harfBuzzFont.get());
     341
    194342    auto features = fontFeatures(m_font, fontPlatformData.orientation());
    195343    HbUniquePtr<hb_buffer_t> buffer(hb_buffer_create());
     344    if (fontPlatformData.orientation() == FontOrientation::Vertical)
     345        hb_buffer_set_script(buffer.get(), findScriptForVerticalGlyphSubstitution(face.get()));
    196346
    197347    for (unsigned i = 0; i < runCount; ++i) {
    198348        auto& run = runList[m_run.rtl() ? runCount - i - 1 : i];
    199349
    200         hb_buffer_set_script(buffer.get(), hb_icu_script_to_script(run.script));
     350        if (fontPlatformData.orientation() != FontOrientation::Vertical)
     351            hb_buffer_set_script(buffer.get(), hb_icu_script_to_script(run.script));
    201352        if (!m_mayUseNaturalWritingDirection || m_run.directionalOverride())
    202353            hb_buffer_set_direction(buffer.get(), m_run.rtl() ? HB_DIRECTION_RTL : HB_DIRECTION_LTR);
     
    207358        hb_buffer_add_utf16(buffer.get(), reinterpret_cast<const uint16_t*>(characters), length, run.startIndex, run.endIndex - run.startIndex);
    208359
    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());
    214360        hb_shape(harfBuzzFont.get(), buffer.get(), features.isEmpty() ? nullptr : features.data(), features.size());
    215361        m_complexTextRuns.append(ComplexTextRun::create(buffer.get(), *font, characters, stringLocation, length, run.startIndex, run.endIndex));
  • trunk/Source/WebCore/platform/graphics/harfbuzz/HbUniquePtr.h

    r222843 r239101  
    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

    r237394 r239101  
    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.