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

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

Issue 2815523002: Rename Script() returning UScriptCode to GetScript() (Closed)
Patch Set: Rebase Created 3 years, 8 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/shaping/CachingWordShaperTest.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, 2008, 2009, 2010, 2012 Google Inc. All rights 2 * Copyright (c) 2006, 2007, 2008, 2009, 2010, 2012 Google Inc. All rights
3 * reserved. 3 * 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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 {USCRIPT_TRADITIONAL_HAN, kTraditionalHanFonts}, 291 {USCRIPT_TRADITIONAL_HAN, kTraditionalHanFonts},
292 {USCRIPT_VAI, kVaiFonts}, 292 {USCRIPT_VAI, kVaiFonts},
293 {USCRIPT_YI, kYiFonts}}; 293 {USCRIPT_YI, kYiFonts}};
294 294
295 for (const auto& font_family : kScriptToFontFamilies) { 295 for (const auto& font_family : kScriptToFontFamilies) {
296 script_font_map[font_family.script].candidate_family_names = 296 script_font_map[font_family.script].candidate_family_names =
297 font_family.families; 297 font_family.families;
298 } 298 }
299 299
300 // Initialize the locale-dependent mapping from system locale. 300 // Initialize the locale-dependent mapping from system locale.
301 UScriptCode han_script = LayoutLocale::GetSystem().ScriptForHan(); 301 UScriptCode han_script = LayoutLocale::GetSystem().GetScriptForHan();
302 DCHECK(han_script != USCRIPT_HAN); 302 DCHECK(han_script != USCRIPT_HAN);
303 if (script_font_map[han_script].candidate_family_names) { 303 if (script_font_map[han_script].candidate_family_names) {
304 script_font_map[USCRIPT_HAN].candidate_family_names = 304 script_font_map[USCRIPT_HAN].candidate_family_names =
305 script_font_map[han_script].candidate_family_names; 305 script_font_map[han_script].candidate_family_names;
306 } 306 }
307 } 307 }
308 308
309 void FindFirstExistingCandidateFont(FontMapping& script_font_mapping, 309 void FindFirstExistingCandidateFont(FontMapping& script_font_mapping,
310 SkFontMgr* font_manager) { 310 SkFontMgr* font_manager) {
311 for (const UChar* const* family_ptr = 311 for (const UChar* const* family_ptr =
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 script = USCRIPT_HAN; 498 script = USCRIPT_HAN;
499 499
500 if (script == USCRIPT_COMMON) 500 if (script == USCRIPT_COMMON)
501 script = GetScriptBasedOnUnicodeBlock(character); 501 script = GetScriptBasedOnUnicodeBlock(character);
502 502
503 // For unified-Han scripts, try the lang attribute, system, or 503 // For unified-Han scripts, try the lang attribute, system, or
504 // accept-languages. 504 // accept-languages.
505 if (script == USCRIPT_HAN) { 505 if (script == USCRIPT_HAN) {
506 if (const LayoutLocale* locale_for_han = 506 if (const LayoutLocale* locale_for_han =
507 LayoutLocale::LocaleForHan(content_locale)) 507 LayoutLocale::LocaleForHan(content_locale))
508 script = locale_for_han->ScriptForHan(); 508 script = locale_for_han->GetScriptForHan();
509 // If still unknown, USCRIPT_HAN uses UI locale. 509 // If still unknown, USCRIPT_HAN uses UI locale.
510 // See initializeScriptFontMap(). 510 // See initializeScriptFontMap().
511 } 511 }
512 512
513 family = GetFontFamilyForScript(script, generic, font_manager); 513 family = GetFontFamilyForScript(script, generic, font_manager);
514 // Another lame work-around to cover non-BMP characters. 514 // Another lame work-around to cover non-BMP characters.
515 // If the font family for script is not found or the character is 515 // If the font family for script is not found or the character is
516 // not in BMP (> U+FFFF), we resort to the hard-coded list of 516 // not in BMP (> U+FFFF), we resort to the hard-coded list of
517 // fallback fonts for now. 517 // fallback fonts for now.
518 if (!family || character > 0xFFFF) { 518 if (!family || character > 0xFFFF) {
(...skipping 17 matching lines...) Expand all
536 family = L"lucida sans unicode"; 536 family = L"lucida sans unicode";
537 } 537 }
538 } 538 }
539 539
540 if (script_checked) 540 if (script_checked)
541 *script_checked = script; 541 *script_checked = script;
542 return family; 542 return family;
543 } 543 }
544 544
545 } // namespace blink 545 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaperTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698