summaryrefslogtreecommitdiff
path: root/pdf
diff options
context:
space:
mode:
authorKen Sharp <ken.sharp@artifex.com>2023-04-04 08:20:20 +0100
committerKen Sharp <ken.sharp@artifex.com>2023-04-04 08:32:24 +0100
commit34055411d34255d811dd091e7f771b92d4494600 (patch)
treed57086156f64b6f5098bcaa18c6a545261e915a5 /pdf
parentad2b59ccd818b9c99db845a1add3c561b4ed9231 (diff)
downloadghostpdl-34055411d34255d811dd091e7f771b92d4494600.tar.gz
GhostPDF - write 3-byte Unicode values with leading 0
Bug #706533 "Copy/paste ligatures from luaLaTeX with new PDF interpreter produces invalid chars" The code to retrieve a Unicode code point for a glyph, as a string, was padding 3-byte values with a trailing 0, should be a leading 0. Similarly fix one byte values (if we ever see any)
Diffstat (limited to 'pdf')
-rw-r--r--pdf/pdf_font.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/pdf/pdf_font.c b/pdf/pdf_font.c
index fbc935e03..8598cd4ec 100644
--- a/pdf/pdf_font.c
+++ b/pdf/pdf_font.c
@@ -1754,8 +1754,8 @@ int pdfi_tounicode_char_to_unicode(pdf_context *ctx, pdf_cmap *tounicode, gs_gly
if (counter.entry.value.size == 1) {
l = 2;
if (ucode != NULL && length >= l) {
- ucode[0] = counter.entry.value.data[0];
- ucode[1] = counter.entry.value.data[1];
+ ucode[0] = 0x00;
+ ucode[1] = counter.entry.value.data[0];
}
}
else if (counter.entry.value.size == 2) {
@@ -1768,10 +1768,10 @@ int pdfi_tounicode_char_to_unicode(pdf_context *ctx, pdf_cmap *tounicode, gs_gly
else if (counter.entry.value.size == 3) {
l = 4;
if (ucode != NULL && length >= l) {
- ucode[0] = counter.entry.value.data[0];
- ucode[1] = counter.entry.value.data[1];
- ucode[2] = counter.entry.value.data[2];
- ucode[3] = 0;
+ ucode[0] = 0;
+ ucode[1] = counter.entry.value.data[0];
+ ucode[2] = counter.entry.value.data[1];
+ ucode[3] = counter.entry.value.data[2];
}
}
else {