Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 #include "SkDataTable.h" | 8 #include "SkDataTable.h" |
| 9 #include "SkFontDescriptor.h" | 9 #include "SkFontDescriptor.h" |
| 10 #include "SkFontHost_FreeType_common.h" | 10 #include "SkFontHost_FreeType_common.h" |
| (...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 791 return NULL; | 791 return NULL; |
| 792 } | 792 } |
| 793 | 793 |
| 794 return createTypefaceFromFcPattern(font); | 794 return createTypefaceFromFcPattern(font); |
| 795 } | 795 } |
| 796 | 796 |
| 797 virtual SkTypeface* onMatchFaceStyle(const SkTypeface* typeface, | 797 virtual SkTypeface* onMatchFaceStyle(const SkTypeface* typeface, |
| 798 const SkFontStyle& style) const SK_OVER RIDE | 798 const SkFontStyle& style) const SK_OVER RIDE |
| 799 { | 799 { |
| 800 //TODO: should the SkTypeface_fontconfig know its family? | 800 //TODO: should the SkTypeface_fontconfig know its family? |
| 801 const SkTypeface_fontconfig* fcTypeface = | 801 const char* name = NULL; |
|
mtklein
2014/09/12 18:55:27
not ""?
bungeman-skia
2014/09/12 19:02:32
Yeah, I want no-name not empty-name here. In theor
| |
| 802 static_cast<const SkTypeface_fontconfig*>(typeface); | 802 if (typeface) { |
| 803 return this->matchFamilyStyle(get_string(fcTypeface->fPattern, FC_FAMILY ), style); | 803 const SkTypeface_fontconfig* fcTypeface = |
| 804 static_cast<const SkTypeface_fontconfig*>(typeface); | |
| 805 name = get_string(fcTypeface->fPattern, FC_FAMILY); | |
| 806 } | |
| 807 return this->matchFamilyStyle(name, style); | |
| 804 } | 808 } |
| 805 | 809 |
| 806 /** @param stream does not take ownership of the reference. */ | 810 /** @param stream does not take ownership of the reference. */ |
| 807 virtual SkTypeface* onCreateFromStream(SkStream* stream, int ttcIndex) const SK_OVERRIDE { | 811 virtual SkTypeface* onCreateFromStream(SkStream* stream, int ttcIndex) const SK_OVERRIDE { |
| 808 const size_t length = stream->getLength(); | 812 const size_t length = stream->getLength(); |
| 809 if (length <= 0 || (1u << 30) < length) { | 813 if (length <= 0 || (1u << 30) < length) { |
| 810 return NULL; | 814 return NULL; |
| 811 } | 815 } |
| 812 | 816 |
| 813 SkTypeface::Style style = SkTypeface::kNormal; | 817 SkTypeface::Style style = SkTypeface::kNormal; |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 844 return typeface.detach(); | 848 return typeface.detach(); |
| 845 } | 849 } |
| 846 | 850 |
| 847 return this->matchFamilyStyle(NULL, style); | 851 return this->matchFamilyStyle(NULL, style); |
| 848 } | 852 } |
| 849 }; | 853 }; |
| 850 | 854 |
| 851 SkFontMgr* SkFontMgr::Factory() { | 855 SkFontMgr* SkFontMgr::Factory() { |
| 852 return SkNEW(SkFontMgr_fontconfig); | 856 return SkNEW(SkFontMgr_fontconfig); |
| 853 } | 857 } |
| OLD | NEW |