Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Unified Diff: include/core/SkPaint.h

Issue 152073003: Adding code to calculate Underline Thickness from Font Metrics, this will be useful when Skia is us… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fixing comments for Underline patch Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkPaint.cpp » ('j') | src/core/SkPaint.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkPaint.h
diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h
index abb859950c5bb6a66aecccded690ca8cd6ae02a2..17dda8601b515c34fcc8fa17818e070b04aeac31 100644
--- a/include/core/SkPaint.h
+++ b/include/core/SkPaint.h
@@ -731,17 +731,45 @@ 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 {
bungeman-skia 2014/02/20 16:52:46 Since this is in FontMetrics (already namespaced)
+ kUnderlineThinknessIsValid_FontMetricFlag = 0x01,
+ kUnderlinePositionIsValid_FontMetricsflag = 1 << 1,
bungeman-skia 2014/02/20 16:52:46 kUnderlineThinkness_ValidityFlag kUnderlinePositio
+ };
+
+ uint32_t fFontMetricsFlag; //!< Bit field to identify which values are unknown
bungeman-skia 2014/02/20 16:52:46 fValidityFlags
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
+ SkScalar fUnderlinePosition; //!< underline position, or 0 if cannot be determined
+
+ /** Method to get bit set for Font Metrics
+ @param bitSet bit whose value we want to know is set or not
+ */
+ void setFontMetricsFlag(FontMetrics::FontMetricsFlags bitSet);
bungeman-skia 2014/02/20 16:52:46 validate(uint32_t flags) or validate(ValidityFlags
+
+ /** Method to get bit set for Font Metrics
+ @param bitSet bit whose value we want to know is set or not
+ */
+ void unsetFontMetricsFlag(FontMetrics::FontMetricsFlags bitSet);
bungeman-skia 2014/02/20 16:52:46 invalidate(uint32_t flags) or invalidate(ValidityF
+
+ /** Method to get bit set for Font Metrics
+ @param bitSet bit whose value we want to know is set or not
+ @param return true if FontMetrics bit i set false otherwise
+ */
+ bool checkFontMetricsFlag(FontMetrics::FontMetricsFlags bitSet) const;
bungeman-skia 2014/02/20 16:52:46 isValid(uint32_t flags) or isValid(ValidityFlags f
+
};
/** Return the recommend spacing between lines (which will be
« no previous file with comments | « no previous file | src/core/SkPaint.cpp » ('j') | src/core/SkPaint.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698