| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright (c) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. | 3 * Copyright (c) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 77 |
| 78 // This function is called on android or when we are emulating android fonts on | 78 // This function is called on android or when we are emulating android fonts on |
| 79 // linux and the embedder has overriden the default fontManager with | 79 // linux and the embedder has overriden the default fontManager with |
| 80 // WebFontRendering::setSkiaFontMgr. | 80 // WebFontRendering::setSkiaFontMgr. |
| 81 // static | 81 // static |
| 82 AtomicString FontCache::getFamilyNameForCharacter( | 82 AtomicString FontCache::getFamilyNameForCharacter( |
| 83 SkFontMgr* fm, | 83 SkFontMgr* fm, |
| 84 UChar32 c, | 84 UChar32 c, |
| 85 const FontDescription& fontDescription, | 85 const FontDescription& fontDescription, |
| 86 FontFallbackPriority fallbackPriority) { | 86 FontFallbackPriority fallbackPriority) { |
| 87 ASSERT(fm); | 87 DCHECK(fm); |
| 88 | 88 |
| 89 const size_t kMaxLocales = 4; | 89 const size_t kMaxLocales = 4; |
| 90 const char* bcp47Locales[kMaxLocales]; | 90 const char* bcp47Locales[kMaxLocales]; |
| 91 size_t localeCount = 0; | 91 size_t localeCount = 0; |
| 92 | 92 |
| 93 // Fill in the list of locales in the reverse priority order. | 93 // Fill in the list of locales in the reverse priority order. |
| 94 // Skia expects the highest array index to be the first priority. | 94 // Skia expects the highest array index to be the first priority. |
| 95 const LayoutLocale* contentLocale = fontDescription.locale(); | 95 const LayoutLocale* contentLocale = fontDescription.locale(); |
| 96 if (const LayoutLocale* hanLocale = LayoutLocale::localeForHan(contentLocale)) | 96 if (const LayoutLocale* hanLocale = LayoutLocale::localeForHan(contentLocale)) |
| 97 bcp47Locales[localeCount++] = hanLocale->localeForHanForSkFontMgr(); | 97 bcp47Locales[localeCount++] = hanLocale->localeForHanForSkFontMgr(); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 AlternateFontName::LastResort); | 195 AlternateFontName::LastResort); |
| 196 } | 196 } |
| 197 if (!fontPlatformData) { | 197 if (!fontPlatformData) { |
| 198 DEFINE_STATIC_LOCAL(const FontFaceCreationParams, couriernewCreationParams, | 198 DEFINE_STATIC_LOCAL(const FontFaceCreationParams, couriernewCreationParams, |
| 199 (AtomicString("Courier New"))); | 199 (AtomicString("Courier New"))); |
| 200 fontPlatformData = getFontPlatformData( | 200 fontPlatformData = getFontPlatformData( |
| 201 description, couriernewCreationParams, AlternateFontName::LastResort); | 201 description, couriernewCreationParams, AlternateFontName::LastResort); |
| 202 } | 202 } |
| 203 #endif | 203 #endif |
| 204 | 204 |
| 205 ASSERT(fontPlatformData); | 205 DCHECK(fontPlatformData); |
| 206 return fontDataFromFontPlatformData(fontPlatformData, shouldRetain); | 206 return fontDataFromFontPlatformData(fontPlatformData, shouldRetain); |
| 207 } | 207 } |
| 208 | 208 |
| 209 sk_sp<SkTypeface> FontCache::createTypeface( | 209 sk_sp<SkTypeface> FontCache::createTypeface( |
| 210 const FontDescription& fontDescription, | 210 const FontDescription& fontDescription, |
| 211 const FontFaceCreationParams& creationParams, | 211 const FontFaceCreationParams& creationParams, |
| 212 CString& name) { | 212 CString& name) { |
| 213 #if !OS(WIN) && !OS(ANDROID) | 213 #if !OS(WIN) && !OS(ANDROID) |
| 214 if (creationParams.creationType() == CreateFontByFciIdAndTtcIndex) { | 214 if (creationParams.creationType() == CreateFontByFciIdAndTtcIndex) { |
| 215 if (Platform::current()->sandboxSupport()) | 215 if (Platform::current()->sandboxSupport()) |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 fontDescription.isSyntheticBold(), | 274 fontDescription.isSyntheticBold(), |
| 275 ((fontDescription.style() == FontStyleItalic || | 275 ((fontDescription.style() == FontStyleItalic || |
| 276 fontDescription.style() == FontStyleOblique) && | 276 fontDescription.style() == FontStyleOblique) && |
| 277 !tf->isItalic()) || | 277 !tf->isItalic()) || |
| 278 fontDescription.isSyntheticItalic(), | 278 fontDescription.isSyntheticItalic(), |
| 279 fontDescription.orientation())); | 279 fontDescription.orientation())); |
| 280 } | 280 } |
| 281 #endif // !OS(WIN) | 281 #endif // !OS(WIN) |
| 282 | 282 |
| 283 } // namespace blink | 283 } // namespace blink |
| OLD | NEW |