OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 // Create new FontPlatformData from our CGFontRef, point size an
d ATSFontRef. | 161 // Create new FontPlatformData from our CGFontRef, point size an
d ATSFontRef. |
162 if (!m_font->ensureCustomFontData()) | 162 if (!m_font->ensureCustomFontData()) |
163 return 0; | 163 return 0; |
164 | 164 |
165 fontData.set(new SimpleFontData(m_font->platformDataFromCustomDa
ta(fontDescription.computedPixelSize(), syntheticBold, syntheticItalic, fontDesc
ription.orientation(), fontDescription.renderingMode()), true, false)); | 165 fontData.set(new SimpleFontData(m_font->platformDataFromCustomDa
ta(fontDescription.computedPixelSize(), syntheticBold, syntheticItalic, fontDesc
ription.orientation(), fontDescription.renderingMode()), true, false)); |
166 } | 166 } |
167 } else { | 167 } else { |
168 #if ENABLE(SVG_FONTS) | 168 #if ENABLE(SVG_FONTS) |
169 // In-Document SVG Fonts | 169 // In-Document SVG Fonts |
170 if (m_svgFontFaceElement) | 170 if (m_svgFontFaceElement) |
171 fontData.set(new SimpleFontData(adoptPtr(new SVGFontData(m_svgFo
ntFaceElement)), fontDescription.computedPixelSize(), syntheticBold, syntheticIt
alic)); | 171 fontData.set(new SimpleFontData(adoptPtr(new SVGFontData(m_svgFo
ntFaceElement.get())), fontDescription.computedPixelSize(), syntheticBold, synth
eticItalic)); |
172 #endif | 172 #endif |
173 } | 173 } |
174 } else { | 174 } else { |
175 // Kick off the load now. | 175 // Kick off the load now. |
176 if (CachedResourceLoader* cachedResourceLoader = fontSelector->cachedRes
ourceLoader()) | 176 if (CachedResourceLoader* cachedResourceLoader = fontSelector->cachedRes
ourceLoader()) |
177 m_font->beginLoadIfNeeded(cachedResourceLoader); | 177 m_font->beginLoadIfNeeded(cachedResourceLoader); |
178 // FIXME: m_string is a URL so it makes no sense to pass it as a family
name. | 178 // FIXME: m_string is a URL so it makes no sense to pass it as a family
name. |
179 SimpleFontData* tempData = fontCache()->getCachedFontData(fontDescriptio
n, m_string); | 179 SimpleFontData* tempData = fontCache()->getCachedFontData(fontDescriptio
n, m_string); |
180 if (!tempData) | 180 if (!tempData) |
181 tempData = fontCache()->getLastResortFallbackFont(fontDescription); | 181 tempData = fontCache()->getLastResortFallbackFont(fontDescription); |
182 | 182 |
183 fontData.set(new SimpleFontData(tempData->platformData(), true, true)); | 183 fontData.set(new SimpleFontData(tempData->platformData(), true, true)); |
184 } | 184 } |
185 | 185 |
186 SimpleFontData* fontDataRawPtr = fontData.leakPtr(); | 186 SimpleFontData* fontDataRawPtr = fontData.leakPtr(); |
187 m_fontDataTable.set(hashKey, fontDataRawPtr); | 187 m_fontDataTable.set(hashKey, fontDataRawPtr); |
188 | 188 |
189 return fontDataRawPtr; | 189 return fontDataRawPtr; |
190 } | 190 } |
191 | 191 |
192 #if ENABLE(SVG_FONTS) | 192 #if ENABLE(SVG_FONTS) |
| 193 SVGFontFaceElement* CSSFontFaceSource::svgFontFaceElement() const |
| 194 { |
| 195 return m_svgFontFaceElement.get(); |
| 196 } |
| 197 |
| 198 void CSSFontFaceSource::setSVGFontFaceElement(PassRefPtr<SVGFontFaceElement> ele
ment) |
| 199 { |
| 200 m_svgFontFaceElement = element; |
| 201 } |
| 202 |
193 bool CSSFontFaceSource::isSVGFontFaceSource() const | 203 bool CSSFontFaceSource::isSVGFontFaceSource() const |
194 { | 204 { |
195 return m_svgFontFaceElement || (m_font && m_font->isSVGFont()); | 205 return m_svgFontFaceElement || (m_font && m_font->isSVGFont()); |
196 } | 206 } |
197 #endif | 207 #endif |
198 | 208 |
199 } | 209 } |
OLD | NEW |