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 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 if (outFamilyName) { | 695 if (outFamilyName) { |
696 outFamilyName->set(post_config_family); | 696 outFamilyName->set(post_config_family); |
697 } | 697 } |
698 if (outStyle) { | 698 if (outStyle) { |
699 *outStyle = skfontstyle_from_fcpattern(match); | 699 *outStyle = skfontstyle_from_fcpattern(match); |
700 } | 700 } |
701 return true; | 701 return true; |
702 } | 702 } |
703 | 703 |
704 SkStreamAsset* SkFontConfigInterfaceDirect::openStream(const FontIdentity& ident
ity) { | 704 SkStreamAsset* SkFontConfigInterfaceDirect::openStream(const FontIdentity& ident
ity) { |
705 return SkStream::MakeFromFile(identity.fString.c_str()).release(); | 705 return SkStream::NewFromFile(identity.fString.c_str()); |
706 } | 706 } |
707 | 707 |
708 /////////////////////////////////////////////////////////////////////////////// | 708 /////////////////////////////////////////////////////////////////////////////// |
709 | 709 |
710 static bool find_name(const SkTDArray<const char*>& list, const char* str) { | 710 static bool find_name(const SkTDArray<const char*>& list, const char* str) { |
711 int count = list.count(); | 711 int count = list.count(); |
712 for (int i = 0; i < count; ++i) { | 712 for (int i = 0; i < count; ++i) { |
713 if (!strcmp(list[i], str)) { | 713 if (!strcmp(list[i], str)) { |
714 return true; | 714 return true; |
715 } | 715 } |
(...skipping 29 matching lines...) Expand all Loading... |
745 const char* famName = get_name(match, FC_FAMILY); | 745 const char* famName = get_name(match, FC_FAMILY); |
746 if (famName && !find_name(names, famName)) { | 746 if (famName && !find_name(names, famName)) { |
747 *names.append() = famName; | 747 *names.append() = famName; |
748 *sizes.append() = strlen(famName) + 1; | 748 *sizes.append() = strlen(famName) + 1; |
749 } | 749 } |
750 } | 750 } |
751 | 751 |
752 return SkDataTable::MakeCopyArrays((const void*const*)names.begin(), | 752 return SkDataTable::MakeCopyArrays((const void*const*)names.begin(), |
753 sizes.begin(), names.count()); | 753 sizes.begin(), names.count()); |
754 } | 754 } |
OLD | NEW |