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

Unified Diff: app/gfx/canvas_linux.cc

Issue 338029: Got the about panel to have its text lined up correctly.
Patch Set: Added pango font metrics cache Created 11 years, 2 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 | app/gfx/font.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: app/gfx/canvas_linux.cc
diff --git a/app/gfx/canvas_linux.cc b/app/gfx/canvas_linux.cc
index e658c6ac184878f5deffe17d4d06ced77851788d..223c1a9822416ebc96e40c798850a779a15002b0 100755
--- a/app/gfx/canvas_linux.cc
+++ b/app/gfx/canvas_linux.cc
@@ -185,6 +185,9 @@ void Canvas::DrawStringInt(const std::wstring& text,
int width, height;
pango_layout_get_pixel_size(layout, &width, &height);
+ cairo_rectangle(cr, x, y, width, height);
+ cairo_clip(cr);
+
if (flags & Canvas::TEXT_VALIGN_TOP) {
// Cairo should draw from the top left corner already.
} else if (flags & Canvas::TEXT_VALIGN_BOTTOM) {
@@ -194,11 +197,16 @@ void Canvas::DrawStringInt(const std::wstring& text,
y += ((h - height) / 2);
}
- cairo_rectangle(cr, x, y, w, h);
- cairo_clip(cr);
-
cairo_move_to(cr, x, y);
pango_cairo_show_layout(cr, layout);
+ if (font.style() & gfx::Font::UNDERLINED) {
+ double underline_y =
+ static_cast<double>(y) + height + font.underline_position();
+ cairo_set_line_width(cr, font.underline_thickness());
+ cairo_move_to(cr, x, underline_y);
+ cairo_line_to(cr, x + width, underline_y);
+ cairo_stroke(cr);
+ }
cairo_restore(cr);
g_object_unref(layout);
« no previous file with comments | « no previous file | app/gfx/font.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698