| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2009 The Android Open Source Project | 2 * Copyright 2009 The Android Open Source Project |
| 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 "SkFontLCDConfig.h" | 8 #include "SkFontLCDConfig.h" |
| 9 #include "SkOnce.h" | 9 #include "SkOnce.h" |
| 10 | 10 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 SkFontStyle::SkFontStyle(int weight, int width, Slant slant) { | 63 SkFontStyle::SkFontStyle(int weight, int width, Slant slant) { |
| 64 fUnion.fU32 = 0; | 64 fUnion.fU32 = 0; |
| 65 fUnion.fR.fWeight = SkPin32(weight, kThin_Weight, kBlack_Weight); | 65 fUnion.fR.fWeight = SkPin32(weight, kThin_Weight, kBlack_Weight); |
| 66 fUnion.fR.fWidth = SkPin32(width, kUltraCondensed_Width, kUltaExpanded_Width
); | 66 fUnion.fR.fWidth = SkPin32(width, kUltraCondensed_Width, kUltaExpanded_Width
); |
| 67 fUnion.fR.fSlant = SkPin32(slant, kUpright_Slant, kItalic_Slant); | 67 fUnion.fR.fSlant = SkPin32(slant, kUpright_Slant, kItalic_Slant); |
| 68 } | 68 } |
| 69 | 69 |
| 70 #include "SkFontMgr.h" | 70 #include "SkFontMgr.h" |
| 71 | 71 |
| 72 SK_DEFINE_INST_COUNT(SkFontStyleSet) | |
| 73 | |
| 74 class SkEmptyFontStyleSet : public SkFontStyleSet { | 72 class SkEmptyFontStyleSet : public SkFontStyleSet { |
| 75 public: | 73 public: |
| 76 virtual int count() SK_OVERRIDE { return 0; } | 74 virtual int count() SK_OVERRIDE { return 0; } |
| 77 virtual void getStyle(int, SkFontStyle*, SkString*) SK_OVERRIDE { | 75 virtual void getStyle(int, SkFontStyle*, SkString*) SK_OVERRIDE { |
| 78 SkDEBUGFAIL("SkFontStyleSet::getStyle called on empty set"); | 76 SkDEBUGFAIL("SkFontStyleSet::getStyle called on empty set"); |
| 79 } | 77 } |
| 80 virtual SkTypeface* createTypeface(int index) SK_OVERRIDE { | 78 virtual SkTypeface* createTypeface(int index) SK_OVERRIDE { |
| 81 SkDEBUGFAIL("SkFontStyleSet::createTypeface called on empty set"); | 79 SkDEBUGFAIL("SkFontStyleSet::createTypeface called on empty set"); |
| 82 return NULL; | 80 return NULL; |
| 83 } | 81 } |
| 84 virtual SkTypeface* matchStyle(const SkFontStyle&) SK_OVERRIDE { | 82 virtual SkTypeface* matchStyle(const SkFontStyle&) SK_OVERRIDE { |
| 85 return NULL; | 83 return NULL; |
| 86 } | 84 } |
| 87 }; | 85 }; |
| 88 | 86 |
| 89 SkFontStyleSet* SkFontStyleSet::CreateEmpty() { | 87 SkFontStyleSet* SkFontStyleSet::CreateEmpty() { |
| 90 return SkNEW(SkEmptyFontStyleSet); | 88 return SkNEW(SkEmptyFontStyleSet); |
| 91 } | 89 } |
| 92 | 90 |
| 93 /////////////////////////////////////////////////////////////////////////////// | 91 /////////////////////////////////////////////////////////////////////////////// |
| 94 | 92 |
| 95 SK_DEFINE_INST_COUNT(SkFontMgr) | |
| 96 | |
| 97 class SkEmptyFontMgr : public SkFontMgr { | 93 class SkEmptyFontMgr : public SkFontMgr { |
| 98 protected: | 94 protected: |
| 99 virtual int onCountFamilies() SK_OVERRIDE { | 95 virtual int onCountFamilies() SK_OVERRIDE { |
| 100 return 0; | 96 return 0; |
| 101 } | 97 } |
| 102 virtual void onGetFamilyName(int index, SkString* familyName) SK_OVERRIDE { | 98 virtual void onGetFamilyName(int index, SkString* familyName) SK_OVERRIDE { |
| 103 SkDEBUGFAIL("onGetFamilyName called with bad index"); | 99 SkDEBUGFAIL("onGetFamilyName called with bad index"); |
| 104 } | 100 } |
| 105 virtual SkFontStyleSet* onCreateStyleSet(int index) SK_OVERRIDE { | 101 virtual SkFontStyleSet* onCreateStyleSet(int index) SK_OVERRIDE { |
| 106 SkDEBUGFAIL("onCreateStyleSet called with bad index"); | 102 SkDEBUGFAIL("onCreateStyleSet called with bad index"); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault()); | 241 SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault()); |
| 246 return fm->createFromFile(path); | 242 return fm->createFromFile(path); |
| 247 } | 243 } |
| 248 | 244 |
| 249 SkTypeface* SkFontHost::CreateTypefaceFromStream(SkStream* stream) { | 245 SkTypeface* SkFontHost::CreateTypefaceFromStream(SkStream* stream) { |
| 250 SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault()); | 246 SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault()); |
| 251 return fm->createFromStream(stream); | 247 return fm->createFromStream(stream); |
| 252 } | 248 } |
| 253 | 249 |
| 254 #endif | 250 #endif |
| OLD | NEW |