OLD | NEW |
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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 SkFontMgr* fontManager) { | 441 SkFontMgr* fontManager) { |
442 static ScriptToFontMap scriptFontMap; | 442 static ScriptToFontMap scriptFontMap; |
443 static bool initialized = false; | 443 static bool initialized = false; |
444 if (!initialized) { | 444 if (!initialized) { |
445 initializeScriptFontMap(scriptFontMap); | 445 initializeScriptFontMap(scriptFontMap); |
446 initialized = true; | 446 initialized = true; |
447 } | 447 } |
448 | 448 |
449 if (script == USCRIPT_INVALID_CODE) | 449 if (script == USCRIPT_INVALID_CODE) |
450 return 0; | 450 return 0; |
451 ASSERT(script < USCRIPT_CODE_LIMIT); | 451 DCHECK_LT(script, USCRIPT_CODE_LIMIT); |
452 if (generic == FontDescription::MonospaceFamily) { | 452 if (generic == FontDescription::MonospaceFamily) { |
453 const UChar* monospaceFamily = findMonospaceFontForScript(script); | 453 const UChar* monospaceFamily = findMonospaceFontForScript(script); |
454 if (monospaceFamily) | 454 if (monospaceFamily) |
455 return monospaceFamily; | 455 return monospaceFamily; |
456 } | 456 } |
457 if (scriptFontMap[script].candidateFamilyNames) | 457 if (scriptFontMap[script].candidateFamilyNames) |
458 findFirstExistingCandidateFont(scriptFontMap[script], fontManager); | 458 findFirstExistingCandidateFont(scriptFontMap[script], fontManager); |
459 return scriptFontMap[script].familyName; | 459 return scriptFontMap[script].familyName; |
460 } | 460 } |
461 | 461 |
462 // FIXME: | 462 // FIXME: |
463 // - Handle 'Inherited', 'Common' and 'Unknown' | 463 // - Handle 'Inherited', 'Common' and 'Unknown' |
464 // (see http://www.unicode.org/reports/tr24/#Usage_Model ) | 464 // (see http://www.unicode.org/reports/tr24/#Usage_Model ) |
465 // For 'Inherited' and 'Common', perhaps we need to | 465 // For 'Inherited' and 'Common', perhaps we need to |
466 // accept another parameter indicating the previous family | 466 // accept another parameter indicating the previous family |
467 // and just return it. | 467 // and just return it. |
468 // - All the characters (or characters up to the point a single | 468 // - All the characters (or characters up to the point a single |
469 // font can cover) need to be taken into account | 469 // font can cover) need to be taken into account |
470 const UChar* getFallbackFamily(UChar32 character, | 470 const UChar* getFallbackFamily(UChar32 character, |
471 FontDescription::GenericFamilyType generic, | 471 FontDescription::GenericFamilyType generic, |
472 const LayoutLocale* contentLocale, | 472 const LayoutLocale* contentLocale, |
473 UScriptCode* scriptChecked, | 473 UScriptCode* scriptChecked, |
474 FontFallbackPriority fallbackPriority, | 474 FontFallbackPriority fallbackPriority, |
475 SkFontMgr* fontManager) { | 475 SkFontMgr* fontManager) { |
476 ASSERT(character); | 476 DCHECK(character); |
477 ASSERT(fontManager); | 477 DCHECK(fontManager); |
478 UBlockCode block = fallbackPriority == FontFallbackPriority::EmojiEmoji | 478 UBlockCode block = fallbackPriority == FontFallbackPriority::EmojiEmoji |
479 ? UBLOCK_EMOTICONS | 479 ? UBLOCK_EMOTICONS |
480 : ublock_getCode(character); | 480 : ublock_getCode(character); |
481 const UChar* family = getFontBasedOnUnicodeBlock(block, fontManager); | 481 const UChar* family = getFontBasedOnUnicodeBlock(block, fontManager); |
482 if (family) { | 482 if (family) { |
483 if (scriptChecked) | 483 if (scriptChecked) |
484 *scriptChecked = USCRIPT_INVALID_CODE; | 484 *scriptChecked = USCRIPT_INVALID_CODE; |
485 return family; | 485 return family; |
486 } | 486 } |
487 | 487 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 family = L"lucida sans unicode"; | 533 family = L"lucida sans unicode"; |
534 } | 534 } |
535 } | 535 } |
536 | 536 |
537 if (scriptChecked) | 537 if (scriptChecked) |
538 *scriptChecked = script; | 538 *scriptChecked = script; |
539 return family; | 539 return family; |
540 } | 540 } |
541 | 541 |
542 } // namespace blink | 542 } // namespace blink |
OLD | NEW |