Chromium Code Reviews| 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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 227 #endif | 227 #endif |
| 228 | 228 |
| 229 #if OS(LINUX) | 229 #if OS(LINUX) |
| 230 // On linux if the fontManager has been overridden then we should be calling the embedder | 230 // On linux if the fontManager has been overridden then we should be calling the embedder |
| 231 // provided font Manager rather than calling SkTypeface::CreateFromName whic h may redirect the | 231 // provided font Manager rather than calling SkTypeface::CreateFromName whic h may redirect the |
| 232 // call to the default font Manager. | 232 // call to the default font Manager. |
| 233 if (m_fontManager) | 233 if (m_fontManager) |
| 234 return adoptRef(m_fontManager->matchFamilyStyle(name.data(), fontStyle(f ontDescription))); | 234 return adoptRef(m_fontManager->matchFamilyStyle(name.data(), fontStyle(f ontDescription))); |
| 235 #endif | 235 #endif |
| 236 | 236 |
| 237 // FIXME: Use m_fontManager, SkFontStyle and matchFamilyStyle instead of | 237 // FIXME: Use m_fontManager, SkFontStyle and matchFamilyStyle instead of |
|
eae
2016/04/22 02:05:46
Please change this to remove the reference to SkFo
Tom (Use chromium acct)
2016/04/22 18:51:53
Done.
| |
| 238 // CreateFromName on all platforms. | 238 // CreateFromName on all platforms. |
| 239 int style = SkTypeface::kNormal; | 239 return adoptRef(SkTypeface::CreateFromName(name.data(), fontStyle(fontDescri ption))); |
|
bungeman-skia
2016/04/22 18:15:36
Why not just
// FIXME: Use m_fontManager, matchFa
Tom (Use chromium acct)
2016/04/22 18:51:53
Done.
| |
| 240 if (fontDescription.weight() >= FontWeight600) | |
| 241 style |= SkTypeface::kBold; | |
| 242 if (fontDescription.style()) | |
| 243 style |= SkTypeface::kItalic; | |
| 244 return adoptRef(SkTypeface::CreateFromName(name.data(), static_cast<SkTypefa ce::Style>(style))); | |
| 245 } | 240 } |
| 246 | 241 |
| 247 #if !OS(WIN) | 242 #if !OS(WIN) |
| 248 PassOwnPtr<FontPlatformData> FontCache::createFontPlatformData(const FontDescrip tion& fontDescription, | 243 PassOwnPtr<FontPlatformData> FontCache::createFontPlatformData(const FontDescrip tion& fontDescription, |
| 249 const FontFaceCreationParams& creationParams, float fontSize) | 244 const FontFaceCreationParams& creationParams, float fontSize) |
| 250 { | 245 { |
| 251 CString name; | 246 CString name; |
| 252 RefPtr<SkTypeface> tf(createTypeface(fontDescription, creationParams, name)) ; | 247 RefPtr<SkTypeface> tf(createTypeface(fontDescription, creationParams, name)) ; |
| 253 if (!tf) | 248 if (!tf) |
| 254 return nullptr; | 249 return nullptr; |
| 255 | 250 |
| 256 return adoptPtr(new FontPlatformData(tf, | 251 return adoptPtr(new FontPlatformData(tf, |
| 257 name.data(), | 252 name.data(), |
| 258 fontSize, | 253 fontSize, |
| 259 (fontDescription.weight() >= FontWeight600 && !tf->isBold()) || fontDesc ription.isSyntheticBold(), | 254 (fontDescription.weight() >= FontWeight600 && !tf->isBold()) || fontDesc ription.isSyntheticBold(), |
| 260 ((fontDescription.style() == FontStyleItalic || fontDescription.style() == FontStyleOblique) && !tf->isItalic()) || fontDescription.isSyntheticItalic(), | 255 ((fontDescription.style() == FontStyleItalic || fontDescription.style() == FontStyleOblique) && !tf->isItalic()) || fontDescription.isSyntheticItalic(), |
| 261 fontDescription.orientation(), | 256 fontDescription.orientation(), |
| 262 fontDescription.useSubpixelPositioning())); | 257 fontDescription.useSubpixelPositioning())); |
| 263 } | 258 } |
| 264 #endif // !OS(WIN) | 259 #endif // !OS(WIN) |
| 265 | 260 |
| 266 } // namespace blink | 261 } // namespace blink |
| OLD | NEW |