OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2006, 2007, 2008, 2009, 2010, 2012 Google Inc. All rights reser
ved. | 2 * Copyright (c) 2006, 2007, 2008, 2009, 2010, 2012 Google Inc. All rights reser
ved. |
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 namespace { | 46 namespace { |
47 | 47 |
48 static inline bool isFontPresent(const UChar* fontName, SkFontMgr* fontManager) | 48 static inline bool isFontPresent(const UChar* fontName, SkFontMgr* fontManager) |
49 { | 49 { |
50 String family = fontName; | 50 String family = fontName; |
51 SkTypeface* typeface; | 51 SkTypeface* typeface; |
52 if (FontCache::useDirectWrite()) | 52 if (FontCache::useDirectWrite()) |
53 typeface = fontManager->matchFamilyStyle(family.utf8().data(), SkFontSty
le()); | 53 typeface = fontManager->matchFamilyStyle(family.utf8().data(), SkFontSty
le()); |
54 else | 54 else |
55 typeface = fontManager->legacyCreateTypeface(family.utf8().data(), SkTyp
eface::kNormal); | 55 typeface = fontManager->legacyCreateTypeface(family.utf8().data(), SkFon
tStyle()); |
56 | 56 |
57 if (!typeface) | 57 if (!typeface) |
58 return false; | 58 return false; |
59 | 59 |
60 RefPtr<SkTypeface> tf = adoptRef(typeface); | 60 RefPtr<SkTypeface> tf = adoptRef(typeface); |
61 SkTypeface::LocalizedStrings* actualFamilies = tf->createFamilyNameIterator(
); | 61 SkTypeface::LocalizedStrings* actualFamilies = tf->createFamilyNameIterator(
); |
62 bool matchesRequestedFamily = false; | 62 bool matchesRequestedFamily = false; |
63 SkTypeface::LocalizedString actualFamily; | 63 SkTypeface::LocalizedString actualFamily; |
64 while (actualFamilies->next(&actualFamily)) { | 64 while (actualFamilies->next(&actualFamily)) { |
65 if (equalIgnoringCase(family, AtomicString::fromUTF8(actualFamily.fStrin
g.c_str()))) { | 65 if (equalIgnoringCase(family, AtomicString::fromUTF8(actualFamily.fStrin
g.c_str()))) { |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 family = L"lucida sans unicode"; | 545 family = L"lucida sans unicode"; |
546 } | 546 } |
547 } | 547 } |
548 | 548 |
549 if (scriptChecked) | 549 if (scriptChecked) |
550 *scriptChecked = script; | 550 *scriptChecked = script; |
551 return family; | 551 return family; |
552 } | 552 } |
553 | 553 |
554 } // namespace blink | 554 } // namespace blink |
OLD | NEW |