Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: third_party/WebKit/Source/platform/fonts/win/FontCacheSkiaWin.cpp

Issue 2692803005: Avoid checking family name in getLastResortFallbackFont() on Windows (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/skia/FontCacheSkia.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 return true; 326 return true;
327 } 327 }
328 } 328 }
329 329
330 return false; 330 return false;
331 } 331 }
332 332
333 std::unique_ptr<FontPlatformData> FontCache::createFontPlatformData( 333 std::unique_ptr<FontPlatformData> FontCache::createFontPlatformData(
334 const FontDescription& fontDescription, 334 const FontDescription& fontDescription,
335 const FontFaceCreationParams& creationParams, 335 const FontFaceCreationParams& creationParams,
336 float fontSize) { 336 float fontSize,
337 AlternateFontName alternateFontName) {
337 ASSERT(creationParams.creationType() == CreateFontByFamily); 338 ASSERT(creationParams.creationType() == CreateFontByFamily);
338 339
339 CString name; 340 CString name;
340 sk_sp<SkTypeface> tf = createTypeface(fontDescription, creationParams, name); 341 sk_sp<SkTypeface> tf = createTypeface(fontDescription, creationParams, name);
341 // Windows will always give us a valid pointer here, even if the face name 342 // Windows will always give us a valid pointer here, even if the face name
342 // is non-existent. We have to double-check and see if the family name was 343 // is non-existent. We have to double-check and see if the family name was
343 // really used. 344 // really used.
344 if (!tf || !typefacesMatchesFamily(tf.get(), creationParams.family())) { 345 if (!tf || !typefacesMatchesFamily(tf.get(), creationParams.family())) {
345 AtomicString adjustedName; 346 AtomicString adjustedName;
346 FontWeight variantWeight; 347 FontWeight variantWeight;
347 FontStretch variantStretch; 348 FontStretch variantStretch;
348 349
349 if (typefacesHasWeightSuffix(creationParams.family(), adjustedName, 350 if (alternateFontName == AlternateFontName::LastResort) {
350 variantWeight)) { 351 if (!tf)
352 return nullptr;
353 } else if (typefacesHasWeightSuffix(creationParams.family(), adjustedName,
354 variantWeight)) {
351 FontFaceCreationParams adjustedParams(adjustedName); 355 FontFaceCreationParams adjustedParams(adjustedName);
352 FontDescription adjustedFontDescription = fontDescription; 356 FontDescription adjustedFontDescription = fontDescription;
353 adjustedFontDescription.setWeight(variantWeight); 357 adjustedFontDescription.setWeight(variantWeight);
354 tf = createTypeface(adjustedFontDescription, adjustedParams, name); 358 tf = createTypeface(adjustedFontDescription, adjustedParams, name);
355 if (!tf || !typefacesMatchesFamily(tf.get(), adjustedName)) 359 if (!tf || !typefacesMatchesFamily(tf.get(), adjustedName))
356 return nullptr; 360 return nullptr;
357 361
358 } else if (typefacesHasStretchSuffix(creationParams.family(), adjustedName, 362 } else if (typefacesHasStretchSuffix(creationParams.family(), adjustedName,
359 variantStretch)) { 363 variantStretch)) {
360 FontFaceCreationParams adjustedParams(adjustedName); 364 FontFaceCreationParams adjustedParams(adjustedName);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 if (typefacesMatchesFamily(tf.get(), family)) { 418 if (typefacesMatchesFamily(tf.get(), family)) {
415 result->setMinSizeForSubpixel(minSizeForSubpixelForFont); 419 result->setMinSizeForSubpixel(minSizeForSubpixelForFont);
416 break; 420 break;
417 } 421 }
418 } 422 }
419 423
420 return result; 424 return result;
421 } 425 }
422 426
423 } // namespace blink 427 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/skia/FontCacheSkia.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698