summaryrefslogtreecommitdiffstats
path: root/app/gfx
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-06 17:00:35 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-06 17:00:35 +0000
commitb09c0b8c8bd3e82a2f088f3f91c1d4278132ebbd (patch)
tree3df762a6b71a5253f6e6cad47a399c1394996501 /app/gfx
parent653c9eadfec2cde8d489556f93437212e382d2f1 (diff)
downloadchromium_src-b09c0b8c8bd3e82a2f088f3f91c1d4278132ebbd.zip
chromium_src-b09c0b8c8bd3e82a2f088f3f91c1d4278132ebbd.tar.gz
chromium_src-b09c0b8c8bd3e82a2f088f3f91c1d4278132ebbd.tar.bz2
Fix the ChromeCanvas code to respect text alignment in Linux by using pango.
Review URL: http://codereview.chromium.org/111004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15418 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/gfx')
-rw-r--r--app/gfx/chrome_canvas_linux.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/gfx/chrome_canvas_linux.cc b/app/gfx/chrome_canvas_linux.cc
index ea5e371..0c79f3a 100644
--- a/app/gfx/chrome_canvas_linux.cc
+++ b/app/gfx/chrome_canvas_linux.cc
@@ -95,6 +95,12 @@ void ChromeCanvas::DrawStringInt(const std::wstring& text,
pango_layout_set_width(layout, w * PANGO_SCALE);
pango_layout_set_height(layout, h * PANGO_SCALE);
+ if (flags & TEXT_ALIGN_CENTER) {
+ pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER);
+ } else if (flags & TEXT_ALIGN_RIGHT) {
+ pango_layout_set_alignment(layout, PANGO_ALIGN_RIGHT);
+ }
+
std::string utf8 = WideToUTF8(text);
pango_layout_set_text(layout, utf8.data(), utf8.size());