diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2012-03-05 14:38:14 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2012-03-05 14:38:14 +0000 |
commit | de78cac20606a5487809f4c7d8bb6c50ecf09204 (patch) | |
tree | af5bc03d1ceebeed25afc73b0ca394c834d3ba06 /Build/source/texk/dvipdfmx/dvipdfmx-20110311-PATCHES | |
parent | edc562bfa3e97201709f690ae5c738b150dc365c (diff) |
(x)dvipdfmx: Handle UTP-16 surrogates for UCS-4 supplementary planes
git-svn-id: svn://tug.org/texlive/trunk@25568 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dvipdfmx/dvipdfmx-20110311-PATCHES')
-rw-r--r-- | Build/source/texk/dvipdfmx/dvipdfmx-20110311-PATCHES/ChangeLog | 5 | ||||
-rw-r--r-- | Build/source/texk/dvipdfmx/dvipdfmx-20110311-PATCHES/patch-07-surrogates | 44 |
2 files changed, 49 insertions, 0 deletions
diff --git a/Build/source/texk/dvipdfmx/dvipdfmx-20110311-PATCHES/ChangeLog b/Build/source/texk/dvipdfmx/dvipdfmx-20110311-PATCHES/ChangeLog index 5c76be80116..a0579a900f3 100644 --- a/Build/source/texk/dvipdfmx/dvipdfmx-20110311-PATCHES/ChangeLog +++ b/Build/source/texk/dvipdfmx/dvipdfmx-20110311-PATCHES/ChangeLog @@ -1,3 +1,8 @@ +2012-03-05 Peter Breitenlohner <peb@mppmu.mpg.de> + + * patch-07-surrogates (new): Handle UTP-16 surrogates for UCS-4 + supplementary planes. Based on patch from Tanaka Takuji-san. + 2012-01-17 Hironori Kitagawa <h_kitagawa2001@yahoo.co.jp> * patch-06-dtou (new): Support for (e-)(u)pTeX dtou direction. diff --git a/Build/source/texk/dvipdfmx/dvipdfmx-20110311-PATCHES/patch-07-surrogates b/Build/source/texk/dvipdfmx/dvipdfmx-20110311-PATCHES/patch-07-surrogates new file mode 100644 index 00000000000..22c547b19aa --- /dev/null +++ b/Build/source/texk/dvipdfmx/dvipdfmx-20110311-PATCHES/patch-07-surrogates @@ -0,0 +1,44 @@ + Handle UTP-16 surrogates for UCS-4 supplementary planes. + +diff -ur dvipdfmx-20110311.orig/src/pdfdev.c dvipdfmx-20110311/src/pdfdev.c +--- dvipdfmx-20110311.orig/src/pdfdev.c 2012-01-17 19:27:40.000000000 +0100 ++++ dvipdfmx-20110311/src/pdfdev.c 2012-03-05 13:44:30.000000000 +0100 +@@ -960,17 +960,32 @@ + } + length *= 4; + } else if (ctype == 2) { ++ int len = 0; ++ + if (length * 2 >= FORMAT_BUF_SIZE) { + WARN("Too long string..."); + return -1; + } +- for (i = 0; i < length; i += 2) { +- sbuf1[i*2 ] = font->ucs_group; +- sbuf1[i*2+1] = font->ucs_plane; +- sbuf1[i*2+2] = p[i]; +- sbuf1[i*2+3] = p[i+1]; ++ for (i = 0; i < length; i += 2, len += 4) { ++ sbuf1[len ] = font->ucs_group; ++ if ((p[i] & 0xf8) == 0xd8) { ++ int c; ++ /* Check for valid surrogate pair. */ ++ if ((p[i] & 0xfc) != 0xd8 || i + 2 >= length || (p[i+2] & 0xfc) != 0xdc) { ++ WARN("Invalid surrogate p[%d]=%02X...", i, p[i]); ++ return -1; ++ } ++ c = (((p[i] & 0x03) << 10) | (p[i+1] << 2) | (p[i+2] & 0x03)) + 0x100; ++ sbuf1[len+1] = (c >> 8) & 0xff; ++ sbuf1[len+2] = c & 0xff; ++ i += 2; ++ } else { ++ sbuf1[len+1] = font->ucs_plane; ++ sbuf1[len+2] = p[i]; ++ } ++ sbuf1[len+3] = p[i+1]; + } +- length *= 2; ++ length = len; + } + p = sbuf1; + } else if (ctype == 1 && font->mapc >= 0) { |