dwrite: Underline origin is always at the left run boundary.
authorNikolay Sivov <nsivov@codeweavers.com>
Tue, 19 Jan 2016 20:23:00 +0000 (23:23 +0300)
committerAlexandre Julliard <julliard@winehq.org>
Wed, 20 Jan 2016 05:48:53 +0000 (14:48 +0900)
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
dlls/dwrite/layout.c

index f765dc68619d8e1ac0beaa5f7b9fe553f928e6de..6b5bec72f0650dcbd6dea80fa07df09bf171acf4 100644 (file)
@@ -428,6 +428,11 @@ static HRESULT format_set_optical_alignment(struct dwrite_textformat_data *forma
     return S_OK;
 }
 
+static BOOL is_run_rtl(const struct layout_effective_run *run)
+{
+    return run->run->u.regular.run.bidiLevel & 1;
+}
+
 static struct layout_run *alloc_layout_run(enum layout_run_kind kind)
 {
     struct layout_run *ret;
@@ -3144,7 +3149,8 @@ static HRESULT WINAPI dwritetextlayout_Draw(IDWriteTextLayout2 *iface,
     LIST_FOR_EACH_ENTRY(u, &This->underlines, struct layout_underline, entry) {
         IDWriteTextRenderer_DrawUnderline(renderer,
             context,
-            u->run->origin_x + run->align_dx + origin_x,
+            /* horizontal underline always grows from left to right, width is always added to origin regardless of run direction */
+            (is_run_rtl(u->run) ? u->run->origin_x - u->run->width : u->run->origin_x) + run->align_dx + origin_x,
             SNAP_COORD(u->run->origin_y + origin_y),
             &u->u,
             u->run->effect);