summaryrefslogtreecommitdiff
path: root/Build/source/texk/xdvipdfmx/src
diff options
context:
space:
mode:
authorJonathan Kew <jfkthame@googlemail.com>2008-02-15 14:29:53 +0000
committerJonathan Kew <jfkthame@googlemail.com>2008-02-15 14:29:53 +0000
commit21854aa6efbf4fb1013d04ec22340388af752dc7 (patch)
tree1dd738bcec8756046f169782fd61daf290eb5fee /Build/source/texk/xdvipdfmx/src
parent8ffd652f16549581f95dc60a3f383774a6df2e5d (diff)
merged updates from xdvipdfmx repos. rev 108
git-svn-id: svn://tug.org/texlive/trunk@6637 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/xdvipdfmx/src')
-rw-r--r--Build/source/texk/xdvipdfmx/src/dvi.c56
-rw-r--r--Build/source/texk/xdvipdfmx/src/dvipdfmx.c37
-rw-r--r--Build/source/texk/xdvipdfmx/src/jpegimage.c8
-rw-r--r--Build/source/texk/xdvipdfmx/src/pst_obj.c6
-rw-r--r--Build/source/texk/xdvipdfmx/src/spc_util.c39
-rw-r--r--Build/source/texk/xdvipdfmx/src/tt_cmap.c24
-rw-r--r--Build/source/texk/xdvipdfmx/src/tt_post.c9
7 files changed, 117 insertions, 62 deletions
diff --git a/Build/source/texk/xdvipdfmx/src/dvi.c b/Build/source/texk/xdvipdfmx/src/dvi.c
index 85a682de2c5..50ad1687ccd 100644
--- a/Build/source/texk/xdvipdfmx/src/dvi.c
+++ b/Build/source/texk/xdvipdfmx/src/dvi.c
@@ -2436,26 +2436,39 @@ read_length (double *vp, double mag, char **pp, char *endptr)
v = atof(q);
RELEASE(q);
+ skip_white(&p, endptr);
q = parse_c_ident(&p, endptr);
if (q) {
- if (strlen(q) > strlen("true") &&
+ char *qq = q; /* remember this for RELEASE, because q may be advanced */
+ if (strlen(q) >= strlen("true") &&
!memcmp(q, "true", strlen("true"))) {
u /= mag != 0.0 ? mag : 1.0; /* inverse magnify */
q += strlen("true");
}
- for (k = 0; _ukeys[k] && strcmp(_ukeys[k], q); k++);
- switch (k) {
- case K_UNIT__PT: u *= 72.0 / 72.27; break;
- case K_UNIT__IN: u *= 72.0; break;
- case K_UNIT__CM: u *= 72.0 / 2.54 ; break;
- case K_UNIT__MM: u *= 72.0 / 25.4 ; break;
- case K_UNIT__BP: u *= 1.0 ; break;
- default:
- WARN("Unknown unit of measure: %s", q);
+ if (strlen(q) == 0) { /* "true" was a separate word from the units */
+ RELEASE(qq);
+ skip_white(&p, endptr);
+ qq = q = parse_c_ident(&p, endptr);
+ }
+ if (q) {
+ for (k = 0; _ukeys[k] && strcmp(_ukeys[k], q); k++);
+ switch (k) {
+ case K_UNIT__PT: u *= 72.0 / 72.27; break;
+ case K_UNIT__IN: u *= 72.0; break;
+ case K_UNIT__CM: u *= 72.0 / 2.54 ; break;
+ case K_UNIT__MM: u *= 72.0 / 25.4 ; break;
+ case K_UNIT__BP: u *= 1.0 ; break;
+ default:
+ WARN("Unknown unit of measure: %s", q);
+ error = -1;
+ break;
+ }
+ RELEASE(qq);
+ }
+ else {
+ WARN("Missing unit of measure after \"true\"");
error = -1;
- break;
}
- RELEASE(q);
}
*vp = v * u; *pp = p;
@@ -2468,7 +2481,7 @@ scan_special (double *wd, double *ht, double *xo, double *yo, char *lm, const ch
{
char *q, *p = (char *) buf;
char *endptr;
- int ns_pdf = 0, error = 0;
+ int ns_pdf = 0, ns_xtx = 0, error = 0;
double tmp;
extern double paper_width, paper_height;
extern char landscape_mode;
@@ -2487,6 +2500,15 @@ scan_special (double *wd, double *ht, double *xo, double *yo, char *lm, const ch
q = parse_c_ident(&p, endptr); ns_pdf = 1;
}
}
+ else if (q && !strcmp(q, "x")) {
+ skip_white(&p, endptr);
+ if (p < endptr && *p == ':') {
+ p++;
+ skip_white(&p, endptr);
+ RELEASE(q);
+ q = parse_c_ident(&p, endptr); ns_xtx = 1;
+ }
+ }
skip_white(&p, endptr);
if (q) {
@@ -2533,16 +2555,16 @@ scan_special (double *wd, double *ht, double *xo, double *yo, char *lm, const ch
qchr = *p; p++;
skip_white(&p, endptr);
}
- error = read_length(&tmp, 1.0, &p, endptr);
+ error = read_length(&tmp, dvi_tell_mag(), &p, endptr);
if (!error) {
- *wd = tmp;
+ *wd = tmp * dvi_tell_mag();
skip_white(&p, endptr);
if (p < endptr && *p == ',') {
p++; skip_white(&p, endptr);
}
- error = read_length(&tmp, 1.0, &p, endptr);
+ error = read_length(&tmp, dvi_tell_mag(), &p, endptr);
if (!error)
- *ht = tmp;
+ *ht = tmp * dvi_tell_mag();
skip_white(&p, endptr);
}
if (!error && qchr) { /* Check if properly quoted */
diff --git a/Build/source/texk/xdvipdfmx/src/dvipdfmx.c b/Build/source/texk/xdvipdfmx/src/dvipdfmx.c
index a1c5e1e45f9..912cab41a4d 100644
--- a/Build/source/texk/xdvipdfmx/src/dvipdfmx.c
+++ b/Build/source/texk/xdvipdfmx/src/dvipdfmx.c
@@ -221,25 +221,38 @@ read_length (double *vp, char **pp, char *endptr)
v = atof(q);
RELEASE(q);
+ skip_white(&p, endptr);
q = parse_c_ident(&p, endptr);
if (q) {
- if (strlen(q) > strlen("true") &&
+ char *qq = q;
+ if (strlen(q) >= strlen("true") &&
!memcmp(q, "true", strlen("true"))) {
q += strlen("true"); /* just skip "true" */
}
- for (k = 0; _ukeys[k] && strcmp(_ukeys[k], q); k++);
- switch (k) {
- case K_UNIT__PT: u *= 72.0 / 72.27; break;
- case K_UNIT__IN: u *= 72.0; break;
- case K_UNIT__CM: u *= 72.0 / 2.54 ; break;
- case K_UNIT__MM: u *= 72.0 / 25.4 ; break;
- case K_UNIT__BP: u *= 1.0 ; break;
- default:
- WARN("Unknown unit of measure: %s", q);
+ if (strlen(q) == 0) {
+ RELEASE(qq);
+ skip_white(&p, endptr);
+ qq = q = parse_c_ident(&p, endptr);
+ }
+ if (q) {
+ for (k = 0; _ukeys[k] && strcmp(_ukeys[k], q); k++);
+ switch (k) {
+ case K_UNIT__PT: u *= 72.0 / 72.27; break;
+ case K_UNIT__IN: u *= 72.0; break;
+ case K_UNIT__CM: u *= 72.0 / 2.54 ; break;
+ case K_UNIT__MM: u *= 72.0 / 25.4 ; break;
+ case K_UNIT__BP: u *= 1.0 ; break;
+ default:
+ WARN("Unknown unit of measure: %s", q);
+ error = -1;
+ break;
+ }
+ RELEASE(qq);
+ }
+ else {
+ WARN("Missing unit of measure after \"true\"");
error = -1;
- break;
}
- RELEASE(q);
}
*vp = v * u; *pp = p;
diff --git a/Build/source/texk/xdvipdfmx/src/jpegimage.c b/Build/source/texk/xdvipdfmx/src/jpegimage.c
index a6605cc0c94..6aea61213a3 100644
--- a/Build/source/texk/xdvipdfmx/src/jpegimage.c
+++ b/Build/source/texk/xdvipdfmx/src/jpegimage.c
@@ -337,15 +337,13 @@ jpeg_include_image (pdf_ximage *ximage, FILE *fp)
#define IS_JFIF(j) ((j).flags & HAVE_APPn_JFIF)
if (IS_JFIF(j_info)) {
- struct JPEG_APPn_JFIF *app_data;
int i;
for (i = 0; i < j_info.num_appn; i++) {
- if (j_info.appn[i].marker != JM_APP0 ||
- j_info.appn[i].app_sig != JS_APPn_JFIF)
- continue;
+ if (j_info.appn[i].marker == JM_APP0 && j_info.appn[i].app_sig == JS_APPn_JFIF)
+ break;
}
if (i < j_info.num_appn) {
- app_data = (struct JPEG_APPn_JFIF *)j_info.appn[i].app_data;
+ struct JPEG_APPn_JFIF *app_data = (struct JPEG_APPn_JFIF *)j_info.appn[i].app_data;
switch (app_data->units) {
case 1: /* pixels per inch */
info.xdensity = 72.0 / app_data->Xdensity;
diff --git a/Build/source/texk/xdvipdfmx/src/pst_obj.c b/Build/source/texk/xdvipdfmx/src/pst_obj.c
index 55d5773cdd9..dde44284cf6 100644
--- a/Build/source/texk/xdvipdfmx/src/pst_obj.c
+++ b/Build/source/texk/xdvipdfmx/src/pst_obj.c
@@ -555,9 +555,11 @@ parse_long (unsigned char **inbuf, unsigned char *inbufend, unsigned char base,
} else {
break;
}
- val = val * base + c;
+ if (val < (LONG_MAX - c) / base) {
+ val = val * base + c;
+ count++;
+ }
cur++;
- count++;
}
if (ndigits != NULL)
diff --git a/Build/source/texk/xdvipdfmx/src/spc_util.c b/Build/source/texk/xdvipdfmx/src/spc_util.c
index 2ebe9e1c094..2e56cbc92c4 100644
--- a/Build/source/texk/xdvipdfmx/src/spc_util.c
+++ b/Build/source/texk/xdvipdfmx/src/spc_util.c
@@ -269,26 +269,39 @@ spc_util_read_length (struct spc_env *spe, double *vp /* ret. */, struct spc_arg
v = atof(q);
RELEASE(q);
+ skip_white(&ap->curptr, ap->endptr);
q = parse_c_ident(&ap->curptr, ap->endptr);
if (q) {
- if (strlen(q) > strlen("true") &&
+ char *qq = q;
+ if (strlen(q) >= strlen("true") &&
!memcmp(q, "true", strlen("true"))) {
u /= spe->mag != 0.0 ? spe->mag : 1.0; /* inverse magnify */
q += strlen("true");
}
- for (k = 0; ukeys[k] && strcmp(ukeys[k], q); k++);
- switch (k) {
- case K_UNIT__PT: u *= 72.0 / 72.27; break;
- case K_UNIT__IN: u *= 72.0; break;
- case K_UNIT__CM: u *= 72.0 / 2.54 ; break;
- case K_UNIT__MM: u *= 72.0 / 25.4 ; break;
- case K_UNIT__BP: u *= 1.0 ; break;
- default:
- spc_warn(spe, "Unknown unit of measure: %s", q);
- error = -1;
- break;
+ if (strlen(q) == 0) {
+ RELEASE(qq);
+ skip_white(&ap->curptr, ap->endptr);
+ qq = q = parse_c_ident(&ap->curptr, ap->endptr);
+ }
+ if (q) {
+ for (k = 0; ukeys[k] && strcmp(ukeys[k], q); k++);
+ switch (k) {
+ case K_UNIT__PT: u *= 72.0 / 72.27; break;
+ case K_UNIT__IN: u *= 72.0; break;
+ case K_UNIT__CM: u *= 72.0 / 2.54 ; break;
+ case K_UNIT__MM: u *= 72.0 / 25.4 ; break;
+ case K_UNIT__BP: u *= 1.0 ; break;
+ default:
+ spc_warn(spe, "Unknown unit of measure: %s", q);
+ error = -1;
+ break;
+ }
+ RELEASE(qq);
+ }
+ else {
+ spc_warn(spe, "Missing unit of measure after \"true\"");
+ error = -1;
}
- RELEASE(q);
}
*vp = v * u;
diff --git a/Build/source/texk/xdvipdfmx/src/tt_cmap.c b/Build/source/texk/xdvipdfmx/src/tt_cmap.c
index 73f0a5dff6a..56076346993 100644
--- a/Build/source/texk/xdvipdfmx/src/tt_cmap.c
+++ b/Build/source/texk/xdvipdfmx/src/tt_cmap.c
@@ -521,7 +521,7 @@ tt_cmap_read (sfnt *sfont, USHORT platform, USHORT encoding)
cmap->map = read_cmap12(sfont, length);
break;
default:
- WARN("Unrecognized TrueType cmap format.");
+ WARN("Unrecognized OpenType/TrueType cmap format.");
tt_cmap_release(cmap);
return NULL;
}
@@ -557,7 +557,7 @@ tt_cmap_release (tt_cmap *cmap)
release_cmap12(cmap->map);
break;
default:
- ERROR("Unrecognized TrueType cmap format.");
+ ERROR("Unrecognized OpenType/TrueType cmap format.");
}
}
RELEASE(cmap);
@@ -575,7 +575,7 @@ tt_cmap_lookup (tt_cmap *cmap, long cc)
ASSERT(cmap);
if (cc > 0xffffL && cmap->format < 12) {
- WARN("Four bytes charcode not supported in TrueType cmap format 0...6.");
+ WARN("Four bytes charcode not supported in OpenType/TrueType cmap format 0...6.");
return 0;
}
@@ -596,7 +596,7 @@ tt_cmap_lookup (tt_cmap *cmap, long cc)
gid = lookup_cmap12(cmap->map, (ULONG) cc);
break;
default:
- ERROR("Unrecognized TrueType cmap subtable format");
+ ERROR("Unrecognized OpenType/TrueType cmap subtable format");
break;
}
@@ -889,6 +889,8 @@ handle_subst_glyphs (CMap *cmap,
for (k = 0; k < unicode_count; ++k) {
len += UC_sput_UTF16BE(unicodes[k], &p, wbuf+WBUF_SIZE);
}
+ wbuf[0] = (gid >> 8) & 0xff;
+ wbuf[1] = gid & 0xff;
CMap_add_bfchar(cmap, wbuf, 2, wbuf + 2, len);
}
}
@@ -1117,7 +1119,7 @@ otf_create_ToUnicode_stream (const char *font_name,
#endif
if (!sfont) {
- ERROR("Could not open TrueType font file \"%s\"", font_name);
+ ERROR("Could not open OpenType/TrueType font file \"%s\"", font_name);
}
switch (sfont->type) {
@@ -1133,7 +1135,7 @@ otf_create_ToUnicode_stream (const char *font_name,
}
if (sfnt_read_table_directory(sfont, offset) < 0) {
- ERROR("Could not read TrueType table directory.");
+ ERROR("Could not read OpenType/TrueType table directory.");
}
cmap_add_id = CMap_cache_find(cmap_name);
@@ -1162,7 +1164,7 @@ otf_create_ToUnicode_stream (const char *font_name,
}
}
if (cmap_obj == NULL)
- WARN("Unable to read TrueType Unicode cmap table.");
+ WARN("Unable to read OpenType/TrueType Unicode cmap table.");
tt_cmap_release(ttcmap);
CMap_set_silent(0);
@@ -1614,10 +1616,10 @@ handle_gsub (pdf_obj *conf,
rv = otl_gsub_select(gsub_list, script, language, feature);
if (rv < 0) {
if (flag == 'p') {
- WARN("No GSUB featre %s.%s.%s loaded...",
+ WARN("No GSUB feature %s.%s.%s loaded...",
script, language, feature);
} else if (flag == 'r') {
- ERROR("No GSUB featre %s.%s.%s loaded...",
+ ERROR("No GSUB feature %s.%s.%s loaded...",
script, language, feature);
}
} else {
@@ -1850,7 +1852,7 @@ fprintf(stderr, "otf_load_Unicode_CMap(%s, %d)\n", map_name, ttc_index);
}
opt_conf = otl_conf_find_opt(conf, opt_tag);
if (!opt_conf)
- ERROR("There are no option \"%s\" in \"%s\".",
+ ERROR("There is no option \"%s\" in \"%s\".",
opt_tag, conf_name);
load_gsub(opt_conf, gsub_list, sfont);
}
@@ -1861,7 +1863,7 @@ fprintf(stderr, "otf_load_Unicode_CMap(%s, %d)\n", map_name, ttc_index);
if (opt_tag) {
opt_conf = otl_conf_find_opt(conf, opt_tag);
if (!opt_conf)
- ERROR("There are no option \"%s\" in \"%s\".",
+ ERROR("There is no option \"%s\" in \"%s\".",
opt_tag, conf_name);
handle_gsub(opt_conf, ttcmap, gsub_list, &unencoded);
}
diff --git a/Build/source/texk/xdvipdfmx/src/tt_post.c b/Build/source/texk/xdvipdfmx/src/tt_post.c
index 5a2b513e156..8779010a205 100644
--- a/Build/source/texk/xdvipdfmx/src/tt_post.c
+++ b/Build/source/texk/xdvipdfmx/src/tt_post.c
@@ -138,15 +138,20 @@ tt_read_post_table (sfnt *sfont)
post->names = NULL;
} else if (post->Version == 0x00020000UL) {
if (read_v2_post_names(post, sfont) < 0) {
- WARN("Invalid TrueType 'post' table...");
+ WARN("Invalid version 2.0 'post' table");
tt_release_post_table(post);
post = NULL;
}
- } else if (post->Version == 0x00030000UL) {
+ } else if (post->Version == 0x00030000UL) { /* no glyph names provided */
post->numberOfGlyphs = 0; /* wrong */
post->glyphNamePtr = NULL;
post->count = 0;
post->names = NULL;
+ } else if (post->Version == 0x00040000UL) { /* Apple format for printer-based fonts */
+ post->numberOfGlyphs = 0; /* don't bother constructing char names, not sure if they'll ever be needed */
+ post->glyphNamePtr = NULL;
+ post->count = 0;
+ post->names = NULL;
} else {
WARN("Unknown 'post' version: %08X", post->Version);
tt_release_post_table(post);