| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 | 142 |
| 143 // We should at least have Sans or Arial which is the last resort fallback o
f SkFontHost ports. | 143 // We should at least have Sans or Arial which is the last resort fallback o
f SkFontHost ports. |
| 144 if (!fontPlatformData) { | 144 if (!fontPlatformData) { |
| 145 DEFINE_STATIC_LOCAL(const FontFaceCreationParams, sansCreationParams, (A
tomicString("Sans", AtomicString::ConstructFromLiteral))); | 145 DEFINE_STATIC_LOCAL(const FontFaceCreationParams, sansCreationParams, (A
tomicString("Sans", AtomicString::ConstructFromLiteral))); |
| 146 fontPlatformData = getFontPlatformData(description, sansCreationParams); | 146 fontPlatformData = getFontPlatformData(description, sansCreationParams); |
| 147 } | 147 } |
| 148 if (!fontPlatformData) { | 148 if (!fontPlatformData) { |
| 149 DEFINE_STATIC_LOCAL(const FontFaceCreationParams, arialCreationParams, (
AtomicString("Arial", AtomicString::ConstructFromLiteral))); | 149 DEFINE_STATIC_LOCAL(const FontFaceCreationParams, arialCreationParams, (
AtomicString("Arial", AtomicString::ConstructFromLiteral))); |
| 150 fontPlatformData = getFontPlatformData(description, arialCreationParams)
; | 150 fontPlatformData = getFontPlatformData(description, arialCreationParams)
; |
| 151 } | 151 } |
| 152 #if OS(WIN) |
| 153 // Try some more Windows-specific fallbacks. |
| 154 if (!fontPlatformData) { |
| 155 DEFINE_STATIC_LOCAL(const FontFaceCreationParams, msuigothicCreationPara
ms, (AtomicString("MS UI Gothic", AtomicString::ConstructFromLiteral))); |
| 156 fontPlatformData = getFontPlatformData(description, msuigothicCreationPa
rams); |
| 157 } |
| 158 if (!fontPlatformData) { |
| 159 DEFINE_STATIC_LOCAL(const FontFaceCreationParams, mssansserifCreationPar
ams, (AtomicString("Microsoft Sans Serif", AtomicString::ConstructFromLiteral)))
; |
| 160 fontPlatformData = getFontPlatformData(description, mssansserifCreationP
arams); |
| 161 } |
| 162 #endif |
| 152 | 163 |
| 153 ASSERT(fontPlatformData); | 164 ASSERT(fontPlatformData); |
| 154 return fontDataFromFontPlatformData(fontPlatformData, shouldRetain); | 165 return fontDataFromFontPlatformData(fontPlatformData, shouldRetain); |
| 155 } | 166 } |
| 156 | 167 |
| 157 PassRefPtr<SkTypeface> FontCache::createTypeface(const FontDescription& fontDesc
ription, const FontFaceCreationParams& creationParams, CString& name) | 168 PassRefPtr<SkTypeface> FontCache::createTypeface(const FontDescription& fontDesc
ription, const FontFaceCreationParams& creationParams, CString& name) |
| 158 { | 169 { |
| 159 #if !OS(WIN) && !OS(ANDROID) | 170 #if !OS(WIN) && !OS(ANDROID) |
| 160 if (creationParams.creationType() == CreateFontByFciIdAndTtcIndex) { | 171 if (creationParams.creationType() == CreateFontByFciIdAndTtcIndex) { |
| 161 // TODO(dro): crbug.com/381620 Use creationParams.ttcIndex() after | 172 // TODO(dro): crbug.com/381620 Use creationParams.ttcIndex() after |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 fontSize, | 226 fontSize, |
| 216 (fontDescription.weight() >= FontWeight600 && !tf->isBold()) || fontDesc
ription.isSyntheticBold(), | 227 (fontDescription.weight() >= FontWeight600 && !tf->isBold()) || fontDesc
ription.isSyntheticBold(), |
| 217 (fontDescription.style() && !tf->isItalic()) || fontDescription.isSynthe
ticItalic(), | 228 (fontDescription.style() && !tf->isItalic()) || fontDescription.isSynthe
ticItalic(), |
| 218 fontDescription.orientation(), | 229 fontDescription.orientation(), |
| 219 fontDescription.useSubpixelPositioning()); | 230 fontDescription.useSubpixelPositioning()); |
| 220 return result; | 231 return result; |
| 221 } | 232 } |
| 222 #endif // !OS(WIN) | 233 #endif // !OS(WIN) |
| 223 | 234 |
| 224 } // namespace WebCore | 235 } // namespace WebCore |
| OLD | NEW |