Chromium Code Reviews| Index: include/core/SkPaint.h |
| diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h |
| index abb859950c5bb6a66aecccded690ca8cd6ae02a2..243556c988f84fcb562ce2fe630a2355bd710597 100644 |
| --- a/include/core/SkPaint.h |
| +++ b/include/core/SkPaint.h |
| @@ -731,17 +731,63 @@ public: |
| void setTextEncoding(TextEncoding encoding); |
| struct FontMetrics { |
| + /** Flags which indicate the confidence level of various metrics. |
| + A set flag indicates that the metric may be trusted. |
| + */ |
| + enum FontMetricsFlags { |
| + kUnderlineThinknessIsValid_Flag = 0x01, |
|
reed1
2014/02/24 13:26:22
tiny nit:
Since we're using 1 << 1 (which I like
h.joshi
2014/02/24 18:21:44
Done, fixed in new patch.
On 2014/02/24 13:26:22,
|
| + kUnderlinePositionIsValid_Flag = 1 << 1, |
| + }; |
| + |
| + uint32_t fFlags; //!< Bit field to identify which values are unknown |
| SkScalar fTop; //!< The greatest distance above the baseline for any glyph (will be <= 0) |
| SkScalar fAscent; //!< The recommended distance above the baseline (will be <= 0) |
| SkScalar fDescent; //!< The recommended distance below the baseline (will be >= 0) |
| SkScalar fBottom; //!< The greatest distance below the baseline for any glyph (will be >= 0) |
| SkScalar fLeading; //!< The recommended distance to add between lines of text (will be >= 0) |
| - SkScalar fAvgCharWidth; //!< the average charactor width (>= 0) |
| - SkScalar fMaxCharWidth; //!< the max charactor width (>= 0) |
| + SkScalar fAvgCharWidth; //!< the average character width (>= 0) |
| + SkScalar fMaxCharWidth; //!< the max character width (>= 0) |
| SkScalar fXMin; //!< The minimum bounding box x value for all glyphs |
| SkScalar fXMax; //!< The maximum bounding box x value for all glyphs |
| SkScalar fXHeight; //!< The height of an 'x' in px, or 0 if no 'x' in face |
| SkScalar fCapHeight; //!< The cap height (> 0), or 0 if cannot be determined. |
| + SkScalar fUnderlineThickness; //!< underline thickness, or 0 if cannot be determined |
|
reed1
2014/02/24 13:26:22
Documentation question about position.
If the thi
h.joshi
2014/02/24 18:22:39
For Position we can have following values
- Posit
|
| + SkScalar fUnderlinePosition; //!< underline position, or 0 if cannot be determined |
| + |
| + /** Method to get bit set for Font Metrics |
| + @param flag bit whose value we want to validate |
| + */ |
| + void validate(FontMetrics::FontMetricsFlags flag) { |
| + fFlags |= flag; |
| + } |
| + |
| + /** Method to check invalidate flag set for Font Metrics |
| + @param flag bit whose value we want to invalidate |
| + */ |
| + void invalidate(FontMetrics::FontMetricsFlags flag) { |
| + fFlags &= ~flag; |
| + } |
| + |
| + /** Method to get bit set for Font Metrics |
| + @param flag flag of type FontMetrics::FontMetricsFlags whose value we want to know |
| + @param return true if FontMetrics bit false otherwise |
| + */ |
| + bool isValid(uint32_t flag) const { |
| + return SkToBool((fFlags & flag) == flag); |
| + } |
|
reed1
2014/02/24 13:26:22
I don't think we should have any of these construc
h.joshi
2014/02/24 18:21:44
Done, removed getter and setter methods.
On 2014/
|
| + |
| + /** If the fontmetrics has a valid underlinethickness, return true, and set the |
| + thickness param to that value. If it doesn't return false and ignore the |
| + thickness param. |
| + */ |
| + bool hasUnderlineThickness(SkScalar* thickness) const; |
| + |
| + /** If the fontmetrics has a valid underlineposition, return true, and set the |
| + thickness param to that value. If it doesn't return false and ignore the |
| + thickness param. |
| + */ |
| + bool hasUnderlinePosition(SkScalar* thickness) const; |
|
reed1
2014/02/24 13:26:22
These two getters are OK in my opinion, though not
h.joshi
2014/02/24 18:21:44
Done, these are made inline now in new patch.
On
|
| + |
| }; |
| /** Return the recommend spacing between lines (which will be |