OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 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 #ifndef SkScalerContext_DEFINED | 8 #ifndef SkScalerContext_DEFINED |
9 #define SkScalerContext_DEFINED | 9 #define SkScalerContext_DEFINED |
10 | 10 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 SkTypeface* getTypeface() const { return fTypeface.get(); } | 153 SkTypeface* getTypeface() const { return fTypeface.get(); } |
154 | 154 |
155 SkMask::Format getMaskFormat() const { | 155 SkMask::Format getMaskFormat() const { |
156 return (SkMask::Format)fRec.fMaskFormat; | 156 return (SkMask::Format)fRec.fMaskFormat; |
157 } | 157 } |
158 | 158 |
159 bool isSubpixel() const { | 159 bool isSubpixel() const { |
160 return SkToBool(fRec.fFlags & kSubpixelPositioning_Flag); | 160 return SkToBool(fRec.fFlags & kSubpixelPositioning_Flag); |
161 } | 161 } |
162 | 162 |
| 163 bool isVertical() const { |
| 164 return SkToBool(fRec.fFlags & kVertical_Flag); |
| 165 } |
| 166 |
163 // remember our glyph offset/base | 167 // remember our glyph offset/base |
164 void setBaseGlyphCount(unsigned baseGlyphCount) { | 168 void setBaseGlyphCount(unsigned baseGlyphCount) { |
165 fBaseGlyphCount = baseGlyphCount; | 169 fBaseGlyphCount = baseGlyphCount; |
166 } | 170 } |
167 | 171 |
168 /** Return the corresponding glyph for the specified unichar. Since contexts | 172 /** Return the corresponding glyph for the specified unichar. Since contexts |
169 may be chained (under the hood), the glyphID that is returned may in | 173 may be chained (under the hood), the glyphID that is returned may in |
170 fact correspond to a different font/context. In that case, we use the | 174 fact correspond to a different font/context. In that case, we use the |
171 base-glyph-count to know how to translate back into local glyph space. | 175 base-glyph-count to know how to translate back into local glyph space. |
172 */ | 176 */ |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 | 242 |
239 /** Sets the passed path to the glyph outline. | 243 /** Sets the passed path to the glyph outline. |
240 * If this cannot be done the path is set to empty; | 244 * If this cannot be done the path is set to empty; |
241 * this is indistinguishable from a glyph with an empty path. | 245 * this is indistinguishable from a glyph with an empty path. |
242 * This does not set glyph.fPath. | 246 * This does not set glyph.fPath. |
243 * | 247 * |
244 * TODO: path is always glyph.fPath, no reason to pass separately. | 248 * TODO: path is always glyph.fPath, no reason to pass separately. |
245 */ | 249 */ |
246 virtual void generatePath(const SkGlyph& glyph, SkPath* path) = 0; | 250 virtual void generatePath(const SkGlyph& glyph, SkPath* path) = 0; |
247 | 251 |
248 /** Retrieves font metrics. | 252 /** Retrieves font metrics. */ |
249 * TODO: there is now a vertical bit, no need for two parameters. | 253 virtual void generateFontMetrics(SkPaint::FontMetrics*) = 0; |
250 */ | |
251 virtual void generateFontMetrics(SkPaint::FontMetrics* mX, | |
252 SkPaint::FontMetrics* mY) = 0; | |
253 | 254 |
254 /** Returns the number of glyphs in the font. */ | 255 /** Returns the number of glyphs in the font. */ |
255 virtual unsigned generateGlyphCount() = 0; | 256 virtual unsigned generateGlyphCount() = 0; |
256 | 257 |
257 /** Returns the glyph id for the given unichar. | 258 /** Returns the glyph id for the given unichar. |
258 * If there is no 1:1 mapping from the unichar to a glyph id, returns 0. | 259 * If there is no 1:1 mapping from the unichar to a glyph id, returns 0. |
259 */ | 260 */ |
260 virtual uint16_t generateCharToGlyph(SkUnichar unichar) = 0; | 261 virtual uint16_t generateCharToGlyph(SkUnichar unichar) = 0; |
261 | 262 |
262 /** Returns the unichar for the given glyph id. | 263 /** Returns the unichar for the given glyph id. |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 return static_cast<SkPaint::Hinting>(hint); | 349 return static_cast<SkPaint::Hinting>(hint); |
349 } | 350 } |
350 | 351 |
351 void SkScalerContextRec::setHinting(SkPaint::Hinting hinting) { | 352 void SkScalerContextRec::setHinting(SkPaint::Hinting hinting) { |
352 fFlags = (fFlags & ~SkScalerContext::kHinting_Mask) | | 353 fFlags = (fFlags & ~SkScalerContext::kHinting_Mask) | |
353 (hinting << SkScalerContext::kHinting_Shift); | 354 (hinting << SkScalerContext::kHinting_Shift); |
354 } | 355 } |
355 | 356 |
356 | 357 |
357 #endif | 358 #endif |
OLD | NEW |