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 "SkLazyPtr.h" | 9 #include "SkLazyPtr.h" |
10 | 10 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 fUnion.fR.fSlant = kUpright_Slant; | 60 fUnion.fR.fSlant = kUpright_Slant; |
61 } | 61 } |
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 SkFontStyle::SkFontStyle(unsigned oldStyle) { | |
71 fUnion.fU32 = 0; | |
72 fUnion.fR.fWeight = (oldStyle & SkTypeface::kBold) ? SkFontStyle::kBold_Weig
ht | |
73 : SkFontStyle::kNormal_We
ight; | |
74 fUnion.fR.fWidth = SkFontStyle::kNormal_Width; | |
75 fUnion.fR.fSlant = (oldStyle & SkTypeface::kItalic) ? SkFontStyle::kItalic_S
lant | |
76 : SkFontStyle::kUpright_
Slant; | |
77 } | |
78 | |
79 #include "SkFontMgr.h" | 70 #include "SkFontMgr.h" |
80 | 71 |
81 class SkEmptyFontStyleSet : public SkFontStyleSet { | 72 class SkEmptyFontStyleSet : public SkFontStyleSet { |
82 public: | 73 public: |
83 virtual int count() SK_OVERRIDE { return 0; } | 74 virtual int count() SK_OVERRIDE { return 0; } |
84 virtual void getStyle(int, SkFontStyle*, SkString*) SK_OVERRIDE { | 75 virtual void getStyle(int, SkFontStyle*, SkString*) SK_OVERRIDE { |
85 SkDEBUGFAIL("SkFontStyleSet::getStyle called on empty set"); | 76 SkDEBUGFAIL("SkFontStyleSet::getStyle called on empty set"); |
86 } | 77 } |
87 virtual SkTypeface* createTypeface(int index) SK_OVERRIDE { | 78 virtual SkTypeface* createTypeface(int index) SK_OVERRIDE { |
88 SkDEBUGFAIL("SkFontStyleSet::createTypeface called on empty set"); | 79 SkDEBUGFAIL("SkFontStyleSet::createTypeface called on empty set"); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 SkFontMgr* sk_fontmgr_create_default() { | 202 SkFontMgr* sk_fontmgr_create_default() { |
212 SkFontMgr* fm = SkFontMgr::Factory(); | 203 SkFontMgr* fm = SkFontMgr::Factory(); |
213 return fm ? fm : SkNEW(SkEmptyFontMgr); | 204 return fm ? fm : SkNEW(SkEmptyFontMgr); |
214 } | 205 } |
215 | 206 |
216 SK_DECLARE_STATIC_LAZY_PTR(SkFontMgr, singleton, sk_fontmgr_create_default); | 207 SK_DECLARE_STATIC_LAZY_PTR(SkFontMgr, singleton, sk_fontmgr_create_default); |
217 | 208 |
218 SkFontMgr* SkFontMgr::RefDefault() { | 209 SkFontMgr* SkFontMgr::RefDefault() { |
219 return SkRef(singleton.get()); | 210 return SkRef(singleton.get()); |
220 } | 211 } |
OLD | NEW |