summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rwxr-xr-x[-rw-r--r--]app/gfx/canvas_linux.cc10
-rwxr-xr-x[-rw-r--r--]app/gfx/font_skia.cc1
2 files changed, 2 insertions, 9 deletions
diff --git a/app/gfx/canvas_linux.cc b/app/gfx/canvas_linux.cc
index b08b4ce..e658c6a 100644..100755
--- a/app/gfx/canvas_linux.cc
+++ b/app/gfx/canvas_linux.cc
@@ -154,11 +154,7 @@ void Canvas::SizeStringInt(const std::wstring& text,
std::string utf8 = WideToUTF8(text);
pango_layout_set_text(layout, utf8.data(), utf8.size());
- int chars_height;
- pango_layout_get_size(layout, width, &chars_height);
- *width /= PANGO_SCALE;
- // Pango returns the height of the characters, not the height of the font.
- *height = font.height();
+ pango_layout_get_pixel_size(layout, width, height);
g_object_unref(layout);
cairo_destroy(cr);
@@ -187,9 +183,7 @@ void Canvas::DrawStringInt(const std::wstring& text,
pango_layout_set_text(layout, utf8.data(), utf8.size());
int width, height;
- pango_layout_get_size(layout, &width, &height);
- width /= PANGO_SCALE;
- height /= PANGO_SCALE;
+ pango_layout_get_pixel_size(layout, &width, &height);
if (flags & Canvas::TEXT_VALIGN_TOP) {
// Cairo should draw from the top left corner already.
diff --git a/app/gfx/font_skia.cc b/app/gfx/font_skia.cc
index 37cbe8d..8f6ccc1 100644..100755
--- a/app/gfx/font_skia.cc
+++ b/app/gfx/font_skia.cc
@@ -187,7 +187,6 @@ double Font::avg_width() {
int text_width = GetStringWidth(
L"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
double dialog_units = (text_width / 26 + 1) / 2;
-
avg_width_ = std::min(pango_width, dialog_units);
pango_font_metrics_unref(pango_metrics);
pango_font_description_free(pango_desc);