Commit 74550d24 authored by Daiki Ueno's avatar Daiki Ueno
Browse files

Fix label alignment when the text is RTL.

parent 148d8e75
...@@ -608,6 +608,7 @@ eek_renderer_real_render_key_label (EekRenderer *self, ...@@ -608,6 +608,7 @@ eek_renderer_real_render_key_label (EekRenderer *self,
EekBounds bounds; EekBounds bounds;
const TextProperty *prop; const TextProperty *prop;
PangoFontDescription *font; PangoFontDescription *font;
PangoLayoutLine *line;
gdouble scale; gdouble scale;
symbol = eek_key_get_symbol_with_fallback (key, 0, 0); symbol = eek_key_get_symbol_with_fallback (key, 0, 0);
...@@ -654,6 +655,9 @@ eek_renderer_real_render_key_label (EekRenderer *self, ...@@ -654,6 +655,9 @@ eek_renderer_real_render_key_label (EekRenderer *self,
pango_font_description_free (font); pango_font_description_free (font);
pango_layout_set_text (layout, label, -1); pango_layout_set_text (layout, label, -1);
line = pango_layout_get_line (layout, 0);
if (line->resolved_dir == PANGO_DIRECTION_RTL)
pango_layout_set_alignment (layout, PANGO_ALIGN_RIGHT);
pango_layout_set_width (layout, pango_layout_set_width (layout,
PANGO_SCALE * bounds.width * priv->scale * scale); PANGO_SCALE * bounds.width * priv->scale * scale);
if (prop->ellipses) if (prop->ellipses)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment