Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/ports/SkFontMgr_fontconfig.cpp

Issue 586473002: Restore old behavior of SkTypeface::CreateFromTypeface. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove extra newline. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkTypeface.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 return NULL; 799 return NULL;
800 } 800 }
801 801
802 return createTypefaceFromFcPattern(font); 802 return createTypefaceFromFcPattern(font);
803 } 803 }
804 804
805 virtual SkTypeface* onMatchFaceStyle(const SkTypeface* typeface, 805 virtual SkTypeface* onMatchFaceStyle(const SkTypeface* typeface,
806 const SkFontStyle& style) const SK_OVER RIDE 806 const SkFontStyle& style) const SK_OVER RIDE
807 { 807 {
808 //TODO: should the SkTypeface_fontconfig know its family? 808 //TODO: should the SkTypeface_fontconfig know its family?
809 const char* name = NULL; 809 const SkTypeface_fontconfig* fcTypeface =
810 if (typeface) {
811 const SkTypeface_fontconfig* fcTypeface =
812 static_cast<const SkTypeface_fontconfig*>(typeface); 810 static_cast<const SkTypeface_fontconfig*>(typeface);
813 name = get_string(fcTypeface->fPattern, FC_FAMILY); 811 return this->matchFamilyStyle(get_string(fcTypeface->fPattern, FC_FAMILY ), style);
814 }
815 return this->matchFamilyStyle(name, style);
816 } 812 }
817 813
818 /** @param stream does not take ownership of the reference. */ 814 /** @param stream does not take ownership of the reference. */
819 virtual SkTypeface* onCreateFromStream(SkStream* stream, int ttcIndex) const SK_OVERRIDE { 815 virtual SkTypeface* onCreateFromStream(SkStream* stream, int ttcIndex) const SK_OVERRIDE {
820 const size_t length = stream->getLength(); 816 const size_t length = stream->getLength();
821 if (length <= 0 || (1u << 30) < length) { 817 if (length <= 0 || (1u << 30) < length) {
822 return NULL; 818 return NULL;
823 } 819 }
824 820
825 SkTypeface::Style style = SkTypeface::kNormal; 821 SkTypeface::Style style = SkTypeface::kNormal;
(...skipping 30 matching lines...) Expand all
856 return typeface.detach(); 852 return typeface.detach();
857 } 853 }
858 854
859 return this->matchFamilyStyle(NULL, style); 855 return this->matchFamilyStyle(NULL, style);
860 } 856 }
861 }; 857 };
862 858
863 SkFontMgr* SkFontMgr::Factory() { 859 SkFontMgr* SkFontMgr::Factory() {
864 return SkNEW(SkFontMgr_fontconfig); 860 return SkNEW(SkFontMgr_fontconfig);
865 } 861 }
OLDNEW
« no previous file with comments | « src/core/SkTypeface.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698