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 30 matching lines...) Expand all Loading... |
41 #include "wtf/text/AtomicString.h" | 41 #include "wtf/text/AtomicString.h" |
42 #include "wtf/text/CString.h" | 42 #include "wtf/text/CString.h" |
43 #include <unicode/locid.h> | 43 #include <unicode/locid.h> |
44 | 44 |
45 namespace WebCore { | 45 namespace WebCore { |
46 | 46 |
47 void FontCache::platformInit() | 47 void FontCache::platformInit() |
48 { | 48 { |
49 } | 49 } |
50 | 50 |
51 #if !OS(WINDOWS) | 51 #if !OS(WIN) |
52 PassRefPtr<SimpleFontData> FontCache::getFontDataForCharacter(const Font& font,
UChar32 c) | 52 PassRefPtr<SimpleFontData> FontCache::getFontDataForCharacter(const Font& font,
UChar32 c) |
53 { | 53 { |
54 icu::Locale locale = icu::Locale::getDefault(); | 54 icu::Locale locale = icu::Locale::getDefault(); |
55 FontCache::SimpleFontFamily family; | 55 FontCache::SimpleFontFamily family; |
56 FontCache::getFontFamilyForCharacter(c, locale.getLanguage(), &family); | 56 FontCache::getFontFamilyForCharacter(c, locale.getLanguage(), &family); |
57 if (family.name.isEmpty()) | 57 if (family.name.isEmpty()) |
58 return 0; | 58 return 0; |
59 | 59 |
60 AtomicString atomicFamily(family.name); | 60 AtomicString atomicFamily(family.name); |
61 // Changes weight and/or italic of given FontDescription depends on | 61 // Changes weight and/or italic of given FontDescription depends on |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 name = family.string().utf8(); | 142 name = family.string().utf8(); |
143 } | 143 } |
144 | 144 |
145 int style = SkTypeface::kNormal; | 145 int style = SkTypeface::kNormal; |
146 if (fontDescription.weight() >= FontWeightBold) | 146 if (fontDescription.weight() >= FontWeightBold) |
147 style |= SkTypeface::kBold; | 147 style |= SkTypeface::kBold; |
148 if (fontDescription.italic()) | 148 if (fontDescription.italic()) |
149 style |= SkTypeface::kItalic; | 149 style |= SkTypeface::kItalic; |
150 | 150 |
151 // FIXME: Use SkFontStyle and matchFamilyStyle instead of legacyCreateTypefa
ce. | 151 // FIXME: Use SkFontStyle and matchFamilyStyle instead of legacyCreateTypefa
ce. |
152 #if OS(WINDOWS) && !ENABLE(GDI_FONTS_ON_WINDOWS) | 152 #if OS(WIN) && !ENABLE(GDI_FONTS_ON_WINDOWS) |
153 if (m_fontManager) | 153 if (m_fontManager) |
154 return m_fontManager->legacyCreateTypeface(name.data(), style); | 154 return m_fontManager->legacyCreateTypeface(name.data(), style); |
155 #endif | 155 #endif |
156 | 156 |
157 return SkTypeface::CreateFromName(name.data(), static_cast<SkTypeface::Style
>(style)); | 157 return SkTypeface::CreateFromName(name.data(), static_cast<SkTypeface::Style
>(style)); |
158 } | 158 } |
159 | 159 |
160 #if !OS(WINDOWS) | 160 #if !OS(WIN) |
161 FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontD
escription, const AtomicString& family) | 161 FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontD
escription, const AtomicString& family) |
162 { | 162 { |
163 CString name; | 163 CString name; |
164 SkTypeface* tf = createTypeface(fontDescription, family, name); | 164 SkTypeface* tf = createTypeface(fontDescription, family, name); |
165 if (!tf) | 165 if (!tf) |
166 return 0; | 166 return 0; |
167 | 167 |
168 FontPlatformData* result = new FontPlatformData(tf, | 168 FontPlatformData* result = new FontPlatformData(tf, |
169 name.data(), | 169 name.data(), |
170 fontDescription.computedSize(), | 170 fontDescription.computedSize(), |
171 fontDescription.weight() >= FontWeightBold && !tf->isBold(), | 171 fontDescription.weight() >= FontWeightBold && !tf->isBold(), |
172 fontDescription.italic() && !tf->isItalic(), | 172 fontDescription.italic() && !tf->isItalic(), |
173 fontDescription.orientation()); | 173 fontDescription.orientation()); |
174 tf->unref(); | 174 tf->unref(); |
175 return result; | 175 return result; |
176 } | 176 } |
177 #endif // !OS(WINDOWNS) | 177 #endif // !OS(WINDOWNS) |
178 | 178 |
179 } // namespace WebCore | 179 } // namespace WebCore |
OLD | NEW |