diff options
author | Robin Watts <robin.watts@artifex.com> | 2016-01-18 20:17:00 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2016-01-18 20:17:48 +0000 |
commit | ac27f6c40787c34830b5273ca51fb915d341c697 (patch) | |
tree | 7da7db02e9e343835419cbec22f7093a5320d5c2 /source/html | |
parent | 0455fb54f5c7291c43ec782c11499ef074284cbc (diff) | |
download | mupdf-ac27f6c40787c34830b5273ca51fb915d341c697.tar.xz |
Add support for bidirectional mirror characters
Diffstat (limited to 'source/html')
-rw-r--r-- | source/html/html-layout.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/html/html-layout.c b/source/html/html-layout.c index 4f7091fa..af480cbc 100644 --- a/source/html/html-layout.c +++ b/source/html/html-layout.c @@ -80,6 +80,7 @@ static fz_html_flow *add_flow(fz_context *ctx, fz_pool *pool, fz_html *top, fz_c flow->expand = 0; flow->char_r2l = 0; flow->block_r2l = 0; + flow->mirror = 0; flow->style = style; *top->flow_tail = flow; top->flow_tail = &flow->next; @@ -938,6 +939,10 @@ static void draw_flow_box(fz_context *ctx, fz_html *box, float page_top, float p while (*t) { t += fz_chartorune(&c, t); + if (node->mirror) + { + c = Bidi_mirrorChar(c); + } g = fz_encode_character(ctx, node->style->font, c); if (g) { @@ -962,6 +967,10 @@ static void draw_flow_box(fz_context *ctx, fz_html *box, float page_top, float p while (*s) { s += fz_chartorune(&c, s); + if (node->mirror) + { + c = Bidi_mirrorChar(c); + } g = fz_encode_character(ctx, node->style->font, c); if (g) { @@ -1537,6 +1546,8 @@ static void newFragCb(const uint16_t *fragment, /* This flow box is entirely contained within this fragment. */ data->flow->block_r2l = rightToLeft; data->flow->char_r2l = charDirR2L; + if (mirror != 0) + data->flow->mirror = 1; data->flow = data->flow->next; fragmentOffset += len; fragmentLen -= len; |