diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2015-12-24 14:21:27 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2015-12-24 14:21:27 +0000 |
commit | 164b0fa85d746d5af11633aa156f6049ed6be7ce (patch) | |
tree | 1868baf8755b13fb8314d9bb15b07f80ea574cef | |
parent | 97556fc24652d783bfd585b549eaef116bb71580 (diff) |
texk/dvipdfm-x: Support to download type1 fonts such as cmctt10.pfb with complicated encoding. (from S. Hirata).
git-svn-id: svn://tug.org/texlive/trunk@39190 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Build/source/texk/dvipdfm-x/ChangeLog | 5 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/t1_load.c | 109 |
2 files changed, 113 insertions, 1 deletions
diff --git a/Build/source/texk/dvipdfm-x/ChangeLog b/Build/source/texk/dvipdfm-x/ChangeLog index 7740a6758f1..2b832f6da89 100644 --- a/Build/source/texk/dvipdfm-x/ChangeLog +++ b/Build/source/texk/dvipdfm-x/ChangeLog @@ -1,3 +1,8 @@ +2015-12-24 Shunsaku Hirata <shunsaku.hirata74@gmail.com> + + * t1_load.c: Support to download type1 fonts such as cmctt10.pfb + with complicated encoding. + 2015-11-05 Karl Berry <karl@tug.org> * data/dvipdfmx.cfg (D): add -dAutoRotatePages=/None. diff --git a/Build/source/texk/dvipdfm-x/t1_load.c b/Build/source/texk/dvipdfm-x/t1_load.c index f755bae962b..da6ed660888 100644 --- a/Build/source/texk/dvipdfm-x/t1_load.c +++ b/Build/source/texk/dvipdfm-x/t1_load.c @@ -322,6 +322,105 @@ static const char *const ISOLatin1Encoding[256] = { "ydieresis" }; +/* Treat cases such as "dup num num getinterval num exch putinterval" + * or "dup num exch num get put" + */ +static int +try_put_or_putinterval (char **enc_vec, unsigned char **start, unsigned char *end) +{ + pst_obj *tok; + int i, num1, num2, num3; + + tok = pst_get_token(start, end); + if (!tok || !PST_INTEGERTYPE(tok) || + (num1 = pst_getIV(tok)) > 255 || num1 < 0) { + RELEASE_TOK(tok); + return -1; + } + RELEASE_TOK(tok); + + tok = pst_get_token(start, end); + if (!tok) { + return -1; + } else if (MATCH_OP(tok, "exch")) { + /* dup num exch num get put */ + RELEASE_TOK(tok); + + tok = pst_get_token(start, end); + if (!tok || !PST_INTEGERTYPE(tok) || + (num2 = pst_getIV(tok)) > 255 || num2 < 0) { + RELEASE_TOK(tok); + return -1; + } + RELEASE_TOK(tok); + + tok = pst_get_token(start, end); + if (!MATCH_OP(tok, "get")) { + RELEASE_TOK(tok); + return -1; + } + RELEASE_TOK(tok); + + tok = pst_get_token(start, end); + if (!MATCH_OP(tok, "put")) { + RELEASE_TOK(tok); + return -1; + } + RELEASE_TOK(tok); + + if (enc_vec[num1]) + RELEASE(enc_vec[num1]); + enc_vec[num1] = xstrdup(enc_vec[num2]); + } else if (PST_INTEGERTYPE(tok) && + (num2 = pst_getIV(tok)) + num1 <= 255 && num2 >= 0) { + RELEASE_TOK(tok); + + tok = pst_get_token(start, end); + if (!MATCH_OP(tok, "getinterval")) { + RELEASE_TOK(tok); + return -1; + } + RELEASE_TOK(tok); + + tok = pst_get_token(start, end); + if (!tok || !PST_INTEGERTYPE(tok) || + (num3 = pst_getIV(tok)) + num2 > 255 || num3 < 0) { + RELEASE_TOK(tok); + return -1; + } + RELEASE_TOK(tok); + + tok = pst_get_token(start, end); + if (!MATCH_OP(tok, "exch")) { + RELEASE_TOK(tok); + return -1; + } + RELEASE_TOK(tok); + + tok = pst_get_token(start, end); + if (!MATCH_OP(tok, "putinterval")) { + RELEASE_TOK(tok); + return -1; + } + RELEASE_TOK(tok); + + for (i = 0; i < num2; i++) { + if (enc_vec[num1 + i]) { /* num1 + i < 256 here */ + if (enc_vec[num3 + i]) { /* num3 + i < 256 here */ + RELEASE(enc_vec[num3 + i]); + enc_vec[num3+i] = NULL; + } + enc_vec[num3 + i] = xstrdup(enc_vec[num1 + i]); + } + } + } else { + RELEASE_TOK(tok); + return -1; + } + + return 0; +} + static int parse_encoding (char **enc_vec, unsigned char **start, unsigned char *end) { @@ -393,8 +492,16 @@ parse_encoding (char **enc_vec, unsigned char **start, unsigned char *end) } RELEASE_TOK(tok); + /* cmctt10.pfb for examples contains the following PS code + * dup num num getinterval num exch putinterval + * dup num exch num get put + */ tok = pst_get_token(start, end); - if (!tok || !PST_INTEGERTYPE(tok) || + if (MATCH_OP(tok, "dup")) { /* possibly putinterval type */ + try_put_or_putinterval(enc_vec, start, end); + RELEASE_TOK(tok) + continue; + } else if (!tok || !PST_INTEGERTYPE(tok) || (code = pst_getIV(tok)) > 255 || code < 0) { RELEASE_TOK(tok); continue; |