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 29 matching lines...) Expand all Loading... |
40 #include <limits> | 40 #include <limits> |
41 #include <unicode/uchar.h> | 41 #include <unicode/uchar.h> |
42 | 42 |
43 namespace blink { | 43 namespace blink { |
44 | 44 |
45 namespace { | 45 namespace { |
46 | 46 |
47 static inline bool isFontPresent(const UChar* fontName, SkFontMgr* fontManager) | 47 static inline bool isFontPresent(const UChar* fontName, SkFontMgr* fontManager) |
48 { | 48 { |
49 String family = fontName; | 49 String family = fontName; |
50 SkTypeface* typeface; | 50 sk_sp<SkTypeface> tf(fontManager->matchFamilyStyle(family.utf8().data(), SkF
ontStyle())); |
51 typeface = fontManager->matchFamilyStyle(family.utf8().data(), SkFontStyle()
); | 51 if (!tf) |
52 | |
53 if (!typeface) | |
54 return false; | 52 return false; |
55 | 53 |
56 RefPtr<SkTypeface> tf = adoptRef(typeface); | |
57 SkTypeface::LocalizedStrings* actualFamilies = tf->createFamilyNameIterator(
); | 54 SkTypeface::LocalizedStrings* actualFamilies = tf->createFamilyNameIterator(
); |
58 bool matchesRequestedFamily = false; | 55 bool matchesRequestedFamily = false; |
59 SkTypeface::LocalizedString actualFamily; | 56 SkTypeface::LocalizedString actualFamily; |
60 while (actualFamilies->next(&actualFamily)) { | 57 while (actualFamilies->next(&actualFamily)) { |
61 if (equalIgnoringCase(family, AtomicString::fromUTF8(actualFamily.fStrin
g.c_str()))) { | 58 if (equalIgnoringCase(family, AtomicString::fromUTF8(actualFamily.fStrin
g.c_str()))) { |
62 matchesRequestedFamily = true; | 59 matchesRequestedFamily = true; |
63 break; | 60 break; |
64 } | 61 } |
65 } | 62 } |
66 actualFamilies->unref(); | 63 actualFamilies->unref(); |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 family = L"lucida sans unicode"; | 522 family = L"lucida sans unicode"; |
526 } | 523 } |
527 } | 524 } |
528 | 525 |
529 if (scriptChecked) | 526 if (scriptChecked) |
530 *scriptChecked = script; | 527 *scriptChecked = script; |
531 return family; | 528 return family; |
532 } | 529 } |
533 | 530 |
534 } // namespace blink | 531 } // namespace blink |
OLD | NEW |