Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007 Apple Computer, Inc. | 2 * Copyright (C) 2006, 2007 Apple Computer, Inc. |
| 3 * Copyright (c) 2006, 2007, 2008, 2009, 2012 Google Inc. All rights reserved. | 3 * Copyright (c) 2006, 2007, 2008, 2009, 2012 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 214 case USCRIPT_ARMENIAN: | 214 case USCRIPT_ARMENIAN: |
| 215 case USCRIPT_THAANA: | 215 case USCRIPT_THAANA: |
| 216 case USCRIPT_CANADIAN_ABORIGINAL: | 216 case USCRIPT_CANADIAN_ABORIGINAL: |
| 217 case USCRIPT_CHEROKEE: | 217 case USCRIPT_CHEROKEE: |
| 218 case USCRIPT_MONGOLIAN: | 218 case USCRIPT_MONGOLIAN: |
| 219 default: | 219 default: |
| 220 return 0; | 220 return 0; |
| 221 } | 221 } |
| 222 } | 222 } |
| 223 | 223 |
| 224 static bool fontRequiresFullHinting(const AtomicString& familyName) | |
| 225 { | |
| 226 DEFINE_STATIC_LOCAL(AtomicString, courierNew, ("Courier New", AtomicString:: ConstructFromLiteral)); | |
| 227 if (equalIgnoringCase(familyName, courierNew)) | |
|
Stephen White
2014/05/28 13:12:52
BTW, it looks from the code like a case-insensitiv
| |
| 228 return true; | |
| 229 | |
| 230 return false; | |
| 231 } | |
| 232 | |
| 224 FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontD escription, const AtomicString& family, float fontSize) | 233 FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontD escription, const AtomicString& family, float fontSize) |
| 225 { | 234 { |
| 226 CString name; | 235 CString name; |
| 227 RefPtr<SkTypeface> tf = createTypeface(fontDescription, family, name); | 236 RefPtr<SkTypeface> tf = createTypeface(fontDescription, family, name); |
| 228 if (!tf) | 237 if (!tf) |
| 229 return 0; | 238 return 0; |
| 230 | 239 |
| 231 // Windows will always give us a valid pointer here, even if the face name | 240 // Windows will always give us a valid pointer here, even if the face name |
| 232 // is non-existent. We have to double-check and see if the family name was | 241 // is non-existent. We have to double-check and see if the family name was |
| 233 // really used. | 242 // really used. |
| 234 // FIXME: Do we need to use predefined fonts "guaranteed" to exist | 243 // FIXME: Do we need to use predefined fonts "guaranteed" to exist |
| 235 // when we're running in layout-test mode? | 244 // when we're running in layout-test mode? |
| 236 if (!typefacesMatchesFamily(tf.get(), family)) { | 245 if (!typefacesMatchesFamily(tf.get(), family)) { |
| 237 return 0; | 246 return 0; |
| 238 } | 247 } |
| 239 | 248 |
| 240 FontPlatformData* result = new FontPlatformData(tf, | 249 FontPlatformData* result = new FontPlatformData(tf, |
| 241 name.data(), | 250 name.data(), |
| 242 fontSize, | 251 fontSize, |
| 243 fontDescription.weight() >= FontWeightBold && !tf->isBold() || fontDescr iption.isSyntheticBold(), | 252 fontDescription.weight() >= FontWeightBold && !tf->isBold() || fontDescr iption.isSyntheticBold(), |
| 244 fontDescription.style() == FontStyleItalic && !tf->isItalic() || fontDes cription.isSyntheticItalic(), | 253 fontDescription.style() == FontStyleItalic && !tf->isItalic() || fontDes cription.isSyntheticItalic(), |
| 245 fontDescription.orientation(), | 254 fontDescription.orientation(), |
| 246 s_useSubpixelPositioning); | 255 s_useSubpixelPositioning); |
| 247 | 256 |
| 257 // FIXME: It might be sufficient to set the "full hinting" flag for | |
| 258 // CJK instead of forcing aliased rendering. | |
| 248 if (s_useDirectWrite) { | 259 if (s_useDirectWrite) { |
| 249 result->setMinSizeForAntiAlias( | 260 result->setMinSizeForAntiAlias( |
| 250 minSizeForAntiAlias(fontDescription.script())); | 261 minSizeForAntiAlias(fontDescription.script())); |
| 262 if (fontRequiresFullHinting(family)) | |
| 263 result->setHinting(SkPaint::kFull_Hinting); | |
| 251 } | 264 } |
| 252 | 265 |
| 253 return result; | 266 return result; |
| 254 } | 267 } |
| 255 | 268 |
| 256 } | 269 } |
| OLD | NEW |