Changeset 189539 in webkit
- Timestamp:
- Sep 9, 2015 5:26:08 AM (9 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r189538 r189539 1 2015-09-09 Antti Koivisto <antti@apple.com> 2 3 Split mixed font GlyphPage functionality to separate class 4 https://bugs.webkit.org/show_bug.cgi?id=148965 5 6 Reviewed by Myles Maxfield. 7 8 Currently GlyphPage class is used for both immutable single font case (in Font) and 9 for caching mixed font mappings (in FontCascadeFonts). It is cleaner to use separate 10 classed for these cases. This will also make future improvements easier. 11 12 * platform/graphics/Font.cpp: 13 (WebCore::Font::~Font): 14 (WebCore::fillGlyphPage): 15 (WebCore::createAndFillGlyphPage): 16 (WebCore::Font::glyphPage): 17 (WebCore::Font::glyphForCharacter): 18 (WebCore::Font::glyphDataForCharacter): 19 * platform/graphics/Font.h: 20 * platform/graphics/FontCascadeFonts.cpp: 21 (WebCore::MixedFontGlyphPage::MixedFontGlyphPage): 22 (WebCore::MixedFontGlyphPage::glyphDataForCharacter): 23 (WebCore::MixedFontGlyphPage::setGlyphDataForCharacter): 24 (WebCore::MixedFontGlyphPage::setGlyphDataForIndex): 25 26 Mixed font pages are now an implementation detail of FontCascadeFonts. 27 28 (WebCore::FontCascadeFonts::GlyphPageCacheEntry::glyphDataForCharacter): 29 (WebCore::FontCascadeFonts::GlyphPageCacheEntry::setGlyphDataForCharacter): 30 (WebCore::FontCascadeFonts::GlyphPageCacheEntry::setSingleFontPage): 31 32 Cache entry is either shared single font GlyphPage or mutable MixedFontGlyphPage. 33 34 (WebCore::FontCascadeFonts::FontCascadeFonts): 35 (WebCore::FontCascadeFonts::glyphDataForCharacter): 36 (WebCore::FontCascadeFonts::pruneSystemFallbacks): 37 * platform/graphics/FontCascadeFonts.h: 38 (WebCore::FontCascadeFonts::GlyphPageCacheEntry::isNull): 39 (WebCore::FontCascadeFonts::GlyphPageCacheEntry::isMixedFont): 40 * platform/graphics/GlyphPage.h: 41 42 GlyphPage is now for single font mappings only. 43 Use regular allocation instead of variable size tricks. 44 It is always immutable after initialization (though currently a setter is still needed). 45 46 (WebCore::GlyphPage::create): 47 (WebCore::GlyphPage::~GlyphPage): 48 (WebCore::GlyphPage::count): 49 (WebCore::GlyphPage::indexForCharacter): 50 (WebCore::GlyphPage::glyphDataForCharacter): 51 (WebCore::GlyphPage::glyphForCharacter): 52 (WebCore::GlyphPage::glyphDataForIndex): 53 (WebCore::GlyphPage::glyphForIndex): 54 (WebCore::GlyphPage::setGlyphForIndex): 55 (WebCore::GlyphPage::font): 56 (WebCore::GlyphPage::GlyphPage): 57 (WebCore::GlyphPage::createForMixedFonts): Deleted. 58 (WebCore::GlyphPage::createCopyForMixedFonts): Deleted. 59 (WebCore::GlyphPage::createForSingleFont): Deleted. 60 (WebCore::GlyphPage::isImmutable): Deleted. 61 (WebCore::GlyphPage::setImmutable): Deleted. 62 (WebCore::GlyphPage::glyphAt): Deleted. 63 (WebCore::GlyphPage::fontForCharacter): Deleted. 64 (WebCore::GlyphPage::setGlyphDataForCharacter): Deleted. 65 (WebCore::GlyphPage::setGlyphDataForIndex): Deleted. 66 (WebCore::GlyphPage::hasPerGlyphFontData): Deleted. 67 * platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp: 68 (WebCore::GlyphPage::fill): 69 * platform/graphics/mac/GlyphPageMac.cpp: 70 (WebCore::GlyphPage::fill): 71 * platform/graphics/opentype/OpenTypeVerticalData.cpp: 72 (WebCore::OpenTypeVerticalData::substituteWithVerticalGlyphs): 73 * platform/graphics/win/GlyphPageTreeNodeCGWin.cpp: 74 (WebCore::GlyphPage::fill): 75 * platform/graphics/win/GlyphPageTreeNodeCairoWin.cpp: 76 (WebCore::GlyphPage::fill): 77 * svg/SVGFontData.cpp: 78 (WebCore::SVGFontData::applySVGGlyphSelection): 79 (WebCore::SVGFontData::fillSVGGlyphPage): 80 (WebCore::SVGFontData::fillBMPGlyphs): 81 (WebCore::SVGFontData::fillNonBMPGlyphs): 82 * svg/SVGFontData.h: 83 (WebCore::SVGFontData::verticalAdvanceY): 84 1 85 2015-09-09 Manuel Rego Casasnovas <rego@igalia.com> 2 86 -
trunk/Source/WebCore/platform/graphics/Font.cpp
r189466 r189539 150 150 } 151 151 152 static bool fillGlyphPage(GlyphPage& pageToFill, UChar* buffer, unsigned bufferLength, const Font *font)152 static bool fillGlyphPage(GlyphPage& pageToFill, UChar* buffer, unsigned bufferLength, const Font& font) 153 153 { 154 154 #if ENABLE(SVG_FONTS) 155 if (auto* svgData = font ->svgData())156 return svgData->fillSVGGlyphPage(&pageToFill, buffer, bufferLength , font);157 #endif 158 bool hasGlyphs = pageToFill.fill(buffer, bufferLength, font);155 if (auto* svgData = font.svgData()) 156 return svgData->fillSVGGlyphPage(&pageToFill, buffer, bufferLength); 157 #endif 158 bool hasGlyphs = pageToFill.fill(buffer, bufferLength, &font); 159 159 #if ENABLE(OPENTYPE_VERTICAL) 160 if (hasGlyphs && font ->verticalData())161 font ->verticalData()->substituteWithVerticalGlyphs(font, &pageToFill);160 if (hasGlyphs && font.verticalData()) 161 font.verticalData()->substituteWithVerticalGlyphs(&font, &pageToFill); 162 162 #endif 163 163 return hasGlyphs; 164 164 } 165 165 166 static RefPtr<GlyphPage> createAndFillGlyphPage(unsigned pageNumber, const Font *font)166 static RefPtr<GlyphPage> createAndFillGlyphPage(unsigned pageNumber, const Font& font) 167 167 { 168 168 #if PLATFORM(IOS) … … 170 170 // Once we have the fix for <rdar://problem/9823975> then remove this code together with Font::shouldNotBeUsedForArabic() 171 171 // in <rdar://problem/12096835>. 172 if (pageNumber == 6 && font ->shouldNotBeUsedForArabic())172 if (pageNumber == 6 && font.shouldNotBeUsedForArabic()) 173 173 return nullptr; 174 174 #endif … … 227 227 // Success is not guaranteed. For example, Times fails to fill page 260, giving glyph data 228 228 // for only 128 out of 256 characters. 229 Ref Ptr<GlyphPage> glyphPage = GlyphPage::createForSingleFont(font);230 231 bool haveGlyphs = fillGlyphPage( *glyphPage, buffer, bufferLength, font);229 Ref<GlyphPage> glyphPage = GlyphPage::create(font); 230 231 bool haveGlyphs = fillGlyphPage(glyphPage, buffer, bufferLength, font); 232 232 if (!haveGlyphs) 233 233 return nullptr; 234 234 235 glyphPage->setImmutable(); 236 return glyphPage; 235 return WTF::move(glyphPage); 237 236 } 238 237 … … 241 240 if (!pageNumber) { 242 241 if (!m_glyphPageZero) 243 m_glyphPageZero = createAndFillGlyphPage(0, this);242 m_glyphPageZero = createAndFillGlyphPage(0, *this); 244 243 return m_glyphPageZero.get(); 245 244 } 246 245 auto addResult = m_glyphPages.add(pageNumber, nullptr); 247 246 if (addResult.isNewEntry) 248 addResult.iterator->value = createAndFillGlyphPage(pageNumber, this);247 addResult.iterator->value = createAndFillGlyphPage(pageNumber, *this); 249 248 250 249 return addResult.iterator->value.get(); … … 256 255 if (!page) 257 256 return 0; 258 return page->glyph At(character % GlyphPage::size);257 return page->glyphForCharacter(character); 259 258 } 260 259 -
trunk/Source/WebCore/platform/graphics/Font.h
r189465 r189539 77 77 virtual void initializeFont(Font*, float fontSize) = 0; 78 78 virtual float widthForSVGGlyph(Glyph, float fontSize) const = 0; 79 virtual bool fillSVGGlyphPage(GlyphPage*, UChar* buffer, unsigned bufferLength , const Font*) const = 0;79 virtual bool fillSVGGlyphPage(GlyphPage*, UChar* buffer, unsigned bufferLength) const = 0; 80 80 }; 81 81 -
trunk/Source/WebCore/platform/graphics/FontCascadeFonts.cpp
r187569 r189539 36 36 namespace WebCore { 37 37 38 class MixedFontGlyphPage { 39 WTF_MAKE_FAST_ALLOCATED; 40 public: 41 MixedFontGlyphPage(const GlyphPage* initialPage) 42 { 43 if (initialPage) { 44 for (unsigned i = 0; i < GlyphPage::size; ++i) 45 setGlyphDataForIndex(i, initialPage->glyphDataForIndex(i)); 46 } 47 } 48 49 GlyphData glyphDataForCharacter(UChar32 c) const 50 { 51 unsigned index = GlyphPage::indexForCharacter(c); 52 ASSERT_WITH_SECURITY_IMPLICATION(index < GlyphPage::size); 53 return { m_glyphs[index], m_fonts[index] }; 54 } 55 56 void setGlyphDataForCharacter(UChar32 c, GlyphData glyphData) 57 { 58 setGlyphDataForIndex(GlyphPage::indexForCharacter(c), glyphData); 59 } 60 61 private: 62 void setGlyphDataForIndex(unsigned index, const GlyphData& glyphData) 63 { 64 ASSERT_WITH_SECURITY_IMPLICATION(index < GlyphPage::size); 65 m_glyphs[index] = glyphData.glyph; 66 m_fonts[index] = glyphData.font; 67 } 68 69 Glyph m_glyphs[GlyphPage::size] { }; 70 const Font* m_fonts[GlyphPage::size] { }; 71 }; 72 73 GlyphData FontCascadeFonts::GlyphPageCacheEntry::glyphDataForCharacter(UChar32 character) 74 { 75 ASSERT(!(m_singleFont && m_mixedFont)); 76 if (m_singleFont) 77 return m_singleFont->glyphDataForCharacter(character); 78 if (m_mixedFont) 79 return m_mixedFont->glyphDataForCharacter(character); 80 return 0; 81 } 82 83 void FontCascadeFonts::GlyphPageCacheEntry::setGlyphDataForCharacter(UChar32 character, GlyphData glyphData) 84 { 85 ASSERT(!glyphDataForCharacter(character).glyph); 86 if (!m_mixedFont) { 87 m_mixedFont = std::make_unique<MixedFontGlyphPage>(m_singleFont.get()); 88 m_singleFont = nullptr; 89 } 90 m_mixedFont->setGlyphDataForCharacter(character, glyphData); 91 } 92 93 void FontCascadeFonts::GlyphPageCacheEntry::setSingleFontPage(RefPtr<GlyphPage>&& page) 94 { 95 ASSERT(isNull()); 96 m_singleFont = page; 97 } 38 98 39 99 FontCascadeFonts::FontCascadeFonts(RefPtr<FontSelector>&& fontSelector) … … 372 432 const unsigned pageNumber = c / GlyphPage::size; 373 433 374 RefPtr<GlyphPage>& cachedPage = pageNumber ? m_cachedPages.add(pageNumber, nullptr).iterator->value : m_cachedPageZero; 375 if (!cachedPage) 376 cachedPage = glyphPageFromFontRanges(pageNumber, realizeFallbackRangesAt(description, 0)); 377 378 GlyphData glyphData = cachedPage ? cachedPage->glyphDataForCharacter(c) : GlyphData(); 434 auto& cacheEntry = pageNumber ? m_cachedPages.add(pageNumber, GlyphPageCacheEntry()).iterator->value : m_cachedPageZero; 435 436 // Initialize cache with a full page of glyph mappings from a single font. 437 if (cacheEntry.isNull()) 438 cacheEntry.setSingleFontPage(glyphPageFromFontRanges(pageNumber, realizeFallbackRangesAt(description, 0))); 439 440 GlyphData glyphData = cacheEntry.glyphDataForCharacter(c); 379 441 if (!glyphData.glyph) { 380 if (!cachedPage) 381 cachedPage = GlyphPage::createForMixedFonts(); 382 else if (cachedPage->isImmutable()) 383 cachedPage = GlyphPage::createCopyForMixedFonts(*cachedPage); 384 442 // No glyph, resolve per-character. 385 443 glyphData = glyphDataForNormalVariant(c, description); 386 cachedPage->setGlyphDataForCharacter(c, glyphData.glyph, glyphData.font); 387 } 444 // Cache the results. 445 cacheEntry.setGlyphDataForCharacter(c, glyphData); 446 } 447 388 448 return glyphData; 389 449 } … … 394 454 return; 395 455 // Mutable glyph pages may reference fallback fonts. 396 if (m_cachedPageZero && !m_cachedPageZero->isImmutable())397 m_cachedPageZero = nullptr;456 if (m_cachedPageZero.isMixedFont()) 457 m_cachedPageZero = { }; 398 458 m_cachedPages.removeIf([](decltype(m_cachedPages)::KeyValuePairType& keyAndValue) { 399 return !keyAndValue.value->isImmutable();459 return keyAndValue.value.isMixedFont(); 400 460 }); 401 461 m_systemFallbackFontSet.clear(); -
trunk/Source/WebCore/platform/graphics/FontCascadeFonts.h
r187569 r189539 36 36 namespace WebCore { 37 37 38 class GraphicsContext;39 class IntRect;40 38 class FontDescription; 41 39 class FontPlatformData; 42 40 class FontSelector; 41 class GraphicsContext; 42 class IntRect; 43 class MixedFontGlyphPage; 43 44 44 45 class FontCascadeFonts : public RefCounted<FontCascadeFonts> { … … 83 84 unsigned m_lastRealizedFallbackIndex { 0 }; 84 85 85 RefPtr<GlyphPage> m_cachedPageZero; 86 HashMap<int, RefPtr<GlyphPage>> m_cachedPages; 86 class GlyphPageCacheEntry { 87 public: 88 GlyphData glyphDataForCharacter(UChar32); 89 90 void setSingleFontPage(RefPtr<GlyphPage>&&); 91 void setGlyphDataForCharacter(UChar32, GlyphData); 92 93 bool isNull() const { return !m_singleFont && !m_mixedFont; } 94 bool isMixedFont() const { return !!m_mixedFont; } 95 96 private: 97 // Only one of these is non-null. 98 RefPtr<GlyphPage> m_singleFont; 99 std::unique_ptr<MixedFontGlyphPage> m_mixedFont; 100 }; 101 102 GlyphPageCacheEntry m_cachedPageZero; 103 HashMap<int, GlyphPageCacheEntry> m_cachedPages; 87 104 88 105 HashSet<RefPtr<Font>> m_systemFallbackFontSet; -
trunk/Source/WebCore/platform/graphics/GlyphPage.h
r189466 r189539 54 54 }; 55 55 56 #if COMPILER(MSVC)57 #pragma warning(push)58 #pragma warning(disable: 4200) // Disable "zero-sized array in struct/union" warning59 #endif60 61 56 // A GlyphPage contains a fixed-size set of GlyphData mappings for a contiguous 62 57 // range of characters in the Unicode code space. GlyphPages are indexed 63 58 // starting from 0 and incrementing for each 256 glyphs. 64 //65 // One page may actually include glyphs from other fonts if the characters are66 // missing in the primary font.67 59 class GlyphPage : public RefCounted<GlyphPage> { 68 60 public: 69 static PassRefPtr<GlyphPage> createForMixedFonts()61 static Ref<GlyphPage> create(const Font& font) 70 62 { 71 void* slot = fastMalloc(sizeof(GlyphPage) + sizeof(Font*) * GlyphPage::size); 72 return adoptRef(new (NotNull, slot) GlyphPage(nullptr)); 73 } 74 75 static PassRefPtr<GlyphPage> createCopyForMixedFonts(const GlyphPage& original) 76 { 77 RefPtr<GlyphPage> page = createForMixedFonts(); 78 for (unsigned i = 0; i < GlyphPage::size; ++i) 79 page->setGlyphDataForIndex(i, original.glyphDataForIndex(i)); 80 return page.release(); 81 } 82 83 static PassRefPtr<GlyphPage> createForSingleFont(const Font* font) 84 { 85 ASSERT(font); 86 return adoptRef(new GlyphPage(font)); 63 return adoptRef(*new GlyphPage(font)); 87 64 } 88 65 … … 92 69 } 93 70 94 bool isImmutable() const { return m_isImmutable; }95 void setImmutable() { m_isImmutable = true; }96 97 71 static unsigned count() { return s_count; } 98 72 99 73 static const size_t size = 256; // Covers Latin-1 in a single page. 100 static_assert((!(0xD800 % size)) && (!(0xDC00 % size)) && (!(0xE000 % size)), "GlyphPages must never straddle code-unit length boundaries");101 74 static unsigned indexForCharacter(UChar32 c) { return c % GlyphPage::size; } 102 75 103 ALWAYS_INLINEGlyphData glyphDataForCharacter(UChar32 c) const76 GlyphData glyphDataForCharacter(UChar32 c) const 104 77 { 105 78 return glyphDataForIndex(indexForCharacter(c)); 106 79 } 107 80 108 ALWAYS_INLINE GlyphData glyphDataForIndex(unsigned index) const81 Glyph glyphForCharacter(UChar32 c) const 109 82 { 110 ASSERT_WITH_SECURITY_IMPLICATION(index < size); 111 Glyph glyph = m_glyphs[index]; 112 if (hasPerGlyphFontData()) 113 return GlyphData(glyph, m_perGlyphFontData[index]); 114 return GlyphData(glyph, glyph ? m_fontForAllGlyphs : 0); 83 return glyphForIndex(indexForCharacter(c)); 115 84 } 116 85 117 ALWAYS_INLINE Glyph glyphAt(unsigned index) const 86 GlyphData glyphDataForIndex(unsigned index) const 87 { 88 Glyph glyph = glyphForIndex(index); 89 return GlyphData(glyph, glyph ? &m_font : nullptr); 90 } 91 92 Glyph glyphForIndex(unsigned index) const 118 93 { 119 94 ASSERT_WITH_SECURITY_IMPLICATION(index < size); … … 121 96 } 122 97 123 ALWAYS_INLINE const Font* fontForCharacter(UChar32 c) const 98 // FIXME: Pages are immutable after initialization. This should be private. 99 void setGlyphForIndex(unsigned index, Glyph glyph) 124 100 { 125 unsigned index = indexForCharacter(c); 126 if (hasPerGlyphFontData()) 127 return m_perGlyphFontData[index]; 128 return m_glyphs[index] ? m_fontForAllGlyphs : 0; 101 ASSERT_WITH_SECURITY_IMPLICATION(index < size); 102 m_glyphs[index] = glyph; 129 103 } 130 104 131 void setGlyphDataForCharacter(UChar32 c, Glyph g, const Font* f)105 const Font& font() const 132 106 { 133 setGlyphDataForIndex(indexForCharacter(c), g, f); 134 } 135 136 void setGlyphDataForIndex(unsigned index, Glyph glyph, const Font* font) 137 { 138 ASSERT_WITH_SECURITY_IMPLICATION(index < size); 139 ASSERT(!m_isImmutable); 140 141 m_glyphs[index] = glyph; 142 143 // GlyphPage getters will always return a null Font* for glyph #0 if there's no per-glyph font array. 144 if (hasPerGlyphFontData()) { 145 m_perGlyphFontData[index] = glyph ? font : 0; 146 return; 147 } 148 149 // A single-font GlyphPage already assigned m_fontForAllGlyphs in the constructor. 150 ASSERT(!glyph || font == m_fontForAllGlyphs); 151 } 152 153 void setGlyphDataForIndex(unsigned index, const GlyphData& glyphData) 154 { 155 setGlyphDataForIndex(index, glyphData.glyph, glyphData.font); 107 return m_font; 156 108 } 157 109 … … 160 112 161 113 private: 162 explicit GlyphPage(const Font * fontForAllGlyphs)163 : m_font ForAllGlyphs(fontForAllGlyphs)114 explicit GlyphPage(const Font& font) 115 : m_font(font) 164 116 { 165 memset(m_glyphs, 0, sizeof(m_glyphs));166 if (hasPerGlyphFontData())167 memset(m_perGlyphFontData, 0, sizeof(Font*) * GlyphPage::size);168 117 ++s_count; 169 118 } 170 119 171 bool hasPerGlyphFontData() const { return !m_fontForAllGlyphs; } 172 173 const Font* m_fontForAllGlyphs; 174 Glyph m_glyphs[size]; 175 176 bool m_isImmutable { false }; 177 // NOTE: This array has (GlyphPage::size) elements if m_fontForAllGlyphs is null. 178 const Font* m_perGlyphFontData[0]; 120 const Font& m_font; 121 Glyph m_glyphs[size] { }; 179 122 180 123 WEBCORE_EXPORT static unsigned s_count; 181 124 }; 182 125 183 #if COMPILER(MSVC)184 #pragma warning(pop)185 #endif186 187 126 } // namespace WebCore 188 127 -
trunk/Source/WebCore/platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp
r189465 r189539 58 58 Glyph glyph = FcFreeTypeCharIndex(face, character); 59 59 if (!glyph) 60 setGlyph DataForIndex(i, 0, 0);60 setGlyphForIndex(i, 0); 61 61 else { 62 setGlyph DataForIndex(i, glyph, fontData);62 setGlyphForIndex(i, glyph); 63 63 haveGlyphs = true; 64 64 } -
trunk/Source/WebCore/platform/graphics/mac/GlyphPageMac.cpp
r189466 r189539 61 61 bool GlyphPage::fill(UChar* buffer, unsigned bufferLength, const Font* fontData) 62 62 { 63 bool haveGlyphs = false; 63 ASSERT(fontData == &font()); 64 ASSERT(bufferLength == GlyphPage::size || bufferLength == 2 * GlyphPage::size); 64 65 65 66 Vector<CGGlyph, 512> glyphs(bufferLength); 67 unsigned glyphStep; 66 68 if (!shouldUseCoreText(buffer, bufferLength, fontData)) { 67 69 // We pass in either 256 or 512 UTF-16 characters: 256 for U+FFFF and less, 512 (double character surrogates) … … 70 72 // this should not happen as the only time we pass in 512 characters is when they are surrogates. 71 73 CGFontGetGlyphsForUnichars(fontData->platformData().cgFont(), buffer, glyphs.data(), bufferLength); 72 for (unsigned i = 0; i < GlyphPage::size; ++i) { 73 if (!glyphs[i]) 74 setGlyphDataForIndex(i, 0, 0); 75 else { 76 setGlyphDataForIndex(i, glyphs[i], fontData); 77 haveGlyphs = true; 78 } 79 } 74 glyphStep = 1; 80 75 } else { 81 76 // Because we know the implementation of shouldUseCoreText(), if the font isn't for text combine and it isn't a system font, … … 85 80 else 86 81 CTFontGetVerticalGlyphsForCharacters(fontData->platformData().ctFont(), buffer, glyphs.data(), bufferLength); 82 87 83 // When buffer consists of surrogate pairs, CTFontGetVerticalGlyphsForCharacters and CTFontGetGlyphsForCharacters 88 84 // place the glyphs at indices corresponding to the first character of each pair. 89 ASSERT(bufferLength == GlyphPage::size || bufferLength == 2 * GlyphPage::size); 90 unsigned glyphStep = bufferLength / GlyphPage::size; 91 for (unsigned i = 0; i < GlyphPage::size; ++i) { 92 if (!glyphs[i * glyphStep]) 93 setGlyphDataForIndex(i, 0, 0); 94 else { 95 setGlyphDataForIndex(i, glyphs[i * glyphStep], fontData); 96 haveGlyphs = true; 97 } 85 glyphStep = bufferLength / GlyphPage::size; 86 } 87 88 bool haveGlyphs = false; 89 for (unsigned i = 0; i < GlyphPage::size; ++i) { 90 if (glyphs[i * glyphStep]) { 91 setGlyphForIndex(i, glyphs[i * glyphStep]); 92 haveGlyphs = true; 98 93 } 99 94 } 100 101 95 return haveGlyphs; 102 96 } -
trunk/Source/WebCore/platform/graphics/opentype/OpenTypeVerticalData.cpp
r189465 r189539 543 543 544 544 for (unsigned index = 0; index < GlyphPage::size; ++index) { 545 Glyph glyph = glyphPage->glyph At(index);545 Glyph glyph = glyphPage->glyphForIndex(index); 546 546 if (glyph) { 547 ASSERT (glyphPage->glyphDataForIndex(index).font== font);547 ASSERT_UNUSED(font, &glyphPage->font() == font); 548 548 Glyph to = map.get(glyph); 549 549 if (to) 550 glyphPage->setGlyph DataForIndex(index, to, font);550 glyphPage->setGlyphForIndex(index, to); 551 551 } 552 552 } -
trunk/Source/WebCore/platform/graphics/win/GlyphPageTreeNodeCGWin.cpp
r189465 r189539 48 48 Glyph glyph = localGlyphBuffer[i]; 49 49 if (!glyph) 50 setGlyph DataForIndex(i, 0, 0);50 setGlyphForIndex(i, 0); 51 51 else { 52 setGlyph DataForIndex(i, glyph, fontData);52 setGlyphForIndex(i, glyph); 53 53 haveGlyphs = true; 54 54 } -
trunk/Source/WebCore/platform/graphics/win/GlyphPageTreeNodeCairoWin.cpp
r189465 r189539 55 55 Glyph glyph = localGlyphBuffer[i]; 56 56 if (glyph == 0xffff) 57 setGlyph DataForIndex(i, 0, 0);57 setGlyphForIndex(i, 0); 58 58 else { 59 setGlyph DataForIndex(i, glyph, fontData);59 setGlyphForIndex(i, glyph); 60 60 haveGlyphs = true; 61 61 } -
trunk/Source/WebCore/svg/SVGFontData.cpp
r189465 r189539 205 205 } 206 206 207 bool SVGFontData::fillSVGGlyphPage(GlyphPage* pageToFill, UChar* buffer, unsigned bufferLength, const Font* font) const 208 { 209 ASSERT(font->isCustomFont()); 210 ASSERT(font->isSVGFont()); 211 207 bool SVGFontData::fillSVGGlyphPage(GlyphPage* pageToFill, UChar* buffer, unsigned bufferLength) const 208 { 212 209 SVGFontFaceElement* fontFaceElement = this->svgFontFaceElement(); 213 210 ASSERT(fontFaceElement); … … 217 214 218 215 if (bufferLength == GlyphPage::size) 219 return fillBMPGlyphs(fontElement, pageToFill, buffer , font);216 return fillBMPGlyphs(fontElement, pageToFill, buffer); 220 217 221 218 ASSERT(bufferLength == 2 * GlyphPage::size); 222 return fillNonBMPGlyphs(fontElement, pageToFill, buffer , font);223 } 224 225 bool SVGFontData::fillBMPGlyphs(SVGFontElement* fontElement, GlyphPage* pageToFill, UChar* buffer , const Font* font) const219 return fillNonBMPGlyphs(fontElement, pageToFill, buffer); 220 } 221 222 bool SVGFontData::fillBMPGlyphs(SVGFontElement* fontElement, GlyphPage* pageToFill, UChar* buffer) const 226 223 { 227 224 bool haveGlyphs = false; … … 231 228 fontElement->collectGlyphsForString(lookupString, glyphs); 232 229 if (glyphs.isEmpty()) { 233 pageToFill->setGlyph DataForIndex(i, 0, 0);230 pageToFill->setGlyphForIndex(i, 0); 234 231 continue; 235 232 } … … 240 237 // only possible within the context of a string (eg. arabic form matching). 241 238 haveGlyphs = true; 242 pageToFill->setGlyph DataForIndex(i, glyphs.first().tableEntry, font);239 pageToFill->setGlyphForIndex(i, glyphs.first().tableEntry); 243 240 glyphs.clear(); 244 241 } … … 247 244 } 248 245 249 bool SVGFontData::fillNonBMPGlyphs(SVGFontElement* fontElement, GlyphPage* pageToFill, UChar* buffer , const Font* font) const246 bool SVGFontData::fillNonBMPGlyphs(SVGFontElement* fontElement, GlyphPage* pageToFill, UChar* buffer) const 250 247 { 251 248 bool haveGlyphs = false; … … 256 253 fontElement->collectGlyphsForString(lookupString, glyphs); 257 254 if (glyphs.isEmpty()) { 258 pageToFill->setGlyph DataForIndex(i, 0, 0);255 pageToFill->setGlyphForIndex(i, 0); 259 256 continue; 260 257 } … … 265 262 // only possible within the context of a string (eg. arabic form matching). 266 263 haveGlyphs = true; 267 pageToFill->setGlyph DataForIndex(i, glyphs.first().tableEntry, font);264 pageToFill->setGlyphForIndex(i, glyphs.first().tableEntry); 268 265 glyphs.clear(); 269 266 } -
trunk/Source/WebCore/svg/SVGFontData.h
r189465 r189539 36 36 virtual void initializeFont(Font*, float fontSize) override; 37 37 virtual float widthForSVGGlyph(Glyph, float fontSize) const override; 38 virtual bool fillSVGGlyphPage(GlyphPage*, UChar* buffer, unsigned bufferLength , const Font*) const override;38 virtual bool fillSVGGlyphPage(GlyphPage*, UChar* buffer, unsigned bufferLength) const override; 39 39 40 40 bool applySVGGlyphSelection(WidthIterator&, GlyphData&, bool mirror, int currentCharacter, unsigned& advanceLength, String& normalizedSpacesStringCache) const; … … 51 51 52 52 private: 53 bool fillBMPGlyphs(SVGFontElement*, GlyphPage*, UChar* buffer , const Font*) const;54 bool fillNonBMPGlyphs(SVGFontElement*, GlyphPage*, UChar* buffer , const Font*) const;53 bool fillBMPGlyphs(SVGFontElement*, GlyphPage*, UChar* buffer) const; 54 bool fillNonBMPGlyphs(SVGFontElement*, GlyphPage*, UChar* buffer) const; 55 55 56 56 bool applyTransforms(GlyphBufferGlyph*, GlyphBufferAdvance*, size_t, TypesettingFeatures) const = delete;
Note: See TracChangeset
for help on using the changeset viewer.