Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 /** Flags which indicate the confidence level of various metrics. | |
| 735 A set flag indicates that the metric may be trusted. | |
| 736 */ | |
| 737 enum FontMetricsFlags { | |
| 738 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,
| |
| 739 kUnderlinePositionIsValid_Flag = 1 << 1, | |
| 740 }; | |
| 741 | |
| 742 uint32_t fFlags; //!< Bit field to identify which values are un known | |
| 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 character width (>= 0) |
| 740 SkScalar fMaxCharWidth; //!< the max charactor width (>= 0) | 749 SkScalar fMaxCharWidth; //!< the max character 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 | |
|
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
| |
| 755 SkScalar fUnderlinePosition; //!< underline position, or 0 if cannot be determined | |
| 756 | |
| 757 /** Method to get bit set for Font Metrics | |
| 758 @param flag bit whose value we want to validate | |
| 759 */ | |
| 760 void validate(FontMetrics::FontMetricsFlags flag) { | |
| 761 fFlags |= flag; | |
| 762 } | |
| 763 | |
| 764 /** Method to check invalidate flag set for Font Metrics | |
| 765 @param flag bit whose value we want to invalidate | |
| 766 */ | |
| 767 void invalidate(FontMetrics::FontMetricsFlags flag) { | |
| 768 fFlags &= ~flag; | |
| 769 } | |
| 770 | |
| 771 /** Method to get bit set for Font Metrics | |
| 772 @param flag flag of type FontMetrics::FontMetricsFlags whose value we want to know | |
| 773 @param return true if FontMetrics bit false otherwise | |
| 774 */ | |
| 775 bool isValid(uint32_t flag) const { | |
| 776 return SkToBool((fFlags & flag) == flag); | |
| 777 } | |
|
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/
| |
| 778 | |
| 779 /** If the fontmetrics has a valid underlinethickness, return true, and set the | |
| 780 thickness param to that value. If it doesn't return false and ig nore the | |
| 781 thickness param. | |
| 782 */ | |
| 783 bool hasUnderlineThickness(SkScalar* thickness) const; | |
| 784 | |
| 785 /** If the fontmetrics has a valid underlineposition, return true, and set the | |
| 786 thickness param to that value. If it doesn't return false and ig nore the | |
| 787 thickness param. | |
| 788 */ | |
| 789 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
| |
| 790 | |
| 745 }; | 791 }; |
| 746 | 792 |
| 747 /** Return the recommend spacing between lines (which will be | 793 /** Return the recommend spacing between lines (which will be |
| 748 fDescent - fAscent + fLeading). | 794 fDescent - fAscent + fLeading). |
| 749 If metrics is not null, return in it the font metrics for the | 795 If metrics is not null, return in it the font metrics for the |
| 750 typeface/pointsize/etc. currently set in the paint. | 796 typeface/pointsize/etc. currently set in the paint. |
| 751 @param metrics If not null, returns the font metrics for the | 797 @param metrics If not null, returns the font metrics for the |
| 752 current typeface/pointsize/etc setting in this | 798 current typeface/pointsize/etc setting in this |
| 753 paint. | 799 paint. |
| 754 @param scale If not 0, return width as if the canvas were scaled | 800 @param scale If not 0, return width as if the canvas were scaled |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1079 #ifdef SK_BUILD_FOR_ANDROID | 1125 #ifdef SK_BUILD_FOR_ANDROID |
| 1080 SkPaintOptionsAndroid fPaintOptionsAndroid; | 1126 SkPaintOptionsAndroid fPaintOptionsAndroid; |
| 1081 | 1127 |
| 1082 // In order for the == operator to work properly this must be the last field | 1128 // 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. | 1129 // in the struct so that we can do a memcmp to this field's offset. |
| 1084 uint32_t fGenerationID; | 1130 uint32_t fGenerationID; |
| 1085 #endif | 1131 #endif |
| 1086 }; | 1132 }; |
| 1087 | 1133 |
| 1088 #endif | 1134 #endif |
| OLD | NEW |