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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 #if OS(LINUX) | 235 #if OS(LINUX) |
236 // On linux if the fontManager has been overridden then we should be calling
the embedder | 236 // On linux if the fontManager has been overridden then we should be calling
the embedder |
237 // provided font Manager rather than calling SkTypeface::CreateFromName whic
h may redirect the | 237 // provided font Manager rather than calling SkTypeface::CreateFromName whic
h may redirect the |
238 // call to the default font Manager. | 238 // call to the default font Manager. |
239 if (m_fontManager) | 239 if (m_fontManager) |
240 return adoptRef(m_fontManager->matchFamilyStyle(name.data(), fontStyle(f
ontDescription))); | 240 return adoptRef(m_fontManager->matchFamilyStyle(name.data(), fontStyle(f
ontDescription))); |
241 #endif | 241 #endif |
242 | 242 |
243 // FIXME: Use m_fontManager, SkFontStyle and matchFamilyStyle instead of | 243 // FIXME: Use m_fontManager, SkFontStyle and matchFamilyStyle instead of |
244 // CreateFromName on all platforms. | 244 // CreateFromName on all platforms. |
245 return adoptRef(SkTypeface::CreateFromName(name.data(), static_cast<SkTypefa
ce::Style>(style))); | 245 const SkFontStyle fontStyle(style); |
| 246 return adoptRef(SkTypeface::CreateFromName(name.data(), fontStyle)); |
246 } | 247 } |
247 | 248 |
248 #if !OS(WIN) | 249 #if !OS(WIN) |
249 PassOwnPtr<FontPlatformData> FontCache::createFontPlatformData(const FontDescrip
tion& fontDescription, | 250 PassOwnPtr<FontPlatformData> FontCache::createFontPlatformData(const FontDescrip
tion& fontDescription, |
250 const FontFaceCreationParams& creationParams, float fontSize) | 251 const FontFaceCreationParams& creationParams, float fontSize) |
251 { | 252 { |
252 CString name; | 253 CString name; |
253 RefPtr<SkTypeface> tf(createTypeface(fontDescription, creationParams, name))
; | 254 RefPtr<SkTypeface> tf(createTypeface(fontDescription, creationParams, name))
; |
254 if (!tf) | 255 if (!tf) |
255 return nullptr; | 256 return nullptr; |
256 | 257 |
257 return adoptPtr(new FontPlatformData(tf, | 258 return adoptPtr(new FontPlatformData(tf, |
258 name.data(), | 259 name.data(), |
259 fontSize, | 260 fontSize, |
260 (fontDescription.weight() >= FontWeight600 && !tf->isBold()) || fontDesc
ription.isSyntheticBold(), | 261 (fontDescription.weight() >= FontWeight600 && !tf->isBold()) || fontDesc
ription.isSyntheticBold(), |
261 ((fontDescription.style() == FontStyleItalic || fontDescription.style()
== FontStyleOblique) && !tf->isItalic()) || fontDescription.isSyntheticItalic(), | 262 ((fontDescription.style() == FontStyleItalic || fontDescription.style()
== FontStyleOblique) && !tf->isItalic()) || fontDescription.isSyntheticItalic(), |
262 fontDescription.orientation(), | 263 fontDescription.orientation(), |
263 fontDescription.useSubpixelPositioning())); | 264 fontDescription.useSubpixelPositioning())); |
264 } | 265 } |
265 #endif // !OS(WIN) | 266 #endif // !OS(WIN) |
266 | 267 |
267 } // namespace blink | 268 } // namespace blink |
OLD | NEW |