summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-encoding.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2018-06-29 14:28:46 +0200
committerTor Andersson <tor.andersson@artifex.com>2018-07-05 15:32:34 +0200
commitf48db730bc063809c8c86b4434a91facd2c4846c (patch)
treeb7d17f43e7cb161ddfb72382df820cc88cedebed /source/pdf/pdf-encoding.c
parentf61d5f7cada6fa2eb0c457e4bf7d820a4aeb004e (diff)
downloadmupdf-f48db730bc063809c8c86b4434a91facd2c4846c.tar.xz
Use real WinAnsi encoding when writing appearance stream text.
Diffstat (limited to 'source/pdf/pdf-encoding.c')
-rw-r--r--source/pdf/pdf-encoding.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/source/pdf/pdf-encoding.c b/source/pdf/pdf-encoding.c
index 04874457..f4fe584c 100644
--- a/source/pdf/pdf-encoding.c
+++ b/source/pdf/pdf-encoding.c
@@ -123,3 +123,22 @@ int pdf_greek_from_unicode(int u)
}
return -1;
}
+
+int pdf_winansi_from_unicode(int u)
+{
+ int l = 0;
+ int r = nelem(winansi_from_unicode) - 1;
+ if (u < 128)
+ return u;
+ while (l <= r)
+ {
+ int m = (l + r) >> 1;
+ if (u < winansi_from_unicode[m].u)
+ r = m - 1;
+ else if (u > winansi_from_unicode[m].u)
+ l = m + 1;
+ else
+ return winansi_from_unicode[m].c;
+ }
+ return -1;
+}