OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009-2015 Google Inc. | 2 * Copyright 2009-2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 /* migrated from chrome/src/skia/ext/SkFontHost_fontconfig_direct.cpp */ | 8 /* migrated from chrome/src/skia/ext/SkFontHost_fontconfig_direct.cpp */ |
9 | 9 |
10 #include "SkBuffer.h" | 10 #include "SkBuffer.h" |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 // | 625 // |
626 // However, we special-case fallback fonts; see IsFallbackFontAllowed(). | 626 // However, we special-case fallback fonts; see IsFallbackFontAllowed(). |
627 | 627 |
628 const char* post_config_family = get_name(pattern, FC_FAMILY); | 628 const char* post_config_family = get_name(pattern, FC_FAMILY); |
629 if (!post_config_family) { | 629 if (!post_config_family) { |
630 // we can just continue with an empty name, e.g. default font | 630 // we can just continue with an empty name, e.g. default font |
631 post_config_family = ""; | 631 post_config_family = ""; |
632 } | 632 } |
633 | 633 |
634 FcResult result; | 634 FcResult result; |
635 FcFontSet* font_set = FcFontSort(0, pattern, 0, 0, &result); | 635 FcFontSet* font_set = FcFontSort(nullptr, pattern, 0, nullptr, &result); |
636 if (!font_set) { | 636 if (!font_set) { |
637 FcPatternDestroy(pattern); | 637 FcPatternDestroy(pattern); |
638 return false; | 638 return false; |
639 } | 639 } |
640 | 640 |
641 FcPattern* match = this->MatchFont(font_set, post_config_family, familyStr); | 641 FcPattern* match = this->MatchFont(font_set, post_config_family, familyStr); |
642 if (!match) { | 642 if (!match) { |
643 FcPatternDestroy(pattern); | 643 FcPatternDestroy(pattern); |
644 FcFontSetDestroy(font_set); | 644 FcFontSetDestroy(font_set); |
645 return false; | 645 return false; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 const char* famName = get_name(match, FC_FAMILY); | 726 const char* famName = get_name(match, FC_FAMILY); |
727 if (famName && !find_name(names, famName)) { | 727 if (famName && !find_name(names, famName)) { |
728 *names.append() = famName; | 728 *names.append() = famName; |
729 *sizes.append() = strlen(famName) + 1; | 729 *sizes.append() = strlen(famName) + 1; |
730 } | 730 } |
731 } | 731 } |
732 | 732 |
733 return SkDataTable::NewCopyArrays((const void*const*)names.begin(), | 733 return SkDataTable::NewCopyArrays((const void*const*)names.begin(), |
734 sizes.begin(), names.count()); | 734 sizes.begin(), names.count()); |
735 } | 735 } |
OLD | NEW |