summaryrefslogtreecommitdiff
path: root/Build/source/texk/xdvipdfmx
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2009-03-16 15:13:07 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2009-03-16 15:13:07 +0000
commite967e0cc978d647040ac5616d389e9007d593464 (patch)
tree1f33ce27a77473b2e90b549d42399b73d4123497 /Build/source/texk/xdvipdfmx
parent49f1fb6887627cdb7cf524aaef9b92108c894381 (diff)
new reentrant kpathsea API (from Taco)
git-svn-id: svn://tug.org/texlive/trunk@12401 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/xdvipdfmx')
-rw-r--r--Build/source/texk/xdvipdfmx/ChangeLog.TL25
-rw-r--r--Build/source/texk/xdvipdfmx/src/cff.c92
-rw-r--r--Build/source/texk/xdvipdfmx/src/dpxutil.c1
-rw-r--r--Build/source/texk/xdvipdfmx/src/mem.c1
-rw-r--r--Build/source/texk/xdvipdfmx/src/pdfencoding.c1
-rw-r--r--Build/source/texk/xdvipdfmx/src/pdfencrypt.c3
6 files changed, 58 insertions, 65 deletions
diff --git a/Build/source/texk/xdvipdfmx/ChangeLog.TL b/Build/source/texk/xdvipdfmx/ChangeLog.TL
index 03ae52d8f15..157c1f6e854 100644
--- a/Build/source/texk/xdvipdfmx/ChangeLog.TL
+++ b/Build/source/texk/xdvipdfmx/ChangeLog.TL
@@ -1,11 +1,14 @@
-ChangeLog.TL: Changes for xdvipdfmx (teTeX / TeX live)
-======================================================
+ChangeLog.TL: Changes for dvipdfmx (teTeX / TeX live)
+=====================================================
+
+2009-03-16 Peter Breitenlohner <peb@mppmu.mpg.de>
+ * src/cff.c, src/dpxutil.c, src/mem.c, src/pdfencoding.c,
+ src/pdfencrypt.c: Must include Kpathsea headers (via `system.h')
+ before including `mem.h'.
2008-04-06 Peter Breitenlohner <peb@mppmu.mpg.de>
- * configure.in: respect library dependencies.
-2008-03-31 Peter Breitenlohner <peb@mppmu.mpg.de>
- * Makefile.in, data/Makefile.in, src/Makefile.in: regenerated.
+ * configure.in: respect library dependencies.
2008-03-04 Peter Breitenlohner <peb@mppmu.mpg.de>
@@ -13,13 +16,5 @@ ChangeLog.TL: Changes for xdvipdfmx (teTeX / TeX live)
* configure.in: moved macro definitions ...
* m4/maw-time.m4 (new): ... to here
* acinclude.m4 (removed): moved macro definitions ...
- * m4/maw-kpse.m4, maw-libs.m4, maw-macos.m4 (all new): ... to
- here; these files are the same as in ../dvipdfmx.
-
-2008-02-21 Peter Breitenlohner <peb@mppmu.mpg.de>
-
- Allow maintainer mode to regenerate files.
- * configure.in, acinclude.m4: added AC_DEFINES's third arg to
- provide autoheader templates.
- * configure.in: use AC_DEFINES for XETEX and XETEX_MAC.
-
+ * m4/maw-kpse.m4, maw-libs.m4 (both new): ... to here; these
+ files are the same as in ../xdvipdfmx.
diff --git a/Build/source/texk/xdvipdfmx/src/cff.c b/Build/source/texk/xdvipdfmx/src/cff.c
index 51d33633f9d..70adb996fcd 100644
--- a/Build/source/texk/xdvipdfmx/src/cff.c
+++ b/Build/source/texk/xdvipdfmx/src/cff.c
@@ -23,6 +23,7 @@
#include <stdio.h>
#include <string.h>
+#include "system.h"
#include "mem.h"
#include "error.h"
#include "mfileio.h"
@@ -37,24 +38,24 @@
#define CFF_DEBUG 5
#define CFF_DEBUG_STR "CFF"
-static unsigned long get_unsigned (sfnt *sfont, int n)
+static unsigned long get_unsigned (FILE *stream, int n)
{
unsigned long v = 0;
while (n-- > 0)
- v = v*0x100u + sfnt_get_byte(sfont);
+ v = v*0x100u + get_unsigned_byte(stream);
return v;
}
#define get_offset(s, n) get_unsigned((s), (n))
-#define get_card8(s) sfnt_get_byte((s))
-#define get_card16(s) sfnt_get_ushort((s))
+#define get_card8(s) get_unsigned_byte((s))
+#define get_card16(s) get_unsigned_pair((s))
/*
* Read Header, Name INDEX, Top DICT INDEX, and String INDEX.
*/
-cff_font *cff_open(sfnt *sfont, long offset, int n)
+cff_font *cff_open(FILE *stream, long offset, int n)
{
cff_font *cff;
cff_index *idx;
@@ -63,7 +64,7 @@ cff_font *cff_open(sfnt *sfont, long offset, int n)
cff->fontname = NULL;
cff->index = n;
- cff->sfont = sfont;
+ cff->stream = stream;
cff->offset = offset;
cff->filter = 0; /* not used */
cff->flag = 0;
@@ -83,10 +84,10 @@ cff_font *cff_open(sfnt *sfont, long offset, int n)
cff->_string = NULL;
cff_seek_set(cff, 0);
- cff->header.major = get_card8(cff->sfont);
- cff->header.minor = get_card8(cff->sfont);
- cff->header.hdr_size = get_card8(cff->sfont);
- cff->header.offsize = get_card8(cff->sfont);
+ cff->header.major = get_card8(cff->stream);
+ cff->header.minor = get_card8(cff->stream);
+ cff->header.hdr_size = get_card8(cff->stream);
+ cff->header.offsize = get_card8(cff->stream);
if (cff->header.offsize < 1 ||
cff->header.offsize > 4)
ERROR("invalid offsize data");
@@ -140,12 +141,12 @@ cff_font *cff_open(sfnt *sfont, long offset, int n)
cff->string = cff_get_index(cff);
/* offset to GSubr */
- cff->gsubr_offset = cff->sfont->loc - offset;
+ cff->gsubr_offset = tell_position(cff->stream) - offset;
/* Number of glyphs */
offset = (long) cff_dict_get(cff->topdict, "CharStrings", 0);
cff_seek_set(cff, offset);
- cff->num_glyphs = get_card16(cff->sfont);
+ cff->num_glyphs = get_card16(cff->stream);
/* Check for font type */
if (cff_dict_known(cff->topdict, "ROS")) {
@@ -292,15 +293,15 @@ cff_get_index_header (cff_font *cff)
idx = NEW(1, cff_index);
- idx->count = count = get_card16(cff->sfont);
+ idx->count = count = get_card16(cff->stream);
if (count > 0) {
- idx->offsize = get_card8(cff->sfont);
+ idx->offsize = get_card8(cff->stream);
if (idx->offsize < 1 || idx->offsize > 4)
ERROR("invalid offsize data");
idx->offset = NEW(count+1, l_offset);
for (i=0;i<count+1;i++) {
- (idx->offset)[i] = get_offset(cff->sfont, idx->offsize);
+ (idx->offset)[i] = get_offset(cff->stream, idx->offsize);
}
if (idx->offset[0] != 1)
@@ -325,15 +326,15 @@ cff_get_index (cff_font *cff)
idx = NEW(1, cff_index);
- idx->count = count = get_card16(cff->sfont);
+ idx->count = count = get_card16(cff->stream);
if (count > 0) {
- idx->offsize = get_card8(cff->sfont);
+ idx->offsize = get_card8(cff->stream);
if (idx->offsize < 1 || idx->offsize > 4)
ERROR("invalid offsize data");
idx->offset = NEW(count + 1, l_offset);
for (i = 0 ; i < count + 1; i++) {
- idx->offset[i] = get_offset(cff->sfont, idx->offsize);
+ idx->offset[i] = get_offset(cff->stream, idx->offsize);
}
if (idx->offset[0] != 1)
@@ -344,7 +345,7 @@ cff_get_index (cff_font *cff)
idx->data = NEW(length, card8);
offset = 0;
while (length > 0) {
- nb_read = sfnt_read(idx->data + offset, length, cff->sfont);
+ nb_read = fread(idx->data + offset, 1, length, cff->stream);
offset += nb_read;
length -= nb_read;
}
@@ -625,27 +626,27 @@ long cff_read_encoding (cff_font *cff)
cff_seek_set(cff, offset);
cff->encoding = encoding = NEW(1, cff_encoding);
- encoding->format = get_card8(cff->sfont);
+ encoding->format = get_card8(cff->stream);
length = 1;
switch (encoding->format & (~0x80)) {
case 0:
- encoding->num_entries = get_card8(cff->sfont);
+ encoding->num_entries = get_card8(cff->stream);
(encoding->data).codes = NEW(encoding->num_entries, card8);
for (i=0;i<(encoding->num_entries);i++) {
- (encoding->data).codes[i] = get_card8(cff->sfont);
+ (encoding->data).codes[i] = get_card8(cff->stream);
}
length += encoding->num_entries + 1;
break;
case 1:
{
cff_range1 *ranges;
- encoding->num_entries = get_card8(cff->sfont);
+ encoding->num_entries = get_card8(cff->stream);
encoding->data.range1 = ranges
= NEW(encoding->num_entries, cff_range1);
for (i=0;i<(encoding->num_entries);i++) {
- ranges[i].first = get_card8(cff->sfont);
- ranges[i].n_left = get_card8(cff->sfont);
+ ranges[i].first = get_card8(cff->stream);
+ ranges[i].n_left = get_card8(cff->stream);
}
length += (encoding->num_entries) * 2 + 1;
}
@@ -659,11 +660,11 @@ long cff_read_encoding (cff_font *cff)
/* Supplementary data */
if ((encoding->format) & 0x80) {
cff_map *map;
- encoding->num_supps = get_card8(cff->sfont);
+ encoding->num_supps = get_card8(cff->stream);
encoding->supp = map = NEW(encoding->num_supps, cff_map);
for (i=0;i<(encoding->num_supps);i++) {
- map[i].code = get_card8(cff->sfont);
- map[i].glyph = get_card16(cff->sfont); /* SID */
+ map[i].code = get_card8(cff->stream);
+ map[i].glyph = get_card16(cff->stream); /* SID */
}
length += (encoding->num_supps) * 3 + 1;
} else {
@@ -841,7 +842,7 @@ long cff_read_charsets (cff_font *cff)
cff_seek_set(cff, offset);
cff->charsets = charset = NEW(1, cff_charsets);
- charset->format = get_card8(cff->sfont);
+ charset->format = get_card8(cff->stream);
charset->num_entries = 0;
count = cff->num_glyphs - 1;
@@ -854,7 +855,7 @@ long cff_read_charsets (cff_font *cff)
charset->data.glyphs = NEW(charset->num_entries, s_SID);
length += (charset->num_entries) * 2;
for (i=0;i<(charset->num_entries);i++) {
- charset->data.glyphs[i] = get_card16(cff->sfont);
+ charset->data.glyphs[i] = get_card16(cff->stream);
}
count = 0;
break;
@@ -863,8 +864,8 @@ long cff_read_charsets (cff_font *cff)
cff_range1 *ranges = NULL;
while (count > 0 && charset->num_entries < cff->num_glyphs) {
ranges = RENEW(ranges, charset->num_entries + 1, cff_range1);
- ranges[charset->num_entries].first = get_card16(cff->sfont);
- ranges[charset->num_entries].n_left = get_card8(cff->sfont);
+ ranges[charset->num_entries].first = get_card16(cff->stream);
+ ranges[charset->num_entries].n_left = get_card8(cff->stream);
count -= ranges[charset->num_entries].n_left + 1; /* no-overrap */
charset->num_entries += 1;
charset->data.range1 = ranges;
@@ -877,8 +878,8 @@ long cff_read_charsets (cff_font *cff)
cff_range2 *ranges = NULL;
while (count > 0 && charset->num_entries < cff->num_glyphs) {
ranges = RENEW(ranges, charset->num_entries + 1, cff_range2);
- ranges[charset->num_entries].first = get_card16(cff->sfont);
- ranges[charset->num_entries].n_left = get_card16(cff->sfont);
+ ranges[charset->num_entries].first = get_card16(cff->stream);
+ ranges[charset->num_entries].n_left = get_card16(cff->stream);
count -= ranges[charset->num_entries].n_left + 1; /* non-overrapping */
charset->num_entries += 1;
}
@@ -1171,7 +1172,7 @@ long cff_read_fdselect (cff_font *cff)
offset = (long) cff_dict_get(cff->topdict, "FDSelect", 0);
cff_seek_set(cff, offset);
cff->fdselect = fdsel = NEW(1, cff_fdselect);
- fdsel->format = get_card8(cff->sfont);
+ fdsel->format = get_card8(cff->stream);
length = 1;
@@ -1180,22 +1181,22 @@ long cff_read_fdselect (cff_font *cff)
fdsel->num_entries = cff->num_glyphs;
(fdsel->data).fds = NEW(fdsel->num_entries, card8);
for (i=0;i<(fdsel->num_entries);i++) {
- (fdsel->data).fds[i] = get_card8(cff->sfont);
+ (fdsel->data).fds[i] = get_card8(cff->stream);
}
length += fdsel->num_entries;
break;
case 3:
{
cff_range3 *ranges;
- fdsel->num_entries = get_card16(cff->sfont);
+ fdsel->num_entries = get_card16(cff->stream);
fdsel->data.ranges = ranges = NEW(fdsel->num_entries, cff_range3);
for (i=0;i<(fdsel->num_entries);i++) {
- ranges[i].first = get_card16(cff->sfont);
- ranges[i].fd = get_card8(cff->sfont);
+ ranges[i].first = get_card16(cff->stream);
+ ranges[i].fd = get_card8(cff->stream);
}
if (ranges[0].first != 0)
ERROR("Range not starting with 0.");
- if (cff->num_glyphs != get_card16(cff->sfont))
+ if (cff->num_glyphs != get_card16(cff->stream))
ERROR("Sentinel value mismatched with number of glyphs.");
length += (fdsel->num_entries) * 3 + 4;
}
@@ -1419,7 +1420,7 @@ long cff_read_private (cff_font *cff)
offset = (long) cff_dict_get(cff->fdarray[i], "Private", 1);
cff_seek_set(cff, offset);
data = NEW(size, card8);
- if (sfnt_read(data, size, cff->sfont) != size)
+ if (fread(data, 1, size, cff->stream) != size)
ERROR("reading file failed");
(cff->private)[i] = cff_dict_unpack(data, data+size);
RELEASE(data);
@@ -1436,7 +1437,7 @@ long cff_read_private (cff_font *cff)
offset = (long) cff_dict_get(cff->topdict, "Private", 1);
cff_seek_set(cff, offset);
data = NEW(size, card8);
- if (sfnt_read(data, size, cff->sfont) != size)
+ if (fread(data, 1, size, cff->stream) != size)
ERROR("reading file failed");
cff->private[0] = cff_dict_unpack(data, data+size);
RELEASE(data);
@@ -1449,10 +1450,3 @@ long cff_read_private (cff_font *cff)
return len;
}
-
-#ifdef XETEX
-unsigned short* cff_get_ft_to_gid(cff_font *cff)
-{
- return cff->ft_to_gid;
-}
-#endif
diff --git a/Build/source/texk/xdvipdfmx/src/dpxutil.c b/Build/source/texk/xdvipdfmx/src/dpxutil.c
index c87568b96a5..a30a3269dfa 100644
--- a/Build/source/texk/xdvipdfmx/src/dpxutil.c
+++ b/Build/source/texk/xdvipdfmx/src/dpxutil.c
@@ -28,6 +28,7 @@
#include <string.h>
#include <time.h>
+#include "system.h"
#include "mem.h"
#include "error.h"
diff --git a/Build/source/texk/xdvipdfmx/src/mem.c b/Build/source/texk/xdvipdfmx/src/mem.c
index e474f407e6d..97e46cdd0d9 100644
--- a/Build/source/texk/xdvipdfmx/src/mem.c
+++ b/Build/source/texk/xdvipdfmx/src/mem.c
@@ -25,6 +25,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include "system.h"
#include "mem.h"
#include "error.h"
diff --git a/Build/source/texk/xdvipdfmx/src/pdfencoding.c b/Build/source/texk/xdvipdfmx/src/pdfencoding.c
index 4f50b312372..296674d9880 100644
--- a/Build/source/texk/xdvipdfmx/src/pdfencoding.c
+++ b/Build/source/texk/xdvipdfmx/src/pdfencoding.c
@@ -28,6 +28,7 @@
#include <string.h>
+#include "system.h"
#include "mem.h"
#include "error.h"
#include "dpxutil.h"
diff --git a/Build/source/texk/xdvipdfmx/src/pdfencrypt.c b/Build/source/texk/xdvipdfmx/src/pdfencrypt.c
index fd43569dd1c..e76f18eedaa 100644
--- a/Build/source/texk/xdvipdfmx/src/pdfencrypt.c
+++ b/Build/source/texk/xdvipdfmx/src/pdfencrypt.c
@@ -2,7 +2,7 @@
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
- Copyright (C) 2002 by Jin-Hwan Cho and Shunsaku Hirata,
+ Copyright (C) 2007 by Jin-Hwan Cho and Shunsaku Hirata,
the dvipdfmx project team <dvipdfmx@project.ktug.or.kr>
This program is free software; you can redistribute it and/or modify
@@ -36,6 +36,7 @@
#include <unistd.h>
#endif /* WIN32 */
+#include "system.h"
#include "mem.h"
#include "error.h"
#include "pdfobj.h"