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

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

Issue 563263003: Handle NULL typeface in SkFontMgr_fontconfig::onMatchFaceStyle. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « no previous file | 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 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698