Changeset 176276 in webkit for trunk/Source/WebCore/css/CSSFontFaceSource.cpp
- Timestamp:
- Nov 18, 2014, 12:04:38 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/css/CSSFontFaceSource.cpp
r176267 r176276 38 38 39 39 #if ENABLE(SVG_FONTS) 40 #include "CachedSVGFont.h" 40 41 #include "FontCustomPlatformData.h" 41 42 #include "SVGFontData.h" … … 123 124 if (isLoaded()) { 124 125 if (m_font) { 125 #if ENABLE(SVG_FONTS) 126 if (m_hasExternalSVGFont) { 127 // For SVG fonts parse the external SVG document, and extract the <font> element. 128 if (!m_font->ensureSVGFontData()) 129 return 0; 126 // Create new FontPlatformData from our CGFontRef, point size and ATSFontRef. 127 if (!m_font->ensureCustomFontData(m_hasExternalSVGFont)) 128 return nullptr; 130 129 131 if (!m_externalSVGFontElement) { 132 String fragmentIdentifier; 133 size_t start = m_string.find('#'); 134 if (start != notFound) 135 fragmentIdentifier = m_string.string().substring(start + 1); 136 m_externalSVGFontElement = m_font->getSVGFontById(fragmentIdentifier); 137 } 138 139 if (!m_externalSVGFontElement) 140 return 0; 141 142 if (auto firstFontFace = childrenOfType<SVGFontFaceElement>(*m_externalSVGFontElement).first()) { 143 if (!m_svgFontFaceElement) { 144 // We're created using a CSS @font-face rule, that means we're not associated with a SVGFontFaceElement. 145 // Use the imported <font-face> tag as referencing font-face element for these cases. 146 m_svgFontFaceElement = firstFontFace; 147 } 148 149 fontData = SimpleFontData::create(std::make_unique<SVGFontData>(firstFontFace), fontDescription.computedPixelSize(), syntheticBold, syntheticItalic); 150 } 151 } else 152 #endif 153 { 154 // Create new FontPlatformData from our CGFontRef, point size and ATSFontRef. 155 if (!m_font->ensureCustomFontData()) 156 return 0; 157 158 fontData = SimpleFontData::create(m_font->platformDataFromCustomData(fontDescription.computedPixelSize(), syntheticBold, syntheticItalic, 159 fontDescription.orientation(), fontDescription.widthVariant(), fontDescription.renderingMode()), true, false); 160 } 130 fontData = m_font->getFontData(fontDescription, m_string, syntheticBold, syntheticItalic, m_hasExternalSVGFont); 161 131 } else { 162 132 #if ENABLE(SVG_FONTS) … … 180 150 } 181 151 182 #if ENABLE(SVG_FONTS)183 SVGFontFaceElement* CSSFontFaceSource::svgFontFaceElement() const184 {185 return m_svgFontFaceElement.get();186 }187 188 void CSSFontFaceSource::setSVGFontFaceElement(PassRefPtr<SVGFontFaceElement> element)189 {190 m_svgFontFaceElement = element;191 }192 193 bool CSSFontFaceSource::isSVGFontFaceSource() const194 {195 return m_svgFontFaceElement || m_hasExternalSVGFont;196 }197 #endif198 199 152 #if ENABLE(FONT_LOAD_EVENTS) 200 153 bool CSSFontFaceSource::isDecodeError() const … … 209 162 if (!m_font) 210 163 return false; 211 #if ENABLE(SVG_FONTS) 212 if (m_hasExternalSVGFont) 213 return m_font->ensureSVGFontData(); 214 #endif 215 return m_font->ensureCustomFontData(); 164 return m_font->ensureCustomFontData(m_hasExternalSVGFont); 216 165 } 217 166 #endif
Note:
See TracChangeset
for help on using the changeset viewer.