summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2016-10-12 12:25:15 +0200
committerTor Andersson <tor.andersson@artifex.com>2016-10-12 14:45:42 +0200
commitca8f55472a46cf0b2007d15f26d9f0eddb2ce7df (patch)
treec1970887f9f67a7c799785198b34c1105f0b1454
parent0bb6e0b11cf2fda4ecdb89a6407d919c6ed328f5 (diff)
downloadmupdf-ca8f55472a46cf0b2007d15f26d9f0eddb2ce7df.tar.xz
Bug 696958: Workarounds for 'rem' and 'ch' units in epub.
-rw-r--r--source/html/css-apply.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/source/html/css-apply.c b/source/html/css-apply.c
index af2a3a45..43aaa905 100644
--- a/source/html/css-apply.c
+++ b/source/html/css-apply.c
@@ -913,6 +913,14 @@ number_from_value(fz_css_value *value, float initial, int initial_unit)
if (p[0] == 'p' && p[1] == 'x')
return make_number(x, N_LENGTH);
+ /* FIXME: 'rem' should be 'em' of root element. This is a bad approximation. */
+ if (p[0] == 'r' && p[1] == 'e' && p[2] == 'm')
+ return make_number(x * 16, N_LENGTH);
+
+ /* FIXME: 'ch' should be width of '0' character. This is an approximation. */
+ if (p[0] == 'c' && p[1] == 'h')
+ return make_number(x / 2, N_LENGTH);
+
return make_number(x, N_LENGTH);
}