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

Side by Side 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: Adding Bitfield to Font Metrics Structure 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/core/SkPaint.cpp » ('j') | src/core/SkPaint.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 2
3 /* 3 /*
4 * Copyright 2006 The Android Open Source Project 4 * Copyright 2006 The Android Open Source Project
5 * 5 *
6 * Use of this source code is governed by a BSD-style license that can be 6 * Use of this source code is governed by a BSD-style license that can be
7 * found in the LICENSE file. 7 * found in the LICENSE file.
8 */ 8 */
9 9
10 10
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 kUTF16_TextEncoding, //!< the text parameters are UTF16 724 kUTF16_TextEncoding, //!< the text parameters are UTF16
725 kUTF32_TextEncoding, //!< the text parameters are UTF32 725 kUTF32_TextEncoding, //!< the text parameters are UTF32
726 kGlyphID_TextEncoding //!< the text parameters are glyph indices 726 kGlyphID_TextEncoding //!< the text parameters are glyph indices
727 }; 727 };
728 728
729 TextEncoding getTextEncoding() const { return (TextEncoding)fTextEncoding; } 729 TextEncoding getTextEncoding() const { return (TextEncoding)fTextEncoding; }
730 730
731 void setTextEncoding(TextEncoding encoding); 731 void setTextEncoding(TextEncoding encoding);
732 732
733 struct FontMetrics { 733 struct FontMetrics {
734 /** Describes defined to identify which values are unknown, later ca n be
bungeman-skia 2014/02/17 19:10:06 nit: this comment needs to be un-indented This co
h.joshi 2014/02/18 05:48:48 Okey, will make suggested changes On 2014/02/17 1
735 used for other uses
736 */
737 enum FontMetricsFlags {
738 kUnderlineThinknessIsValid_FontMetricFlag = 0x01,
739 kUnderlinePositionIsValid_FontMetricsflag = 1 << 1,
740 };
741
742 uint32_t fFontMetricsFlag; //!< Bit field to identify which val ues are unknown
734 SkScalar fTop; //!< The greatest distance above the baseline fo r any glyph (will be <= 0) 743 SkScalar fTop; //!< The greatest distance above the baseline fo r any glyph (will be <= 0)
735 SkScalar fAscent; //!< The recommended distance above the baseline (will be <= 0) 744 SkScalar fAscent; //!< The recommended distance above the baseline (will be <= 0)
736 SkScalar fDescent; //!< The recommended distance below the baseline (will be >= 0) 745 SkScalar fDescent; //!< The recommended distance below the baseline (will be >= 0)
737 SkScalar fBottom; //!< The greatest distance below the baseline fo r any glyph (will be >= 0) 746 SkScalar fBottom; //!< The greatest distance below the baseline fo r any glyph (will be >= 0)
738 SkScalar fLeading; //!< The recommended distance to add between lin es of text (will be >= 0) 747 SkScalar fLeading; //!< The recommended distance to add between lin es of text (will be >= 0)
739 SkScalar fAvgCharWidth; //!< the average charactor width (>= 0) 748 SkScalar fAvgCharWidth; //!< the average charactor width (>= 0)
740 SkScalar fMaxCharWidth; //!< the max charactor width (>= 0) 749 SkScalar fMaxCharWidth; //!< the max charactor width (>= 0)
741 SkScalar fXMin; //!< The minimum bounding box x value for all gl yphs 750 SkScalar fXMin; //!< The minimum bounding box x value for all gl yphs
742 SkScalar fXMax; //!< The maximum bounding box x value for all gl yphs 751 SkScalar fXMax; //!< The maximum bounding box x value for all gl yphs
743 SkScalar fXHeight; //!< The height of an 'x' in px, or 0 if no 'x' in face 752 SkScalar fXHeight; //!< The height of an 'x' in px, or 0 if no 'x' in face
744 SkScalar fCapHeight; //!< The cap height (> 0), or 0 if cannot be de termined. 753 SkScalar fCapHeight; //!< The cap height (> 0), or 0 if cannot be de termined.
754 SkScalar fUnderlineThickness; //!< underline thickness, or 0 if canno t be determined
755 SkScalar fUnderlinePosition; //!< underline position, or 0 if cannot be determined
745 }; 756 };
746 757
758 /** Method to get bit set for Font Metrics
759 @param fObject Pointer of FontMetrics object
760 @param bitSet bit whose value we want to know is set or not
761 @param retrun true if FontMetrics bit i set false otherwise
762 */
763 bool isFontMetricsFlagSet(FontMetrics * fObject, FontMetrics::FontMetricsFla gs bitSet) const;
bungeman-skia 2014/02/17 19:10:06 This seems like a really odd public interface to h
h.joshi 2014/02/18 05:48:48 Pls suggest should I move method inside FontMetric
764
747 /** Return the recommend spacing between lines (which will be 765 /** Return the recommend spacing between lines (which will be
748 fDescent - fAscent + fLeading). 766 fDescent - fAscent + fLeading).
749 If metrics is not null, return in it the font metrics for the 767 If metrics is not null, return in it the font metrics for the
750 typeface/pointsize/etc. currently set in the paint. 768 typeface/pointsize/etc. currently set in the paint.
751 @param metrics If not null, returns the font metrics for the 769 @param metrics If not null, returns the font metrics for the
752 current typeface/pointsize/etc setting in this 770 current typeface/pointsize/etc setting in this
753 paint. 771 paint.
754 @param scale If not 0, return width as if the canvas were scaled 772 @param scale If not 0, return width as if the canvas were scaled
755 by this value 773 by this value
756 @param return the recommended spacing between lines 774 @param return the recommended spacing between lines
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 #ifdef SK_BUILD_FOR_ANDROID 1097 #ifdef SK_BUILD_FOR_ANDROID
1080 SkPaintOptionsAndroid fPaintOptionsAndroid; 1098 SkPaintOptionsAndroid fPaintOptionsAndroid;
1081 1099
1082 // In order for the == operator to work properly this must be the last field 1100 // In order for the == operator to work properly this must be the last field
1083 // in the struct so that we can do a memcmp to this field's offset. 1101 // in the struct so that we can do a memcmp to this field's offset.
1084 uint32_t fGenerationID; 1102 uint32_t fGenerationID;
1085 #endif 1103 #endif
1086 }; 1104 };
1087 1105
1088 #endif 1106 #endif
OLDNEW
« 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