summaryrefslogtreecommitdiffstats
path: root/ui/gfx/render_text_linux.cc
diff options
context:
space:
mode:
authorbinji@chromium.org <binji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-09 23:21:11 +0000
committerbinji@chromium.org <binji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-09 23:21:11 +0000
commit4909ecaf28e4b3bbc6171814548cf51e249ad45a (patch)
tree9b5220653638c509a1cece937d817578455bf174 /ui/gfx/render_text_linux.cc
parent106b09d97d773b9c0fff77ce2b44f32f43cad34c (diff)
downloadchromium_src-4909ecaf28e4b3bbc6171814548cf51e249ad45a.zip
chromium_src-4909ecaf28e4b3bbc6171814548cf51e249ad45a.tar.gz
chromium_src-4909ecaf28e4b3bbc6171814548cf51e249ad45a.tar.bz2
Revert 116945 - 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 TBR=asvitkine@chromium.org Review URL: http://codereview.chromium.org/9147016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116948 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/render_text_linux.cc')
-rw-r--r--ui/gfx/render_text_linux.cc32
1 files changed, 0 insertions, 32 deletions
diff --git a/ui/gfx/render_text_linux.cc b/ui/gfx/render_text_linux.cc
index a51bbef..4ebac11 100644
--- a/ui/gfx/render_text_linux.cc
+++ b/ui/gfx/render_text_linux.cc
@@ -258,7 +258,6 @@ void RenderTextLinux::EnsureLayout() {
// TODO(xji): If RenderText will be used for displaying purpose, such as
// label, we will need to remove the single-line-mode setting.
pango_layout_set_single_paragraph_mode(layout_, true);
- SetupPangoAttributes(layout_);
current_line_ = pango_layout_get_line_readonly(layout_, 0);
pango_layout_line_ref(current_line_);
@@ -270,35 +269,6 @@ void RenderTextLinux::EnsureLayout() {
}
}
-void RenderTextLinux::SetupPangoAttributes(PangoLayout* layout) {
- PangoAttrList* attrs = pango_attr_list_new();
-
- int default_font_style = font_list().GetStyle();
- for (StyleRanges::const_iterator i = style_ranges().begin();
- i < style_ranges().end(); ++i) {
- // In Pango, different fonts means different runs, and it breaks Arabic
- // shaping across run boundaries. So, set font only when it is different
- // from the default font.
- // TODO(xji): We'll eventually need to split up StyleRange into components
- // (ColorRange, FontRange, etc.) so that we can combine adjacent ranges
- // with the same Fonts (to avoid unnecessarily splitting up runs).
- if (i->font_style != default_font_style) {
- FontList derived_font_list = font_list().DeriveFontList(i->font_style);
- PangoFontDescription* desc = pango_font_description_from_string(
- derived_font_list.GetFontDescriptionString().c_str());
-
- PangoAttribute* pango_attr = pango_attr_font_desc_new(desc);
- pango_attr->start_index = Utf16IndexToUtf8Index(i->range.start());
- pango_attr->end_index = Utf16IndexToUtf8Index(i->range.end());
- pango_attr_list_insert(attrs, pango_attr);
- pango_font_description_free(desc);
- }
- }
-
- pango_layout_set_attributes(layout, attrs);
- pango_attr_list_unref(attrs);
-}
-
void RenderTextLinux::DrawVisualText(Canvas* canvas) {
TRACE_EVENT0("gfx", "RenderTextLinux::DrawVisualText");
DCHECK(layout_);
@@ -383,7 +353,6 @@ void RenderTextLinux::DrawVisualText(Canvas* canvas) {
// styles evenly over the glyph. We can do this too by
// clipping and drawing the glyph several times.
renderer.SetForegroundColor(styles[style].foreground);
- renderer.SetFontStyle(styles[style].font_style);
renderer.DrawPosText(&pos[start], &glyphs[start], i - start);
if (styles[style].underline || styles[style].strike) {
renderer.DrawDecorations(start_x, y, glyph_x - start_x,
@@ -403,7 +372,6 @@ void RenderTextLinux::DrawVisualText(Canvas* canvas) {
// Draw the remaining glyphs.
renderer.SetForegroundColor(styles[style].foreground);
- renderer.SetFontStyle(styles[style].font_style);
renderer.DrawPosText(&pos[start], &glyphs[start], glyph_count - start);
if (styles[style].underline || styles[style].strike) {
renderer.DrawDecorations(start_x, y, glyph_x - start_x,