Changeset 239122 in webkit
- Timestamp:
- Dec 12, 2018 11:02:53 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 2 deleted
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r239100 r239122 1 2018-12-12 Michael Catanzaro <mcatanzaro@igalia.com> 2 3 Unreviewed manual rollout of r239100-r239102 and r239114 4 https://bugs.webkit.org/show_bug.cgi?id=192151 5 <rdar://problem/46655586> 6 7 * Source/cmake/OptionsGTK.cmake: 8 1 9 2018-12-12 Carlos Garcia Campos <cgarcia@igalia.com> 2 10 -
trunk/LayoutTests/ChangeLog
r239101 r239122 1 2018-12-12 Michael Catanzaro <mcatanzaro@igalia.com> 2 3 Unreviewed manual rollout of r239100-r239102 and r239114 4 https://bugs.webkit.org/show_bug.cgi?id=192151 5 <rdar://problem/46655586> 6 7 * platform/gtk/TestExpectations: 8 * platform/gtk/mathml/opentype/opentype-stretchy-expected.png: 9 * platform/gtk/mathml/opentype/opentype-stretchy-expected.txt: 10 1 11 2018-12-12 Carlos Garcia Campos <cgarcia@igalia.com> 2 12 -
trunk/LayoutTests/platform/gtk/TestExpectations
r239100 r239122 1047 1047 webkit.org/b/161962 fast/forms/implicit-submission.html [ Failure ] 1048 1048 1049 # Font variations build flag is turned off 1050 webkit.org/b/162815 fast/text/variations/ [ Skip ] 1051 webkit.org/b/162815 animations/font-variations/ [ Skip ] 1052 webkit.org/b/162815 legacy-animation-engine/animations/font-variations/ [ Skip ] 1053 1049 1054 webkit.org/b/169531 fast/text/font-selection-font-face-parse.html [ Skip ] 1050 1055 … … 3638 3643 webkit.org/b/192435 fast/css-custom-paint/leaks.html [ Failure ] 3639 3644 3640 webkit.org/b/162815 fast/text/variations/font-face-clamp.html [ ImageOnlyFailure ]3641 webkit.org/b/162815 fast/text/variations/font-selection-properties.html [ ImageOnlyFailure ]3642 webkit.org/b/162815 fast/text/variations/skia-postscript-name.html [ ImageOnlyFailure ]3643 3644 3645 #//////////////////////////////////////////////////////////////////////////////////////// 3645 3646 # End of non-crashing, non-flaky tests failing -
trunk/LayoutTests/platform/gtk/mathml/opentype/opentype-stretchy-expected.txt
r239101 r239122 1 1 layer at (0,0) size 800x600 2 2 RenderView at (0,0) size 800x600 3 layer at (0,0) size 800x3 504 RenderBlock {HTML} at (0,0) size 800x3 505 RenderBody {BODY} at (8,16) size 784x3 183 layer at (0,0) size 800x339 4 RenderBlock {HTML} at (0,0) size 800x339 5 RenderBody {BODY} at (8,16) size 784x307 6 6 RenderBlock {P} at (0,0) size 784x35 7 7 RenderMathMLMath {math} at (0,20) size 26x11 … … 36 36 text run at (0,-3) width 2: "\x{219F}" 37 37 RenderText {#text} at (0,0) size 0x0 38 RenderBlock {P} at (0,221) size 784x 9739 RenderMathMLMath {math} at (0,0) size 94x9340 RenderMathMLRow {mrow} at (0,0) size 94x9341 RenderMathMLOperator {mo} at (0,0) size 94x9338 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 42 42 RenderBlock (anonymous) at (0,0) size 10x12 43 43 RenderText {#text} at (0,6) size 10x0 -
trunk/Source/WebCore/ChangeLog
r239116 r239122 1 2018-12-12 Michael Catanzaro <mcatanzaro@igalia.com> 2 3 Unreviewed manual rollout of r239100-r239102 and r239114 4 https://bugs.webkit.org/show_bug.cgi?id=192151 5 <rdar://problem/46655586> 6 7 * css/CSSFontFaceSource.cpp: 8 (WebCore::CSSFontFaceSource::font): 9 * loader/cache/CachedFont.cpp: 10 (WebCore::CachedFont::platformDataFromCustomData): 11 * platform/FreeType.cmake: 12 * platform/graphics/FontPlatformData.h: 13 (WebCore::FontPlatformData::isFixedWidth const): Deleted. 14 * platform/graphics/cairo/FontCustomPlatformData.h: 15 * platform/graphics/freetype/FontCacheFreeType.cpp: 16 (WebCore::FontCache::systemFallbackForCharacters): 17 (WebCore::FontCache::createFontPlatformData): 18 (WebCore::getFontPropertiesFromPattern): Deleted. 19 (WebCore::defaultVariationValues): Deleted. 20 (WebCore::buildVariationSettings): Deleted. 21 * platform/graphics/freetype/FontCacheFreeType.h: Removed. 22 * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp: 23 (WebCore::FontCustomPlatformData::FontCustomPlatformData): 24 (WebCore::FontCustomPlatformData::~FontCustomPlatformData): 25 (WebCore::FontCustomPlatformData::fontPlatformData): 26 (WebCore::FontCustomPlatformData::supportsFormat): 27 (WebCore::defaultFontconfigOptions): Deleted. 28 * platform/graphics/freetype/FontPlatformDataFreeType.cpp: 29 (WebCore::setCairoFontOptionsFromFontConfigPattern): 30 (WebCore::getDefaultFontconfigOptions): 31 (WebCore::FontPlatformData::FontPlatformData): 32 (WebCore::FontPlatformData::operator=): 33 (WebCore::FontPlatformData::harfBuzzFace const): 34 (WebCore::FontPlatformData::platformIsEqual const): 35 (WebCore::FontPlatformData::buildScaledFont): 36 (WebCore::FontPlatformData::fcPattern const): Deleted. 37 (WebCore::FontPlatformData::createOpenTypeMathHarfBuzzFont const): Deleted. 38 * platform/graphics/freetype/SimpleFontDataFreeType.cpp: 39 (WebCore::Font::platformCreateScaledFont const): 40 * platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp: 41 (WebCore::fontFeatures): 42 (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): 43 (WebCore::floatToHarfBuzzPosition): Deleted. 44 (WebCore::doubleToHarfBuzzPosition): Deleted. 45 (WebCore::harfBuzzFontFunctions): Deleted. 46 (WebCore::findScriptForVerticalGlyphSubstitution): Deleted. 47 * platform/graphics/harfbuzz/HarfBuzzFace.cpp: Added. 48 (WebCore::HarfBuzzFace::CacheEntry::CacheEntry): 49 (WebCore::HarfBuzzFace::CacheEntry::~CacheEntry): 50 (WebCore::HarfBuzzFace::cache): 51 (WebCore::HarfBuzzFace::HarfBuzzFace): 52 (WebCore::HarfBuzzFace::~HarfBuzzFace): 53 (WebCore::findScriptForVerticalGlyphSubstitution): 54 (WebCore::HarfBuzzFace::setScriptForVerticalGlyphSubstitution): 55 * platform/graphics/harfbuzz/HarfBuzzFace.h: Added. 56 (WebCore::HarfBuzzFace::CacheEntry::create): 57 (WebCore::HarfBuzzFace::CacheEntry::face): 58 (WebCore::HarfBuzzFace::CacheEntry::glyphCache): 59 * platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp: Added. 60 (WebCore::floatToHarfBuzzPosition): 61 (WebCore::doubleToHarfBuzzPosition): 62 (WebCore::CairoGetGlyphWidthAndExtents): 63 (WebCore::harfBuzzGetGlyph): 64 (WebCore::harfBuzzGetGlyphHorizontalAdvance): 65 (WebCore::harfBuzzGetGlyphHorizontalOrigin): 66 (WebCore::harfBuzzGetGlyphExtents): 67 (WebCore::harfBuzzCairoTextGetFontFuncs): 68 (WebCore::harfBuzzCairoGetTable): 69 (WebCore::HarfBuzzFace::createFace): 70 (WebCore::HarfBuzzFace::createFont): 71 * platform/graphics/harfbuzz/HbUniquePtr.h: 72 (WebCore::HbPtrDeleter<hb_face_t>::operator() const): Deleted. 73 * platform/graphics/opentype/OpenTypeMathData.cpp: 74 (WebCore::OpenTypeMathData::OpenTypeMathData): 75 * platform/graphics/win/FontCustomPlatformData.cpp: 76 (WebCore::FontCustomPlatformData::fontPlatformData): 77 * platform/graphics/win/FontCustomPlatformData.h: 78 * platform/graphics/win/FontCustomPlatformDataCairo.cpp: 79 (WebCore::FontCustomPlatformData::fontPlatformData): 80 1 81 2018-12-12 Chris Dumez <cdumez@apple.com> 2 82 -
trunk/Source/WebCore/css/CSSFontFaceSource.cpp
r239100 r239122 233 233 if (!m_inDocumentCustomPlatformData) 234 234 return nullptr; 235 #if PLATFORM(COCOA) 235 236 return Font::create(m_inDocumentCustomPlatformData->fontPlatformData(fontDescription, syntheticBold, syntheticItalic, fontFaceFeatures, fontFaceVariantSettings, fontFaceCapabilities), Font::Origin::Remote); 237 #else 238 return Font::create(m_inDocumentCustomPlatformData->fontPlatformData(fontDescription, syntheticBold, syntheticItalic), Font::Origin::Remote); 239 #endif 236 240 #endif 237 241 -
trunk/Source/WebCore/loader/cache/CachedFont.cpp
r239100 r239122 142 142 FontPlatformData CachedFont::platformDataFromCustomData(FontCustomPlatformData& fontCustomPlatformData, const FontDescription& fontDescription, bool bold, bool italic, const FontFeatureSettings& fontFaceFeatures, const FontVariantSettings& fontFaceVariantSettings, FontSelectionSpecifiedCapabilities fontFaceCapabilities) 143 143 { 144 #if PLATFORM(COCOA) 144 145 return fontCustomPlatformData.fontPlatformData(fontDescription, bold, italic, fontFaceFeatures, fontFaceVariantSettings, fontFaceCapabilities); 146 #else 147 UNUSED_PARAM(fontFaceFeatures); 148 UNUSED_PARAM(fontFaceVariantSettings); 149 UNUSED_PARAM(fontFaceCapabilities); 150 return fontCustomPlatformData.fontPlatformData(fontDescription, bold, italic); 151 #endif 145 152 } 146 153 -
trunk/Source/WebCore/platform/FreeType.cmake
r239101 r239122 12 12 13 13 platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp 14 platform/graphics/harfbuzz/HarfBuzzFace.cpp 14 15 ) 15 16 … … 27 28 list(APPEND WebCore_SOURCES 28 29 platform/graphics/cairo/FontCairoHarfbuzzNG.cpp 30 31 platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp 29 32 ) 30 33 endif () -
trunk/Source/WebCore/platform/graphics/FontPlatformData.h
r239101 r239122 41 41 #if USE(FREETYPE) 42 42 #include "FcUniquePtr.h" 43 #include "H bUniquePtr.h"43 #include "HarfBuzzFace.h" 44 44 #include "RefPtrFontconfig.h" 45 45 #include <memory> … … 113 113 114 114 #if USE(FREETYPE) 115 FontPlatformData(cairo_font_face_t*, FcPattern*, float size, bool fixedWidth, bool syntheticBold, bool syntheticOblique, FontOrientation); 115 FontPlatformData(FcPattern*, const FontDescription&); 116 FontPlatformData(cairo_font_face_t*, const FontDescription&, bool syntheticBold, bool syntheticOblique); 116 117 FontPlatformData(const FontPlatformData&); 117 118 FontPlatformData(FontPlatformData&&) = default; … … 169 170 170 171 #if USE(FREETYPE) 171 H bUniquePtr<hb_font_t> createOpenTypeMathHarfBuzzFont() const;172 HarfBuzzFace& harfBuzzFace() const; 172 173 bool hasCompatibleCharmap() const; 173 FcPattern* fcPattern() const;174 bool isFixedWidth() const { return m_fixedWidth; }175 174 #endif 176 175 … … 250 249 #if USE(FREETYPE) 251 250 RefPtr<FcPattern> m_pattern; 251 mutable std::unique_ptr<HarfBuzzFace> m_harfBuzzFace; 252 252 #endif 253 253 -
trunk/Source/WebCore/platform/graphics/cairo/FontCustomPlatformData.h
r239100 r239122 20 20 */ 21 21 22 #pragma once 22 #ifndef FontCustomPlatformData_h 23 #define FontCustomPlatformData_h 23 24 24 25 #if USE(CAIRO) 25 26 26 #include "RefPtrCairo.h"27 27 #include <wtf/Forward.h> 28 28 #include <wtf/Noncopyable.h> 29 29 30 30 typedef struct FT_FaceRec_* FT_Face; 31 typedef struct _cairo_font_face cairo_font_face_t; 31 32 32 33 namespace WebCore { … … 35 36 class FontPlatformData; 36 37 class SharedBuffer; 37 struct FontSelectionSpecifiedCapabilities;38 struct FontVariantSettings;39 40 template <typename T> class FontTaggedSettings;41 typedef FontTaggedSettings<int> FontFeatureSettings;42 38 43 39 struct FontCustomPlatformData { … … 45 41 public: 46 42 FontCustomPlatformData(FT_Face, SharedBuffer&); 47 ~FontCustomPlatformData() = default;48 FontPlatformData fontPlatformData(const FontDescription&, bool bold, bool italic , const FontFeatureSettings&, const FontVariantSettings&, FontSelectionSpecifiedCapabilities);43 ~FontCustomPlatformData(); 44 FontPlatformData fontPlatformData(const FontDescription&, bool bold, bool italic); 49 45 static bool supportsFormat(const String&); 50 46 51 47 private: 52 RefPtr<cairo_font_face_t>m_fontFace;48 cairo_font_face_t* m_fontFace; 53 49 }; 54 50 … … 58 54 59 55 #endif // USE(CAIRO) 56 57 #endif // FontCustomPlatformData_h -
trunk/Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp
r239100 r239122 23 23 #include "FontCache.h" 24 24 25 #include "CairoUniquePtr.h"26 25 #include "CairoUtilities.h" 27 26 #include "FcUniquePtr.h" 28 #include "FloatConversion.h"29 27 #include "Font.h" 30 #include "FontDescription.h"31 #include "FontCacheFreeType.h"32 28 #include "RefPtrCairo.h" 33 29 #include "RefPtrFontconfig.h" … … 41 37 #if PLATFORM(GTK) 42 38 #include "GtkUtilities.h" 43 #endif44 45 #if ENABLE(VARIATION_FONTS)46 #include FT_MULTIPLE_MASTERS_H47 39 #endif 48 40 … … 88 80 } 89 81 90 static void getFontPropertiesFromPattern(FcPattern* pattern, const FontDescription& fontDescription, bool& fixedWidth, bool& syntheticBold, bool& syntheticOblique)91 {92 fixedWidth = false;93 int spacing;94 if (FcPatternGetInteger(pattern, FC_SPACING, 0, &spacing) == FcResultMatch && spacing == FC_MONO)95 fixedWidth = true;96 97 syntheticBold = false;98 bool descriptionAllowsSyntheticBold = fontDescription.fontSynthesis() & FontSynthesisWeight;99 if (descriptionAllowsSyntheticBold && isFontWeightBold(fontDescription.weight())) {100 // The FC_EMBOLDEN property instructs us to fake the boldness of the font.101 FcBool fontConfigEmbolden = FcFalse;102 if (FcPatternGetBool(pattern, FC_EMBOLDEN, 0, &fontConfigEmbolden) == FcResultMatch)103 syntheticBold = fontConfigEmbolden;104 105 // Fallback fonts may not have FC_EMBOLDEN activated even though it's necessary.106 int weight = 0;107 if (!syntheticBold && FcPatternGetInteger(pattern, FC_WEIGHT, 0, &weight) == FcResultMatch)108 syntheticBold = syntheticBold || weight < FC_WEIGHT_DEMIBOLD;109 }110 111 // We requested an italic font, but Fontconfig gave us one that was neither oblique nor italic.112 syntheticOblique = false;113 int actualFontSlant;114 bool descriptionAllowsSyntheticOblique = fontDescription.fontSynthesis() & FontSynthesisStyle;115 if (descriptionAllowsSyntheticOblique && fontDescription.italic()116 && FcPatternGetInteger(pattern, FC_SLANT, 0, &actualFontSlant) == FcResultMatch) {117 syntheticOblique = actualFontSlant == FC_SLANT_ROMAN;118 }119 }120 121 82 RefPtr<Font> FontCache::systemFallbackForCharacters(const FontDescription& description, const Font*, bool, const UChar* characters, unsigned length) 122 83 { … … 146 107 return nullptr; 147 108 148 bool fixedWidth, syntheticBold, syntheticOblique; 149 getFontPropertiesFromPattern(resultPattern.get(), description, fixedWidth, syntheticBold, syntheticOblique); 150 151 RefPtr<cairo_font_face_t> fontFace = adoptRef(cairo_ft_font_face_create_for_pattern(resultPattern.get())); 152 FontPlatformData alternateFontData(fontFace.get(), resultPattern.get(), description.computedPixelSize(), fixedWidth, syntheticBold, syntheticOblique, description.orientation()); 109 FontPlatformData alternateFontData(resultPattern.get(), description); 153 110 return fontForPlatformData(alternateFontData); 154 111 } … … 376 333 // Never choose unscalable fonts, as they pixelate when displayed at different sizes. 377 334 FcPatternAddBool(pattern.get(), FC_SCALABLE, FcTrue); 378 #if ENABLE(VARIATION_FONTS)379 FcPatternAddBool(pattern.get(), FC_VARIABLE, FcDontCare);380 #endif381 335 String familyNameString(getFamilyNameStringFromFamily(family)); 382 336 if (!FcPatternAddString(pattern.get(), FC_FAMILY, reinterpret_cast<const FcChar8*>(familyNameString.utf8().data()))) … … 429 383 return nullptr; 430 384 431 bool fixedWidth, syntheticBold, syntheticOblique;432 getFontPropertiesFromPattern(pattern.get(), fontDescription, fixedWidth, syntheticBold, syntheticOblique);433 434 RefPtr<cairo_font_face_t> fontFace = adoptRef(cairo_ft_font_face_create_for_pattern(resultPattern.get()));435 #if ENABLE(VARIATION_FONTS)436 // Cairo doesn't have API to get the FT_Face of an unscaled font, so we need to437 // create a temporary scaled font to get the FT_Face.438 CairoUniquePtr<cairo_font_options_t> options(cairo_font_options_copy(getDefaultCairoFontOptions()));439 cairo_matrix_t matrix;440 cairo_matrix_init_identity(&matrix);441 RefPtr<cairo_scaled_font_t> scaledFont = adoptRef(cairo_scaled_font_create(fontFace.get(), &matrix, &matrix, options.get()));442 CairoFtFaceLocker cairoFtFaceLocker(scaledFont.get());443 if (FT_Face freeTypeFace = cairoFtFaceLocker.ftFace()) {444 auto variants = buildVariationSettings(freeTypeFace, fontDescription);445 if (!variants.isEmpty())446 FcPatternAddString(resultPattern.get(), FC_FONT_VARIATIONS, reinterpret_cast<const FcChar8*>(variants.utf8().data()));447 }448 #endif449 auto platformData = std::make_unique<FontPlatformData>(fontFace.get(), resultPattern.get(), fontDescription.computedPixelSize(), fixedWidth, syntheticBold, syntheticOblique, fontDescription.orientation());450 385 // Verify that this font has an encoding compatible with Fontconfig. Fontconfig currently 451 386 // supports three encodings in FcFreeTypeCharIndex: Unicode, Symbol and AppleRoman. 452 387 // If this font doesn't have one of these three encodings, don't select it. 388 auto platformData = std::make_unique<FontPlatformData>(resultPattern.get(), fontDescription); 453 389 if (!platformData->hasCompatibleCharmap()) 454 390 return nullptr; … … 462 398 } 463 399 464 #if ENABLE(VARIATION_FONTS) 465 struct VariationDefaults { 466 float defaultValue; 467 float minimumValue; 468 float maximumValue; 469 }; 470 471 typedef HashMap<FontTag, VariationDefaults, FourCharacterTagHash, FourCharacterTagHashTraits> VariationDefaultsMap; 472 typedef HashMap<FontTag, float, FourCharacterTagHash, FourCharacterTagHashTraits> VariationsMap; 473 474 static VariationDefaultsMap defaultVariationValues(FT_Face face) 475 { 476 VariationDefaultsMap result; 477 FT_MM_Var* ftMMVar; 478 if (FT_Get_MM_Var(face, &ftMMVar)) 479 return result; 480 481 for (unsigned i = 0; i < ftMMVar->num_axis; ++i) { 482 auto tag = ftMMVar->axis[i].tag; 483 auto b1 = 0xFF & (tag >> 24); 484 auto b2 = 0xFF & (tag >> 16); 485 auto b3 = 0xFF & (tag >> 8); 486 auto b4 = 0xFF & (tag >> 0); 487 FontTag resultKey = {{ static_cast<char>(b1), static_cast<char>(b2), static_cast<char>(b3), static_cast<char>(b4) }}; 488 VariationDefaults resultValues = { narrowPrecisionToFloat(ftMMVar->axis[i].def / 65536.), narrowPrecisionToFloat(ftMMVar->axis[i].minimum / 65536.), narrowPrecisionToFloat(ftMMVar->axis[i].maximum / 65536.) }; 489 result.set(resultKey, resultValues); 490 } 491 FT_Done_MM_Var(face->glyph->library, ftMMVar); 492 return result; 493 } 494 495 String buildVariationSettings(FT_Face face, const FontDescription& fontDescription) 496 { 497 auto defaultValues = defaultVariationValues(face); 498 const auto& variations = fontDescription.variationSettings(); 499 500 VariationsMap variationsToBeApplied; 501 auto applyVariation = [&](const FontTag& tag, float value) { 502 auto iterator = defaultValues.find(tag); 503 if (iterator == defaultValues.end()) 504 return; 505 float valueToApply = clampTo(value, iterator->value.minimumValue, iterator->value.maximumValue); 506 variationsToBeApplied.set(tag, valueToApply); 507 }; 508 509 for (auto& variation : variations) 510 applyVariation(variation.tag(), variation.value()); 511 512 StringBuilder builder; 513 for (auto& variation : variationsToBeApplied) { 514 if (!builder.isEmpty()) 515 builder.append(','); 516 builder.append(variation.key[0]); 517 builder.append(variation.key[1]); 518 builder.append(variation.key[2]); 519 builder.append(variation.key[3]); 520 builder.append('='); 521 builder.appendNumber(variation.value); 522 } 523 return builder.toString(); 524 } 525 #endif // ENABLE(VARIATION_FONTS) 526 527 } 400 } -
trunk/Source/WebCore/platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp
r239101 r239122 23 23 #include "FontCustomPlatformData.h" 24 24 25 #include "CairoUtilities.h"26 #include "FontCacheFreeType.h"27 #include "FontDescription.h"28 25 #include "FontPlatformData.h" 29 26 #include "SharedBuffer.h" … … 32 29 #include <ft2build.h> 33 30 #include FT_MODULE_H 34 #include <mutex>35 31 36 32 namespace WebCore { … … 41 37 } 42 38 43 static cairo_user_data_key_t freeTypeFaceKey;44 45 39 FontCustomPlatformData::FontCustomPlatformData(FT_Face freeTypeFace, SharedBuffer& buffer) 46 : m_fontFace( adoptRef(cairo_ft_font_face_create_for_ft_face(freeTypeFace, FT_LOAD_DEFAULT)))40 : m_fontFace(cairo_ft_font_face_create_for_ft_face(freeTypeFace, FT_LOAD_DEFAULT)) 47 41 { 48 42 buffer.ref(); // This is balanced by the buffer->deref() in releaseCustomFontData. 49 43 static cairo_user_data_key_t bufferKey; 50 cairo_font_face_set_user_data(m_fontFace .get(), &bufferKey, &buffer,44 cairo_font_face_set_user_data(m_fontFace, &bufferKey, &buffer, 51 45 static_cast<cairo_destroy_func_t>(releaseCustomFontData)); 52 46 53 47 // Cairo doesn't do FreeType reference counting, so we need to ensure that when 54 48 // this cairo_font_face_t is destroyed, it cleans up the FreeType face as well. 55 cairo_font_face_set_user_data(m_fontFace.get(), &freeTypeFaceKey, freeTypeFace, 49 static cairo_user_data_key_t freeTypeFaceKey; 50 cairo_font_face_set_user_data(m_fontFace, &freeTypeFaceKey, freeTypeFace, 56 51 reinterpret_cast<cairo_destroy_func_t>(reinterpret_cast<void(*)(void)>(FT_Done_Face))); 57 52 } 58 53 59 static FcPattern* defaultFontconfigOptions()54 FontCustomPlatformData::~FontCustomPlatformData() 60 55 { 61 // Get some generic default settings from fontconfig for web fonts. Strategy 62 // from Behdad Esfahbod in https://code.google.com/p/chromium/issues/detail?id=173207#c35 63 // For web fonts, the hint style is overridden in FontCustomPlatformData::FontCustomPlatformData 64 // so Fontconfig will not affect the hint style, but it may disable hinting completely. 65 static FcPattern* pattern = nullptr; 66 static std::once_flag flag; 67 std::call_once(flag, [](FcPattern*) { 68 pattern = FcPatternCreate(); 69 FcConfigSubstitute(nullptr, pattern, FcMatchPattern); 70 cairo_ft_font_options_substitute(getDefaultCairoFontOptions(), pattern); 71 FcDefaultSubstitute(pattern); 72 FcPatternDel(pattern, FC_FAMILY); 73 FcConfigSubstitute(nullptr, pattern, FcMatchFont); 74 }, pattern); 75 return pattern; 56 cairo_font_face_destroy(m_fontFace); 76 57 } 77 58 78 FontPlatformData FontCustomPlatformData::fontPlatformData(const FontDescription& description, bool bold, bool italic , const FontFeatureSettings&, const FontVariantSettings&, FontSelectionSpecifiedCapabilities)59 FontPlatformData FontCustomPlatformData::fontPlatformData(const FontDescription& description, bool bold, bool italic) 79 60 { 80 auto* freeTypeFace = static_cast<FT_Face>(cairo_font_face_get_user_data(m_fontFace.get(), &freeTypeFaceKey)); 81 ASSERT(freeTypeFace); 82 RefPtr<FcPattern> pattern = defaultFontconfigOptions(); 83 #if ENABLE(VARIATION_FONTS) 84 auto variants = buildVariationSettings(freeTypeFace, description); 85 if (!variants.isEmpty()) { 86 pattern = adoptRef(FcPatternDuplicate(pattern.get())); 87 FcPatternAddString(pattern.get(), FC_FONT_VARIATIONS, reinterpret_cast<const FcChar8*>(variants.utf8().data())); 88 } 89 #endif 90 return FontPlatformData(m_fontFace.get(), pattern.get(), description.computedPixelSize(), freeTypeFace->face_flags & FT_FACE_FLAG_FIXED_WIDTH, bold, italic, description.orientation()); 61 return FontPlatformData(m_fontFace, description, bold, italic); 91 62 } 92 63 … … 140 111 #if USE(WOFF2) 141 112 || equalLettersIgnoringASCIICase(format, "woff2") 142 #if ENABLE(VARIATION_FONTS)143 || equalLettersIgnoringASCIICase(format, "woff2-variations")144 #endif145 #endif146 #if ENABLE(VARIATION_FONTS)147 || equalLettersIgnoringASCIICase(format, "woff-variations")148 || equalLettersIgnoringASCIICase(format, "truetype-variations")149 || equalLettersIgnoringASCIICase(format, "opentype-variations")150 113 #endif 151 114 || equalLettersIgnoringASCIICase(format, "woff"); -
trunk/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp
r239101 r239122 29 29 #include "CairoUtilities.h" 30 30 #include "FontCache.h" 31 #include "FontDescription.h" 31 32 #include "SharedBuffer.h" 32 33 #include <cairo-ft.h> … … 34 35 #include <ft2build.h> 35 36 #include FT_TRUETYPE_TABLES_H 36 #include <hb-ft.h>37 #include <hb-ot.h>38 37 #include <wtf/MathExtras.h> 39 38 #include <wtf/text/WTFString.h> … … 102 101 if (FcPatternGetBool(pattern, FC_HINTING, 0, &booleanResult) == FcResultMatch && !booleanResult) 103 102 cairo_font_options_set_hint_style(options, CAIRO_HINT_STYLE_NONE); 104 105 #if ENABLE(VARIATION_FONTS) 106 FcChar8* variations; 107 if (FcPatternGetString(pattern, FC_FONT_VARIATIONS, 0, &variations) == FcResultMatch) { 108 cairo_font_options_set_variations(options, reinterpret_cast<char*>(variations)); 109 } 110 #endif 111 } 112 113 FontPlatformData::FontPlatformData(cairo_font_face_t* fontFace, FcPattern* pattern, float size, bool fixedWidth, bool syntheticBold, bool syntheticOblique, FontOrientation orientation) 114 : FontPlatformData(size, syntheticBold, syntheticOblique, orientation) 115 { 116 m_pattern = pattern; 117 m_fixedWidth = fixedWidth; 118 103 } 104 105 static FcPattern* getDefaultFontconfigOptions() 106 { 107 // Get some generic default settings from fontconfig for web fonts. Strategy 108 // from Behdad Esfahbod in https://code.google.com/p/chromium/issues/detail?id=173207#c35 109 // For web fonts, the hint style is overridden in FontCustomPlatformData::FontCustomPlatformData 110 // so Fontconfig will not affect the hint style, but it may disable hinting completely. 111 static FcPattern* pattern = nullptr; 112 static std::once_flag flag; 113 std::call_once(flag, [](FcPattern*) { 114 pattern = FcPatternCreate(); 115 FcConfigSubstitute(nullptr, pattern, FcMatchPattern); 116 cairo_ft_font_options_substitute(getDefaultCairoFontOptions(), pattern); 117 FcDefaultSubstitute(pattern); 118 FcPatternDel(pattern, FC_FAMILY); 119 FcConfigSubstitute(nullptr, pattern, FcMatchFont); 120 }, pattern); 121 return pattern; 122 } 123 124 FontPlatformData::FontPlatformData(FcPattern* pattern, const FontDescription& fontDescription) 125 : m_pattern(pattern) 126 , m_size(fontDescription.computedPixelSize()) 127 , m_orientation(fontDescription.orientation()) 128 { 129 ASSERT(m_pattern); 130 RefPtr<cairo_font_face_t> fontFace = adoptRef(cairo_ft_font_face_create_for_pattern(m_pattern.get())); 131 132 int spacing; 133 if (FcPatternGetInteger(pattern, FC_SPACING, 0, &spacing) == FcResultMatch && spacing == FC_MONO) 134 m_fixedWidth = true; 135 136 bool descriptionAllowsSyntheticBold = fontDescription.fontSynthesis() & FontSynthesisWeight; 137 if (descriptionAllowsSyntheticBold && isFontWeightBold(fontDescription.weight())) { 138 // The FC_EMBOLDEN property instructs us to fake the boldness of the font. 139 FcBool fontConfigEmbolden = FcFalse; 140 if (FcPatternGetBool(pattern, FC_EMBOLDEN, 0, &fontConfigEmbolden) == FcResultMatch) 141 m_syntheticBold = fontConfigEmbolden; 142 143 // Fallback fonts may not have FC_EMBOLDEN activated even though it's necessary. 144 int weight = 0; 145 if (!m_syntheticBold && FcPatternGetInteger(pattern, FC_WEIGHT, 0, &weight) == FcResultMatch) 146 m_syntheticBold = m_syntheticBold || weight < FC_WEIGHT_DEMIBOLD; 147 } 148 149 // We requested an italic font, but Fontconfig gave us one that was neither oblique nor italic. 150 int actualFontSlant; 151 bool descriptionAllowsSyntheticOblique = fontDescription.fontSynthesis() & FontSynthesisStyle; 152 if (descriptionAllowsSyntheticOblique && fontDescription.italic() 153 && FcPatternGetInteger(pattern, FC_SLANT, 0, &actualFontSlant) == FcResultMatch) { 154 m_syntheticOblique = actualFontSlant == FC_SLANT_ROMAN; 155 } 156 157 buildScaledFont(fontFace.get()); 158 } 159 160 FontPlatformData::FontPlatformData(cairo_font_face_t* fontFace, const FontDescription& description, bool bold, bool italic) 161 : m_size(description.computedPixelSize()) 162 , m_orientation(description.orientation()) 163 , m_syntheticBold(bold) 164 , m_syntheticOblique(italic) 165 { 119 166 buildScaledFont(fontFace); 167 168 CairoFtFaceLocker cairoFtFaceLocker(m_scaledFont.get()); 169 if (FT_Face fontConfigFace = cairoFtFaceLocker.ftFace()) 170 m_fixedWidth = fontConfigFace->face_flags & FT_FACE_FLAG_FIXED_WIDTH; 120 171 } 121 172 … … 146 197 147 198 m_scaledFont = other.m_scaledFont; 199 200 // This will be re-created on demand. 201 m_harfBuzzFace = nullptr; 148 202 149 203 return *this; … … 184 238 } 185 239 186 FcPattern* FontPlatformData::fcPattern() const 187 { 188 return m_pattern.get(); 240 HarfBuzzFace& FontPlatformData::harfBuzzFace() const 241 { 242 if (!m_harfBuzzFace) 243 m_harfBuzzFace = std::make_unique<HarfBuzzFace>(const_cast<FontPlatformData&>(*this), hash()); 244 return *m_harfBuzzFace; 189 245 } 190 246 … … 201 257 bool FontPlatformData::platformIsEqual(const FontPlatformData& other) const 202 258 { 203 if (m_pattern != other.m_pattern && !FcPatternEqual(m_pattern.get(), other.m_pattern.get())) 259 // FcPatternEqual does not support null pointers as arguments. 260 if ((m_pattern && !other.m_pattern) 261 || (!m_pattern && other.m_pattern) 262 || (m_pattern != other.m_pattern && !FcPatternEqual(m_pattern.get(), other.m_pattern.get()))) 204 263 return false; 205 264 … … 216 275 void FontPlatformData::buildScaledFont(cairo_font_face_t* fontFace) 217 276 { 218 ASSERT(m_pattern);219 277 CairoUniquePtr<cairo_font_options_t> options(cairo_font_options_copy(getDefaultCairoFontOptions())); 220 setCairoFontOptionsFromFontConfigPattern(options.get(), m_pattern.get()); 278 FcPattern* optionsPattern = m_pattern ? m_pattern.get() : getDefaultFontconfigOptions(); 279 setCairoFontOptionsFromFontConfigPattern(options.get(), optionsPattern); 221 280 222 281 cairo_matrix_t ctm; … … 230 289 231 290 // These matrices may be stacked in the pattern, so it's our job to get them all and multiply them. 232 for (int i = 0; FcPatternGetMatrix( m_pattern.get(), FC_MATRIX, i, &tempFontConfigMatrix) == FcResultMatch; i++)291 for (int i = 0; FcPatternGetMatrix(optionsPattern, FC_MATRIX, i, &tempFontConfigMatrix) == FcResultMatch; i++) 233 292 FcMatrixMultiply(&fontConfigMatrix, &fontConfigMatrix, tempFontConfigMatrix); 234 293 … … 294 353 } 295 354 296 HbUniquePtr<hb_font_t> FontPlatformData::createOpenTypeMathHarfBuzzFont() const297 {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 310 355 } // namespace WebCore -
trunk/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp
r239100 r239122 144 144 { 145 145 ASSERT(m_platformData.scaledFont()); 146 FontDescription scaledFontDescription = fontDescription; 147 scaledFontDescription.setComputedSize(scaleFactor * fontDescription.computedSize()); 146 148 return Font::create(FontPlatformData(cairo_scaled_font_get_font_face(m_platformData.scaledFont()), 147 m_platformData.fcPattern(), 148 scaleFactor * fontDescription.computedSize(), 149 m_platformData.isFixedWidth(), 149 scaledFontDescription, 150 150 m_platformData.syntheticBold(), 151 m_platformData.syntheticOblique(), 152 fontDescription.orientation()), 151 m_platformData.syntheticOblique()), 153 152 origin(), Interstitial::No); 154 153 } -
trunk/Source/WebCore/platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp
r239102 r239122 27 27 #include "ComplexTextController.h" 28 28 29 #include "CairoUtilities.h"30 29 #include "FontCascade.h" 31 30 #include "HbUniquePtr.h" 32 31 #include "SurrogatePairAwareTextIterator.h" 33 #include <hb-ft.h>34 32 #include <hb-icu.h> 35 #include <hb-ot.h>36 37 #if ENABLE(VARIATION_FONTS)38 #include FT_MULTIPLE_MASTERS_H39 #endif40 33 41 34 namespace WebCore { … … 44 37 { 45 38 return static_cast<float>(value) / (1 << 16); 46 }47 48 static inline hb_position_t floatToHarfBuzzPosition(float value)49 {50 return static_cast<hb_position_t>(value * (1 << 16));51 }52 53 static inline hb_position_t doubleToHarfBuzzPosition(double value)54 {55 return static_cast<hb_position_t>(value * (1 << 16));56 }57 58 static 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 #else86 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 #endif92 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;130 39 } 131 40 … … 175 84 } 176 85 177 static const hb_tag_t s_vertTag = HB_TAG('v', 'e', 'r', 't'); 178 static const hb_tag_t s_vrt2Tag = HB_TAG('v', 'r', 't', '2'); 179 static const hb_tag_t s_kernTag = HB_TAG('k', 'e', 'r', 'n'); 180 static const unsigned s_hbEnd = static_cast<unsigned>(-1); 86 static const unsigned hbEnd = static_cast<unsigned>(-1); 181 87 182 88 static Vector<hb_feature_t, 4> fontFeatures(const FontCascade& font, FontOrientation orientation) … … 185 91 186 92 if (orientation == FontOrientation::Vertical) { 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 };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 }; 192 98 if (font.enableKerning()) 193 99 kerning.value = 1; … … 196 102 for (auto& feature : font.fontDescription().featureSettings()) { 197 103 auto& tag = feature.tag(); 198 features.append({ HB_TAG(tag[0], tag[1], tag[2], tag[3]), static_cast<uint32_t>(feature.value()), 0, s_hbEnd });104 features.append({ HB_TAG(tag[0], tag[1], tag[2], tag[3]), static_cast<uint32_t>(feature.value()), 0, hbEnd }); 199 105 } 200 106 … … 263 169 } 264 170 265 static 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 286 171 void ComplexTextController::collectComplexTextRunsForCharacters(const UChar* characters, unsigned length, unsigned stringLocation, const Font* font) 287 172 { … … 307 192 308 193 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 #endif340 341 hb_font_make_immutable(harfBuzzFont.get());342 343 194 auto features = fontFeatures(m_font, fontPlatformData.orientation()); 344 195 HbUniquePtr<hb_buffer_t> buffer(hb_buffer_create()); 345 if (fontPlatformData.orientation() == FontOrientation::Vertical)346 hb_buffer_set_script(buffer.get(), findScriptForVerticalGlyphSubstitution(face.get()));347 196 348 197 for (unsigned i = 0; i < runCount; ++i) { 349 198 auto& run = runList[m_run.rtl() ? runCount - i - 1 : i]; 350 199 351 if (fontPlatformData.orientation() != FontOrientation::Vertical) 352 hb_buffer_set_script(buffer.get(), hb_icu_script_to_script(run.script)); 200 hb_buffer_set_script(buffer.get(), hb_icu_script_to_script(run.script)); 353 201 if (!m_mayUseNaturalWritingDirection || m_run.directionalOverride()) 354 202 hb_buffer_set_direction(buffer.get(), m_run.rtl() ? HB_DIRECTION_RTL : HB_DIRECTION_LTR); … … 359 207 hb_buffer_add_utf16(buffer.get(), reinterpret_cast<const uint16_t*>(characters), length, run.startIndex, run.endIndex - run.startIndex); 360 208 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()); 361 214 hb_shape(harfBuzzFont.get(), buffer.get(), features.isEmpty() ? nullptr : features.data(), features.size()); 362 215 m_complexTextRuns.append(ComplexTextRun::create(buffer.get(), *font, characters, stringLocation, length, run.startIndex, run.endIndex)); -
trunk/Source/WebCore/platform/graphics/harfbuzz/HbUniquePtr.h
r239101 r239122 53 53 }; 54 54 55 template<> struct HbPtrDeleter<hb_face_t> {56 void operator()(hb_face_t* ptr) const57 {58 hb_face_destroy(ptr);59 }60 };61 62 55 } // namespace WebCore 63 56 -
trunk/Source/WebCore/platform/graphics/opentype/OpenTypeMathData.cpp
r239101 r239122 35 35 #include "SharedBuffer.h" 36 36 37 37 38 namespace WebCore { 38 39 using namespace std; … … 257 258 #elif USE(HARFBUZZ) 258 259 OpenTypeMathData::OpenTypeMathData(const FontPlatformData& font) 259 : m_mathFont(font.createOpenTypeMathHarfBuzzFont()) 260 { 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; 261 264 } 262 265 #elif USE(DIRECT2D) … … 294 297 return value * font.sizePerUnit(); 295 298 #elif USE(HARFBUZZ) 296 float OpenTypeMathData::getMathConstant(const Font& font, MathConstant constant) const299 float OpenTypeMathData::getMathConstant(const Font&, MathConstant constant) const 297 300 { 298 301 hb_position_t value = hb_ot_math_get_constant(m_mathFont.get(), static_cast<hb_ot_math_constant_t>(constant)); … … 300 303 return value / 100.0; 301 304 302 return value * font.sizePerUnit();305 return value / 65536.0; 303 306 #else 304 307 float OpenTypeMathData::getMathConstant(const Font&, MathConstant) const … … 324 327 return mathItalicsCorrectionInfo->getItalicCorrection(*m_mathBuffer, glyph) * font.sizePerUnit(); 325 328 #elif USE(HARFBUZZ) 326 float OpenTypeMathData::getItalicCorrection(const Font& font, Glyph glyph) const327 { 328 return hb_ot_math_get_glyph_italics_correction(m_mathFont.get(), glyph) * font.sizePerUnit();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; 329 332 #else 330 333 float OpenTypeMathData::getItalicCorrection(const Font&, Glyph) const -
trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformData.cpp
r239100 r239122 47 47 } 48 48 49 FontPlatformData FontCustomPlatformData::fontPlatformData(const FontDescription& fontDescription, bool bold, bool italic , const FontFeatureSettings&, const FontVariantSettings&, FontSelectionSpecifiedCapabilities)49 FontPlatformData FontCustomPlatformData::fontPlatformData(const FontDescription& fontDescription, bool bold, bool italic) 50 50 { 51 51 int size = fontDescription.computedPixelSize(); -
trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformData.h
r239100 r239122 35 35 class FontPlatformData; 36 36 class SharedBuffer; 37 struct FontSelectionSpecifiedCapabilities;38 struct FontVariantSettings;39 40 template <typename T> class FontTaggedSettings;41 typedef FontTaggedSettings<int> FontFeatureSettings;42 37 43 38 struct FontCustomPlatformData { … … 52 47 ~FontCustomPlatformData(); 53 48 54 FontPlatformData fontPlatformData(const FontDescription&, bool bold, bool italic , const FontFeatureSettings&, const FontVariantSettings&, FontSelectionSpecifiedCapabilities);49 FontPlatformData fontPlatformData(const FontDescription&, bool bold, bool italic); 55 50 56 51 static bool supportsFormat(const String&); -
trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.cpp
r239116 r239122 41 41 } 42 42 43 FontPlatformData FontCustomPlatformData::fontPlatformData(const FontDescription& fontDescription, bool bold, bool italic , const FontFeatureSettings&, const FontVariantSettings&, FontSelectionSpecifiedCapabilities)43 FontPlatformData FontCustomPlatformData::fontPlatformData(const FontDescription& fontDescription, bool bold, bool italic) 44 44 { 45 45 int size = fontDescription.computedPixelSize(); -
trunk/Source/cmake/OptionsGTK.cmake
r239100 r239122 126 126 endif () 127 127 128 # Enable variation fonts when cairo >= 1.16, fontconfig >= 2.13.0, freetype >= 2.9.0 and harfbuzz >= 1.4.2.129 if ("${PC_CAIRO_VERSION}" VERSION_GREATER_EQUAL "1.16.0"130 AND "${PC_FONTCONFIG_VERSION}" VERSION_GREATER_EQUAL "2.13.0"131 AND "${FREETYPE_VERSION_STRING}" VERSION_GREATER_EQUAL "2.9.0"132 AND "${PC_HARFBUZZ_VERSION}" VERSION_GREATER_EQUAL "1.4.2")133 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VARIATION_FONTS PRIVATE ON)134 endif ()135 136 128 # Public options shared with other WebKit ports. Do not add any options here 137 129 # without approval from a GTK+ reviewer. There must be strong reason to support -
trunk/Tools/ChangeLog
r239105 r239122 1 2018-12-12 Michael Catanzaro <mcatanzaro@igalia.com> 2 3 Unreviewed manual rollout of r239100-r239102 and r239114 4 https://bugs.webkit.org/show_bug.cgi?id=192151 5 <rdar://problem/46655586> 6 7 * gtk/jhbuild.modules: 8 * gtk/patches/cairo-ft-Use-FT_Done_MM_Var-instead-of-free-when-available.patch: Removed. 9 1 10 2018-12-12 Commit Queue <commit-queue@webkit.org> 2 11 -
trunk/Tools/gtk/jhbuild.modules
r239100 r239122 108 108 <branch module="releases/cairo-1.16.0.tar.xz" version="1.16.0" 109 109 repo="cairographics.org" 110 hash="sha1:00e81842ae5e81bb0343108884eb5205be0eac14"> 111 <!-- See https://gitlab.freedesktop.org/cairo/cairo/merge_requests/5 --> 112 <patch file="cairo-ft-Use-FT_Done_MM_Var-instead-of-free-when-available.patch" strip="1"/> 113 </branch> 110 hash="sha1:00e81842ae5e81bb0343108884eb5205be0eac14"/> 114 111 </autotools> 115 112
Note: See TracChangeset
for help on using the changeset viewer.