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

Unified Diff: ui/views/examples/text_example.cc

Issue 1819753003: Allow various font weights in gfx. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a lost comment and modify a render text unittest to not test black because of test env font con… Created 4 years, 7 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 | « ui/views/examples/multiline_example.cc ('k') | ui/views/examples/textfield_example.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/examples/text_example.cc
diff --git a/ui/views/examples/text_example.cc b/ui/views/examples/text_example.cc
index 878c910f1afc4fe031411089eb529c92708577ef..c63f1e9f94404534a8a1b0f8e011bae7caab919f 100644
--- a/ui/views/examples/text_example.cc
+++ b/ui/views/examples/text_example.cc
@@ -93,6 +93,11 @@ class TextExample::TextExampleView : public View {
int GetStyle() const { return font_list_.GetFontStyle(); }
void SetStyle(int style) { font_list_ = font_list_.DeriveWithStyle(style); }
+ gfx::Font::Weight GetWeight() const { return font_list_.GetFontWeight(); }
+ void SetWeight(gfx::Font::Weight weight) {
+ font_list_ = font_list_.DeriveWithWeight(weight);
+ }
+
private:
// The font used for drawing the text.
gfx::FontList font_list_;
@@ -190,12 +195,13 @@ void TextExample::ButtonPressed(Button* button, const ui::Event& event) {
int style = text_view_->GetStyle();
SetFlagFromCheckbox(multiline_checkbox_, &flags, gfx::Canvas::MULTI_LINE);
SetFlagFromCheckbox(break_checkbox_, &flags, gfx::Canvas::CHARACTER_BREAK);
- SetFlagFromCheckbox(bold_checkbox_, &style, gfx::Font::BOLD);
SetFlagFromCheckbox(italic_checkbox_, &style, gfx::Font::ITALIC);
SetFlagFromCheckbox(underline_checkbox_, &style, gfx::Font::UNDERLINE);
text_view_->set_halo(halo_checkbox_->checked());
text_view_->set_flags(flags);
text_view_->SetStyle(style);
+ text_view_->SetWeight(bold_checkbox_->checked() ? gfx::Font::Weight::BOLD
+ : gfx::Font::Weight::NORMAL);
text_view_->SchedulePaint();
}
« no previous file with comments | « ui/views/examples/multiline_example.cc ('k') | ui/views/examples/textfield_example.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698