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

Unified Diff: ui/gfx/canvas_skia.cc

Issue 10703075: Fix default alignment of drawn text when no alignment flags are passed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/canvas_skia.cc
===================================================================
--- ui/gfx/canvas_skia.cc (revision 145297)
+++ ui/gfx/canvas_skia.cc (working copy)
@@ -138,6 +138,14 @@
display_rect.set_height(font.GetHeight());
render_text->SetDisplayRect(display_rect);
+ // Set the text alignment explicitly based on the directionality of the UI,
+ // if not specified.
+ if (!(flags & (gfx::Canvas::TEXT_ALIGN_CENTER |
+ gfx::Canvas::TEXT_ALIGN_RIGHT |
+ gfx::Canvas::TEXT_ALIGN_LEFT))) {
+ flags |= gfx::Canvas::DefaultCanvasTextAlignment();
+ }
+
if (flags & gfx::Canvas::TEXT_ALIGN_RIGHT)
render_text->SetHorizontalAlignment(gfx::ALIGN_RIGHT);
else if (flags & gfx::Canvas::TEXT_ALIGN_CENTER)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698