Changeset 177975 in webkit
- Timestamp:
- Jan 6, 2015 11:21:28 AM (9 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r177970 r177975 1 2015-01-06 Antti Koivisto <antti@apple.com> 2 3 Rename SimpleFontData::AdditionalFontData to SimpleFontData::SVGData 4 https://bugs.webkit.org/show_bug.cgi?id=140124 5 6 Reviewed by Anders Carlsson. 7 8 The current name is vague and confusing (as AdditionalFontData is not a FontData). 9 10 * platform/graphics/FontGlyphs.cpp: 11 (WebCore::FontGlyphs::glyphDataForCharacter): 12 * platform/graphics/SimpleFontData.cpp: 13 (WebCore::SimpleFontData::SimpleFontData): 14 (WebCore::SimpleFontData::~SimpleFontData): 15 (WebCore::fillGlyphPage): 16 (WebCore::SimpleFontData::createScaledFontData): 17 * platform/graphics/SimpleFontData.h: 18 (WebCore::SimpleFontData::widthForGlyph): 19 * rendering/svg/SVGTextLayoutEngineSpacing.cpp: 20 (WebCore::SVGTextLayoutEngineSpacing::calculateSVGKerning): 21 * rendering/svg/SVGTextRunRenderingContext.cpp: 22 (WebCore::svgFontAndFontFaceElementForFontData): 23 * svg/SVGFontData.h: 24 1 25 2015-01-06 Timothy Horton <timothy_horton@apple.com> 2 26 -
trunk/Source/WebCore/platform/graphics/FontGlyphs.cpp
r177957 r177975 361 361 } 362 362 363 GlyphData FontGlyphs::glyphDataForCharacter( 363 GlyphData FontGlyphs::glyphDataForCharacter(UChar32 c, const FontDescription& description, FontDataVariant variant) 364 364 { 365 365 ASSERT(isMainThread()); -
trunk/Source/WebCore/platform/graphics/SimpleFontData.cpp
r177877 r177975 77 77 } 78 78 79 SimpleFontData::SimpleFontData(std::unique_ptr< AdditionalFontData> fontData, float fontSize, bool syntheticBold, bool syntheticItalic)79 SimpleFontData::SimpleFontData(std::unique_ptr<SVGData> svgData, float fontSize, bool syntheticBold, bool syntheticItalic) 80 80 : m_platformData(FontPlatformData(fontSize, syntheticBold, syntheticItalic)) 81 , m_ fontData(WTF::move(fontData))81 , m_svgData(WTF::move(svgData)) 82 82 , m_treatAsFixedPitch(false) 83 83 , m_isCustomFont(true) … … 94 94 #endif 95 95 { 96 m_ fontData->initializeFontData(this, fontSize);96 m_svgData->initializeFontData(this, fontSize); 97 97 } 98 98 … … 155 155 SimpleFontData::~SimpleFontData() 156 156 { 157 if (! m_fontData)157 if (!isSVGFont()) 158 158 platformDestroy(); 159 159 } … … 172 172 { 173 173 #if ENABLE(SVG_FONTS) 174 if ( SimpleFontData::AdditionalFontData* additionalFontData = fontData->fontData())175 return additionalFontData->fillSVGGlyphPage(&pageToFill, offset, length, buffer, bufferLength, fontData);174 if (auto* svgData = fontData->svgData()) 175 return svgData->fillSVGGlyphPage(&pageToFill, offset, length, buffer, bufferLength, fontData); 176 176 #endif 177 177 bool hasGlyphs = pageToFill.fill(offset, length, buffer, bufferLength, fontData); … … 406 406 PassRefPtr<SimpleFontData> SimpleFontData::createScaledFontData(const FontDescription& fontDescription, float scaleFactor) const 407 407 { 408 // FIXME: Support scaled fonts that used AdditionalFontData. 409 if (m_fontData) 410 return 0; 408 if (isSVGFont()) 409 return nullptr; 411 410 412 411 return platformCreateScaledFontData(fontDescription, scaleFactor); -
trunk/Source/WebCore/platform/graphics/SimpleFontData.h
r177876 r177975 71 71 class SimpleFontData final : public FontData { 72 72 public: 73 class AdditionalFontData {73 class SVGData { 74 74 WTF_MAKE_FAST_ALLOCATED; 75 75 public: 76 virtual ~ AdditionalFontData() { }76 virtual ~SVGData() { } 77 77 78 78 virtual void initializeFontData(SimpleFontData*, float fontSize) = 0; 79 79 virtual float widthForSVGGlyph(Glyph, float fontSize) const = 0; 80 80 virtual bool fillSVGGlyphPage(GlyphPage*, unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData*) const = 0; 81 virtual bool applySVGGlyphSelection(WidthIterator&, GlyphData&, bool mirror, int currentCharacter, unsigned& advanceLength, String& normalizedSpacesStringCache) const = 0;82 81 }; 83 82 … … 89 88 90 89 // Used to create SVG Fonts. 91 static PassRefPtr<SimpleFontData> create(std::unique_ptr< AdditionalFontData> fontData, float fontSize, bool syntheticBold, bool syntheticItalic)90 static PassRefPtr<SimpleFontData> create(std::unique_ptr<SVGData> svgData, float fontSize, bool syntheticBold, bool syntheticItalic) 92 91 { 93 return adoptRef(new SimpleFontData(WTF::move( fontData), fontSize, syntheticBold, syntheticItalic));92 return adoptRef(new SimpleFontData(WTF::move(svgData), fontSize, syntheticBold, syntheticItalic)); 94 93 } 95 94 … … 177 176 Pitch pitch() const { return m_treatAsFixedPitch ? FixedPitch : VariablePitch; } 178 177 179 AdditionalFontData* fontData() const { return m_fontData.get(); }180 bool isSVGFont() const { return m_fontData != nullptr; }178 const SVGData* svgData() const { return m_svgData.get(); } 179 bool isSVGFont() const { return !!m_svgData; } 181 180 182 181 virtual bool isCustomFont() const override { return m_isCustomFont; } … … 219 218 SimpleFontData(const FontPlatformData&, bool isCustomFont = false, bool isLoading = false, bool isTextOrientationFallback = false); 220 219 221 SimpleFontData(std::unique_ptr< AdditionalFontData>, float fontSize, bool syntheticBold, bool syntheticItalic);220 SimpleFontData(std::unique_ptr<SVGData>, float fontSize, bool syntheticBold, bool syntheticItalic); 222 221 223 222 void platformInit(); … … 252 251 253 252 FontPlatformData m_platformData; 254 std::unique_ptr< AdditionalFontData> m_fontData;253 std::unique_ptr<SVGData> m_svgData; 255 254 256 255 mutable RefPtr<GlyphPage> m_glyphPageZero; … … 349 348 return width; 350 349 351 if ( m_fontData)352 width = m_ fontData->widthForSVGGlyph(glyph, m_platformData.size());350 if (isSVGFont()) 351 width = m_svgData->widthForSVGGlyph(glyph, m_platformData.size()); 353 352 #if ENABLE(OPENTYPE_VERTICAL) 354 353 else if (m_verticalData) -
trunk/Source/WebCore/rendering/svg/SVGTextLayoutEngineSpacing.cpp
r177955 r177975 51 51 ASSERT(fontData.isSVGFont()); 52 52 53 const SVGFontData* svgFontData = static_cast<const SVGFontData*>(fontData.fontData());53 auto* svgFontData = static_cast<const SVGFontData*>(fontData.svgData()); 54 54 SVGFontFaceElement* svgFontFace = svgFontData->svgFontFaceElement(); 55 55 ASSERT(svgFontFace); -
trunk/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp
r177955 r177975 44 44 ASSERT(fontData->isSVGFont()); 45 45 46 const SVGFontData* svgFontData = static_cast<const SVGFontData*>(fontData->fontData());46 auto* svgFontData = static_cast<const SVGFontData*>(fontData->svgData()); 47 47 48 48 fontFace = svgFontData->svgFontFaceElement(); -
trunk/Source/WebCore/svg/SVGFontData.h
r174853 r177975 29 29 class SVGFontFaceElement; 30 30 31 class SVGFontData : public SimpleFontData:: AdditionalFontData {31 class SVGFontData : public SimpleFontData::SVGData { 32 32 public: 33 33 explicit SVGFontData(SVGFontFaceElement*); … … 37 37 virtual float widthForSVGGlyph(Glyph, float fontSize) const override; 38 38 virtual bool fillSVGGlyphPage(GlyphPage*, unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData*) const override; 39 virtual bool applySVGGlyphSelection(WidthIterator&, GlyphData&, bool mirror, int currentCharacter, unsigned& advanceLength, String& normalizedSpacesStringCache) const override; 39 40 bool applySVGGlyphSelection(WidthIterator&, GlyphData&, bool mirror, int currentCharacter, unsigned& advanceLength, String& normalizedSpacesStringCache) const; 40 41 41 42 SVGFontFaceElement* svgFontFaceElement() const { return m_svgFontFaceElement; }
Note: See TracChangeset
for help on using the changeset viewer.