summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-appearance.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-appearance.c
parentf61d5f7cada6fa2eb0c457e4bf7d820a4aeb004e (diff)
downloadmupdf-f48db730bc063809c8c86b4434a91facd2c4846c.tar.xz
Use real WinAnsi encoding when writing appearance stream text.
Diffstat (limited to 'source/pdf/pdf-appearance.c')
-rw-r--r--source/pdf/pdf-appearance.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/source/pdf/pdf-appearance.c b/source/pdf/pdf-appearance.c
index b231b6b5..faea5b33 100644
--- a/source/pdf/pdf-appearance.c
+++ b/source/pdf/pdf-appearance.c
@@ -674,8 +674,8 @@ measure_simple_string(fz_context *ctx, fz_font *font, const char *text)
{
int c, g;
text += fz_chartorune(&c, text);
- /* WinAnsi is close enough to Latin-1 to not matter. Use middle dot for unencodable characters. */
- if (c >= 256) c = REPLACEMENT;
+ c = pdf_winansi_from_unicode(c);
+ if (c < 0) c = REPLACEMENT;
g = fz_encode_character(ctx, font, c);
w += fz_advance_glyph(ctx, font, g, 0);
}
@@ -690,8 +690,8 @@ write_simple_string(fz_context *ctx, fz_buffer *buf, const char *a, const char *
{
int c;
a += fz_chartorune(&c, a);
- /* WinAnsi is close enough to Latin-1 to not matter. Use middle dot for unencodable characters. */
- if (c >= 256) c = REPLACEMENT;
+ c = pdf_winansi_from_unicode(c);
+ if (c < 0) c = REPLACEMENT;
if (c == '(' || c == ')' || c == '\\')
fz_append_byte(ctx, buf, '\\');
fz_append_byte(ctx, buf, c);
@@ -872,8 +872,8 @@ write_comb_string(fz_context *ctx, fz_buffer *buf, const char *a, const char *b,
int c, g;
a += fz_chartorune(&c, a);
- /* WinAnsi is close enough to Latin-1 to not matter. Use middle dot for unencodable characters. */
- if (c >= 256) c = REPLACEMENT;
+ c = pdf_winansi_from_unicode(c);
+ if (c < 0) c = REPLACEMENT;
g = fz_encode_character(ctx, font, c);
gw = fz_advance_glyph(ctx, font, g, 0) * 1000;