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

Unified Diff: ui/gfx/render_text.h

Issue 1020853018: DNCI [RenderText] Added font size options in RenderText. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added font sizes to mac font style iterator Created 5 years, 9 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 | ui/gfx/render_text.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/render_text.h
diff --git a/ui/gfx/render_text.h b/ui/gfx/render_text.h
index fe70f4761beed7b7117b96605d9803a41d8906e3..a05eac0c33616a5ba0a49ab4a6f59dbe0b7139d9 100644
--- a/ui/gfx/render_text.h
+++ b/ui/gfx/render_text.h
@@ -112,12 +112,14 @@ class GFX_EXPORT SkiaTextRenderer {
// Internal helper class used to iterate colors, baselines, and styles.
class StyleIterator {
public:
- StyleIterator(const BreakList<SkColor>& colors,
+ StyleIterator(const BreakList<uint32_t>& font_sizes,
+ const BreakList<SkColor>& colors,
const BreakList<BaselineStyle>& baselines,
const std::vector<BreakList<bool>>& styles);
~StyleIterator();
// Get the colors and styles at the current iterator position.
+ uint32_t font_size() const { return font_size_->second; }
SkColor color() const { return color_->second; }
BaselineStyle baseline() const { return baseline_->second; }
bool style(TextStyle s) const { return style_[s]->second; }
@@ -129,10 +131,12 @@ class StyleIterator {
void UpdatePosition(size_t position);
private:
+ BreakList<uint32_t> font_sizes_;
BreakList<SkColor> colors_;
BreakList<BaselineStyle> baselines_;
std::vector<BreakList<bool> > styles_;
+ BreakList<uint32_t>::const_iterator font_size_;
BreakList<SkColor>::const_iterator color_;
BreakList<BaselineStyle>::const_iterator baseline_;
std::vector<BreakList<bool>::const_iterator> style_;
@@ -214,6 +218,9 @@ class GFX_EXPORT RenderText {
}
void SetHorizontalAlignment(HorizontalAlignment alignment);
+ VerticalAlignment vertical_alignment() const { return vertical_alignment_; }
msw 2015/03/26 23:07:28 You should upload CLs that are rebased on your loc
dschuyler 2015/03/27 21:32:13 Done.
+ void SetVerticalAlignment(VerticalAlignment alignment);
+
const FontList& font_list() const { return font_list_; }
void SetFontList(const FontList& font_list);
@@ -338,6 +345,12 @@ class GFX_EXPORT RenderText {
const Range& GetCompositionRange() const;
void SetCompositionRange(const Range& composition_range);
+ // Set the font size over the entire text or a logical character range.
+ // The |range| should be valid, non-reversed, and within [0, text().length()].
+ // A |value| of zero will expand to the default font size.
+ void SetFontSize(uint32_t value);
+ void ApplyFontSize(uint32_t value, const Range& range);
+
// Set the text color over the entire text or a logical character range.
// The |range| should be valid, non-reversed, and within [0, text().length()].
void SetColor(SkColor value);
@@ -475,6 +488,7 @@ class GFX_EXPORT RenderText {
const base::string16& display_text() const { return display_text_; }
bool text_elided() const { return text_elided_; }
+ const BreakList<uint32_t>& font_sizes() const { return font_sizes_; }
const BreakList<SkColor>& colors() const { return colors_; }
const BreakList<BaselineStyle>& baselines() const { return baselines_; }
const std::vector<BreakList<bool> >& styles() const { return styles_; }
@@ -622,6 +636,7 @@ class GFX_EXPORT RenderText {
FRIEND_TEST_ALL_PREFIXES(RenderTextTest, RevealObscuredText);
FRIEND_TEST_ALL_PREFIXES(RenderTextTest, ElidedText);
FRIEND_TEST_ALL_PREFIXES(RenderTextTest, ElidedObscuredText);
+ FRIEND_TEST_ALL_PREFIXES(RenderTextTest, FontSize);
FRIEND_TEST_ALL_PREFIXES(RenderTextTest, TruncatedText);
FRIEND_TEST_ALL_PREFIXES(RenderTextTest, TruncatedObscuredText);
FRIEND_TEST_ALL_PREFIXES(RenderTextTest, GraphemePositions);
@@ -643,6 +658,7 @@ class GFX_EXPORT RenderText {
FRIEND_TEST_ALL_PREFIXES(RenderTextTest, BreakRunsByUnicodeBlocks);
FRIEND_TEST_ALL_PREFIXES(RenderTextTest, PangoAttributes);
FRIEND_TEST_ALL_PREFIXES(RenderTextTest, StringFitsOwnWidth);
+ FRIEND_TEST_ALL_PREFIXES(RenderTextTest, VerticalAlignement);
// Set the cursor to |position|, with the caret trailing the previous
// grapheme, or if there is no previous grapheme, leading the cursor position.
@@ -679,6 +695,10 @@ class GFX_EXPORT RenderText {
// default is to align left if the application UI is LTR and right if RTL.
HorizontalAlignment horizontal_alignment_;
+ // Vertical alignment of the text with respect to |display_rect_|. The
+ // default is to vertically align middle.
+ VerticalAlignment vertical_alignment_;
+
// The text directionality mode, defaults to DIRECTIONALITY_FROM_TEXT.
DirectionalityMode directionality_mode_;
@@ -720,6 +740,7 @@ class GFX_EXPORT RenderText {
// Color, baseline, and style breaks, used to modify ranges of text.
// BreakList positions are stored with text indices, not display indices.
+ BreakList<uint32_t> font_sizes_;
// TODO(msw): Expand to support cursor, selection, background, etc. colors.
BreakList<SkColor> colors_;
BreakList<BaselineStyle> baselines_;
« no previous file with comments | « no previous file | ui/gfx/render_text.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698