diff options
Diffstat (limited to 'views')
-rw-r--r-- | views/controls/button/text_button.cc | 3 | ||||
-rw-r--r-- | views/controls/label.cc | 6 | ||||
-rw-r--r-- | views/view_text_utils.cc | 5 |
3 files changed, 9 insertions, 5 deletions
diff --git a/views/controls/button/text_button.cc b/views/controls/button/text_button.cc index 578be80..1df698a 100644 --- a/views/controls/button/text_button.cc +++ b/views/controls/button/text_button.cc @@ -9,6 +9,7 @@ #include "app/throb_animation.h" #include "app/resource_bundle.h" #include "base/logging.h" +#include "base/utf_string_conversions.h" #include "gfx/canvas_skia.h" #include "views/controls/button/button.h" #include "views/event.h" @@ -402,7 +403,7 @@ void TextButton::UpdateColor() { void TextButton::UpdateTextSize() { int width = 0, height = 0; gfx::CanvasSkia::SizeStringInt( - text_, font_, &width, &height, + WideToUTF16Hack(text_), font_, &width, &height, gfx::Canvas::NO_ELLIPSIS | PrefixTypeToCanvasType(prefix_type_)); // Add 2 extra pixels to width and height when text halo is used. diff --git a/views/controls/label.cc b/views/controls/label.cc index 32df88a..b228c78b 100644 --- a/views/controls/label.cc +++ b/views/controls/label.cc @@ -68,7 +68,8 @@ int Label::GetHeightForWidth(int w) { w = std::max(0, w - GetInsets().width()); int h = font_.GetHeight(); - gfx::CanvasSkia::SizeStringInt(text_, font_, &w, &h, ComputeMultiLineFlags()); + gfx::CanvasSkia::SizeStringInt(WideToUTF16Hack(text_), font_, &w, &h, + ComputeMultiLineFlags()); return h + GetInsets().height(); } @@ -294,7 +295,8 @@ gfx::Size Label::GetTextSize() const { int flags = ComputeMultiLineFlags(); if (!is_multi_line_) flags |= gfx::Canvas::NO_ELLIPSIS; - gfx::CanvasSkia::SizeStringInt(text_, font_, &w, &h, flags); + gfx::CanvasSkia::SizeStringInt(WideToUTF16Hack(text_), font_, &w, &h, + flags); text_size_.SetSize(w, h); text_size_valid_ = true; } diff --git a/views/view_text_utils.cc b/views/view_text_utils.cc index 9b4442d..73bef45 100644 --- a/views/view_text_utils.cc +++ b/views/view_text_utils.cc @@ -117,7 +117,7 @@ void DrawTextStartingFrom(gfx::Canvas* canvas, word = text; // Draw the whole text at once. int w = font.GetStringWidth(word), h = font.GetHeight(); - gfx::CanvasSkia::SizeStringInt(word, font, &w, &h, flags); + gfx::CanvasSkia::SizeStringInt(WideToUTF16Hack(word), font, &w, &h, flags); // If we exceed the boundaries, we need to wrap. WrapIfWordDoesntFit(w, font.GetHeight(), position, bounds); @@ -131,7 +131,8 @@ void DrawTextStartingFrom(gfx::Canvas* canvas, // left of the LTR string. if (ltr_within_rtl && word[word.size() - 1] == L' ') { int space_w = font.GetStringWidth(L" "), space_h = font.GetHeight(); - gfx::CanvasSkia::SizeStringInt(L" ", font, &space_w, &space_h, flags); + gfx::CanvasSkia::SizeStringInt(UTF8ToUTF16(" "), font, &space_w, + &space_h, flags); x += space_w; } } |