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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 name = family.utf8(); | 174 name = family.utf8(); |
175 } | 175 } |
176 | 176 |
177 #if OS(WIN) | 177 #if OS(WIN) |
178 if (s_sideloadedFonts) { | 178 if (s_sideloadedFonts) { |
179 HashMap<String, RefPtr<SkTypeface>>::iterator sideloadedFont = | 179 HashMap<String, RefPtr<SkTypeface>>::iterator sideloadedFont = |
180 s_sideloadedFonts->find(name.data()); | 180 s_sideloadedFonts->find(name.data()); |
181 if (sideloadedFont != s_sideloadedFonts->end()) | 181 if (sideloadedFont != s_sideloadedFonts->end()) |
182 return sideloadedFont->value; | 182 return sideloadedFont->value; |
183 } | 183 } |
184 | |
185 if (m_fontManager) { | |
186 return adoptRef(m_fontManager->matchFamilyStyle(name.data(), fontDescrip
tion.skiaFontStyle())); | |
187 } | |
188 #endif | 184 #endif |
189 | 185 |
190 #if OS(LINUX) | 186 #if OS(LINUX) || OS(WIN) |
191 // On linux if the fontManager has been overridden then we should be calling
the embedder | 187 // On linux if the fontManager has been overridden then we should be calling
the embedder |
192 // provided font Manager rather than calling SkTypeface::CreateFromName whic
h may redirect the | 188 // provided font Manager rather than calling SkTypeface::CreateFromName whic
h may redirect the |
193 // call to the default font Manager. | 189 // call to the default font Manager. |
| 190 // On Windows the font manager is always present. |
194 if (m_fontManager) | 191 if (m_fontManager) |
195 return adoptRef(m_fontManager->matchFamilyStyle(name.data(), fontDescrip
tion.skiaFontStyle())); | 192 return adoptRef(m_fontManager->matchFamilyStyle(name.data(), fontDescrip
tion.skiaFontStyle())); |
196 #endif | 193 #endif |
197 | 194 |
198 // FIXME: Use m_fontManager, SkFontStyle and matchFamilyStyle instead of | 195 // FIXME: Use m_fontManager, SkFontStyle and matchFamilyStyle instead of |
199 // CreateFromName on all platforms. | 196 // CreateFromName on all platforms. |
200 int style = SkTypeface::kNormal; | 197 int style = SkTypeface::kNormal; |
201 if (fontDescription.weight() >= FontWeight600) | 198 if (fontDescription.weight() >= FontWeight600) |
202 style |= SkTypeface::kBold; | 199 style |= SkTypeface::kBold; |
203 if (fontDescription.style()) | 200 if (fontDescription.style()) |
(...skipping 14 matching lines...) Expand all Loading... |
218 name.data(), | 215 name.data(), |
219 fontSize, | 216 fontSize, |
220 (fontDescription.weight() >= FontWeight600 && !tf->isBold()) || fontDesc
ription.isSyntheticBold(), | 217 (fontDescription.weight() >= FontWeight600 && !tf->isBold()) || fontDesc
ription.isSyntheticBold(), |
221 ((fontDescription.style() == FontStyleItalic || fontDescription.style()
== FontStyleOblique) && !tf->isItalic()) || fontDescription.isSyntheticItalic(), | 218 ((fontDescription.style() == FontStyleItalic || fontDescription.style()
== FontStyleOblique) && !tf->isItalic()) || fontDescription.isSyntheticItalic(), |
222 fontDescription.orientation(), | 219 fontDescription.orientation(), |
223 fontDescription.useSubpixelPositioning())); | 220 fontDescription.useSubpixelPositioning())); |
224 } | 221 } |
225 #endif // !OS(WIN) | 222 #endif // !OS(WIN) |
226 | 223 |
227 } // namespace blink | 224 } // namespace blink |
OLD | NEW |