summaryrefslogtreecommitdiffstats
path: root/ui/gfx/render_text_win.cc
diff options
context:
space:
mode:
authorasvitkine@chromium.org <asvitkine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-10 16:10:27 +0000
committerasvitkine@chromium.org <asvitkine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-10 16:10:27 +0000
commit7aba39cb5325f773053a90dfa7e6b87eb2a1cda1 (patch)
treed7692a12eb85935e540dd2f782b53aad03cb75ff /ui/gfx/render_text_win.cc
parent2e2929bd78578081b5665fcea6d085793df2c233 (diff)
downloadchromium_src-7aba39cb5325f773053a90dfa7e6b87eb2a1cda1.zip
chromium_src-7aba39cb5325f773053a90dfa7e6b87eb2a1cda1.tar.gz
chromium_src-7aba39cb5325f773053a90dfa7e6b87eb2a1cda1.tar.bz2
Enable bold and italic text styles in RenderText*.
To do this, the following changes were made: Added functions GetStyle() and DeriveFontList(style) to FontList. Changed font list to use strings "Bold" and "Italic" instead of PANGO_STYLE_ITALIC and PANGO_WEIGHT_BOLD - where were actually compile constants for setting attributes and weren't recognized by Pango in a font string. (Whereas "Bold" and "Italic" are recognized). Add RenderText test that checks that the width of a bold string > the width of a non-bold string. Add FontList tests for the new functions. BUG=107893 TEST=Run views_examples_exe "Text Styles" examples and try bold and italic styles (this depends on an unreleased CL). Also, new tests in FontListTest and RenderTextTest. Review URL: http://codereview.chromium.org/8963027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117034 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/render_text_win.cc')
-rw-r--r--ui/gfx/render_text_win.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/ui/gfx/render_text_win.cc b/ui/gfx/render_text_win.cc
index b821a44..d982c3d 100644
--- a/ui/gfx/render_text_win.cc
+++ b/ui/gfx/render_text_win.cc
@@ -74,7 +74,10 @@ bool ChooseFallbackFont(HDC hdc,
log_font.lfFaceName[0] = 0;
EnumEnhMetaFile(0, meta_file, MetaFileEnumProc, &log_font, NULL);
if (log_font.lfFaceName[0]) {
+ int font_style = font.GetStyle();
*result = gfx::Font(UTF16ToUTF8(log_font.lfFaceName), font.GetFontSize());
+ if (result->GetStyle() != font_style)
+ *result = result->DeriveFont(0, font_style);
found_fallback = true;
}
}
@@ -510,7 +513,7 @@ void RenderTextWin::ItemizeLogicalText() {
for (int run_break = 0; run_break < text_length;) {
internal::TextRun* run = new internal::TextRun();
run->range.set_start(run_break);
- run->font = GetFont();
+ run->font = GetFont().DeriveFont(0, style->font_style);
run->foreground = style->foreground;
run->strike = style->strike;
run->underline = style->underline;