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

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, adding bitfield to FontMetrics 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') | no next file with comments »
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..1887c7f6175acea3a1291680fe5ae4d21e1ca731 100644
--- a/include/core/SkPaint.h
+++ b/include/core/SkPaint.h
@@ -730,7 +730,28 @@ public:
void setTextEncoding(TextEncoding encoding);
+ /** Describes defined to identify which values are unknown, later can be
+ used for other uses
+ */
+ enum FontMetricsBitSet {
reed1 2014/02/12 17:29:08 Skia convention would name this FontMetricsFlags,
reed1 2014/02/12 17:29:08 Possibly we could place this enum inside FontMetri
h.joshi 2014/02/13 02:23:52 Okey, will change enum variable names. On 2014/02
h.joshi 2014/02/13 02:23:52 Okey, will shift emum inside FontMetrics structure
+ kFontMetrics_Top = 1 << 1, //!< Bit flag for FontMetrics fTop
+ kFontMetrics_Ascent = 1 << 2, //!< Bit flag for FontMetrics Ascent
+ kFontMetrics_Descent = 1 << 3, //!< Bit flag for FontMetrics Descent
+ kFontMetrics_Bottom = 1 << 4, //!< Bit flag for FontMetrics Bottom
reed1 2014/02/12 17:29:08 Do we really need/want a bit for every field? I th
h.joshi 2014/02/13 02:43:20 Will remove comments from enum. Underline will get
+ kFontMetrics_Leading = 1 << 5, //!< Bit flag for FontMetrics Leading
+ kFontMetrics_AvgCharWidth = 1 << 6, //!< Bit flag for FontMetrics Average Char Width
+ kFontMetrics_MaxCharWidth = 1 << 7, //!< Bit flag for FontMetrics Max Char Width
+ kFontMetrics_XMin = 1 << 8, //!< Bit flag for FontMetrics x - min
+ kFontMetrics_XMax = 1 << 9, //!< Bit flag for FontMetrics x - max
+ kFontMetrics_XHeight = 1 << 10, //!< Bit flag for FontMetrics x - height
+ kFontMetrics_CapHeight = 1 << 11, //!< Bit flag for FontMetrics Cap Height
+ kFontMetrics_UnderlineThickness = 1 << 12, //!< Bit flag for FontMetrics Underline Thickness
+ kFontMetrics_UnderlinePosition = 1 << 13, //!< Bit flag for FontMetrics Underline Position
+ kFontMetrics_Max = 0xFFFF, //!< Max Bit flag
reed1 2014/02/12 17:29:08 Why do we need the Max?
h.joshi 2014/02/13 02:23:52 Just added to signify for max/default value, think
+ };
+
struct FontMetrics {
+ uint16_t fFontMetricsFlag; //!< Bit field to identify which values are unknown
reed1 2014/02/12 17:29:08 definitely make this uint32_t (or possibly 64bit)
h.joshi 2014/02/13 02:23:52 Okey will make it 32 bit. On 2014/02/12 17:29:08,
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)
@@ -742,8 +763,17 @@ public:
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 fObject Pointer of FontMetrics object
+ @param bitSet bit whose value we want to know is set or not
+ @param retrun true if FontMetrics bit i set false otherwise
+ */
+ bool isFontMetricsBitSet(FontMetrics * fObject, FontMetricsBitSet bitSet) const;
+
/** Return the recommend spacing between lines (which will be
fDescent - fAscent + fLeading).
If metrics is not null, return in it the font metrics for the
« no previous file with comments | « no previous file | src/core/SkPaint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698