OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (c) 2006, 2007, 2008, 2009 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 11 matching lines...) Expand all Loading... |
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include <unicode/locid.h> | 32 |
| 33 #include "SkFontMgr.h" |
33 #include "SkTypeface.h" | 34 #include "SkTypeface.h" |
34 #include "core/platform/NotImplemented.h" | 35 #include "core/platform/NotImplemented.h" |
35 #include "core/platform/graphics/Font.h" | 36 #include "core/platform/graphics/Font.h" |
36 #include "core/platform/graphics/FontCache.h" | 37 #include "core/platform/graphics/FontCache.h" |
37 #include "core/platform/graphics/FontDescription.h" | 38 #include "core/platform/graphics/FontDescription.h" |
38 #include "core/platform/graphics/SimpleFontData.h" | 39 #include "core/platform/graphics/SimpleFontData.h" |
39 #include "wtf/Assertions.h" | 40 #include "wtf/Assertions.h" |
40 #include "wtf/text/AtomicString.h" | 41 #include "wtf/text/AtomicString.h" |
41 #include "wtf/text/CString.h" | 42 #include "wtf/text/CString.h" |
| 43 #include <unicode/locid.h> |
42 | 44 |
43 namespace WebCore { | 45 namespace WebCore { |
44 | 46 |
45 void FontCache::platformInit() | 47 void FontCache::platformInit() |
46 { | 48 { |
47 } | 49 } |
48 | 50 |
49 #if !OS(WINDOWS) | 51 #if !OS(WINDOWS) |
50 PassRefPtr<SimpleFontData> FontCache::getFontDataForCharacter(const Font& font,
UChar32 c) | 52 PassRefPtr<SimpleFontData> FontCache::getFontDataForCharacter(const Font& font,
UChar32 c) |
51 { | 53 { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 // convert the name to utf8 | 141 // convert the name to utf8 |
140 name = family.string().utf8(); | 142 name = family.string().utf8(); |
141 } | 143 } |
142 | 144 |
143 int style = SkTypeface::kNormal; | 145 int style = SkTypeface::kNormal; |
144 if (fontDescription.weight() >= FontWeightBold) | 146 if (fontDescription.weight() >= FontWeightBold) |
145 style |= SkTypeface::kBold; | 147 style |= SkTypeface::kBold; |
146 if (fontDescription.italic()) | 148 if (fontDescription.italic()) |
147 style |= SkTypeface::kItalic; | 149 style |= SkTypeface::kItalic; |
148 | 150 |
| 151 // FIXME: Use SkFontStyle and matchFamilyStyle instead of legacyCreateTypefa
ce. |
| 152 #if OS(WINDOWS) && !ENABLE(GDI_FONTS_ON_WINDOWS) |
| 153 if (m_fontManager) |
| 154 return m_fontManager->legacyCreateTypeface(name.data(), style); |
| 155 #endif |
| 156 |
149 return SkTypeface::CreateFromName(name.data(), static_cast<SkTypeface::Style
>(style)); | 157 return SkTypeface::CreateFromName(name.data(), static_cast<SkTypeface::Style
>(style)); |
150 } | 158 } |
151 | 159 |
152 #if !OS(WINDOWS) | 160 #if !OS(WINDOWS) |
153 FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontD
escription, const AtomicString& family) | 161 FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontD
escription, const AtomicString& family) |
154 { | 162 { |
155 CString name; | 163 CString name; |
156 SkTypeface* tf = createTypeface(fontDescription, family, name); | 164 SkTypeface* tf = createTypeface(fontDescription, family, name); |
157 if (!tf) | 165 if (!tf) |
158 return 0; | 166 return 0; |
159 | 167 |
160 FontPlatformData* result = new FontPlatformData(tf, | 168 FontPlatformData* result = new FontPlatformData(tf, |
161 name.data(), | 169 name.data(), |
162 fontDescription.computedSize(), | 170 fontDescription.computedSize(), |
163 fontDescription.weight() >= FontWeightBold && !tf->isBold(), | 171 fontDescription.weight() >= FontWeightBold && !tf->isBold(), |
164 fontDescription.italic() && !tf->isItalic(), | 172 fontDescription.italic() && !tf->isItalic(), |
165 fontDescription.orientation()); | 173 fontDescription.orientation()); |
166 tf->unref(); | 174 tf->unref(); |
167 return result; | 175 return result; |
168 } | 176 } |
169 #endif // !OS(WINDOWNS) | 177 #endif // !OS(WINDOWNS) |
170 | 178 |
171 } // namespace WebCore | 179 } // namespace WebCore |
OLD | NEW |