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