summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/pdftexdir
diff options
context:
space:
mode:
authorMartin Schröder <martin@oneiros.de>2007-07-11 21:13:59 +0000
committerMartin Schröder <martin@oneiros.de>2007-07-11 21:13:59 +0000
commit7bf56e6bfcd7b204b3507dc9acaaaa3dce2cbcdb (patch)
tree5f8b4be4a21dc917441e4d2a1ec3e6fe25fd0192 /Build/source/texk/web2c/pdftexdir
parentc0da09fd6e4a542610245624c185a66f5ec814b2 (diff)
Imported pdftex 1.40.4
git-svn-id: svn://tug.org/texlive/trunk@4561 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/pdftexdir')
-rw-r--r--Build/source/texk/web2c/pdftexdir/Makefile.in4
-rw-r--r--Build/source/texk/web2c/pdftexdir/NEWS35
-rw-r--r--Build/source/texk/web2c/pdftexdir/README23
-rw-r--r--Build/source/texk/web2c/pdftexdir/avl.c1135
-rw-r--r--Build/source/texk/web2c/pdftexdir/avlstuff.c8
-rw-r--r--Build/source/texk/web2c/pdftexdir/avlstuff.h10
-rw-r--r--Build/source/texk/web2c/pdftexdir/epdf.c10
-rw-r--r--Build/source/texk/web2c/pdftexdir/epdf.h11
-rw-r--r--Build/source/texk/web2c/pdftexdir/image.h10
-rw-r--r--Build/source/texk/web2c/pdftexdir/macnames.c10
-rw-r--r--Build/source/texk/web2c/pdftexdir/mapfile.c25
-rw-r--r--Build/source/texk/web2c/pdftexdir/pdftex.ch10
-rw-r--r--Build/source/texk/web2c/pdftexdir/pdftex.defines17
-rw-r--r--Build/source/texk/web2c/pdftexdir/pdftex.h10
-rw-r--r--Build/source/texk/web2c/pdftexdir/pdftex.web853
-rw-r--r--Build/source/texk/web2c/pdftexdir/pdftexextra.in10
-rw-r--r--Build/source/texk/web2c/pdftexdir/pdftoepdf.cc29
-rw-r--r--Build/source/texk/web2c/pdftexdir/pdftosrc.cc10
-rw-r--r--Build/source/texk/web2c/pdftexdir/pkin.c10
-rw-r--r--Build/source/texk/web2c/pdftexdir/ptexlib.h30
-rw-r--r--Build/source/texk/web2c/pdftexdir/ptexmac.h10
-rw-r--r--Build/source/texk/web2c/pdftexdir/subfont.c10
-rw-r--r--Build/source/texk/web2c/pdftexdir/tex.ch010
-rw-r--r--Build/source/texk/web2c/pdftexdir/tounicode.c10
-rw-r--r--Build/source/texk/web2c/pdftexdir/ttf2afm.c10
-rw-r--r--Build/source/texk/web2c/pdftexdir/utils.c19
-rw-r--r--Build/source/texk/web2c/pdftexdir/vfpacket.c88
-rw-r--r--Build/source/texk/web2c/pdftexdir/writeenc.c14
-rw-r--r--Build/source/texk/web2c/pdftexdir/writefont.c72
-rw-r--r--Build/source/texk/web2c/pdftexdir/writeimg.c172
-rw-r--r--Build/source/texk/web2c/pdftexdir/writejbig2.c8
-rw-r--r--Build/source/texk/web2c/pdftexdir/writejbig2.h8
-rw-r--r--Build/source/texk/web2c/pdftexdir/writejpg.c10
-rw-r--r--Build/source/texk/web2c/pdftexdir/writepng.c27
-rw-r--r--Build/source/texk/web2c/pdftexdir/writet1.c50
-rw-r--r--Build/source/texk/web2c/pdftexdir/writet3.c23
-rw-r--r--Build/source/texk/web2c/pdftexdir/writettf.c18
-rw-r--r--Build/source/texk/web2c/pdftexdir/writettf.h10
-rw-r--r--Build/source/texk/web2c/pdftexdir/writezip.c53
39 files changed, 1659 insertions, 1223 deletions
diff --git a/Build/source/texk/web2c/pdftexdir/Makefile.in b/Build/source/texk/web2c/pdftexdir/Makefile.in
index 0f77f973d62..7f4aa216d76 100644
--- a/Build/source/texk/web2c/pdftexdir/Makefile.in
+++ b/Build/source/texk/web2c/pdftexdir/Makefile.in
@@ -1,5 +1,5 @@
# Makefile for libpdf - te@dbs.uni-hannover.de
-# $Id: //depot/Build/source.development/TeX/texk/web2c/pdftexdir/Makefile.in#23 $
+# $Id: Makefile.in 200 2007-07-11 13:11:12Z oneiros $
kpse_include ../make/common.mk
kpse_include ../make/programs.mk
@@ -59,7 +59,7 @@ clean::
depend:
rm -f $(OBJS) ttf2afm.o pdftosrc.o
XXCFLAGS=-MM XCFLAGS=-MM $(MAKE) -k $(OBJS) ttf2afm.o pdftosrc.o | \
- grep -v "^$(CC)\|$(CXX)\|$(AR)\|make\|klibtool" | \
+ grep -v "^$(CC)\|$(CXX)\|$(AR)\|make\" | \
sed 's: [^ ]*/\.\./libs/[^ ]*::g' > $(srcdir)/depend.mk
kpse_include pdftexdir/depend.mk
diff --git a/Build/source/texk/web2c/pdftexdir/NEWS b/Build/source/texk/web2c/pdftexdir/NEWS
index 466ba74993d..8cac60b4713 100644
--- a/Build/source/texk/web2c/pdftexdir/NEWS
+++ b/Build/source/texk/web2c/pdftexdir/NEWS
@@ -1,4 +1,37 @@
-------------------------------------------------
+pdfTeX 3.141592-1.40.4 was released on 2007-07-11
+-------------------------------------------------
+- Bugfixes:
+ - It was impossible to set the font Flags to 4 in map entries (762)
+ - The font Flags of non-embedded fonts were wrong (794)
+ Now pdfTeX uses the Flags from map entries (if found) or guesses values for
+ the base14 fonts. It also warns when you not-embedd a font without Flags
+ - Subsetted fonts still had their private UniqueID copied (774)
+ - \pdfunescapehex returned a wrong result if the last character was not a
+ hexadecimal digit and the last hex pair was incomplete (777)
+ - Copying a box with \pdfstartlink inside produced the same /Link annotation
+ object multiply, with same object number and identical coordinates on the
+ page (799)
+ - When trying to use a font without TFM, without map entry, and no PK font
+ available, a broken PDF was produced. Now no PDF is generated and the error
+ messages have been improved (721)
+ - Problems with vf fonts (722)
+ - Font expansion led to wrong log output of \kerns (736)
+ - \pdfprimitive was broken (see
+ http://www.ntg.nl/pipermail/ntg-pdftex/2007-April/002860.html)
+ - The -recorder option of web2c didn't record fonts, included images and some
+ other files (772)
+ - Using \pdfximage in IniTeX before \dump caused a crash when the format was
+ used (824)
+ - \letterspacefont had some problems (712)
+ - \letterspacefont and \pdffontexpand had some problems (747)
+- Improvements:
+ - pdf compression is now a bit faster (patch 726)
+ - the behaviour of TeX when it asks for a file name has been improved (756)
+- pdfTeX uses libpng 1.2.18
+- pdfTeX uses xpdf 3.02
+
+-------------------------------------------------
pdfTeX 3.141592-1.40.3 was released on 2007-02-04
-------------------------------------------------
- bugfix: document which used type 1 and truetype or opentype fonts resulted in
@@ -530,5 +563,5 @@ pdfTeX 3.14159-1.00a-pretest-20010806 was released on 2001-08-06
pdfTeX 3.14159-1.00a-pretest-20010804 was released on 2001-08-04
----------------------------------------------------------------
-$Id: //depot/Build/source.development/TeX/texk/web2c/pdftexdir/NEWS#86 $
+$Id: NEWS 200 2007-07-11 13:11:12Z oneiros $
// vim: tw=79:ts=2:expandtab:autoindent
diff --git a/Build/source/texk/web2c/pdftexdir/README b/Build/source/texk/web2c/pdftexdir/README
index b43ecc3dd66..2c9cd21eb67 100644
--- a/Build/source/texk/web2c/pdftexdir/README
+++ b/Build/source/texk/web2c/pdftexdir/README
@@ -1,10 +1,10 @@
pdfTeX
======
-README for version 3.14159-1.40.3
+README for version 3.14159-1.40.4
=================================
-This directory contains the version 1.40.3 of pdfTeX, an extended version
+This directory contains the version 1.40.4 of pdfTeX, an extended version
of eTeX that can create PDF directly from TeX source files and enhance the
result of TeX typesetting with the help of PDF. When PDF output is not
selected, pdfTeX produces normal DVI output, otherwise it produces PDF
@@ -37,8 +37,8 @@ pdfTeX is copyright (c) 1996-2007 Han The Thanh, <thanh@pdftex.org>
pdfTeX is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
+Foundation; either version 2.1 of the License, or (at your option) any
+later version.
pdfTeX is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
@@ -46,8 +46,8 @@ FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
You should have received a copy of the GNU General Public License along
-with pdfTeX; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place, Suite 330, Boston, MA 02111-1307 USA
+with pdfTeX; if not, write to the Free Software Foundation, Inc., 51
+Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
pdfTeX uses code from TeX; for these parts the original copyright by Don
Knuth applies. See the source files for details.
@@ -69,10 +69,11 @@ CONTRIBUTORS
============
Peter Breitenlohner, Ricardo Sanchez Carmenes, Otfried Cheong, Thomas
-Esser, Hans Hagen, Hartmut Henkel, Taco Hoekwater, Pawel Jackowski, Tom
-Kacvinsky, Akira Kakuto, Reinhard Kotucha, Derek B. Noonburg, Heiko
-Oberdiek, Jiri Osoba, Fabrice Popineau, Sebastian Rahtz, Tomas Rokicki,
-Martin Schröder, Petr Sojka, Ralf Utermann, Olaf Weber, Jiri Zlatuska.
+Esser, Hans Hagen, Hartmut Henkel, Taco Hoekwater, Pawel Jackowski, Pavel
+Janik, Tom Kacvinsky, Akira Kakuto, Reinhard Kotucha, Derek B. Noonburg,
+Heiko Oberdiek, Jiri Osoba, Fabrice Popineau, Sebastian Rahtz, Bernd
+Raichle, Tomas Rokicki, Martin Schröder, Petr Sojka, Ralf Utermann, Olaf
+Weber, Jiri Zlatuska.
pdfTeX is built on top of TeX, written by Donald Knuth cum suis (Liang and
so), and eTeX, written by Peter Breitenlohner cum suis; part of the
@@ -83,5 +84,5 @@ paragraph optimization is inspired by the work of Hermann Zapf.
Please send bug reports, offers of help, etc. to martin@pdftex.org
-$Id: //depot/Build/source.development/TeX/texk/web2c/pdftexdir/README#30 $
+$Id: README 200 2007-07-11 13:11:12Z oneiros $
// vim: tw=75
diff --git a/Build/source/texk/web2c/pdftexdir/avl.c b/Build/source/texk/web2c/pdftexdir/avl.c
index a25239e8d93..79c746cd10d 100644
--- a/Build/source/texk/web2c/pdftexdir/avl.c
+++ b/Build/source/texk/web2c/pdftexdir/avl.c
@@ -33,455 +33,406 @@
with comparison function |compare| using parameter |param|
and memory allocator |allocator|.
Returns |NULL| if memory allocation failed. */
-struct avl_table *
-avl_create (avl_comparison_func *compare, void *param,
- struct libavl_allocator *allocator)
+struct avl_table *avl_create(avl_comparison_func * compare, void *param,
+ struct libavl_allocator *allocator)
{
- struct avl_table *tree;
+ struct avl_table *tree;
- assert (compare != NULL);
+ assert(compare != NULL);
- if (allocator == NULL)
- allocator = &avl_allocator_default;
+ if (allocator == NULL)
+ allocator = &avl_allocator_default;
- tree = allocator->libavl_malloc (allocator, sizeof *tree);
- if (tree == NULL)
- return NULL;
+ tree = allocator->libavl_malloc(allocator, sizeof *tree);
+ if (tree == NULL)
+ return NULL;
- tree->avl_root = NULL;
- tree->avl_compare = compare;
- tree->avl_param = param;
- tree->avl_alloc = allocator;
- tree->avl_count = 0;
- tree->avl_generation = 0;
+ tree->avl_root = NULL;
+ tree->avl_compare = compare;
+ tree->avl_param = param;
+ tree->avl_alloc = allocator;
+ tree->avl_count = 0;
+ tree->avl_generation = 0;
- return tree;
+ return tree;
}
/* Search |tree| for an item matching |item|, and return it if found.
Otherwise return |NULL|. */
-void *
-avl_find (const struct avl_table *tree, const void *item)
+void *avl_find(const struct avl_table *tree, const void *item)
{
- const struct avl_node *p;
-
- assert (tree != NULL && item != NULL);
- for (p = tree->avl_root; p != NULL; )
- {
- int cmp = tree->avl_compare (item, p->avl_data, tree->avl_param);
-
- if (cmp < 0)
- p = p->avl_link[0];
- else if (cmp > 0)
- p = p->avl_link[1];
- else /* |cmp == 0| */
- return p->avl_data;
+ const struct avl_node *p;
+
+ assert(tree != NULL && item != NULL);
+ for (p = tree->avl_root; p != NULL;) {
+ int cmp = tree->avl_compare(item, p->avl_data, tree->avl_param);
+
+ if (cmp < 0)
+ p = p->avl_link[0];
+ else if (cmp > 0)
+ p = p->avl_link[1];
+ else /* |cmp == 0| */
+ return p->avl_data;
}
- return NULL;
+ return NULL;
}
/* Inserts |item| into |tree| and returns a pointer to |item|'s address.
If a duplicate item is found in the tree,
returns a pointer to the duplicate without inserting |item|.
Returns |NULL| in case of memory allocation failure. */
-void **
-avl_probe (struct avl_table *tree, void *item)
+void **avl_probe(struct avl_table *tree, void *item)
{
- struct avl_node *y, *z; /* Top node to update balance factor, and parent. */
- struct avl_node *p, *q; /* Iterator, and parent. */
- struct avl_node *n; /* Newly inserted node. */
- struct avl_node *w; /* New root of rebalanced subtree. */
- int dir; /* Direction to descend. */
-
- unsigned char da[AVL_MAX_HEIGHT]; /* Cached comparison results. */
- int k = 0; /* Number of cached results. */
-
- assert (tree != NULL && item != NULL);
-
- z = (struct avl_node *) &tree->avl_root;
- y = tree->avl_root;
- dir = 0;
- for (q = z, p = y; p != NULL; q = p, p = p->avl_link[dir])
- {
- int cmp = tree->avl_compare (item, p->avl_data, tree->avl_param);
- if (cmp == 0)
- return &p->avl_data;
-
- if (p->avl_balance != 0)
- z = q, y = p, k = 0;
- da[k++] = dir = cmp > 0;
+ struct avl_node *y, *z; /* Top node to update balance factor, and parent. */
+ struct avl_node *p, *q; /* Iterator, and parent. */
+ struct avl_node *n; /* Newly inserted node. */
+ struct avl_node *w; /* New root of rebalanced subtree. */
+ int dir; /* Direction to descend. */
+
+ unsigned char da[AVL_MAX_HEIGHT]; /* Cached comparison results. */
+ int k = 0; /* Number of cached results. */
+
+ assert(tree != NULL && item != NULL);
+
+ z = (struct avl_node *) &tree->avl_root;
+ y = tree->avl_root;
+ dir = 0;
+ for (q = z, p = y; p != NULL; q = p, p = p->avl_link[dir]) {
+ int cmp = tree->avl_compare(item, p->avl_data, tree->avl_param);
+ if (cmp == 0)
+ return &p->avl_data;
+
+ if (p->avl_balance != 0)
+ z = q, y = p, k = 0;
+ da[k++] = dir = cmp > 0;
}
- n = q->avl_link[dir] =
- tree->avl_alloc->libavl_malloc (tree->avl_alloc, sizeof *n);
- if (n == NULL)
- return NULL;
-
- tree->avl_count++;
- n->avl_data = item;
- n->avl_link[0] = n->avl_link[1] = NULL;
- n->avl_balance = 0;
- if (y == NULL)
- return &n->avl_data;
+ n = q->avl_link[dir] =
+ tree->avl_alloc->libavl_malloc(tree->avl_alloc, sizeof *n);
+ if (n == NULL)
+ return NULL;
- for (p = y, k = 0; p != n; p = p->avl_link[da[k]], k++)
- if (da[k] == 0)
- p->avl_balance--;
- else
- p->avl_balance++;
-
- if (y->avl_balance == -2)
- {
- struct avl_node *x = y->avl_link[0];
- if (x->avl_balance == -1)
- {
- w = x;
- y->avl_link[0] = x->avl_link[1];
- x->avl_link[1] = y;
- x->avl_balance = y->avl_balance = 0;
- }
- else
- {
- assert (x->avl_balance == +1);
- w = x->avl_link[1];
- x->avl_link[1] = w->avl_link[0];
- w->avl_link[0] = x;
- y->avl_link[0] = w->avl_link[1];
- w->avl_link[1] = y;
- if (w->avl_balance == -1)
- x->avl_balance = 0, y->avl_balance = +1;
- else if (w->avl_balance == 0)
+ tree->avl_count++;
+ n->avl_data = item;
+ n->avl_link[0] = n->avl_link[1] = NULL;
+ n->avl_balance = 0;
+ if (y == NULL)
+ return &n->avl_data;
+
+ for (p = y, k = 0; p != n; p = p->avl_link[da[k]], k++)
+ if (da[k] == 0)
+ p->avl_balance--;
+ else
+ p->avl_balance++;
+
+ if (y->avl_balance == -2) {
+ struct avl_node *x = y->avl_link[0];
+ if (x->avl_balance == -1) {
+ w = x;
+ y->avl_link[0] = x->avl_link[1];
+ x->avl_link[1] = y;
x->avl_balance = y->avl_balance = 0;
- else /* |w->avl_balance == +1| */
- x->avl_balance = -1, y->avl_balance = 0;
- w->avl_balance = 0;
+ } else {
+ assert(x->avl_balance == +1);
+ w = x->avl_link[1];
+ x->avl_link[1] = w->avl_link[0];
+ w->avl_link[0] = x;
+ y->avl_link[0] = w->avl_link[1];
+ w->avl_link[1] = y;
+ if (w->avl_balance == -1)
+ x->avl_balance = 0, y->avl_balance = +1;
+ else if (w->avl_balance == 0)
+ x->avl_balance = y->avl_balance = 0;
+ else /* |w->avl_balance == +1| */
+ x->avl_balance = -1, y->avl_balance = 0;
+ w->avl_balance = 0;
}
- }
- else if (y->avl_balance == +2)
- {
- struct avl_node *x = y->avl_link[1];
- if (x->avl_balance == +1)
- {
- w = x;
- y->avl_link[1] = x->avl_link[0];
- x->avl_link[0] = y;
- x->avl_balance = y->avl_balance = 0;
- }
- else
- {
- assert (x->avl_balance == -1);
- w = x->avl_link[0];
- x->avl_link[0] = w->avl_link[1];
- w->avl_link[1] = x;
- y->avl_link[1] = w->avl_link[0];
- w->avl_link[0] = y;
- if (w->avl_balance == +1)
- x->avl_balance = 0, y->avl_balance = -1;
- else if (w->avl_balance == 0)
+ } else if (y->avl_balance == +2) {
+ struct avl_node *x = y->avl_link[1];
+ if (x->avl_balance == +1) {
+ w = x;
+ y->avl_link[1] = x->avl_link[0];
+ x->avl_link[0] = y;
x->avl_balance = y->avl_balance = 0;
- else /* |w->avl_balance == -1| */
- x->avl_balance = +1, y->avl_balance = 0;
- w->avl_balance = 0;
+ } else {
+ assert(x->avl_balance == -1);
+ w = x->avl_link[0];
+ x->avl_link[0] = w->avl_link[1];
+ w->avl_link[1] = x;
+ y->avl_link[1] = w->avl_link[0];
+ w->avl_link[0] = y;
+ if (w->avl_balance == +1)
+ x->avl_balance = 0, y->avl_balance = -1;
+ else if (w->avl_balance == 0)
+ x->avl_balance = y->avl_balance = 0;
+ else /* |w->avl_balance == -1| */
+ x->avl_balance = +1, y->avl_balance = 0;
+ w->avl_balance = 0;
}
- }
- else
- return &n->avl_data;
- z->avl_link[y != z->avl_link[0]] = w;
+ } else
+ return &n->avl_data;
+ z->avl_link[y != z->avl_link[0]] = w;
- tree->avl_generation++;
- return &n->avl_data;
+ tree->avl_generation++;
+ return &n->avl_data;
}
/* Inserts |item| into |table|.
Returns |NULL| if |item| was successfully inserted
or if a memory allocation error occurred.
Otherwise, returns the duplicate item. */
-void *
-avl_insert (struct avl_table *table, void *item)
+void *avl_insert(struct avl_table *table, void *item)
{
- void **p = avl_probe (table, item);
- return p == NULL || *p == item ? NULL : *p;
+ void **p = avl_probe(table, item);
+ return p == NULL || *p == item ? NULL : *p;
}
/* Inserts |item| into |table|, replacing any duplicate item.
Returns |NULL| if |item| was inserted without replacing a duplicate,
or if a memory allocation error occurred.
Otherwise, returns the item that was replaced. */
-void *
-avl_replace (struct avl_table *table, void *item)
+void *avl_replace(struct avl_table *table, void *item)
{
- void **p = avl_probe (table, item);
- if (p == NULL || *p == item)
- return NULL;
- else
- {
- void *r = *p;
- *p = item;
- return r;
+ void **p = avl_probe(table, item);
+ if (p == NULL || *p == item)
+ return NULL;
+ else {
+ void *r = *p;
+ *p = item;
+ return r;
}
}
/* Deletes from |tree| and returns an item matching |item|.
Returns a null pointer if no matching item found. */
-void *
-avl_delete (struct avl_table *tree, const void *item)
+void *avl_delete(struct avl_table *tree, const void *item)
{
- /* Stack of nodes. */
- struct avl_node *pa[AVL_MAX_HEIGHT]; /* Nodes. */
- unsigned char da[AVL_MAX_HEIGHT]; /* |avl_link[]| indexes. */
- int k; /* Stack pointer. */
+ /* Stack of nodes. */
+ struct avl_node *pa[AVL_MAX_HEIGHT]; /* Nodes. */
+ unsigned char da[AVL_MAX_HEIGHT]; /* |avl_link[]| indexes. */
+ int k; /* Stack pointer. */
- struct avl_node *p; /* Traverses tree to find node to delete. */
- int cmp; /* Result of comparison between |item| and |p|. */
+ struct avl_node *p; /* Traverses tree to find node to delete. */
+ int cmp; /* Result of comparison between |item| and |p|. */
- assert (tree != NULL && item != NULL);
+ assert(tree != NULL && item != NULL);
- k = 0;
- p = (struct avl_node *) &tree->avl_root;
- for (cmp = -1; cmp != 0;
- cmp = tree->avl_compare (item, p->avl_data, tree->avl_param))
- {
- int dir = cmp > 0;
+ k = 0;
+ p = (struct avl_node *) &tree->avl_root;
+ for (cmp = -1; cmp != 0;
+ cmp = tree->avl_compare(item, p->avl_data, tree->avl_param)) {
+ int dir = cmp > 0;
- pa[k] = p;
- da[k++] = dir;
+ pa[k] = p;
+ da[k++] = dir;
- p = p->avl_link[dir];
- if (p == NULL)
- return NULL;
+ p = p->avl_link[dir];
+ if (p == NULL)
+ return NULL;
}
- item = p->avl_data;
-
- if (p->avl_link[1] == NULL)
- pa[k - 1]->avl_link[da[k - 1]] = p->avl_link[0];
- else
- {
- struct avl_node *r = p->avl_link[1];
- if (r->avl_link[0] == NULL)
- {
- r->avl_link[0] = p->avl_link[0];
- r->avl_balance = p->avl_balance;
- pa[k - 1]->avl_link[da[k - 1]] = r;
- da[k] = 1;
- pa[k++] = r;
- }
- else
- {
- struct avl_node *s;
- int j = k++;
-
- for (;;)
- {
- da[k] = 0;
- pa[k++] = r;
- s = r->avl_link[0];
- if (s->avl_link[0] == NULL)
- break;
-
- r = s;
+ item = p->avl_data;
+
+ if (p->avl_link[1] == NULL)
+ pa[k - 1]->avl_link[da[k - 1]] = p->avl_link[0];
+ else {
+ struct avl_node *r = p->avl_link[1];
+ if (r->avl_link[0] == NULL) {
+ r->avl_link[0] = p->avl_link[0];
+ r->avl_balance = p->avl_balance;
+ pa[k - 1]->avl_link[da[k - 1]] = r;
+ da[k] = 1;
+ pa[k++] = r;
+ } else {
+ struct avl_node *s;
+ int j = k++;
+
+ for (;;) {
+ da[k] = 0;
+ pa[k++] = r;
+ s = r->avl_link[0];
+ if (s->avl_link[0] == NULL)
+ break;
+
+ r = s;
}
- s->avl_link[0] = p->avl_link[0];
- r->avl_link[0] = s->avl_link[1];
- s->avl_link[1] = p->avl_link[1];
- s->avl_balance = p->avl_balance;
+ s->avl_link[0] = p->avl_link[0];
+ r->avl_link[0] = s->avl_link[1];
+ s->avl_link[1] = p->avl_link[1];
+ s->avl_balance = p->avl_balance;
- pa[j - 1]->avl_link[da[j - 1]] = s;
- da[j] = 1;
- pa[j] = s;
+ pa[j - 1]->avl_link[da[j - 1]] = s;
+ da[j] = 1;
+ pa[j] = s;
}
}
- tree->avl_alloc->libavl_free (tree->avl_alloc, p);
-
- assert (k > 0);
- while (--k > 0)
- {
- struct avl_node *y = pa[k];
-
- if (da[k] == 0)
- {
- y->avl_balance++;
- if (y->avl_balance == +1)
- break;
- else if (y->avl_balance == +2)
- {
- struct avl_node *x = y->avl_link[1];
- if (x->avl_balance == -1)
- {
- struct avl_node *w;
- assert (x->avl_balance == -1);
- w = x->avl_link[0];
- x->avl_link[0] = w->avl_link[1];
- w->avl_link[1] = x;
- y->avl_link[1] = w->avl_link[0];
- w->avl_link[0] = y;
- if (w->avl_balance == +1)
- x->avl_balance = 0, y->avl_balance = -1;
- else if (w->avl_balance == 0)
- x->avl_balance = y->avl_balance = 0;
- else /* |w->avl_balance == -1| */
- x->avl_balance = +1, y->avl_balance = 0;
- w->avl_balance = 0;
- pa[k - 1]->avl_link[da[k - 1]] = w;
- }
- else
- {
- y->avl_link[1] = x->avl_link[0];
- x->avl_link[0] = y;
- pa[k - 1]->avl_link[da[k - 1]] = x;
- if (x->avl_balance == 0)
- {
- x->avl_balance = -1;
- y->avl_balance = +1;
- break;
- }
- else
- x->avl_balance = y->avl_balance = 0;
+ tree->avl_alloc->libavl_free(tree->avl_alloc, p);
+
+ assert(k > 0);
+ while (--k > 0) {
+ struct avl_node *y = pa[k];
+
+ if (da[k] == 0) {
+ y->avl_balance++;
+ if (y->avl_balance == +1)
+ break;
+ else if (y->avl_balance == +2) {
+ struct avl_node *x = y->avl_link[1];
+ if (x->avl_balance == -1) {
+ struct avl_node *w;
+ assert(x->avl_balance == -1);
+ w = x->avl_link[0];
+ x->avl_link[0] = w->avl_link[1];
+ w->avl_link[1] = x;
+ y->avl_link[1] = w->avl_link[0];
+ w->avl_link[0] = y;
+ if (w->avl_balance == +1)
+ x->avl_balance = 0, y->avl_balance = -1;
+ else if (w->avl_balance == 0)
+ x->avl_balance = y->avl_balance = 0;
+ else /* |w->avl_balance == -1| */
+ x->avl_balance = +1, y->avl_balance = 0;
+ w->avl_balance = 0;
+ pa[k - 1]->avl_link[da[k - 1]] = w;
+ } else {
+ y->avl_link[1] = x->avl_link[0];
+ x->avl_link[0] = y;
+ pa[k - 1]->avl_link[da[k - 1]] = x;
+ if (x->avl_balance == 0) {
+ x->avl_balance = -1;
+ y->avl_balance = +1;
+ break;
+ } else
+ x->avl_balance = y->avl_balance = 0;
}
}
- }
- else
- {
- y->avl_balance--;
- if (y->avl_balance == -1)
- break;
- else if (y->avl_balance == -2)
- {
- struct avl_node *x = y->avl_link[0];
- if (x->avl_balance == +1)
- {
- struct avl_node *w;
- assert (x->avl_balance == +1);
- w = x->avl_link[1];
- x->avl_link[1] = w->avl_link[0];
- w->avl_link[0] = x;
- y->avl_link[0] = w->avl_link[1];
- w->avl_link[1] = y;
- if (w->avl_balance == -1)
- x->avl_balance = 0, y->avl_balance = +1;
- else if (w->avl_balance == 0)
- x->avl_balance = y->avl_balance = 0;
- else /* |w->avl_balance == +1| */
- x->avl_balance = -1, y->avl_balance = 0;
- w->avl_balance = 0;
- pa[k - 1]->avl_link[da[k - 1]] = w;
- }
- else
- {
- y->avl_link[0] = x->avl_link[1];
- x->avl_link[1] = y;
- pa[k - 1]->avl_link[da[k - 1]] = x;
- if (x->avl_balance == 0)
- {
- x->avl_balance = +1;
- y->avl_balance = -1;
- break;
- }
- else
- x->avl_balance = y->avl_balance = 0;
+ } else {
+ y->avl_balance--;
+ if (y->avl_balance == -1)
+ break;
+ else if (y->avl_balance == -2) {
+ struct avl_node *x = y->avl_link[0];
+ if (x->avl_balance == +1) {
+ struct avl_node *w;
+ assert(x->avl_balance == +1);
+ w = x->avl_link[1];
+ x->avl_link[1] = w->avl_link[0];
+ w->avl_link[0] = x;
+ y->avl_link[0] = w->avl_link[1];
+ w->avl_link[1] = y;
+ if (w->avl_balance == -1)
+ x->avl_balance = 0, y->avl_balance = +1;
+ else if (w->avl_balance == 0)
+ x->avl_balance = y->avl_balance = 0;
+ else /* |w->avl_balance == +1| */
+ x->avl_balance = -1, y->avl_balance = 0;
+ w->avl_balance = 0;
+ pa[k - 1]->avl_link[da[k - 1]] = w;
+ } else {
+ y->avl_link[0] = x->avl_link[1];
+ x->avl_link[1] = y;
+ pa[k - 1]->avl_link[da[k - 1]] = x;
+ if (x->avl_balance == 0) {
+ x->avl_balance = +1;
+ y->avl_balance = -1;
+ break;
+ } else
+ x->avl_balance = y->avl_balance = 0;
}
}
}
}
- tree->avl_count--;
- tree->avl_generation++;
- return (void *) item;
+ tree->avl_count--;
+ tree->avl_generation++;
+ return (void *) item;
}
/* Refreshes the stack of parent pointers in |trav|
and updates its generation number. */
-static void
-trav_refresh (struct avl_traverser *trav)
+static void trav_refresh(struct avl_traverser *trav)
{
- assert (trav != NULL);
+ assert(trav != NULL);
- trav->avl_generation = trav->avl_table->avl_generation;
+ trav->avl_generation = trav->avl_table->avl_generation;
- if (trav->avl_node != NULL)
- {
- avl_comparison_func *cmp = trav->avl_table->avl_compare;
- void *param = trav->avl_table->avl_param;
- struct avl_node *node = trav->avl_node;
- struct avl_node *i;
+ if (trav->avl_node != NULL) {
+ avl_comparison_func *cmp = trav->avl_table->avl_compare;
+ void *param = trav->avl_table->avl_param;
+ struct avl_node *node = trav->avl_node;
+ struct avl_node *i;
- trav->avl_height = 0;
- for (i = trav->avl_table->avl_root; i != node; )
- {
- assert (trav->avl_height < AVL_MAX_HEIGHT);
- assert (i != NULL);
+ trav->avl_height = 0;
+ for (i = trav->avl_table->avl_root; i != node;) {
+ assert(trav->avl_height < AVL_MAX_HEIGHT);
+ assert(i != NULL);
- trav->avl_stack[trav->avl_height++] = i;
- i = i->avl_link[cmp (node->avl_data, i->avl_data, param) > 0];
+ trav->avl_stack[trav->avl_height++] = i;
+ i = i->avl_link[cmp(node->avl_data, i->avl_data, param) > 0];
}
}
}
/* Initializes |trav| for use with |tree|
and selects the null node. */
-void
-avl_t_init (struct avl_traverser *trav, struct avl_table *tree)
+void avl_t_init(struct avl_traverser *trav, struct avl_table *tree)
{
- trav->avl_table = tree;
- trav->avl_node = NULL;
- trav->avl_height = 0;
- trav->avl_generation = tree->avl_generation;
+ trav->avl_table = tree;
+ trav->avl_node = NULL;
+ trav->avl_height = 0;
+ trav->avl_generation = tree->avl_generation;
}
/* Initializes |trav| for |tree|
and selects and returns a pointer to its least-valued item.
Returns |NULL| if |tree| contains no nodes. */
-void *
-avl_t_first (struct avl_traverser *trav, struct avl_table *tree)
+void *avl_t_first(struct avl_traverser *trav, struct avl_table *tree)
{
- struct avl_node *x;
+ struct avl_node *x;
- assert (tree != NULL && trav != NULL);
+ assert(tree != NULL && trav != NULL);
- trav->avl_table = tree;
- trav->avl_height = 0;
- trav->avl_generation = tree->avl_generation;
+ trav->avl_table = tree;
+ trav->avl_height = 0;
+ trav->avl_generation = tree->avl_generation;
- x = tree->avl_root;
- if (x != NULL)
- while (x->avl_link[0] != NULL)
- {
- assert (trav->avl_height < AVL_MAX_HEIGHT);
- trav->avl_stack[trav->avl_height++] = x;
- x = x->avl_link[0];
- }
- trav->avl_node = x;
+ x = tree->avl_root;
+ if (x != NULL)
+ while (x->avl_link[0] != NULL) {
+ assert(trav->avl_height < AVL_MAX_HEIGHT);
+ trav->avl_stack[trav->avl_height++] = x;
+ x = x->avl_link[0];
+ }
+ trav->avl_node = x;
- return x != NULL ? x->avl_data : NULL;
+ return x != NULL ? x->avl_data : NULL;
}
/* Initializes |trav| for |tree|
and selects and returns a pointer to its greatest-valued item.
Returns |NULL| if |tree| contains no nodes. */
-void *
-avl_t_last (struct avl_traverser *trav, struct avl_table *tree)
+void *avl_t_last(struct avl_traverser *trav, struct avl_table *tree)
{
- struct avl_node *x;
+ struct avl_node *x;
- assert (tree != NULL && trav != NULL);
+ assert(tree != NULL && trav != NULL);
- trav->avl_table = tree;
- trav->avl_height = 0;
- trav->avl_generation = tree->avl_generation;
+ trav->avl_table = tree;
+ trav->avl_height = 0;
+ trav->avl_generation = tree->avl_generation;
- x = tree->avl_root;
- if (x != NULL)
- while (x->avl_link[1] != NULL)
- {
- assert (trav->avl_height < AVL_MAX_HEIGHT);
- trav->avl_stack[trav->avl_height++] = x;
- x = x->avl_link[1];
- }
- trav->avl_node = x;
+ x = tree->avl_root;
+ if (x != NULL)
+ while (x->avl_link[1] != NULL) {
+ assert(trav->avl_height < AVL_MAX_HEIGHT);
+ trav->avl_stack[trav->avl_height++] = x;
+ x = x->avl_link[1];
+ }
+ trav->avl_node = x;
- return x != NULL ? x->avl_data : NULL;
+ return x != NULL ? x->avl_data : NULL;
}
/* Searches for |item| in |tree|.
@@ -489,36 +440,34 @@ avl_t_last (struct avl_traverser *trav, struct avl_table *tree)
as well.
If there is no matching item, initializes |trav| to the null item
and returns |NULL|. */
-void *
-avl_t_find (struct avl_traverser *trav, struct avl_table *tree, void *item)
+void *avl_t_find(struct avl_traverser *trav, struct avl_table *tree, void *item)
{
- struct avl_node *p, *q;
-
- assert (trav != NULL && tree != NULL && item != NULL);
- trav->avl_table = tree;
- trav->avl_height = 0;
- trav->avl_generation = tree->avl_generation;
- for (p = tree->avl_root; p != NULL; p = q)
- {
- int cmp = tree->avl_compare (item, p->avl_data, tree->avl_param);
-
- if (cmp < 0)
- q = p->avl_link[0];
- else if (cmp > 0)
- q = p->avl_link[1];
- else /* |cmp == 0| */
- {
- trav->avl_node = p;
- return p->avl_data;
+ struct avl_node *p, *q;
+
+ assert(trav != NULL && tree != NULL && item != NULL);
+ trav->avl_table = tree;
+ trav->avl_height = 0;
+ trav->avl_generation = tree->avl_generation;
+ for (p = tree->avl_root; p != NULL; p = q) {
+ int cmp = tree->avl_compare(item, p->avl_data, tree->avl_param);
+
+ if (cmp < 0)
+ q = p->avl_link[0];
+ else if (cmp > 0)
+ q = p->avl_link[1];
+ else { /* |cmp == 0| */
+
+ trav->avl_node = p;
+ return p->avl_data;
}
- assert (trav->avl_height < AVL_MAX_HEIGHT);
- trav->avl_stack[trav->avl_height++] = p;
+ assert(trav->avl_height < AVL_MAX_HEIGHT);
+ trav->avl_stack[trav->avl_height++] = p;
}
- trav->avl_height = 0;
- trav->avl_node = NULL;
- return NULL;
+ trav->avl_height = 0;
+ trav->avl_node = NULL;
+ return NULL;
}
/* Attempts to insert |item| into |tree|.
@@ -528,193 +477,166 @@ avl_t_find (struct avl_traverser *trav, struct avl_table *tree, void *item)
its location. No replacement of the item occurs.
If a memory allocation failure occurs, |NULL| is returned and |trav|
is initialized to the null item. */
-void *
-avl_t_insert (struct avl_traverser *trav, struct avl_table *tree, void *item)
+void *avl_t_insert(struct avl_traverser *trav, struct avl_table *tree,
+ void *item)
{
- void **p;
-
- assert (trav != NULL && tree != NULL && item != NULL);
-
- p = avl_probe (tree, item);
- if (p != NULL)
- {
- trav->avl_table = tree;
- trav->avl_node =
- ((struct avl_node *)
- ((char *) p - offsetof (struct avl_node, avl_data)));
- trav->avl_generation = tree->avl_generation - 1;
- return *p;
- }
- else
- {
- avl_t_init (trav, tree);
- return NULL;
+ void **p;
+
+ assert(trav != NULL && tree != NULL && item != NULL);
+
+ p = avl_probe(tree, item);
+ if (p != NULL) {
+ trav->avl_table = tree;
+ trav->avl_node = ((struct avl_node *)
+ ((char *) p - offsetof(struct avl_node, avl_data)));
+ trav->avl_generation = tree->avl_generation - 1;
+ return *p;
+ } else {
+ avl_t_init(trav, tree);
+ return NULL;
}
}
/* Initializes |trav| to have the same current node as |src|. */
-void *
-avl_t_copy (struct avl_traverser *trav, const struct avl_traverser *src)
+void *avl_t_copy(struct avl_traverser *trav, const struct avl_traverser *src)
{
- assert (trav != NULL && src != NULL);
-
- if (trav != src)
- {
- trav->avl_table = src->avl_table;
- trav->avl_node = src->avl_node;
- trav->avl_generation = src->avl_generation;
- if (trav->avl_generation == trav->avl_table->avl_generation)
- {
- trav->avl_height = src->avl_height;
- memcpy (trav->avl_stack, (const void *) src->avl_stack,
- sizeof *trav->avl_stack * trav->avl_height);
+ assert(trav != NULL && src != NULL);
+
+ if (trav != src) {
+ trav->avl_table = src->avl_table;
+ trav->avl_node = src->avl_node;
+ trav->avl_generation = src->avl_generation;
+ if (trav->avl_generation == trav->avl_table->avl_generation) {
+ trav->avl_height = src->avl_height;
+ memcpy(trav->avl_stack, (const void *) src->avl_stack,
+ sizeof *trav->avl_stack * trav->avl_height);
}
}
- return trav->avl_node != NULL ? trav->avl_node->avl_data : NULL;
+ return trav->avl_node != NULL ? trav->avl_node->avl_data : NULL;
}
/* Returns the next data item in inorder
within the tree being traversed with |trav|,
or if there are no more data items returns |NULL|. */
-void *
-avl_t_next (struct avl_traverser *trav)
+void *avl_t_next(struct avl_traverser *trav)
{
- struct avl_node *x;
+ struct avl_node *x;
- assert (trav != NULL);
+ assert(trav != NULL);
- if (trav->avl_generation != trav->avl_table->avl_generation)
- trav_refresh (trav);
+ if (trav->avl_generation != trav->avl_table->avl_generation)
+ trav_refresh(trav);
- x = trav->avl_node;
- if (x == NULL)
- {
- return avl_t_first (trav, trav->avl_table);
- }
- else if (x->avl_link[1] != NULL)
- {
- assert (trav->avl_height < AVL_MAX_HEIGHT);
- trav->avl_stack[trav->avl_height++] = x;
- x = x->avl_link[1];
-
- while (x->avl_link[0] != NULL)
- {
- assert (trav->avl_height < AVL_MAX_HEIGHT);
- trav->avl_stack[trav->avl_height++] = x;
- x = x->avl_link[0];
+ x = trav->avl_node;
+ if (x == NULL) {
+ return avl_t_first(trav, trav->avl_table);
+ } else if (x->avl_link[1] != NULL) {
+ assert(trav->avl_height < AVL_MAX_HEIGHT);
+ trav->avl_stack[trav->avl_height++] = x;
+ x = x->avl_link[1];
+
+ while (x->avl_link[0] != NULL) {
+ assert(trav->avl_height < AVL_MAX_HEIGHT);
+ trav->avl_stack[trav->avl_height++] = x;
+ x = x->avl_link[0];
}
- }
- else
- {
- struct avl_node *y;
-
- do
- {
- if (trav->avl_height == 0)
- {
- trav->avl_node = NULL;
- return NULL;
+ } else {
+ struct avl_node *y;
+
+ do {
+ if (trav->avl_height == 0) {
+ trav->avl_node = NULL;
+ return NULL;
}
- y = x;
- x = trav->avl_stack[--trav->avl_height];
+ y = x;
+ x = trav->avl_stack[--trav->avl_height];
}
- while (y == x->avl_link[1]);
+ while (y == x->avl_link[1]);
}
- trav->avl_node = x;
+ trav->avl_node = x;
- return x->avl_data;
+ return x->avl_data;
}
/* Returns the previous data item in inorder
within the tree being traversed with |trav|,
or if there are no more data items returns |NULL|. */
-void *
-avl_t_prev (struct avl_traverser *trav)
+void *avl_t_prev(struct avl_traverser *trav)
{
- struct avl_node *x;
+ struct avl_node *x;
- assert (trav != NULL);
+ assert(trav != NULL);
- if (trav->avl_generation != trav->avl_table->avl_generation)
- trav_refresh (trav);
+ if (trav->avl_generation != trav->avl_table->avl_generation)
+ trav_refresh(trav);
- x = trav->avl_node;
- if (x == NULL)
- {
- return avl_t_last (trav, trav->avl_table);
- }
- else if (x->avl_link[0] != NULL)
- {
- assert (trav->avl_height < AVL_MAX_HEIGHT);
- trav->avl_stack[trav->avl_height++] = x;
- x = x->avl_link[0];
-
- while (x->avl_link[1] != NULL)
- {
- assert (trav->avl_height < AVL_MAX_HEIGHT);
- trav->avl_stack[trav->avl_height++] = x;
- x = x->avl_link[1];
+ x = trav->avl_node;
+ if (x == NULL) {
+ return avl_t_last(trav, trav->avl_table);
+ } else if (x->avl_link[0] != NULL) {
+ assert(trav->avl_height < AVL_MAX_HEIGHT);
+ trav->avl_stack[trav->avl_height++] = x;
+ x = x->avl_link[0];
+
+ while (x->avl_link[1] != NULL) {
+ assert(trav->avl_height < AVL_MAX_HEIGHT);
+ trav->avl_stack[trav->avl_height++] = x;
+ x = x->avl_link[1];
}
- }
- else
- {
- struct avl_node *y;
-
- do
- {
- if (trav->avl_height == 0)
- {
- trav->avl_node = NULL;
- return NULL;
+ } else {
+ struct avl_node *y;
+
+ do {
+ if (trav->avl_height == 0) {
+ trav->avl_node = NULL;
+ return NULL;
}
- y = x;
- x = trav->avl_stack[--trav->avl_height];
+ y = x;
+ x = trav->avl_stack[--trav->avl_height];
}
- while (y == x->avl_link[0]);
+ while (y == x->avl_link[0]);
}
- trav->avl_node = x;
+ trav->avl_node = x;
- return x->avl_data;
+ return x->avl_data;
}
/* Returns |trav|'s current item. */
-void *
-avl_t_cur (struct avl_traverser *trav)
+void *avl_t_cur(struct avl_traverser *trav)
{
- assert (trav != NULL);
+ assert(trav != NULL);
- return trav->avl_node != NULL ? trav->avl_node->avl_data : NULL;
+ return trav->avl_node != NULL ? trav->avl_node->avl_data : NULL;
}
/* Replaces the current item in |trav| by |new| and returns the item replaced.
|trav| must not have the null item selected.
The new item must not upset the ordering of the tree. */
-void *
-avl_t_replace (struct avl_traverser *trav, void *new)
+void *avl_t_replace(struct avl_traverser *trav, void *new)
{
- void *old;
+ void *old;
- assert (trav != NULL && trav->avl_node != NULL && new != NULL);
- old = trav->avl_node->avl_data;
- trav->avl_node->avl_data = new;
- return old;
+ assert(trav != NULL && trav->avl_node != NULL && new != NULL);
+ old = trav->avl_node->avl_data;
+ trav->avl_node->avl_data = new;
+ return old;
}
/* Destroys |new| with |avl_destroy (new, destroy)|,
first setting right links of nodes in |stack| within |new|
to null pointers to avoid touching uninitialized data. */
static void
-copy_error_recovery (struct avl_node **stack, int height,
- struct avl_table *new, avl_item_func *destroy)
+copy_error_recovery(struct avl_node **stack, int height,
+ struct avl_table *new, avl_item_func * destroy)
{
- assert (stack != NULL && height >= 0 && new != NULL);
+ assert(stack != NULL && height >= 0 && new != NULL);
- for (; height > 2; height -= 2)
- stack[height - 1]->avl_link[1] = NULL;
- avl_destroy (new, destroy);
+ for (; height > 2; height -= 2)
+ stack[height - 1]->avl_link[1] = NULL;
+ avl_destroy(new, destroy);
}
/* Copies |org| to a newly created tree, which is returned.
@@ -726,168 +648,147 @@ copy_error_recovery (struct avl_node **stack, int height,
and returns |NULL|.
If |allocator != NULL|, it is used for allocation in the new tree.
Otherwise, the same allocator used for |org| is used. */
-struct avl_table *
-avl_copy (const struct avl_table *org, avl_copy_func *copy,
- avl_item_func *destroy, struct libavl_allocator *allocator)
+struct avl_table *avl_copy(const struct avl_table *org, avl_copy_func * copy,
+ avl_item_func * destroy,
+ struct libavl_allocator *allocator)
{
- struct avl_node *stack[2 * (AVL_MAX_HEIGHT + 1)];
- int height = 0;
+ struct avl_node *stack[2 * (AVL_MAX_HEIGHT + 1)];
+ int height = 0;
- struct avl_table *new;
- const struct avl_node *x;
- struct avl_node *y;
+ struct avl_table *new;
+ const struct avl_node *x;
+ struct avl_node *y;
- assert (org != NULL);
- new = avl_create (org->avl_compare, org->avl_param,
- allocator != NULL ? allocator : org->avl_alloc);
- if (new == NULL)
- return NULL;
- new->avl_count = org->avl_count;
- if (new->avl_count == 0)
- return new;
-
- x = (const struct avl_node *) &org->avl_root;
- y = (struct avl_node *) &new->avl_root;
- for (;;)
- {
- while (x->avl_link[0] != NULL)
- {
- assert (height < 2 * (AVL_MAX_HEIGHT + 1));
-
- y->avl_link[0] =
- new->avl_alloc->libavl_malloc (new->avl_alloc,
- sizeof *y->avl_link[0]);
- if (y->avl_link[0] == NULL)
- {
- if (y != (struct avl_node *) &new->avl_root)
- {
- y->avl_data = NULL;
- y->avl_link[1] = NULL;
+ assert(org != NULL);
+ new = avl_create(org->avl_compare, org->avl_param,
+ allocator != NULL ? allocator : org->avl_alloc);
+ if (new == NULL)
+ return NULL;
+ new->avl_count = org->avl_count;
+ if (new->avl_count == 0)
+ return new;
+
+ x = (const struct avl_node *) &org->avl_root;
+ y = (struct avl_node *) &new->avl_root;
+ for (;;) {
+ while (x->avl_link[0] != NULL) {
+ assert(height < 2 * (AVL_MAX_HEIGHT + 1));
+
+ y->avl_link[0] =
+ new->avl_alloc->libavl_malloc(new->avl_alloc,
+ sizeof *y->avl_link[0]);
+ if (y->avl_link[0] == NULL) {
+ if (y != (struct avl_node *) &new->avl_root) {
+ y->avl_data = NULL;
+ y->avl_link[1] = NULL;
}
- copy_error_recovery (stack, height, new, destroy);
- return NULL;
+ copy_error_recovery(stack, height, new, destroy);
+ return NULL;
}
- stack[height++] = (struct avl_node *) x;
- stack[height++] = y;
- x = x->avl_link[0];
- y = y->avl_link[0];
+ stack[height++] = (struct avl_node *) x;
+ stack[height++] = y;
+ x = x->avl_link[0];
+ y = y->avl_link[0];
}
- y->avl_link[0] = NULL;
-
- for (;;)
- {
- y->avl_balance = x->avl_balance;
- if (copy == NULL)
- y->avl_data = x->avl_data;
- else
- {
- y->avl_data = copy (x->avl_data, org->avl_param);
- if (y->avl_data == NULL)
- {
- y->avl_link[1] = NULL;
- copy_error_recovery (stack, height, new, destroy);
- return NULL;
+ y->avl_link[0] = NULL;
+
+ for (;;) {
+ y->avl_balance = x->avl_balance;
+ if (copy == NULL)
+ y->avl_data = x->avl_data;
+ else {
+ y->avl_data = copy(x->avl_data, org->avl_param);
+ if (y->avl_data == NULL) {
+ y->avl_link[1] = NULL;
+ copy_error_recovery(stack, height, new, destroy);
+ return NULL;
}
}
- if (x->avl_link[1] != NULL)
- {
- y->avl_link[1] =
- new->avl_alloc->libavl_malloc (new->avl_alloc,
- sizeof *y->avl_link[1]);
- if (y->avl_link[1] == NULL)
- {
- copy_error_recovery (stack, height, new, destroy);
- return NULL;
+ if (x->avl_link[1] != NULL) {
+ y->avl_link[1] =
+ new->avl_alloc->libavl_malloc(new->avl_alloc,
+ sizeof *y->avl_link[1]);
+ if (y->avl_link[1] == NULL) {
+ copy_error_recovery(stack, height, new, destroy);
+ return NULL;
}
- x = x->avl_link[1];
- y = y->avl_link[1];
- break;
- }
- else
- y->avl_link[1] = NULL;
+ x = x->avl_link[1];
+ y = y->avl_link[1];
+ break;
+ } else
+ y->avl_link[1] = NULL;
- if (height <= 2)
- return new;
+ if (height <= 2)
+ return new;
- y = stack[--height];
- x = stack[--height];
+ y = stack[--height];
+ x = stack[--height];
}
}
}
/* Frees storage allocated for |tree|.
If |destroy != NULL|, applies it to each data item in inorder. */
-void
-avl_destroy (struct avl_table *tree, avl_item_func *destroy)
+void avl_destroy(struct avl_table *tree, avl_item_func * destroy)
{
- struct avl_node *p, *q;
-
- assert (tree != NULL);
-
- for (p = tree->avl_root; p != NULL; p = q)
- if (p->avl_link[0] == NULL)
- {
- q = p->avl_link[1];
- if (destroy != NULL && p->avl_data != NULL)
- destroy (p->avl_data, tree->avl_param);
- tree->avl_alloc->libavl_free (tree->avl_alloc, p);
- }
- else
- {
- q = p->avl_link[0];
- p->avl_link[0] = q->avl_link[1];
- q->avl_link[1] = p;
- }
-
- tree->avl_alloc->libavl_free (tree->avl_alloc, tree);
+ struct avl_node *p, *q;
+
+ assert(tree != NULL);
+
+ for (p = tree->avl_root; p != NULL; p = q)
+ if (p->avl_link[0] == NULL) {
+ q = p->avl_link[1];
+ if (destroy != NULL && p->avl_data != NULL)
+ destroy(p->avl_data, tree->avl_param);
+ tree->avl_alloc->libavl_free(tree->avl_alloc, p);
+ } else {
+ q = p->avl_link[0];
+ p->avl_link[0] = q->avl_link[1];
+ q->avl_link[1] = p;
+ }
+
+ tree->avl_alloc->libavl_free(tree->avl_alloc, tree);
}
/* Allocates |size| bytes of space using |malloc()|.
Returns a null pointer if allocation fails. */
-void *
-avl_malloc (struct libavl_allocator *allocator, size_t size)
+void *avl_malloc(struct libavl_allocator *allocator, size_t size)
{
- assert (allocator != NULL && size > 0);
- return malloc (size);
+ assert(allocator != NULL && size > 0);
+ return malloc(size);
}
/* Frees |block|. */
-void
-avl_free (struct libavl_allocator *allocator, void *block)
+void avl_free(struct libavl_allocator *allocator, void *block)
{
- assert (allocator != NULL && block != NULL);
- free (block);
+ assert(allocator != NULL && block != NULL);
+ free(block);
}
/* Default memory allocator that uses |malloc()| and |free()|. */
-struct libavl_allocator avl_allocator_default =
- {
+struct libavl_allocator avl_allocator_default = {
avl_malloc,
avl_free
- };
+};
#undef NDEBUG
#include <assert.h>
/* Asserts that |avl_insert()| succeeds at inserting |item| into |table|. */
void
-(avl_assert_insert) (struct avl_table *table, void *item)
-{
- void **p = avl_probe (table, item);
- assert (p != NULL && *p == item);
+ (avl_assert_insert) (struct avl_table * table, void *item) {
+ void **p = avl_probe(table, item);
+ assert(p != NULL && *p == item);
}
/* Asserts that |avl_delete()| really removes |item| from |table|,
and returns the removed item. */
-void *
-(avl_assert_delete) (struct avl_table *table, void *item)
-{
- void *p = avl_delete (table, item);
- assert (p != NULL);
- return p;
+void *(avl_assert_delete) (struct avl_table * table, void *item) {
+ void *p = avl_delete(table, item);
+ assert(p != NULL);
+ return p;
}
-
diff --git a/Build/source/texk/web2c/pdftexdir/avlstuff.c b/Build/source/texk/web2c/pdftexdir/avlstuff.c
index 1a05c762eb1..8b0ae737477 100644
--- a/Build/source/texk/web2c/pdftexdir/avlstuff.c
+++ b/Build/source/texk/web2c/pdftexdir/avlstuff.c
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2004-2005 Han The Thanh, <thanh@pdftex.org>
+Copyright (c) 2004-2007 Han The Thanh, <thanh@pdftex.org>
This file is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by Free
@@ -12,10 +12,10 @@ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
-with this file; if not, write to the Free Software Foundation, Inc.,
-59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+with pdfTeX; if not, write to the Free Software Foundation, Inc., 51
+Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: avlstuff.c,v 1.12 2005/07/11 20:27:39 hahe Exp hahe $
+$Id: avlstuff.c 200 2007-07-11 13:11:12Z oneiros $
*/
diff --git a/Build/source/texk/web2c/pdftexdir/avlstuff.h b/Build/source/texk/web2c/pdftexdir/avlstuff.h
index 2ffa57b627d..2dc4d8c277b 100644
--- a/Build/source/texk/web2c/pdftexdir/avlstuff.h
+++ b/Build/source/texk/web2c/pdftexdir/avlstuff.h
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2004 Han The Thanh, <thanh@pdftex.org>
+Copyright (c) 2004-2007 Han The Thanh, <thanh@pdftex.org>
This file is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by Free
@@ -12,12 +12,10 @@ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
-with this file; if not, write to the Free Software Foundation, Inc.,
-59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+with pdfTeX; if not, write to the Free Software Foundation, Inc., 51
+Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: //depot/Build/source.development/TeX/texk/web2c/pdftexdir/avlstuff.h#5 $
-
-formatted by indent -kr
+$Id: avlstuff.h 200 2007-07-11 13:11:12Z oneiros $
*/
#include "avl.h"
diff --git a/Build/source/texk/web2c/pdftexdir/epdf.c b/Build/source/texk/web2c/pdftexdir/epdf.c
index 1b13c2b0d8c..53164e66ae2 100644
--- a/Build/source/texk/web2c/pdftexdir/epdf.c
+++ b/Build/source/texk/web2c/pdftexdir/epdf.c
@@ -1,5 +1,5 @@
/*
-Copyright (c) 1996-2002 Han The Thanh, <thanh@pdftex.org>
+Copyright (c) 1996-2007 Han The Thanh, <thanh@pdftex.org>
This file is part of pdfTeX.
@@ -13,11 +13,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with pdfTeX; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+You should have received a copy of the GNU General Public License along
+with pdfTeX; if not, write to the Free Software Foundation, Inc., 51
+Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: epdf.c,v 1.45 2006/08/20 10:56:04 hahe Exp hahe $
+$Id: epdf.c 200 2007-07-11 13:11:12Z oneiros $
*/
#include "ptexlib.h"
diff --git a/Build/source/texk/web2c/pdftexdir/epdf.h b/Build/source/texk/web2c/pdftexdir/epdf.h
index 0a13d59df34..3a6265cf679 100644
--- a/Build/source/texk/web2c/pdftexdir/epdf.h
+++ b/Build/source/texk/web2c/pdftexdir/epdf.h
@@ -1,5 +1,5 @@
/*
-Copyright (c) 1996-2006 Han The Thanh, <thanh@pdftex.org>
+Copyright (c) 1996-2007 Han The Thanh, <thanh@pdftex.org>
This file is part of pdfTeX.
@@ -13,11 +13,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with pdfTeX; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+You should have received a copy of the GNU General Public License along
+with pdfTeX; if not, write to the Free Software Foundation, Inc., 51
+Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: epdf.h,v 1.6 2005/11/28 23:29:32 hahe Exp $
+$Id: epdf.h 200 2007-07-11 13:11:12Z oneiros $
*/
extern "C" {
@@ -72,6 +72,7 @@ extern "C" {
extern integer pdfbufsize;
extern integer pdfosmode;
extern eightbits pdflastbyte;
+ extern integer fixedinclusioncopyfont;
extern char notdef[];
diff --git a/Build/source/texk/web2c/pdftexdir/image.h b/Build/source/texk/web2c/pdftexdir/image.h
index 8907e50f603..b8468af5dd2 100644
--- a/Build/source/texk/web2c/pdftexdir/image.h
+++ b/Build/source/texk/web2c/pdftexdir/image.h
@@ -1,5 +1,5 @@
/*
-Copyright (c) 1996-2002 Han The Thanh, <thanh@pdftex.org>
+Copyright (c) 1996-2007 Han The Thanh, <thanh@pdftex.org>
This file is part of pdfTeX.
@@ -13,11 +13,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with pdfTeX; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+You should have received a copy of the GNU General Public License along
+with pdfTeX; if not, write to the Free Software Foundation, Inc., 51
+Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: //depot/Build/source.development/TeX/texk/web2c/pdftexdir/image.h#10 $
+$Id: image.h 200 2007-07-11 13:11:12Z oneiros $
*/
#include <png.h>
diff --git a/Build/source/texk/web2c/pdftexdir/macnames.c b/Build/source/texk/web2c/pdftexdir/macnames.c
index fe9fbf8151d..20a4d2b5381 100644
--- a/Build/source/texk/web2c/pdftexdir/macnames.c
+++ b/Build/source/texk/web2c/pdftexdir/macnames.c
@@ -1,5 +1,5 @@
/*
-Copyright (c) 1996-2002 Han The Thanh, <thanh@pdftex.org>
+Copyright (c) 1996-2007 Han The Thanh, <thanh@pdftex.org>
This file is part of pdfTeX.
@@ -13,11 +13,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with pdfTeX; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+You should have received a copy of the GNU General Public License along
+with pdfTeX; if not, write to the Free Software Foundation, Inc., 51
+Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: //depot/Build/source.development/TeX/texk/web2c/pdftexdir/macnames.c#5 $
+$Id: macnames.c 200 2007-07-11 13:11:12Z oneiros $
*/
const char notdef[] = ".notdef";
diff --git a/Build/source/texk/web2c/pdftexdir/mapfile.c b/Build/source/texk/web2c/pdftexdir/mapfile.c
index 5ac8d51ebfa..87d56f8ea7c 100644
--- a/Build/source/texk/web2c/pdftexdir/mapfile.c
+++ b/Build/source/texk/web2c/pdftexdir/mapfile.c
@@ -1,5 +1,5 @@
/*
-Copyright (c) 1996-2006 Han The Thanh, <thanh@pdftex.org>
+Copyright (c) 1996-2007 Han The Thanh, <thanh@pdftex.org>
This file is part of pdfTeX.
@@ -13,11 +13,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with pdfTeX; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+You should have received a copy of the GNU General Public License along
+with pdfTeX; if not, write to the Free Software Foundation, Inc., 51
+Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: mapfile.c,v 1.1 2006/12/14 01:21:33 hahe Exp hahe $
+$Id: mapfile.c 200 2007-07-11 13:11:12Z oneiros $
*/
#include <math.h>
@@ -71,7 +71,7 @@ fm_entry *new_fm_entry(void)
fm->tfm_name = NULL;
fm->sfd_name = NULL;
fm->ps_name = NULL;
- fm->fd_flags = 4;
+ fm->fd_flags = FD_FLAGS_NOT_SET_IN_MAPLINE;
fm->ff_name = NULL;
fm->encname = NULL;
fm->type = 0;
@@ -347,9 +347,9 @@ int check_fm_entry(fm_entry * fm, boolean warn)
}
/**********************************************************************/
-/* returns true if s is one of the 14 std. font names; speed-trimmed. */
+/* returns the font number if s is one of the 14 std. font names, -1 otherwise; speed-trimmed. */
-boolean check_std_t1font(char *s)
+int check_std_t1font(char *s)
{
static const char *std_t1font_names[] = {
"Courier", /* 0:7 */
@@ -371,6 +371,7 @@ boolean check_std_t1font(char *s)
{ -1, -1, -1, -1, -1, -1, 8, 0, -1, 4, 10, 9, -1, -1, 5, 2, 12, 6, -1,
3, -1, 7
};
+ assert(s != NULL);
const size_t n = strlen(s);
int k = -1;
if (n > 21)
@@ -392,11 +393,10 @@ boolean check_std_t1font(char *s)
} else
k = index[n];
if (k > -1 && strcmp(std_t1font_names[k], s) == 0)
- return true;
- return false;
+ return k;
+ return -1;
};
-
/**********************************************************************/
static void fm_scan_line()
@@ -526,7 +526,7 @@ static void fm_scan_line()
}
}
done:
- if (fm->ps_name != NULL && check_std_t1font(fm->ps_name))
+ if (fm->ps_name != NULL && (check_std_t1font(fm->ps_name) >= 0))
set_std_t1font(fm);
if (is_fontfile(fm)) {
if (strcasecmp(strend(fm_fontfile(fm)) - 4, ".ttf") == 0)
@@ -891,3 +891,4 @@ void fm_free(void)
/**********************************************************************/
/* end of mapfile.c */
+// vim: ts=4
diff --git a/Build/source/texk/web2c/pdftexdir/pdftex.ch b/Build/source/texk/web2c/pdftexdir/pdftex.ch
index 31211b2477f..975559f01b9 100644
--- a/Build/source/texk/web2c/pdftexdir/pdftex.ch
+++ b/Build/source/texk/web2c/pdftexdir/pdftex.ch
@@ -1,5 +1,5 @@
%
-% Copyright (c) 1996-2006 Han The Thanh, <thanh@pdftex.org>
+% Copyright (c) 1996-2007 Han The Thanh, <thanh@pdftex.org>
%
% This file is part of pdfTeX.
%
@@ -13,11 +13,11 @@
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
-% You should have received a copy of the GNU General Public License
-% along with pdfTeX; if not, write to the Free Software
-% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+% You should have received a copy of the GNU General Public License along with
+% pdfTeX; if not, write to the Free Software Foundation, Inc., 51 Franklin
+% Street, Fifth Floor, Boston, MA 02110-1301 USA.
%
-% $Id: //depot/Build/source.development/TeX/texk/web2c/pdfetexdir/pdfetex.ch2#20 $
+% $Id: pdftex.ch 200 2007-07-11 13:11:12Z oneiros $
%
@x [0.0] l.83 - WEAVE: we want the whole file
\def\?##1]{\hbox{Changes to \hbox to 1em{\hfil##1}.\ }}
diff --git a/Build/source/texk/web2c/pdftexdir/pdftex.defines b/Build/source/texk/web2c/pdftexdir/pdftex.defines
index 977b472e168..7b5a52b4c69 100644
--- a/Build/source/texk/web2c/pdftexdir/pdftex.defines
+++ b/Build/source/texk/web2c/pdftexdir/pdftex.defines
@@ -1,5 +1,5 @@
{
-Copyright (c) 1996-2006 Han The Thanh, <thanh@pdftex.org>
+Copyright (c) 1996-2007 Han The Thanh, <thanh@pdftex.org>
This file is part of pdfTeX.
@@ -13,11 +13,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with pdfTeX; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+You should have received a copy of the GNU General Public License along
+with pdfTeX; if not, write to the Free Software Foundation, Inc., 51
+Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: //depot/Build/source.development/TeX/texk/web2c/pdftexdir/pdftex.defines#15 $
+$Id: pdftex.defines 200 2007-07-11 13:11:12Z oneiros $
}
{ pdftex.defines: additions for pdfTeX }
@@ -98,6 +98,7 @@ $Id: //depot/Build/source.development/TeX/texk/web2c/pdftexdir/pdftex.defines#15
@define function packetbyte;
@define procedure startpacket();
@define procedure storepacket();
+@define function sqxfw();
{ functions from writefont.c }
@define procedure dopdffont();
@@ -121,6 +122,9 @@ $Id: //depot/Build/source.development/TeX/texk/web2c/pdftexdir/pdftex.defines#15
@define procedure updateimageprocset();
@define procedure writeimage();
+@define procedure dumpimagemeta;
+@define procedure undumpimagemeta();
+
{ functions from writet3.c }
@define function getpkcharwidth();
@@ -134,5 +138,8 @@ $Id: //depot/Build/source.development/TeX/texk/web2c/pdftexdir/pdftex.defines#15
{ functions from tounicode.c }
@define procedure deftounicode();
+{ functions from pdftex.web (thanks Taco for the trick) }
+@define function autoexpandvf();
+
{ end of pdftex.defines }
{ vim: set syntax=web : }
diff --git a/Build/source/texk/web2c/pdftexdir/pdftex.h b/Build/source/texk/web2c/pdftexdir/pdftex.h
index 805301fc633..f9c7c30e315 100644
--- a/Build/source/texk/web2c/pdftexdir/pdftex.h
+++ b/Build/source/texk/web2c/pdftexdir/pdftex.h
@@ -1,5 +1,5 @@
/*
-Copyright (c) 1996-2006 Han The Thanh, <thanh@pdftex.org>
+Copyright (c) 1996-2007 Han The Thanh, <thanh@pdftex.org>
This file is part of pdfTeX.
@@ -13,11 +13,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with pdfTeX; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+You should have received a copy of the GNU General Public License along
+with pdfTeX; if not, write to the Free Software Foundation, Inc., 51
+Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: //depot/Build/source.development/TeX/texk/web2c/pdftexdir/pdftex.h#4 $
+$Id: pdftex.h 200 2007-07-11 13:11:12Z oneiros $
*/
/* Additions to texmfmp.h for pdfTeX */
diff --git a/Build/source/texk/web2c/pdftexdir/pdftex.web b/Build/source/texk/web2c/pdftexdir/pdftex.web
index 693a347d447..b005393e757 100644
--- a/Build/source/texk/web2c/pdftexdir/pdftex.web
+++ b/Build/source/texk/web2c/pdftexdir/pdftex.web
@@ -1,4 +1,4 @@
-% Copyright (c) 1996-2006 Han Th\^e\llap{\raise 0.5ex\hbox{\'{}}} Th\`anh, <thanh@@pdftex.org>
+% Copyright (c) 1996-2007 Han Th\^e\llap{\raise 0.5ex\hbox{\'{}}} Th\`anh, <thanh@@pdftex.org>
% This file is part of pdfTeX.
@@ -12,8 +12,8 @@
% A PARTICULAR PURPOSE. See the GNU General Public License for more details.
% You should have received a copy of the GNU General Public License along with
-% pdfTeX; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-% Suite 330, Boston, MA 02111-1307 USA
+% pdfTeX; if not, write to the Free Software Foundation, Inc., 51 Franklin
+% Street, Fifth Floor, Boston, MA 02110-1301 USA.
% e-TeX is copyright (C) 1994,98 by Peter Breitenlohner; all rights are
% reserved. Copying of this file is authorized only if (1) you are Peter
@@ -286,8 +286,8 @@ known as `\eTeX'.
{printed when \eTeX\ starts}
@#
@d pdftex_version==140 { \.{\\pdftexversion} }
-@d pdftex_revision=="3" { \.{\\pdftexrevision} }
-@d pdftex_version_string=='-1.40.3' {current \pdfTeX\ version}
+@d pdftex_revision=="4" { \.{\\pdftexrevision} }
+@d pdftex_version_string=='-1.40.4' {current \pdfTeX\ version}
@#
@d pdfeTeX_banner=='This is pdfeTeX, Version 3.141592',pdftex_version_string,eTeX_version_string
{printed when \pdfeTeX\ starts}
@@ -4781,7 +4781,8 @@ that might be expanded by `\.{\\the}'.
@d hyph_data=99 {hyphenation data ( \.{\\hyphenation}, \.{\\patterns} )}
@d set_interaction=100 {define level of interaction ( \.{\\batchmode}, etc.~)}
@d letterspace_font=101 {letterspace a font ( \.{\\letterspacefont} )}
-@d max_command=101 {the largest command code seen at |big_switch|}
+@d pdf_copy_font=102 {create a new font instance ( \.{\\pdfcopyfont} )}
+@d max_command=102 {the largest command code seen at |big_switch|}
@ The remaining command codes are extra special, since they cannot get through
\TeX's scanner to the main control routine. They have been given values higher
@@ -4919,7 +4920,7 @@ level is kept in the global quantities |mode|, |head|, |tail|, |prev_graf|,
|aux|, and |mode_line|, which live in a \PASCAL\ record that is ready to
be pushed onto |nest| if necessary.
-@d ignore_depth==-65536000 {|prev_depth| value that is ignored}
+@d ignore_depth==-65536000 {magic dimension value to mean `ignore me'}
@<Types...@>=
@!list_state_record=record@!mode_field:-mmode..mmode;@+
@@ -5033,7 +5034,7 @@ end;
@ @<Show the auxiliary...@>=
case abs(m) div (max_command+1) of
0: begin print_nl("prevdepth ");
- if a.sc<=ignore_depth then print("ignored")
+ if a.sc<=pdf_ignored_dimen then print("ignored")
else print_scaled(a.sc);
if nest[p].pg_field<>0 then
begin print(", prevgraf ");
@@ -5658,7 +5659,8 @@ that will be defined later.
@d pdf_append_kern_code = pdftex_first_integer_code + 23 {append kern before certain characters?}
@d pdf_gen_tounicode_code = pdftex_first_integer_code + 24 {generate ToUnicode for fonts?}
@d pdf_draftmode_code = pdftex_first_integer_code + 25 {switch on draftmode if positive}
-@d pdf_int_pars=pdftex_first_integer_code + 26 {total number of \pdfTeX's integer parameters}
+@d pdf_inclusion_copy_font_code = pdftex_first_integer_code + 26 {generate ToUnicode for fonts?}
+@d pdf_int_pars=pdftex_first_integer_code + 27 {total number of \pdfTeX's integer parameters}
@#
@d etex_int_base=pdf_int_pars {base for \eTeX's integer parameters}
@d tracing_assigns_code=etex_int_base {show assignments}
@@ -5763,6 +5765,7 @@ that will be defined later.
@d pdf_image_hicolor == int_par(pdf_image_hicolor_code)
@d pdf_image_apply_gamma == int_par(pdf_image_apply_gamma_code)
@d pdf_draftmode == int_par(pdf_draftmode_code)
+@d pdf_inclusion_copy_font == int_par(pdf_inclusion_copy_font_code)
@#
@d tracing_assigns==int_par(tracing_assigns_code)
@d tracing_groups==int_par(tracing_groups_code)
@@ -5864,6 +5867,7 @@ pdf_prepend_kern_code: print_esc("pdfprependkern");
pdf_append_kern_code: print_esc("pdfappendkern");
pdf_gen_tounicode_code: print_esc("pdfgentounicode");
pdf_draftmode_code: print_esc("pdfdraftmode");
+pdf_inclusion_copy_font_code: print_esc("pdfinclusioncopyfonts");
@/@<Cases for |print_param|@>@/
othercases print("[unknown integer parameter!]")
endcases;
@@ -6039,6 +6043,8 @@ primitive("pdfgentounicode",assign_int,int_base+pdf_gen_tounicode_code);@/
@!@:pdf_gen_tounicode_}{\.{\\pdfgentounicode} primitive@>
primitive("pdfdraftmode",assign_int,int_base+pdf_draftmode_code);@/
@!@:pdf_draftmode_}{\.{\\pdfdraftmode} primitive@>
+primitive("pdfinclusioncopyfonts",assign_int,int_base+pdf_inclusion_copy_font_code);@/
+@!@:pdf_inclusion_copy_font_}{\.{\\pdfinclusioncopyfonts} primitive@>
@ @<Cases of |print_cmd_chr|...@>=
assign_int: if chr_code<count_base then print_param(chr_code-int_base)
@@ -6146,8 +6152,9 @@ here, and the 256 \.{\\dimen} registers.
@d pdf_last_line_depth_code = pdftex_first_dimen_code + 8
@d pdf_each_line_height_code = pdftex_first_dimen_code + 9
@d pdf_each_line_depth_code = pdftex_first_dimen_code + 10
-@d pdf_px_dimen_code = pdftex_first_dimen_code + 11
-@d pdftex_last_dimen_code = pdftex_first_dimen_code + 11 {last number defined in this section}
+@d pdf_ignored_dimen_code = pdftex_first_dimen_code + 11
+@d pdf_px_dimen_code = pdftex_first_dimen_code + 12
+@d pdftex_last_dimen_code = pdftex_first_dimen_code + 12 {last number defined in this section}
@d dimen_pars = pdftex_last_dimen_code + 1 {total number of dimension parameters}
@d scaled_base=dimen_base+dimen_pars
{table of 256 user-defined \.{\\dimen} registers}
@@ -6187,6 +6194,7 @@ here, and the 256 \.{\\dimen} registers.
@d pdf_last_line_depth == dimen_par(pdf_last_line_depth_code)
@d pdf_each_line_height == dimen_par(pdf_each_line_height_code)
@d pdf_each_line_depth == dimen_par(pdf_each_line_depth_code)
+@d pdf_ignored_dimen == dimen_par(pdf_ignored_dimen_code)
@d pdf_px_dimen == dimen_par(pdf_px_dimen_code)
@p procedure print_length_param(@!n:integer);
@@ -6223,6 +6231,7 @@ pdf_first_line_height_code: print_esc("pdffirstlineheight");
pdf_last_line_depth_code: print_esc("pdflastlinedepth");
pdf_each_line_height_code: print_esc("pdfeachlineheight");
pdf_each_line_depth_code: print_esc("pdfeachlinedepth");
+pdf_ignored_dimen_code: print_esc("pdfignoreddimen");
pdf_px_dimen_code: print_esc("pdfpxdimen");
othercases print("[unknown dimen parameter!]")
endcases;
@@ -6295,6 +6304,8 @@ primitive("pdfeachlineheight",assign_dimen,dimen_base+pdf_each_line_height_code)
@!@:pdf_each_line_height_}{\.{\\pdfeachlineheight} primitive@>
primitive("pdfeachlinedepth",assign_dimen,dimen_base+pdf_each_line_depth_code);@/
@!@:pdf_each_line_depth_}{\.{\\pdfeachlinedepth} primitive@>
+primitive("pdfignoreddimen",assign_dimen,dimen_base+pdf_ignored_dimen_code);@/
+@!@:pdf_ignored_dimen_}{\.{\\pdfignoreddimen} primitive@>
primitive("pdfpxdimen",assign_dimen,dimen_base+pdf_px_dimen_code);@/
@!@:pdf_px_dimen_}{\.{\\pdfpxdimen} primitive@>
@@ -6662,6 +6673,8 @@ primitive("font",def_font,0);@/
@!@:font_}{\.{\\font} primitive@>
primitive("letterspacefont",letterspace_font,0);@/
@!@:letterspace_font_}{\.{\\letterspacefont} primitive@>
+primitive("pdfcopyfont",pdf_copy_font,0);@/
+@!@:pdf_copy_font_}{\.{\\pdfcopyfont} primitive@>
primitive("fontdimen",assign_font_dimen,0);@/
@!@:font_dimen_}{\.{\\fontdimen} primitive@>
primitive("halign",halign,0);@/
@@ -6740,6 +6753,7 @@ char_num: print_esc("char");
cs_name: print_esc("csname");
def_font: print_esc("font");
letterspace_font: print_esc("letterspacefont");
+pdf_copy_font: print_esc("pdfcopyfont");
delim_num: print_esc("delimiter");
divide: print_esc("divide");
end_cs_name: print_esc("endcsname");
@@ -8856,8 +8870,9 @@ if cur_cs < hash_base then
else
cur_cs := prim_lookup(text(cur_cs));
if cur_cs<>undefined_primitive then begin
- if cur_cmd>max_command then begin
- cur_cmd := prim_eq_type(cur_cs);
+ t := prim_eq_type(cur_cs);
+ if t>max_command then begin
+ cur_cmd := t;
cur_chr := prim_equiv(cur_cs);
cur_tok := (cur_cmd*@'400)+cur_chr;
cur_cs := 0;
@@ -9524,7 +9539,7 @@ var m:halfword; {|chr_code| part of the operand token}
begin m:=cur_chr;
case cur_cmd of
def_code: @<Fetch a character code from some table@>;
-toks_register,assign_toks,def_family,set_font,def_font,letterspace_font: @<Fetch a token list or
+toks_register,assign_toks,def_family,set_font,def_font,letterspace_font,pdf_copy_font: @<Fetch a token list or
font identifier, provided that |level=tok_val|@>;
assign_int: scanned_result(eqtb[m].int)(int_val);
assign_dimen: scanned_result(eqtb[m].sc)(dimen_val);
@@ -10333,7 +10348,7 @@ if mag<>1000 then
end
@ The necessary conversion factors can all be specified exactly as
-fractions whose numerator and denominator are 65535 or less.
+fractions whose numerator and denominator add to 32768 or less.
According to the definitions here, $\rm2660\,dd\approx1000.33297\,mm$;
this agrees well with the value $\rm1000.333\,mm$ cited by Bosshard
@^Bosshard, Hans Rudolf@>
@@ -10341,7 +10356,13 @@ in {\sl Technische Grundlagen zur Satzherstellung\/} (Bern, 1980).
The Didot point has been newly standardized in 1978;
it's now exactly $\rm 1\,nd=0.375\,mm$.
Conversion uses the equation $0.375=21681/20320/72.27\cdot25.4$.
-The new Cicero follows the new Didot point; $\rm 1\,nc=12\,nd$.
+The new Cicero follows the new Didot point; $\rm 1\,nc=12\,nd$.
+These would lead to the ratios $21681/20320$ and $65043/5080$,
+respectively.
+The closest approximations supported by the algorithm would be
+$11183/10481$ and $1370/107$. In order to maintain the
+relation $\rm 1\,nc=12\,nd$, we pick the ratio $685/642$ for
+$\rm nd$, however.
@d set_conversion_end(#)== denom:=#; end
@d set_conversion(#)==@+begin num:=#; set_conversion_end
@@ -10361,9 +10382,9 @@ else if scan_keyword("dd") then set_conversion(1238)(1157)
@.dd@>
else if scan_keyword("cc") then set_conversion(14856)(1157)
@.cc@>
-else if scan_keyword("nd") then set_conversion(21681)(20320)
+else if scan_keyword("nd") then set_conversion(685)(642)
@.nd@>
-else if scan_keyword("nc") then set_conversion(65043)(5080)
+else if scan_keyword("nc") then set_conversion(1370)(107)
@.nc@>
else if scan_keyword("sp") then goto done
@.sp@>
@@ -10756,7 +10777,7 @@ pdf_font_name_code, pdf_font_objnum_code, pdf_font_size_code: begin
if cur_val = null_font then
pdf_error("font", "invalid font identifier");
if c <> pdf_font_size_code then begin
- pdf_check_vf(cur_val);
+ pdf_check_vf_cur_val;
if not font_used[cur_val] then
pdf_init_font_cur_val;
end;
@@ -13176,7 +13197,7 @@ procedure scan_font_ident;
var f:internal_font_number;
@!m:halfword;
begin @<Get the next non-blank non-call...@>;
-if (cur_cmd=def_font) or (cur_cmd=letterspace_font) then f:=cur_font
+if (cur_cmd=def_font) or (cur_cmd=letterspace_font) or (cur_cmd=pdf_copy_font) then f:=cur_font
else if cur_cmd=set_font then f:=cur_chr
else if cur_cmd=def_family then
begin m:=cur_chr; scan_four_bit_int; f:=equiv(m+cur_val);
@@ -15149,6 +15170,7 @@ begin
fixed_image_apply_gamma := fix_int(pdf_image_apply_gamma, 0, 1);
fixed_pdf_objcompresslevel := fix_int(pdf_objcompresslevel, 0, 3);
fixed_pdf_draftmode := fix_int(pdf_draftmode, 0, 1);
+ fixed_inclusion_copy_font := fix_int(pdf_inclusion_copy_font, 0, 1);
if (fixed_pdf_minor_version >= 5) and (fixed_pdf_objcompresslevel > 0) then
pdf_os_enable := true
else begin
@@ -15304,6 +15326,7 @@ begin
print(": "); print(p);
if append_nl then
print_ln;
+ if history=spotless then history:=warning_issued;
end;
procedure pdf_os_get_os_buf(s: integer); {check that |s| bytes more
@@ -15625,6 +15648,7 @@ DVI}
@!fixed_pk_resolution: integer;
@!fixed_decimal_digits: integer;
@!fixed_gen_tounicode: integer;
+@!fixed_inclusion_copy_font: integer;
@!pk_scale_factor: integer;
@!pdf_output_option: integer;
@!pdf_output_value: integer;
@@ -15989,7 +16013,7 @@ end;
@* \[32d] The cross-reference table.
The cross-reference table |obj_tab| is an array of |obj_tab_size| of
-|tab_entry|. Each entry contains five integer fields and represents an object
+|obj_entry|. Each entry contains five integer fields and represents an object
in PDF file whose object number is the index of this entry in |obj_tab|.
Objects in |obj_tab| maybe linked into list; objects in such a linked list have
the same type.
@@ -16007,10 +16031,9 @@ The second field of |obj_entry| contains link to the next
object in |obj_tab| if this object is linked in a list.
The third field holds the byte offset of the object in the output PDF file,
-or its byte offset within an object stream.
-Objects that have been not written yet have this field set to zero. However
-sometimes we have to use this field to store some info before the object is
-written out.
+or its byte offset within an object stream. As long as the object is not
+written, this field is used for flags about the write status of the object;
+then it has a negative value.
The fourth field holds the object number of the object stream, into which
the object is included.
@@ -16021,10 +16044,14 @@ well.
@d obj_info(#) == obj_tab[#].int0 {information representing identifier of this object}
@d obj_link(#) == obj_tab[#].int1 {link to the next entry in linked list}
-@d obj_offset(#) == obj_tab[#].int2 {byte offset for this object in PDF output file, or object stream number for this object}
+@d obj_offset(#) == obj_tab[#].int2 {negative (flags), or byte offset for this object in PDF output file, or object stream number for this object}
@d obj_os_idx(#) == obj_tab[#].int3 {index of this object in object stream}
@d obj_aux(#) == obj_tab[#].int4 {auxiliary pointer}
-@d is_obj_written(#) == (obj_offset(#) <> 0)
+
+@d set_obj_fresh(#) == obj_offset(#) := -2
+@d set_obj_scheduled(#) == if obj_offset(#) = -2 then obj_offset(#) := -1
+@d is_obj_scheduled(#) == (obj_offset(#) > -2)
+@d is_obj_written(#) == (obj_offset(#) > -1)
@# {types of objects}
@d obj_type_others == 0 {objects which are not linked in any list}
@@ -16055,7 +16082,7 @@ destination |pdf_left| and |pdf_top| are used for some types of destinations}
@d pdf_right(#) == mem[# + 3].sc
@d pdf_bottom(#) == mem[# + 4].sc
-@# {dimesion of destinations/threads/annotations (in whatsit node)}
+@# {dimension of destinations/threads/annotations (in whatsit node)}
@d pdf_width(#) == mem[# + 1].sc
@d pdf_height(#) == mem[# + 2].sc
@d pdf_depth(#) == mem[# + 3].sc
@@ -16089,7 +16116,7 @@ destination |pdf_left| and |pdf_top| are used for some types of destinations}
@d pdf_setmatrix_node_size == 2
@d pdf_setmatrix_data(#) == link(#+1) {data}
-@# {data structure for \.{\\pdsave}}
+@# {data structure for \.{\\pdfsave}}
@d pdf_save_node_size == 2
@# {data structure for \.{\\pdfrestore}}
@@ -16328,7 +16355,7 @@ begin
incr(sys_obj_ptr);
obj_ptr := sys_obj_ptr;
obj_info(obj_ptr) := i;
- obj_offset(obj_ptr) := 0;
+ set_obj_fresh(obj_ptr);
obj_aux(obj_ptr) := 0;
avl_put_obj(obj_ptr, t);
if t = obj_type_page then begin
@@ -16712,28 +16739,15 @@ during adjusting spacing. Such fonts are linked via the |pdf_font_elink| array.
@d virtual_font_type = 1 {virtual font}
@d real_font_type = 2 {real font}
@d subst_font_type = 3 {substituted font}
-@d pdf_check_vf(#) == begin
- tmp_f := #;
- do_vf;
- if pdf_font_type[#] = virtual_font_type then
- pdf_error("font", "command cannot be used with virtual font");
-end
-
-@d pdf_check_new_font(#) ==
- if pdf_font_type[#] = new_font_type then begin
- tmp_f := #;
- do_vf;
- end
@<Declare procedures that need to be declared forward for \pdfTeX@>=
-procedure do_vf; forward;
+procedure pdf_check_vf_cur_val; forward;
procedure pdf_init_font_cur_val; forward;
procedure scan_pdf_ext_toks; forward;
@ @<Glob...@>=
@!pdf_font_type: ^eight_bits; {the type of font}
@!pdf_font_attr: ^str_number; {pointer to additional attributes}
-@!tmp_f: internal_font_number; {temporary register to pass parameter to some subroutines}
@ Here come some subroutines to deal with expanded fonts for HZ-algorithm.
@@ -16747,6 +16761,8 @@ else if type(#) = ligature_node then begin
f := font(lig_char(#));
end
+@d non_existent_path == "///..."
+
@p
procedure set_tag_code(f: internal_font_number; c: eight_bits; i: integer);
var fixedi:integer;
@@ -17020,7 +17036,10 @@ var k: internal_font_number;
begin
if fs <> 0 then begin
for k := font_base + 1 to font_ptr do
- if str_eq_str(font_name[k], s) and (font_size[k] = fs) then begin
+ if (font_area[k] <> non_existent_path) and
+ str_eq_str(font_name[k], s) and
+ (font_size[k] = fs) then
+ begin
flush_str(s);
tfm_lookup := k;
return;
@@ -17028,7 +17047,9 @@ begin
end
else begin
for k := font_base + 1 to font_ptr do
- if str_eq_str(font_name[k], s) then begin
+ if (font_area[k] <> non_existent_path) and
+ str_eq_str(font_name[k], s) then
+ begin
flush_str(s);
tfm_lookup := k;
return;
@@ -17056,45 +17077,6 @@ begin
load_expand_font := k;
end;
-function auto_expand_vf(f: internal_font_number): boolean;
-{check for a virtual auto-expanded font}
-var save_f, bf, lf: internal_font_number;
- e, k: integer;
-begin
- auto_expand_vf := false;
- if (not pdf_font_auto_expand[f]) or (pdf_font_blink[f] = null_font) then
- return; {not an auto-expanded font}
- bf := pdf_font_blink[f];
- if pdf_font_type[bf] = new_font_type then {we must process the base font first}
- begin
- save_f := tmp_f;
- tmp_f := bf;
- do_vf;
- tmp_f := save_f;
- end;
-
- if pdf_font_type[bf] <> virtual_font_type then
- return; {not a virtual font}
-
- e := pdf_font_expand_ratio[f];
- for k := 0 to vf_local_font_num[bf] - 1 do begin
- lf := vf_default_font[bf] + k;
- allocvffnts;
- {copy vf local font numbers:}
- vf_e_fnts[vf_nf] := vf_e_fnts[lf];
- {definition of local vf fonts are expanded from base fonts:}
- vf_i_fnts[vf_nf] := auto_expand_font(vf_i_fnts[lf], e);
- copy_expand_params(vf_i_fnts[vf_nf], vf_i_fnts[lf], e);
- incr(vf_nf);
- end;
- vf_packet_base[f] := vf_packet_base[bf];
- vf_local_font_num[f] := vf_local_font_num[bf];
- vf_default_font[f] := vf_nf - vf_local_font_num[f];
-
- pdf_font_type[f] := virtual_font_type;
- auto_expand_vf := true;
-end;
-
function fix_expand_value(f: internal_font_number; e: integer): integer;
{return the multiple of |pdf_font_step[f]| that is nearest to |e|}
var step: integer;
@@ -17160,15 +17142,15 @@ begin
end;
procedure set_expand_params(f: internal_font_number; auto_expand: boolean;
- font_stretch, font_shrink, font_step, expand_ratio: integer);
+ stretch_limit, shrink_limit, font_step, expand_ratio: integer);
{expand a font with given parameters}
begin
pdf_font_step[f] := font_step;
pdf_font_auto_expand[f] := auto_expand;
- if font_stretch > 0 then
- pdf_font_stretch[f] := get_expand_font(f, font_stretch);
- if font_shrink > 0 then
- pdf_font_shrink[f] := get_expand_font(f, -font_shrink);
+ if stretch_limit > 0 then
+ pdf_font_stretch[f] := get_expand_font(f, stretch_limit);
+ if shrink_limit > 0 then
+ pdf_font_shrink[f] := get_expand_font(f, -shrink_limit);
if expand_ratio <> 0 then
pdf_font_expand_ratio[f] := expand_ratio;
end;
@@ -17182,7 +17164,7 @@ begin
lf := vf_i_fnts[vf_default_font[f] + k];
set_expand_params(lf, pdf_font_auto_expand[f],
pdf_font_expand_ratio[pdf_font_stretch[f]],
- pdf_font_expand_ratio[pdf_font_shrink[f]],
+ -pdf_font_expand_ratio[pdf_font_shrink[f]],
pdf_font_step[f], pdf_font_expand_ratio[f]);
if pdf_font_type[lf] = virtual_font_type then
vf_expand_local_fonts(lf);
@@ -17190,7 +17172,7 @@ begin
end;
procedure read_expand_font; {read font expansion spec and load expanded font}
-var font_shrink, font_stretch, font_step: integer;
+var shrink_limit, stretch_limit, font_step: integer;
f: internal_font_number;
auto_expand: boolean;
begin
@@ -17200,23 +17182,23 @@ begin
if f = null_font then
pdf_error("font expansion", "invalid font identifier");
if pdf_font_blink[f] <> null_font then
- pdf_error("font expansion", "\pdffontexpand cannot be used this way (the base font has been expanded or letter-spaced)");
+ pdf_error("font expansion", "\pdffontexpand cannot be used this way (the base font has been expanded)");
scan_optional_equals;
scan_int;
- font_stretch := fix_int(cur_val, 0, 1000);
+ stretch_limit := fix_int(cur_val, 0, 1000);
scan_int;
- font_shrink := fix_int(cur_val, 0, 500);
+ shrink_limit := fix_int(cur_val, 0, 500);
scan_int;
font_step := fix_int(cur_val, 0, 100);
if font_step = 0 then
pdf_error("font expansion", "invalid step");
- font_stretch := font_stretch - font_stretch mod font_step;
- if font_stretch < 0 then
- font_stretch := 0;
- font_shrink := font_shrink - font_shrink mod font_step;
- if font_shrink < 0 then
- font_shrink := 0;
- if (font_stretch = 0) and (font_shrink = 0) then
+ stretch_limit := stretch_limit - stretch_limit mod font_step;
+ if stretch_limit < 0 then
+ stretch_limit := 0;
+ shrink_limit := shrink_limit - shrink_limit mod font_step;
+ if shrink_limit < 0 then
+ shrink_limit := 0;
+ if (stretch_limit = 0) and (shrink_limit = 0) then
pdf_error("font expansion", "invalid limit(s)");
auto_expand := false;
if scan_keyword("autoexpand") then begin
@@ -17230,37 +17212,60 @@ begin
if (pdf_font_step[f] <> 0) then
{this font has been expanded, ensure the expansion parameters are identical}
begin
- if (pdf_font_step[f] <> font_step) or
- ((pdf_font_stretch[f] = null_font) and (font_stretch <> 0)) or
- ((pdf_font_stretch[f] <> null_font) and
- (pdf_font_expand_ratio[pdf_font_stretch[f]] <> font_stretch)) or
- ((pdf_font_shrink[f] = null_font) and (font_shrink <> 0)) or
+ if pdf_font_step[f] <> font_step then
+ pdf_error("font expansion", "font has been expanded with different expansion step");
+
+ if ((pdf_font_stretch[f] = null_font) and (stretch_limit <> 0)) or
+ ((pdf_font_stretch[f] <> null_font) and
+ (pdf_font_expand_ratio[pdf_font_stretch[f]] <> stretch_limit)) then
+ pdf_error("font expansion", "font has been expanded with different stretch limit");
+
+ if ((pdf_font_shrink[f] = null_font) and (shrink_limit <> 0)) or
((pdf_font_shrink[f] <> null_font) and
- (pdf_font_expand_ratio[pdf_font_shrink[f]] <> -font_shrink)) or
- (pdf_font_auto_expand[f] <> auto_expand)
- then
- pdf_error("font expansion", "font has been expanded with different parameters");
+ (-pdf_font_expand_ratio[pdf_font_shrink[f]] <> shrink_limit)) then
+ pdf_error("font expansion", "font has been expanded with different shrink limit");
+
+ if pdf_font_auto_expand[f] <> auto_expand then
+ pdf_error("font expansion", "font has been expanded with different auto expansion value");
end
else begin
- if pdf_font_type[f] <> new_font_type then
+ if (pdf_font_type[f] <> new_font_type) and (pdf_font_type[f] <> virtual_font_type) then
pdf_warning("font expansion", "font should be expanded before its first use",
true, true);
- set_expand_params(f, auto_expand, font_stretch, font_shrink, font_step, 0);
+ set_expand_params(f, auto_expand, stretch_limit, shrink_limit, font_step, 0);
if pdf_font_type[f] = virtual_font_type then
vf_expand_local_fonts(f);
end;
end;
+@ We implement robust letter spacing using virtual font.
+
+@d vf_replace_z ==
+begin
+ vf_alpha:=16;
+ while vf_z>=@'40000000 do begin
+ vf_z:=vf_z div 2;
+ vf_alpha:=vf_alpha+vf_alpha;
+ end;
+ vf_beta:=256 div vf_alpha;
+ vf_alpha:=vf_alpha*vf_z;
+end
+
+@p
function letter_space_font(u: pointer; f: internal_font_number; e: integer): internal_font_number;
var k: internal_font_number;
- w, r, fs: scaled;
+ w, r: scaled;
s: str_number;
i, nw: integer;
old_setting:0..max_selector;
+ vf_z: integer;
+ vf_alpha: integer;
+ vf_beta: 1..16;
begin
{read a new font and expand the character widths}
k := read_font_info(u, font_name[f], "", font_size[f]);
- set_no_ligatures(k); {disable ligatures for letter-spaced fonts}
+ if scan_keyword("nolig") then
+ set_no_ligatures(k); {disable ligatures for letter-spaced fonts}
nw := height_base[k] - width_base[k];
for i := 0 to nw - 1 do
font_info[width_base[k] + i].sc :=
@@ -17288,8 +17293,7 @@ begin
vf_default_font[k] := vf_nf - 1;
pdf_font_type[k] := virtual_font_type;
- fs := font_size[f];
- vf_z := fs;
+ vf_z := font_size[f];
vf_replace_z;
w := round_xn_over_d(quad(f), e, 2000);
if w > 0 then
@@ -17363,6 +17367,106 @@ begin
equiv(u):=f; eqtb[font_id_base+f]:=eqtb[u]; font_id_text(f):=t;
end;
+function is_letterspaced_font(f: internal_font_number): boolean;
+label done;
+var i, j: pool_pointer;
+begin
+ is_letterspaced_font := false;
+ if pdf_font_type[f] <> virtual_font_type then
+ return;
+ i := str_start[font_name[f] + 1] - 1;
+ j := str_start[font_name[f]];
+ if (str_pool[i - 1] <> 'l') or (str_pool[i] <> 's') then
+ return;
+ i := i - 2;
+ while i >= j do begin
+ if (str_pool[i] < '0') or (str_pool[i] > '9') then
+ goto done;
+ i := i - 1;
+ end;
+done:
+ if i < j then
+ return;
+ if (str_pool[i] <> '+') and (str_pool[i] <> '-') then
+ return;
+ is_letterspaced_font := true;
+end;
+
+function copy_font_info(f: internal_font_number): internal_font_number;
+{create a copy of |f| in the font mem}
+var lf, bc, ec, i: halfword;
+ k: internal_font_number;
+begin
+ if (pdf_font_expand_ratio[f] <> 0) or (pdf_font_step[f] <> 0) then
+ pdf_error("\pdfcopyfont", "cannot copy an expanded font");
+ if is_letterspaced_font(f) then
+ pdf_error("\pdfcopyfont", "cannot copy a letterspaced font");
+
+ k := font_ptr + 1;
+ incr(font_ptr);
+ if (font_ptr >= font_max) then
+ overflow("maximum internal font number (font_max)", font_max);
+ font_name[k] := font_name[f];
+ font_area[k] := non_existent_path; {to avoid interferences with |new_font()| and |tfm_lookup()|}
+ hyphen_char[k] := hyphen_char[f];
+ skew_char[k] := skew_char[f];
+ font_bchar[k] := font_bchar[f];
+ font_false_bchar[k] := font_false_bchar[f];
+ font_bc[k] := font_bc[f];
+ font_ec[k] := font_ec[f];
+ font_size[k] := font_size[f];
+ font_dsize[k] := font_dsize[f];
+ font_params[k] := font_params[f];
+ font_glue[k] := font_glue[f];
+ bchar_label[k] := bchar_label[f];
+
+ {set base addresses}
+ bc := font_bc[f];
+ ec := font_ec[f];
+ char_base[k] := fmem_ptr - bc;
+ width_base[k] := char_base[k] + ec + 1;
+
+ height_base[k] := width_base[k] + (height_base[f] - width_base[f]);
+ depth_base[k] := height_base[k] + (depth_base[f] - height_base[f]);
+ italic_base[k] := depth_base[k] + (italic_base[f] - depth_base[f]);
+ lig_kern_base[k] := italic_base[k] + (lig_kern_base[f] - italic_base[f]);
+ kern_base[k] := lig_kern_base[k] + (kern_base[f] - lig_kern_base[f]);
+ exten_base[k] := kern_base[k] + (exten_base[f] - kern_base[f]);
+ param_base[k] := exten_base[k] + (param_base[f] - exten_base[f]);
+
+ {allocate memory for the new font |k| and copy data from |f|}
+ lf := (param_base[f] - char_base[f]) + font_params[f] + 1;
+ if (fmem_ptr + lf >= font_mem_size) then
+ overflow("number of words of font memory (font_mem_size)", font_mem_size);
+ for i := 0 to lf - 1 do
+ font_info[char_base[k] + bc + i] := font_info[char_base[f] + bc + i];
+ fmem_ptr := fmem_ptr + lf;
+
+ copy_font_info := k;
+end;
+
+procedure make_font_copy(a: small_number);
+{make a font copy for further use with font expansion}
+var u:pointer; {user's font identifier}
+@!t:str_number; {name for the frozen font identifier}
+@!old_setting:0..max_selector; {holds |selector| setting}
+@!f, k:internal_font_number;
+begin
+ get_r_token; u:=cur_cs;
+ if u>=hash_base then t:=text(u)
+ else if u>=single_base then
+ if u=null_cs then t:="FONT"@+else t:=u-single_base
+ else begin old_setting:=selector; selector:=new_string;
+ print("FONT"); print(u-active_base); selector:=old_setting;
+ @.FONTx@>
+ str_room(1); t:=make_string;
+ end;
+ define(u,set_font,null_font); scan_optional_equals; scan_font_ident;
+ k := cur_val;
+ f := copy_font_info(k);
+ equiv(u):=f; eqtb[font_id_base+f]:=eqtb[u]; font_id_text(f):=t;
+end;
+
@ We need to hold information about used characters in each font for partial
downloading.
@@ -17386,50 +17490,24 @@ created by |tokens_to_string|}
pdf_resname_prefix := 0;
last_tokens_string := 0;
-
@ Here we implement reading information from \.{VF} file.
@d vf_max_packet_length = 10000 {max length of character packet in \.{VF} file}
-
@#
-@d vf_error = 61 {label to go to when an error occur}
@d do_char = 70 {label to go to typesetting a character of virtual font}
@#
@d long_char = 242 {\.{VF} command for general character packet}
@d vf_id = 202 {identifies \.{VF} files}
@d put1=133 {typeset a character}
-
-@#
-@d vf_byte == getc(vf_file) {get a byte from\.{VF} file}
-@d vf_packet(#) == vf_packet_start[vf_packet_base[#] + vf_packet_end
-@d vf_packet_end(#) == #]
-
-@#
-@d bad_vf(#) == begin vf_err_str := #; goto vf_error; end {go out \.{VF}
-processing with an error message}
@d four_cases(#) == #,#+1,#+2,#+3
-
@#
@d tmp_b0 == tmp_w.qqqq.b0
@d tmp_b1 == tmp_w.qqqq.b1
@d tmp_b2 == tmp_w.qqqq.b2
@d tmp_b3 == tmp_w.qqqq.b3
@d tmp_int == tmp_w.int
-
@#
-@d scaled3u == {convert |tmp_b1..tmp_b3| to an unsigned scaled dimension}
-(((((tmp_b3*vf_z)div@'400)+(tmp_b2*vf_z))div@'400)+(tmp_b1*vf_z))div vf_beta
-@d scaled4(#) == {convert |tmp_b0..tmp_b3| to a scaled dimension}
- #:=scaled3u;
- if tmp_b0>0 then if tmp_b0=255 then # := # - vf_alpha
-@d scaled3(#) == {convert |tmp_b1..tmp_b3| to a scaled dimension}
- #:=scaled3u; @+ if tmp_b1>127 then # := # - vf_alpha
-@d scaled2 == {convert |tmp_b2..tmp_b3| to a scaled dimension}
- if tmp_b2>127 then tmp_b1:=255 else tmp_b1:=0;
- scaled3
-@d scaled1 == {convert |tmp_b3| to a scaled dimension}
- if tmp_b3>127 then tmp_b1:=255 else tmp_b1:=0;
- tmp_b2:=tmp_b1; scaled3
+@d bad_vf(#) == vf_error(font_name[f], #) {quit with an error message telling the vf filename}
@<Glob...@>=
@!vf_packet_base: ^integer; {base addresses of character packets from virtual fonts}
@@ -17441,34 +17519,46 @@ processing with an error message}
@!vf_e_fnts: ^integer; {external font numbers}
@!vf_i_fnts: ^internal_font_number; {corresponding internal font numbers}
@!tmp_w: memory_word; {accumulator}
-@!vf_z: integer; {multiplier}
-@!vf_alpha: integer; {correction for negative values}
-@!vf_beta: 1..16; {divisor}
@ @<Set init...@>=
vf_nf := 0;
@ The |do_vf| procedure attempts to read the \.{VF} file for a font, and sets
|pdf_font_type| to |real_font_type| if the \.{VF} file could not be found
-or loaded, otherwise sets |pdf_font_type| to |virtual_font_type|. At this
-time, |tmp_f| is the internal font number of the current \.{TFM} font. To
+or loaded, otherwise sets |pdf_font_type| to |virtual_font_type|. To
process font definitions in virtual font we call |vf_def_font|.
-@p procedure vf_replace_z;
+@p
+procedure vf_error(filename, msg: str_number);
+var old_setting:0..max_selector; {holds print |selector|}
+ s: str_number;
begin
- vf_alpha:=16;
- while vf_z>=@'40000000 do begin
- vf_z:=vf_z div 2;
- vf_alpha:=vf_alpha+vf_alpha;
- end;
- vf_beta:=256 div vf_alpha;
- vf_alpha:=vf_alpha*vf_z;
+ str_room(length(filename) + 3);
+ old_setting:=selector; selector:=new_string;
+ print(filename);
+ print(".vf");
+ s := make_string;
+ selector:=old_setting;
+ pdf_error(s, msg);
+end;
+
+function vf_byte: eight_bits; {read a byte from |vf_file|}
+var i: integer;
+begin
+ i := getc(vf_file);
+ if i < 0 then
+ pdf_error("vf", "unexpected EOF or error");
+ vf_byte := i;
end;
function vf_read(k: integer): integer; {read |k| bytes as an integer from \.{VF} file}
var i: integer;
begin
- i := 0;
+ pdfassert((k > 0) and (k <= 4));
+ i := vf_byte;
+ if (k = 4) and (i > 127) then
+ i := i - 256;
+ decr(k);
while k > 0 do begin
i := i*256 + vf_byte;
decr(k);
@@ -17496,15 +17586,13 @@ var k: internal_font_number;
cs: four_quarters;
begin
cs.b0 := vf_byte; cs.b1 := vf_byte; cs.b2 := vf_byte; cs.b3 := vf_byte;
- tmp_b0 := vf_byte; tmp_b1 := vf_byte; tmp_b2 := vf_byte; tmp_b3 := vf_byte;
- scaled4(fs);
+ fs := sqxfw(vf_read(4), font_size[f]);
ds := vf_read(4) div @'20;
tmp_b0 := vf_byte;
tmp_b1 := vf_byte;
while tmp_b0 > 0 do begin
decr(tmp_b0);
- if vf_byte > 0 then
- do_nothing; {skip the font path}
+ call_func(vf_byte); {skip the font path}
end;
str_room(tmp_b1);
while tmp_b1 > 0 do begin
@@ -17528,23 +17616,19 @@ begin
if (pdf_font_step[f] <> 0) then
set_expand_params(k, pdf_font_auto_expand[f],
pdf_font_expand_ratio[pdf_font_stretch[f]],
- pdf_font_expand_ratio[pdf_font_shrink[f]],
+ -pdf_font_expand_ratio[pdf_font_shrink[f]],
pdf_font_step[f], pdf_font_expand_ratio[f]);
vf_def_font := k;
end;
-procedure do_vf; {process \.{VF} file with font internal number |f|}
-label vf_error;
+procedure do_vf(f: internal_font_number); {process \.{VF} file with font internal number |f|}
var cmd, k, n: integer;
- cc, cmd_length: integer;
+ cc, cmd_length, packet_length: integer;
tfm_width: scaled;
- vf_err_str, s: str_number;
+ s: str_number;
stack_level: vf_stack_index;
save_vf_nf: internal_font_number;
- f: internal_font_number;
-
begin
- f := tmp_f;
pdf_font_type[f] := real_font_type;
if auto_expand_vf(f) then
return; {auto-expanded virtual font}
@@ -17560,16 +17644,6 @@ begin
bad_vf("POST command expected");
b_close(vf_file);
pdf_font_type[f] := virtual_font_type;
- return;
-vf_error:
- print_nl("Error in processing VF font (");
- print(font_name[f]);
- print(".vf): ");
- print(vf_err_str);
- print(", virtual font will be ignored");
- print_ln;
- b_close(vf_file);
- update_terminal;
end;
@ @<Open |vf_file|, return if not found@>=
@@ -17584,7 +17658,7 @@ if vf_byte <> vf_id then
bad_vf("wrong id byte");
cmd_length := vf_byte;
for k := 1 to cmd_length do
- tmp_int := vf_byte;
+ call_func(vf_byte); {skip the comment}
tmp_b0 := vf_byte; tmp_b1 := vf_byte; tmp_b2 := vf_byte; tmp_b3 := vf_byte;
if ((tmp_b0 <> 0) or (tmp_b1 <> 0) or (tmp_b2 <> 0) or (tmp_b3 <> 0)) and
((font_check[f].b0 <> 0) or (font_check[f].b1 <> 0) or
@@ -17600,9 +17674,7 @@ if vf_read(4) div @'20 <> font_dsize[f] then begin
print(font_name[f]);
print(".vf ignored");
end;
-update_terminal;
-vf_z := font_size[f];
-vf_replace_z
+update_terminal
@ @<Process the font definitions@>=
cmd := vf_byte;
@@ -17622,38 +17694,36 @@ vf_local_font_num[f] := vf_nf - save_vf_nf;
@ @<Build a character packet@>=
if cmd = long_char then begin
- vf_packet_length := vf_read(4);
+ packet_length := vf_read(4);
cc := vf_read(4);
if not is_valid_char(cc) then
bad_vf("invalid character code");
- tmp_b0 := vf_byte; tmp_b1 := vf_byte; tmp_b2 := vf_byte; tmp_b3 := vf_byte;
- scaled4(tfm_width);
+ tfm_width := sqxfw(vf_read(4), font_size[f]);
end
else begin
- vf_packet_length := cmd;
+ packet_length := cmd;
cc := vf_byte;
if not is_valid_char(cc) then
bad_vf("invalid character code");
- tmp_b1 := vf_byte; tmp_b2 := vf_byte; tmp_b3 := vf_byte;
- scaled3(tfm_width);
+ tfm_width := sqxfw(vf_read(3), font_size[f]);
end;
-if vf_packet_length < 0 then
+if packet_length < 0 then
bad_vf("negative packet length");
-if vf_packet_length > vf_max_packet_length then
+if packet_length > vf_max_packet_length then
bad_vf("packet length too long");
-if (tfm_width <> char_width(f)(char_info(f)(cc))) then begin
+if abs(tfm_width - char_width(f)(char_info(f)(cc))) > 1 then begin
print_nl("character width mismatch in font ");
print(font_name[f]);
print(".vf ignored");
end;
-str_room(vf_packet_length);
-while vf_packet_length > 0 do begin
+str_room(packet_length);
+while packet_length > 0 do begin
cmd := vf_byte;
- decr(vf_packet_length);
+ decr(packet_length);
@<Cases of \.{DVI} commands that can appear in character packet@>;
if cmd <> nop then
append_char(cmd);
- vf_packet_length := vf_packet_length - cmd_length;
+ packet_length := packet_length - cmd_length;
while cmd_length > 0 do begin
decr(cmd_length);
append_char(vf_byte);
@@ -17661,7 +17731,7 @@ while vf_packet_length > 0 do begin
end;
if stack_level <> 0 then
bad_vf("more PUSHs than POPs in character packet");
-if vf_packet_length <> 0 then
+if packet_length <> 0 then
bad_vf("invalid packet length or DVI command in packet");
@<Store the packet being built@>;
cmd := vf_byte
@@ -17678,7 +17748,7 @@ else if ((fnt_num_0 <= cmd) and (cmd <= fnt_num_0 + 63)) or
((fnt1 <= cmd) and (cmd <= fnt1 + 3)) then begin
if cmd >= fnt1 then begin
k := vf_read(cmd - fnt1 + 1);
- vf_packet_length := vf_packet_length - (cmd - fnt1 + 1);
+ packet_length := packet_length - (cmd - fnt1 + 1);
end
else
k := cmd - fnt_num_0;
@@ -17711,7 +17781,7 @@ four_cases(y1): cmd_length := cmd - y1 + 1;
four_cases(z1): cmd_length := cmd - z1 + 1;
four_cases(xxx1): begin
cmd_length := vf_read(cmd - xxx1 + 1);
- vf_packet_length := vf_packet_length - (cmd - xxx1 + 1);
+ packet_length := packet_length - (cmd - xxx1 + 1);
if cmd_length > vf_max_packet_length then
bad_vf("packet length too long");
if cmd_length < 0 then
@@ -17739,6 +17809,49 @@ othercases
bad_vf("improver DVI command");
endcases
+@ @p
+procedure pdf_check_vf_cur_val;
+var f: internal_font_number;
+begin
+ f := cur_val;
+ do_vf(f);
+ if pdf_font_type[f] = virtual_font_type then
+ pdf_error("font", "command cannot be used with virtual font");
+end;
+
+function auto_expand_vf(f: internal_font_number): boolean;
+{check for a virtual auto-expanded font}
+var bf, lf: internal_font_number;
+ e, k: integer;
+begin
+ auto_expand_vf := false;
+ if (not pdf_font_auto_expand[f]) or (pdf_font_blink[f] = null_font) then
+ return; {not an auto-expanded font}
+ bf := pdf_font_blink[f];
+ if pdf_font_type[bf] = new_font_type then {we must process the base font first}
+ do_vf(bf);
+ if pdf_font_type[bf] <> virtual_font_type then
+ return; {not a virtual font}
+
+ e := pdf_font_expand_ratio[f];
+ for k := 0 to vf_local_font_num[bf] - 1 do begin
+ lf := vf_default_font[bf] + k;
+ allocvffnts;
+ {copy vf local font numbers:}
+ vf_e_fnts[vf_nf] := vf_e_fnts[lf];
+ {definition of local vf fonts are expanded from base fonts:}
+ vf_i_fnts[vf_nf] := auto_expand_font(vf_i_fnts[lf], e);
+ copy_expand_params(vf_i_fnts[vf_nf], vf_i_fnts[lf], e);
+ incr(vf_nf);
+ end;
+ vf_packet_base[f] := vf_packet_base[bf];
+ vf_local_font_num[f] := vf_local_font_num[bf];
+ vf_default_font[f] := vf_nf - vf_local_font_num[f];
+
+ pdf_font_type[f] := virtual_font_type;
+ auto_expand_vf := true;
+end;
+
@ The |do_vf_packet| procedure is called in order to interpret the
character packet for a virtual character. Such a packet may contain the
instruction to typeset a character from the same or an other virtual
@@ -17771,7 +17884,11 @@ vf_stack_ptr := 0;
character packet}
var i: integer;
begin
- i := 0;
+ pdfassert((k > 0) and (k <= 4));
+ i := packet_byte;
+ if (k = 4) and (i > 127) then
+ i := i - 256;
+ decr(k);
while k > 0 do begin
i := i*256 + packet_byte;
decr(k);
@@ -17779,43 +17896,27 @@ begin
packet_read := i;
end;
-function packet_scaled(k: integer): integer; {get |k| bytes from packet as a
+function packet_scaled(k: integer; fs: scaled): scaled; {get |k| bytes from packet as a
scaled}
-var s: scaled;
+var fw: integer;
begin
+ fw := packet_read(k);
case k of
- 1: begin
- tmp_b3 := packet_byte;
- scaled1(s);
- end;
- 2: begin
- tmp_b2 := packet_byte;
- tmp_b3 := packet_byte;
- scaled2(s);
- end;
- 3: begin
- tmp_b1 := packet_byte;
- tmp_b2 := packet_byte;
- tmp_b3 := packet_byte;
- scaled3(s);
- end;
- 4: begin
- tmp_b0 := packet_byte;
- tmp_b1 := packet_byte;
- tmp_b2 := packet_byte;
- tmp_b3 := packet_byte;
- scaled4(s);
- end;
- othercases pdf_error("vf", "invalid number size");
+ 1: if fw > 127 then
+ fw := fw - 256;
+ 2: if fw > @"8000 then
+ fw := fw - @"10000;
+ 3: if fw > @"800000 then
+ fw := fw - @"1000000;
endcases;
- packet_scaled := s;
+ packet_scaled := sqxfw(fw, fs);
end;
-procedure do_vf_packet(f: internal_font_number; c: eight_bits); {typeset the \.{DVI} commands in the
-character packet for character |c| in current font |f|}
+procedure do_vf_packet(vf_f: internal_font_number; c: eight_bits); {typeset the
+\.{DVI} commands in the character packet for character |c| in current font |f|}
label do_char, continue;
-var save_vf, k, n: internal_font_number;
- save_h, save_v: scaled;
+var f, k, n: internal_font_number;
+ save_cur_h, save_cur_v: scaled;
cmd: integer;
char_move: boolean;
w, x, y, z: scaled;
@@ -17824,32 +17925,28 @@ begin
incr(vf_cur_s);
if vf_cur_s > vf_max_recursion then
overflow("max level recursion of virtual fonts", vf_max_recursion);
- push_packet_state;
- start_packet(f, c);
- vf_z := font_size[f];
- vf_replace_z;
- save_vf := f;
- f := vf_i_fnts[vf_default_font[save_vf]];
- save_v := cur_v;
- save_h := cur_h;
+ save_cur_v := cur_v;
+ save_cur_h := cur_h;
+ push_packet_state; {save pointer and length of the current packet}
+ start_packet(vf_f, c); {set pointer and length of the new packet}
+ f := vf_i_fnts[vf_default_font[vf_f]];
w := 0; x := 0; y := 0; z := 0;
while vf_packet_length > 0 do begin
cmd := packet_byte;
@<Do typesetting the \.{DVI} commands in virtual character packet@>;
continue:
end;
- cur_h := save_h;
- cur_v := save_v;
- pop_packet_state;
- vf_z := font_size[f];
- vf_replace_z;
+ pop_packet_state; {restore pointer and length of the previous packet}
+ cur_v := save_cur_v;
+ cur_h := save_cur_h;
decr(vf_cur_s);
end;
@ The following code typesets a character to PDF output.
-@d output_one_char(#)==begin
- pdf_check_new_font(f);
+@d output_one_char(#) == begin
+ if pdf_font_type[f] = new_font_type then
+ do_vf(f);
if pdf_font_type[f] = virtual_font_type then
do_vf_packet(f, #)
else begin
@@ -17859,7 +17956,6 @@ end;
end;
end
-
@<Do typesetting the \.{DVI} commands in virtual character packet@>=
if (cmd >= set_char_0) and (cmd <= set_char_0 + 127) then begin
if not is_valid_char(cmd) then begin
@@ -17876,13 +17972,13 @@ else if ((fnt_num_0 <= cmd) and (cmd <= fnt_num_0 + 63)) or (cmd = fnt1) then be
else
k := cmd - fnt_num_0;
n := 0;
- while (n < vf_local_font_num[save_vf]) and
- (vf_e_fnts[vf_default_font[save_vf] + n] <> k) do
+ while (n < vf_local_font_num[vf_f]) and
+ (vf_e_fnts[vf_default_font[vf_f] + n] <> k) do
incr(n);
- if (n = vf_local_font_num[save_vf]) then
+ if (n = vf_local_font_num[vf_f]) then
pdf_error("vf", "local font not found")
else
- f := vf_i_fnts[vf_default_font[save_vf] + n];
+ f := vf_i_fnts[vf_default_font[vf_f] + n];
end
else case cmd of
push: begin
@@ -17920,8 +18016,8 @@ four_cases(set1), four_cases(put1): begin
goto do_char;
end;
set_rule, put_rule: begin
- rule_ht := packet_scaled(4);
- rule_wd := packet_scaled(4);
+ rule_ht := packet_scaled(4, font_size[vf_f]);
+ rule_wd := packet_scaled(4, font_size[vf_f]);
if (rule_wd > 0) and (rule_ht > 0) then begin
pdf_set_rule(cur_h, cur_v, rule_wd, rule_ht);
if cmd = set_rule then
@@ -17929,27 +18025,27 @@ set_rule, put_rule: begin
end;
end;
four_cases(right1):
- cur_h := cur_h + packet_scaled(cmd - right1 + 1);
+ cur_h := cur_h + packet_scaled(cmd - right1 + 1, font_size[vf_f]);
w0, four_cases(w1): begin
if cmd > w0 then
- w := packet_scaled(cmd - w0);
+ w := packet_scaled(cmd - w0, font_size[vf_f]);
cur_h := cur_h + w;
end;
x0, four_cases(x1): begin
if cmd > x0 then
- x := packet_scaled(cmd - x0);
+ x := packet_scaled(cmd - x0, font_size[vf_f]);
cur_h := cur_h + x;
end;
four_cases(down1):
- cur_v := cur_v + packet_scaled(cmd - down1 + 1);
+ cur_v := cur_v + packet_scaled(cmd - down1 + 1, font_size[vf_f]);
y0, four_cases(y1): begin
if cmd > y0 then
- y := packet_scaled(cmd - y0);
+ y := packet_scaled(cmd - y0, font_size[vf_f]);
cur_v := cur_v + y;
end;
z0, four_cases(z1): begin
if cmd > z0 then
- z := packet_scaled(cmd - z0);
+ z := packet_scaled(cmd - z0, font_size[vf_f]);
cur_v := cur_v + z;
end;
four_cases(xxx1): begin
@@ -18536,7 +18632,7 @@ end
else begin
@<Calculate page dimensions and margins@>;
pdf_last_page := get_obj(obj_type_page, total_pages + 1, 0);
- obj_aux(pdf_last_page) := 1; {mark that this page has beed created}
+ obj_aux(pdf_last_page) := 1; {mark that this page has been created}
pdf_new_dict(obj_type_others, 0, 0);
pdf_last_stream := obj_ptr;
cur_h := cur_h_offset;
@@ -18928,14 +19024,13 @@ if pdf_link_list <> null then begin
i := obj_annot_ptr(info(k));
pdf_begin_dict(info(k), 1);
pdf_print_ln("/Type /Annot");
+ if pdf_action_type(pdf_link_action(i)) <> pdf_action_user then
+ pdf_print_ln("/Subtype /Link");
if pdf_link_attr(i) <> null then
pdf_print_toks_ln(pdf_link_attr(i));
pdf_rectangle(pdf_left(i), pdf_top(i), pdf_right(i), pdf_bottom(i));
- if pdf_action_type(pdf_link_action(i)) <> pdf_action_user
- then begin
- pdf_print_ln("/Subtype /Link");
+ if pdf_action_type(pdf_link_action(i)) <> pdf_action_user then
pdf_print("/A ");
- end;
write_action(pdf_link_action(i));
pdf_end_dict;
k := link(k);
@@ -19350,7 +19445,9 @@ for k := font_base + 1 to font_ptr do
print_font_identifier(i);
print(" and ");
print_font_identifier(k);
- print(" has conflicting attributes"); print_ln; print_ln;
+ print(" have conflicting attributes; I will ignore the attributes assigned to ");
+ print_font_identifier(i);
+ print_ln; print_ln;
end;
end;
fixed_gen_tounicode := pdf_gen_tounicode;
@@ -19645,7 +19742,7 @@ print_mod_date;
@ @<Output the |obj_tab|@>=
l := 0;
for k := 1 to sys_obj_ptr do
- if obj_offset(k) = 0 then begin
+ if not is_obj_written(k) then begin
obj_link(l) := k;
l := k;
end;
@@ -19656,7 +19753,7 @@ pdf_print("0 "); pdf_print_int_ln(obj_ptr + 1);
pdf_print_fw_int(obj_link(0), 10);
pdf_print_ln(" 65535 f ");
for k := 1 to obj_ptr do begin
- if obj_offset(k) = 0 then begin
+ if not is_obj_written(k) then begin
pdf_print_fw_int(obj_link(k), 10);
pdf_print_ln(" 00000 f ");
end
@@ -19678,7 +19775,7 @@ else
xref_offset_width := 1;
l := 0;
for k := 1 to sys_obj_ptr do
- if obj_offset(k) = 0 then begin
+ if not is_obj_written(k) then begin
obj_link(l) := k;
l := k;
end;
@@ -19701,7 +19798,7 @@ print_ID(output_file_name);
pdf_print_nl;
pdf_begin_stream;
for k := 0 to sys_obj_ptr do begin
- if obj_offset(k) = 0 then begin {a free object}
+ if not is_obj_written(k) then begin {a free object}
pdf_out(0);
pdf_out_bytes(obj_link(k), xref_offset_width);
pdf_out(255);
@@ -19842,8 +19939,8 @@ location |adjust_tail|.
@ @<Glob...@>=
@!pdf_font_blink: ^internal_font_number; {link to base font (used for expanded fonts only)}
@!pdf_font_elink: ^internal_font_number; {link to expanded fonts (used for base fonts only)}
-@!pdf_font_stretch: ^integer; {limit of stretching}
-@!pdf_font_shrink: ^integer; {limit of shrinking}
+@!pdf_font_stretch: ^integer; {link to font expanded by stretch limi}
+@!pdf_font_shrink: ^integer; {link to font expanded by shrink limit}
@!pdf_font_step: ^integer; {amount of one step of expansion}
@!pdf_font_expand_ratio: ^integer; {expansion ratio of a particular font}
@!pdf_font_auto_expand: ^boolean; {this font is auto-expanded?}
@@ -19921,8 +20018,8 @@ begin
k := pdf_font_shrink[f];
if k <> null_font then begin
if max_shrink_ratio < 0 then
- max_shrink_ratio := pdf_font_expand_ratio[k]
- else if max_shrink_ratio <> pdf_font_expand_ratio[k] then
+ max_shrink_ratio := -pdf_font_expand_ratio[k]
+ else if max_shrink_ratio <> -pdf_font_expand_ratio[k] then
pdf_error("font expansion", "using fonts with different limit of expansion in one paragraph is not allowed");
end;
check_expand_pars := true;
@@ -20002,12 +20099,17 @@ begin
return;
l := prev_char_p;
r := link(p);
- if type(l) = ligature_node then
- l := lig_char(l);
- if type(r) = ligature_node then
- r := lig_char(r);
- if not (is_char_node(l) and is_char_node(r) and
- (font(l) = font(r)) and
+ if not is_char_node(l) then
+ if type(l) = ligature_node then
+ l := lig_char(l)
+ else
+ return;
+ if not is_char_node(r) then
+ if type(r) = ligature_node then
+ r := lig_char(r)
+ else
+ return;
+ if not ((font(l) = font(r)) and
(pdf_font_stretch[font(l)] <> null_font))
then
return;
@@ -20026,12 +20128,17 @@ begin
return;
l := prev_char_p;
r := link(p);
- if type(l) = ligature_node then
- l := lig_char(l);
- if type(r) = ligature_node then
- r := lig_char(r);
- if not (is_char_node(l) and is_char_node(r) and
- (font(l) = font(r)) and
+ if not is_char_node(l) then
+ if type(l) = ligature_node then
+ l := lig_char(l)
+ else
+ return;
+ if not is_char_node(r) then
+ if type(r) = ligature_node then
+ r := lig_char(r)
+ else
+ return;
+ if not ((font(l) = font(r)) and
(pdf_font_shrink[font(l)] <> null_font))
then
return;
@@ -20073,13 +20180,13 @@ begin
if ef = 0 then
return;
if (pdf_font_stretch[f] <> null_font) and (ex_ratio > 0) then
- k := expand_font(f, divide_scaled(ex_ratio*
- pdf_font_expand_ratio[pdf_font_stretch[f]]*ef,
- 1000000, 0))
+ k := expand_font(f, ext_xn_over_d(ex_ratio*ef,
+ pdf_font_expand_ratio[pdf_font_stretch[f]],
+ 1000000))
else if (pdf_font_shrink[f] <> null_font) and (ex_ratio < 0) then
- k := expand_font(f, -divide_scaled(ex_ratio*
- pdf_font_expand_ratio[pdf_font_shrink[f]]*ef,
- 1000000, 0))
+ k := expand_font(f, ext_xn_over_d(ex_ratio*ef,
+ -pdf_font_expand_ratio[pdf_font_shrink[f]],
+ 1000000))
else
k := f;
if k <> f then begin
@@ -20228,30 +20335,32 @@ if p<>null then
x := x + width(p);
end;
kern_node: begin
- if (m = cal_expand_ratio) and (subtype(p) = normal) then begin
- k := kern_stretch(p);
- if k <> 0 then begin
- subtype(p) := substituted;
- font_stretch := font_stretch + k;
- end;
- k := kern_shrink(p);
- if k <> 0 then begin
- subtype(p) := substituted;
- font_shrink := font_shrink + k;
+ if subtype(p) = normal then begin
+ if m = cal_expand_ratio then begin
+ font_stretch := font_stretch + kern_stretch(p);
+ font_shrink := font_shrink + kern_shrink(p);
+ end
+ else if m = subst_ex_font then begin
+ if font_expand_ratio > 0 then
+ k := kern_stretch(p)
+ else if font_expand_ratio < 0 then
+ k := kern_shrink(p)
+ else
+ pdfassert(0);
+ if k <> 0 then begin
+ if is_char_node(link(p)) then
+ width(p) := get_kern(font(prev_char_p),
+ character(prev_char_p),
+ character(link(p)))
+ else if type(link(p)) = ligature_node then
+ width(p) := get_kern(font(prev_char_p),
+ character(prev_char_p),
+ character(lig_char(link(p))));
+ end;
end;
- end
- else if (m = subst_ex_font) and (subtype(p) = substituted) then begin
- if type(link(p)) = ligature_node then
- width(p) := get_kern(font(prev_char_p),
- character(prev_char_p),
- character(lig_char(link(p))))
- else
- width(p) := get_kern(font(prev_char_p),
- character(prev_char_p),
- character(link(p)))
- end;
- x := x + width(p);
end;
+ x := x + width(p);
+ end;
math_node: begin x:=x+width(p);
if TeXXeT_en then @<Adjust \(t)the LR stack for the |hpack| routine@>;
end;
@@ -20659,7 +20768,7 @@ baselineskip calculation is handled by the |append_to_vlist| routine.
@p procedure append_to_vlist(@!b:pointer);
var d:scaled; {deficiency of space between baselines}
@!p:pointer; {a new glue specification}
-begin if prev_depth>ignore_depth then
+begin if prev_depth>pdf_ignored_dimen then
begin d:=width(baseline_skip)-prev_depth-height(b);
if d<line_skip_limit then p:=new_param_glue(line_skip_code)
else begin p:=new_skip_param(baseline_skip_code);
@@ -22905,7 +23014,7 @@ entered, so that the columns will generate a list for subsequent packaging.
procedure init_span(@!p:pointer);
begin push_nest;
if mode=-hmode then space_factor:=1000
-else begin prev_depth:=ignore_depth; normal_paragraph;
+else begin prev_depth:=pdf_ignored_dimen; normal_paragraph;
end;
cur_span:=p;
end;
@@ -25221,14 +25330,21 @@ if left_skip<>zero_glue then
link(r):=q; q:=r;
end
+@ @<Initialize table entries...@>=
+pdf_ignored_dimen := ignore_depth;
+pdf_each_line_height := pdf_ignored_dimen;
+pdf_each_line_depth := pdf_ignored_dimen;
+pdf_first_line_height := pdf_ignored_dimen;
+pdf_last_line_depth := pdf_ignored_dimen;
+
@ @<Append the new box to the current vertical list...@>=
-if pdf_each_line_height <> 0 then
+if pdf_each_line_height <> pdf_ignored_dimen then
height(just_box) := pdf_each_line_height;
-if pdf_each_line_depth <> 0 then
+if pdf_each_line_depth <> pdf_ignored_dimen then
depth(just_box) := pdf_each_line_depth;
-if (pdf_first_line_height <> 0) and (cur_line = prev_graf + 1) then
+if (pdf_first_line_height <> pdf_ignored_dimen) and (cur_line = prev_graf + 1) then
height(just_box) := pdf_first_line_height;
-if (pdf_last_line_depth <> 0) and (cur_line + 1 = best_line) then
+if (pdf_last_line_depth <> pdf_ignored_dimen) and (cur_line + 1 = best_line) then
depth(just_box) := pdf_last_line_depth;
if pre_adjust_head <> pre_adjust_tail then
append_list(pre_adjust_head)(pre_adjust_tail);
@@ -27838,7 +27954,7 @@ end
@ @<Fire up the user's output routine and |return|@>=
begin output_active:=true;
incr(dead_cycles);
-push_nest; mode:=-vmode; prev_depth:=ignore_depth; mode_line:=-line;
+push_nest; mode:=-vmode; prev_depth:=pdf_ignored_dimen; mode_line:=-line;
begin_token_list(output_routine,output_text);
new_save_level(output_group); normal_paragraph;
scan_left_brace;
@@ -28474,11 +28590,11 @@ is short, since the |scan_rule_spec| routine already does most of what is
required; thus, there is no need for a special action procedure.
Note that baselineskip calculations are disabled after a rule in vertical
-mode, by setting |prev_depth:=ignore_depth|.
+mode, by setting |prev_depth:=pdf_ignored_dimen|.
@<Cases of |main_control| that build...@>=
vmode+hrule,hmode+vrule,mmode+vrule: begin tail_append(scan_rule_spec);
- if abs(mode)=vmode then prev_depth:=ignore_depth
+ if abs(mode)=vmode then prev_depth:=pdf_ignored_dimen
else if abs(mode)=hmode then space_factor:=1000;
end;
@@ -29003,7 +29119,7 @@ else begin if k=vmode then scan_spec(vbox_group,true)
end;
push_nest; mode:=-k;
if k=vmode then
- begin prev_depth:=ignore_depth;
+ begin prev_depth:=pdf_ignored_dimen;
if every_vbox<>null then begin_token_list(every_vbox,every_vbox_text);
end
else begin space_factor:=1000;
@@ -29204,7 +29320,7 @@ else
saved(1) := 0;
save_ptr := save_ptr + 2;
new_save_level(insert_group); scan_left_brace; normal_paragraph;
-push_nest; mode:=-vmode; prev_depth:=ignore_depth;
+push_nest; mode:=-vmode; prev_depth:=pdf_ignored_dimen;
end;
@ @<Cases of |handle...@>=
@@ -30138,7 +30254,7 @@ end
@ @<Cases of |main_control| that build...@>=
mmode+vcenter: begin scan_spec(vcenter_group,false); normal_paragraph;
- push_nest; mode:=-vmode; prev_depth:=ignore_depth;
+ push_nest; mode:=-vmode; prev_depth:=pdf_ignored_dimen;
if every_vbox<>null then begin_token_list(every_vbox,every_vbox_text);
end;
@@ -30764,6 +30880,7 @@ any_mode(def_family),
any_mode(set_font),
any_mode(def_font),
any_mode(letterspace_font),
+any_mode(pdf_copy_font),
any_mode(register),
any_mode(advance),
any_mode(multiply),
@@ -31506,6 +31623,7 @@ endcases;
@<Assignments@>=
def_font: new_font(a);
letterspace_font: new_letterspaced_font(a);
+pdf_copy_font: make_font_copy(a);
@ @<Declare subprocedures for |prefixed_command|@>=
procedure new_font(@!a:small_number);
@@ -31947,6 +32065,7 @@ begin @<If dumping is not allowed, abort@>;
@<Dump the table of equivalents@>;
@<Dump the font information@>;
@<Dump the hyphenation tables@>;
+@<Dump pdftex data@>;
@<Dump a couple more things and the closing check word@>;
@<Close the format file@>;
end;
@@ -31976,7 +32095,9 @@ begin @<Undump constants for consistency check@>;
@<Undump the table of equivalents@>;
@<Undump the font information@>;
@<Undump the hyphenation tables@>;
+@<Undump pdftex data@>;
@<Undump a couple more things and the closing check word@>;
+prev_depth := pdf_ignored_dimen;
load_fmt_file:=true; return; {it worked!}
bad_fmt: wake_up_terminal;
wterm_ln('(Fatal format file error; I''m stymied)');
@@ -32367,6 +32488,78 @@ while j>0 do
end;
@!init trie_not_ready:=false @+tini
+@ Store some of the pdftex data structures in the format. The idea here is
+to ensure that any data structures referenced from pdftex-specific whatsit
+nodes are retained. For the sake of simplicity and speed, all the filled parts
+of |pdf_mem| and |obj_tab| are retained, in the present implementation. We also
+retain three of the linked lists that start from |head_tab|, so that it is
+possible to, say, load an image in the \.{INITEX} run and then reference it in a
+\.{VIRTEX} run that uses the dumped format.
+
+@<Dump pdftex data@>=
+begin
+dumpimagemeta; {the image information array }
+dump_int(pdf_mem_size);
+dump_int(pdf_mem_ptr);
+for k:=1 to pdf_mem_ptr-1 do begin
+ dump_int(pdf_mem[k]);
+ end;
+print_ln; print_int(pdf_mem_ptr-1); print(" words of pdfTeX memory");
+dump_int(obj_tab_size);
+dump_int(obj_ptr);
+dump_int(sys_obj_ptr);
+for k:=1 to sys_obj_ptr do begin
+ dump_int(obj_tab[k].int0);
+ dump_int(obj_tab[k].int1);
+ dump_int(obj_tab[k].int3);
+ dump_int(obj_tab[k].int4);
+ end;
+print_ln; print_int(sys_obj_ptr); print(" indirect objects");
+dump_int(pdf_obj_count);
+dump_int(pdf_xform_count);
+dump_int(pdf_ximage_count);
+dump_int(head_tab[obj_type_obj]);
+dump_int(head_tab[obj_type_xform]);
+dump_int(head_tab[obj_type_ximage]);
+dump_int(pdf_last_obj);
+dump_int(pdf_last_xform);
+dump_int(pdf_last_ximage);
+end
+
+@ And restoring the pdftex data structures from the format. The
+two function arguments to |undumpimagemeta| have been restored
+already in an earlier module.
+
+@<Undump pdftex data@>=
+begin
+undumpimagemeta(pdf_minor_version,pdf_inclusion_errorlevel); {the image information array }
+undump_int(pdf_mem_size);
+pdf_mem := xrealloc_array(pdf_mem, integer, pdf_mem_size);
+undump_int(pdf_mem_ptr);
+for k:=1 to pdf_mem_ptr-1 do begin
+ undump_int(pdf_mem[k]);
+ end;
+undump_int(obj_tab_size);
+undump_int(obj_ptr);
+undump_int(sys_obj_ptr);
+for k:=1 to sys_obj_ptr do begin
+ undump_int(obj_tab[k].int0);
+ undump_int(obj_tab[k].int1);
+ obj_tab[k].int2 := -1;
+ undump_int(obj_tab[k].int3);
+ undump_int(obj_tab[k].int4);
+ end;
+undump_int(pdf_obj_count);
+undump_int(pdf_xform_count);
+undump_int(pdf_ximage_count);
+undump_int(head_tab[obj_type_obj]);
+undump_int(head_tab[obj_type_xform]);
+undump_int(head_tab[obj_type_ximage]);
+undump_int(pdf_last_obj);
+undump_int(pdf_last_xform);
+undump_int(pdf_last_ximage);
+end
+
@ We have already printed a lot of statistics, so we set |tracing_stats:=0|
to prevent them from appearing again.
@@ -34276,7 +34469,7 @@ begin
f := cur_val;
if f = null_font then
pdf_error("font", "invalid font identifier");
- pdf_check_vf(f);
+ pdf_check_vf_cur_val;
if not font_used[f] then
pdf_init_font(f);
scan_pdf_ext_toks;
@@ -35283,13 +35476,16 @@ begin
pdf_error("ext4", "annotations cannot be inside an XForm");
if doing_leaders then
return;
+ if is_obj_scheduled(pdf_annot_objnum(p)) then
+ pdf_annot_objnum(p) := pdf_new_objnum;
set_rect_dimens(p, parent_box, x, y,
pdf_width(p), pdf_height(p), pdf_depth(p), 0);
obj_annot_ptr(pdf_annot_objnum(p)) := p;
pdf_append_list(pdf_annot_objnum(p))(pdf_annot_list);
+ set_obj_scheduled(pdf_annot_objnum(p));
end;
-@ To implement nesting link annotations, we need a stack to hold copy of
+@ To implement nested link annotations, we need a stack to hold copy of
|pdf_start_link_node|'s that are being written out, together with their box
nesting level.
@@ -35338,6 +35534,8 @@ begin
if not is_shipping_page then
pdf_error("ext4", "link annotations cannot be inside an XForm");
pdfassert(type(parent_box) = hlist_node);
+ if is_obj_scheduled(pdf_link_objnum(p)) then
+ pdf_link_objnum(p) := pdf_new_objnum;
push_link_level(p);
set_rect_dimens(p, parent_box, x, y,
pdf_width(p), pdf_height(p), pdf_depth(p),
@@ -35345,6 +35543,7 @@ begin
obj_annot_ptr(pdf_link_objnum(p)) := p; {the reference for the pdf annot object
must be set here}
pdf_append_list(pdf_link_objnum(p))(pdf_link_list);
+ set_obj_scheduled(pdf_link_objnum(p));
end;
procedure end_link;
diff --git a/Build/source/texk/web2c/pdftexdir/pdftexextra.in b/Build/source/texk/web2c/pdftexdir/pdftexextra.in
index fec48fd313e..1af7e0628da 100644
--- a/Build/source/texk/web2c/pdftexdir/pdftexextra.in
+++ b/Build/source/texk/web2c/pdftexdir/pdftexextra.in
@@ -1,5 +1,5 @@
/*
-Copyright (c) 1996-2004 Han The Thanh, <thanh@pdftex.org>
+Copyright (c) 1996-2007 Han The Thanh, <thanh@pdftex.org>
This file is part of pdfTeX.
@@ -13,11 +13,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with pdfTeX; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+You should have received a copy of the GNU General Public License along
+with pdfTeX; if not, write to the Free Software Foundation, Inc., 51
+Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: pdftexextra.in,v 1.4 2004/08/26 18:19:57 olaf Exp $
+$Id: pdftexextra.in 200 2007-07-11 13:11:12Z oneiros $
*/
/* pdftexextra.in: banner etc. for pdfTeX.
diff --git a/Build/source/texk/web2c/pdftexdir/pdftoepdf.cc b/Build/source/texk/web2c/pdftexdir/pdftoepdf.cc
index 780cd75bda2..ae770e2e6bf 100644
--- a/Build/source/texk/web2c/pdftexdir/pdftoepdf.cc
+++ b/Build/source/texk/web2c/pdftexdir/pdftoepdf.cc
@@ -1,5 +1,5 @@
/*
-Copyright 1996-2006 Han The Thanh, <thanh@pdftex.org>
+Copyright 1996-2007 Han The Thanh, <thanh@pdftex.org>
This file is part of pdfTeX.
@@ -13,11 +13,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with pdfTeX; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+You should have received a copy of the GNU General Public License along
+with pdfTeX; if not, write to the Free Software Foundation, Inc., 51
+Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: pdftoepdf.cc,v 1.9 2006/09/01 18:06:52 hahe Exp hahe $
+$Id: pdftoepdf.cc 200 2007-07-11 13:11:12Z oneiros $
*/
#include <stdlib.h>
@@ -281,7 +281,7 @@ static void copyName(char *s)
pdf_puts("/");
for (; *s != 0; s++) {
if (isdigit(*s) || isupper(*s) || islower(*s) || *s == '_' ||
- *s == '.' || *s == '-')
+ *s == '.' || *s == '-' || *s == '+')
pdfout(*s);
else
pdf_printf("#%.2X", *s & 0xFF);
@@ -381,7 +381,7 @@ static void copyFont(char *tag, Object * fontRef)
}
// Only handle included Type1 (and Type1C) fonts; anything else will be copied.
// Type1C fonts are replaced by Type1 fonts, if REPLACE_TYPE1C is true.
- if (fontRef->fetch(xref, &fontdict)->isDict()
+ if (!fixedinclusioncopyfont && fontRef->fetch(xref, &fontdict)->isDict()
&& fontdict->dictLookup("Subtype", &subtype)->isName()
&& !strcmp(subtype->getName(), "Type1")
&& fontdict->dictLookup("BaseFont", &basefont)->isName()
@@ -575,9 +575,9 @@ static void copyObject(Object * obj)
} else if (obj->isRef()) {
ref = obj->getRef();
if (ref.num == 0) {
- pdftex_warn
- ("PDF inclusion: reference to invalid object was replaced by <null>");
- pdf_puts("null");
+ pdftex_fail
+ ("PDF inclusion: reference to invalid object"
+ " (is the included pdf broken?)");
} else
pdf_printf("%d 0 R", addOther(ref));
} else {
@@ -622,8 +622,9 @@ static void writeEncodings()
for (r = encodingList; r != 0; r = r->next) {
for (i = 0; i < 256; i++) {
if (r->font->isCIDFont()) {
- pdftex_warn
- ("PDF inclusion: CID font included, encoding maybe wrong");
+ pdftex_fail
+ ("PDF inclusion: CID fonts are not supported"
+ " (try to disable font replacement to fix this)");
}
if ((s = ((Gfx8BitFont *) r->font)->getCharName(i)) != 0)
glyphNames[i] = s;
@@ -849,14 +850,14 @@ void write_epdf(void)
sprintf(s, "/Matrix [%.8f %.8f %.8f %.8f %.8f %.8f]\n",
scale[0],
scale[1], scale[2], scale[3], scale[4], scale[5]);
- pdf_printf(stripzeros(s));
+ pdf_puts(stripzeros(s));
}
}
}
sprintf(s, "/BBox [%.8f %.8f %.8f %.8f]\n",
pagebox->x1, pagebox->y1, pagebox->x2, pagebox->y2);
- pdf_printf(stripzeros(s));
+ pdf_puts(stripzeros(s));
// write the page Group if it's there
if (page->getGroup() != NULL) {
diff --git a/Build/source/texk/web2c/pdftexdir/pdftosrc.cc b/Build/source/texk/web2c/pdftexdir/pdftosrc.cc
index 13cf34d74c6..8b63daed92b 100644
--- a/Build/source/texk/web2c/pdftexdir/pdftosrc.cc
+++ b/Build/source/texk/web2c/pdftexdir/pdftosrc.cc
@@ -1,5 +1,5 @@
/*
-Copyright (c) 1996-2006 Han The Thanh, <thanh@pdftex.org>
+Copyright (c) 1996-2007 Han The Thanh, <thanh@pdftex.org>
This file is part of pdfTeX.
@@ -13,11 +13,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with pdfTeX; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+You should have received a copy of the GNU General Public License along
+with pdfTeX; if not, write to the Free Software Foundation, Inc., 51
+Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: //depot/Build/source.development/TeX/texk/web2c/pdftexdir/pdftosrc.cc#10 $
+$Id: pdftosrc.cc 200 2007-07-11 13:11:12Z oneiros $
*/
#include <stdlib.h>
diff --git a/Build/source/texk/web2c/pdftexdir/pkin.c b/Build/source/texk/web2c/pdftexdir/pkin.c
index 7d7c863b7a4..a25b9bec7a7 100644
--- a/Build/source/texk/web2c/pdftexdir/pkin.c
+++ b/Build/source/texk/web2c/pdftexdir/pkin.c
@@ -1,5 +1,5 @@
/*
-Copyright (c) 1996-2002 Han The Thanh, <thanh@pdftex.org>
+Copyright (c) 1996-2007 Han The Thanh, <thanh@pdftex.org>
This file is part of pdfTeX.
@@ -13,11 +13,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with pdfTeX; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+You should have received a copy of the GNU General Public License along
+with pdfTeX; if not, write to the Free Software Foundation, Inc., 51
+Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: //depot/Build/source.development/TeX/texk/web2c/pdftexdir/pkin.c#4 $
+$Id: pkin.c 200 2007-07-11 13:11:12Z oneiros $
*/
/*
diff --git a/Build/source/texk/web2c/pdftexdir/ptexlib.h b/Build/source/texk/web2c/pdftexdir/ptexlib.h
index c915b8fd47b..b3633cdb63e 100644
--- a/Build/source/texk/web2c/pdftexdir/ptexlib.h
+++ b/Build/source/texk/web2c/pdftexdir/ptexlib.h
@@ -1,5 +1,5 @@
/*
-Copyright (c) 1996-2006 Han The Thanh, <thanh@pdftex.org>
+Copyright (c) 1996-2007 Han The Thanh, <thanh@pdftex.org>
This file is part of pdfTeX.
@@ -13,11 +13,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with pdfTeX; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+You should have received a copy of the GNU General Public License along
+with pdfTeX; if not, write to the Free Software Foundation, Inc., 51
+Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: //depot/Build/source.development/TeX/texk/web2c/pdftexdir/ptexlib.h#26 $
+$Id: ptexlib.h 200 2007-07-11 13:11:12Z oneiros $
*/
#ifndef PDFTEXLIB
@@ -76,6 +76,11 @@ typedef struct {
char *unicode_seq; /* multiple unicode sequence */
} glyph_unicode_entry;
+# define FD_FLAGS_NOT_SET_IN_MAPLINE -1
+# define FD_FLAGS_DEFAULT_EMBED 4 /* a symbol font */
+# define FD_FLAGS_DEFAULT_NON_EMBED 0x22
+ /* a nonsymbolic serif font */
+
typedef struct {
/* parameters scanned from the map file: */
char *tfm_name; /* TFM file name (1st field in map line) */
@@ -178,6 +183,7 @@ extern void pdfinitmapfile(string map_name);
extern fm_entry *new_fm_entry(void);
extern void delete_fm_entry(fm_entry *);
extern int avl_do_entry(fm_entry *, int);
+extern int check_std_t1font(char *s);
/* papersiz.c */
extern integer myatodim(char **);
@@ -266,13 +272,17 @@ extern scaled getury();
extern void allocvffnts();
/* vfpacket.c */
-extern eightbits packetbyte(void);
extern integer newvfpacket(internalfontnumber);
+extern void storepacket(internalfontnumber, eightbits, strnumber);
+extern void startpacket(internalfontnumber, eightbits);
+extern eightbits packetbyte(void);
extern void poppacketstate(void);
extern void pushpacketstate(void);
-extern void startpacket(internalfontnumber, integer);
-extern void storepacket(integer, integer, integer);
extern void vf_free(void);
+# define SIGNED_QUAD scaled
+# define fixword integer
+extern SIGNED_QUAD sqxfw(SIGNED_QUAD sq, fixword fw);
+
/* writeenc.c */
extern fe_entry *get_fe_entry(char *);
@@ -304,6 +314,8 @@ extern void img_free(void);
extern void updateimageprocset(integer);
extern void writeimage(integer);
extern integer imagecolordepth(integer img);
+extern void dumpimagemeta();
+extern void undumpimagemeta(integer, integer);
/* writejbig2.c */
extern void flushjbig2page0objects();
@@ -325,6 +337,7 @@ extern void ttf_free(void);
/* writezip.c */
extern void writezip(boolean);
+extern void zip_free(void);
/* avlstuff.c */
extern int comp_int_entry(const void *, const void *, void *);
@@ -349,3 +362,4 @@ static const key_entry font_key[FONT_KEYS_NUM] = {
/**********************************************************************/
#endif /* PDFTEXLIB */
+// vim: ts=4
diff --git a/Build/source/texk/web2c/pdftexdir/ptexmac.h b/Build/source/texk/web2c/pdftexdir/ptexmac.h
index 29f441b6457..3a82fc99b35 100644
--- a/Build/source/texk/web2c/pdftexdir/ptexmac.h
+++ b/Build/source/texk/web2c/pdftexdir/ptexmac.h
@@ -1,5 +1,5 @@
/*
-Copyright (c) 1996-2006 Han The Thanh, <thanh@pdftex.org>
+Copyright (c) 1996-2007 Han The Thanh, <thanh@pdftex.org>
This file is part of pdfTeX.
@@ -13,11 +13,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with pdfTeX; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+You should have received a copy of the GNU General Public License along
+with pdfTeX; if not, write to the Free Software Foundation, Inc., 51
+Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: ptexmac.h,v 1.14 2005/11/29 22:05:23 hahe Exp $
+$Id: ptexmac.h 200 2007-07-11 13:11:12Z oneiros $
*/
#ifndef PDFTEXMAC
diff --git a/Build/source/texk/web2c/pdftexdir/subfont.c b/Build/source/texk/web2c/pdftexdir/subfont.c
index 09b681781ef..24c6aab87da 100644
--- a/Build/source/texk/web2c/pdftexdir/subfont.c
+++ b/Build/source/texk/web2c/pdftexdir/subfont.c
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2005-2006 Han The Thanh, <thanh@pdftex.org>
+Copyright (c) 2005-2007 Han The Thanh, <thanh@pdftex.org>
This file is part of pdfTeX.
@@ -13,9 +13,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with pdfTeX; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+You should have received a copy of the GNU General Public License along
+with pdfTeX; if not, write to the Free Software Foundation, Inc., 51
+Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+$Id: subfont.c 200 2007-07-11 13:11:12Z oneiros $
*/
#include "ptexlib.h"
diff --git a/Build/source/texk/web2c/pdftexdir/tex.ch0 b/Build/source/texk/web2c/pdftexdir/tex.ch0
index 2dcb3746d6f..c63a9780604 100644
--- a/Build/source/texk/web2c/pdftexdir/tex.ch0
+++ b/Build/source/texk/web2c/pdftexdir/tex.ch0
@@ -1,5 +1,5 @@
%
-% Copyright (c) 1996-2002 Han The Thanh, <thanh@pdftex.org>
+% Copyright (c) 1996-2007 Han The Thanh, <thanh@pdftex.org>
%
% This file is part of pdfTeX.
%
@@ -13,11 +13,11 @@
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
-% You should have received a copy of the GNU General Public License
-% along with pdfTeX; if not, write to the Free Software
-% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+% You should have received a copy of the GNU General Public License along with
+% pdfTeX; if not, write to the Free Software Foundation, Inc., 51 Franklin
+% Street, Fifth Floor, Boston, MA 02110-1301 USA.
%
-% $Id: //depot/Build/source.development/TeX/texk/web2c/pdfetexdir/tex.ch0#10 $
+% $Id: tex.ch0 200 2007-07-11 13:11:12Z oneiros $
%
% Change file to assist in creating the web2c-specific change file.
% This one comes first, resolves inconsistencies between the generated
diff --git a/Build/source/texk/web2c/pdftexdir/tounicode.c b/Build/source/texk/web2c/pdftexdir/tounicode.c
index f30e44eff04..b2126a7890a 100644
--- a/Build/source/texk/web2c/pdftexdir/tounicode.c
+++ b/Build/source/texk/web2c/pdftexdir/tounicode.c
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2006 Han The Thanh, <thanh@pdftex.org>
+Copyright (c) 2006-2007 Han The Thanh, <thanh@pdftex.org>
This file is part of pdfTeX.
@@ -13,9 +13,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with pdfTeX; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+You should have received a copy of the GNU General Public License along
+with pdfTeX; if not, write to the Free Software Foundation, Inc., 51
+Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+$Id: tounicode.c 200 2007-07-11 13:11:12Z oneiros $
*/
#include "ptexlib.h"
diff --git a/Build/source/texk/web2c/pdftexdir/ttf2afm.c b/Build/source/texk/web2c/pdftexdir/ttf2afm.c
index ce7af81553a..4b8d2ddec80 100644
--- a/Build/source/texk/web2c/pdftexdir/ttf2afm.c
+++ b/Build/source/texk/web2c/pdftexdir/ttf2afm.c
@@ -1,5 +1,5 @@
/*
-Copyright (c) 1996-2006 Han The Thanh, <thanh@pdftex.org>
+Copyright (c) 1996-2007 Han The Thanh, <thanh@pdftex.org>
This file is part of pdfTeX.
@@ -13,11 +13,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with pdfTeX; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+You should have received a copy of the GNU General Public License along
+with pdfTeX; if not, write to the Free Software Foundation, Inc., 51
+Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: //depot/Build/source.development/TeX/texk/web2c/pdftexdir/ttf2afm.c#21 $
+$Id: ttf2afm.c 200 2007-07-11 13:11:12Z oneiros $
*/
/*
diff --git a/Build/source/texk/web2c/pdftexdir/utils.c b/Build/source/texk/web2c/pdftexdir/utils.c
index f2d12e036a5..b8f63d52201 100644
--- a/Build/source/texk/web2c/pdftexdir/utils.c
+++ b/Build/source/texk/web2c/pdftexdir/utils.c
@@ -1,5 +1,5 @@
/*
-Copyright (c) 1996-2006 Han The Thanh, <thanh@pdftex.org>
+Copyright (c) 1996-2007 Han The Thanh, <thanh@pdftex.org>
This file is part of pdfTeX.
@@ -13,11 +13,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with pdfTeX; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+You should have received a copy of the GNU General Public License along
+with pdfTeX; if not, write to the Free Software Foundation, Inc., 51
+Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: //depot/Build/source.development/TeX/texk/web2c/pdftexdir/utils.c#24 $
+$Id: utils.c 200 2007-07-11 13:11:12Z oneiros $
*/
#include "openbsd-compat.h"
@@ -438,6 +438,7 @@ void libpdffinish()
ttf_free();
sfd_free();
glyph_unicode_free();
+ zip_free();
}
/* Converts any string given in in in an allowed PDF string which can be
@@ -684,7 +685,7 @@ void unescapehex(poolpointer in)
first = true;
}
if (!first) { /* last hex digit is omitted */
- strpool[poolptr++] = ch << 4;
+ strpool[poolptr++] = a;
}
}
@@ -919,6 +920,7 @@ void getfilemoddate(strnumber s)
return; /* empty string */
}
+ recorder_record_input(file_name);
/* get file status */
if (stat(file_name, &file_data) == 0) {
size_t len;
@@ -948,6 +950,7 @@ void getfilesize(strnumber s)
return; /* empty string */
}
+ recorder_record_input(file_name);
/* get file status */
if (stat(file_name, &file_data) == 0) {
size_t len;
@@ -998,6 +1001,7 @@ void getmd5sum(strnumber s, boolean file)
xfree(file_name);
return;
}
+ recorder_record_input(file_name);
md5_init(&state);
while ((read = fread(&file_buf, sizeof(char), FILE_BUF_SIZE, f)) > 0) {
md5_append(&state, (const md5_byte_t *) file_buf, read);
@@ -1055,6 +1059,7 @@ void getfiledump(strnumber s, int offset, int length)
xfree(file_name);
return;
}
+ recorder_record_input(file_name);
if (fseek(f, (long) offset, SEEK_SET) != 0) {
xfree(file_name);
return;
@@ -1639,7 +1644,7 @@ void pdfshipoutbegin(boolean shipping_page)
void pdfshipoutend(boolean shipping_page)
{
if (pos_stack_used > 0) {
- pdftex_warn("%u unmatched \\pdfsave after %s shipout",
+ pdftex_fail("%u unmatched \\pdfsave after %s shipout",
(unsigned int) pos_stack_used,
((shipping_page) ? "page" : "form"));
}
diff --git a/Build/source/texk/web2c/pdftexdir/vfpacket.c b/Build/source/texk/web2c/pdftexdir/vfpacket.c
index 09cefeacd39..70accdcf13a 100644
--- a/Build/source/texk/web2c/pdftexdir/vfpacket.c
+++ b/Build/source/texk/web2c/pdftexdir/vfpacket.c
@@ -1,5 +1,5 @@
/*
-Copyright (c) 1996-2002 Han The Thanh, <thanh@pdftex.org>
+Copyright (c) 1996-2007 Han The Thanh, <thanh@pdftex.org>
This file is part of pdfTeX.
@@ -13,19 +13,18 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with pdfTeX; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+You should have received a copy of the GNU General Public License along
+with pdfTeX; if not, write to the Free Software Foundation, Inc., 51
+Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: //depot/Build/source.development/TeX/texk/web2c/pdftexdir/vfpacket.c#7 $
+$Id: vfpacket.c 200 2007-07-11 13:11:12Z oneiros $
*/
#include "ptexlib.h"
typedef struct {
- internalfontnumber font;
char *dataptr;
- int len;
+ integer len;
} packet_entry;
/* define packet_ptr, packet_array & packet_limit */
@@ -34,7 +33,7 @@ define_array(packet);
typedef struct {
char **data;
int *len;
- internalfontnumber font;
+ int char_count;
} vf_entry;
/* define vf_ptr, vf_array & vf_limit */
@@ -48,15 +47,15 @@ integer newvfpacket(internalfontnumber f)
alloc_array(vf, 1, SMALL_ARRAY_SIZE);
vf_ptr->len = xtalloc(n, int);
vf_ptr->data = xtalloc(n, char *);
+ vf_ptr->char_count = n;
for (i = 0; i < n; i++) {
vf_ptr->data[i] = NULL;
vf_ptr->len[i] = 0;
}
- vf_ptr->font = f;
return vf_ptr++ - vf_array;
}
-void storepacket(integer f, integer c, integer s)
+void storepacket(internalfontnumber f, eightbits c, strnumber s)
{
int l = strstart[s + 1] - strstart[s];
vf_array[vfpacketbase[f]].len[c - fontbc[f]] = l;
@@ -65,10 +64,21 @@ void storepacket(integer f, integer c, integer s)
(void *) (strpool + strstart[s]), (unsigned) l);
}
+void startpacket(internalfontnumber f, eightbits c)
+{
+ packet_data_ptr = vf_array[vfpacketbase[f]].data[c - fontbc[f]];
+ vfpacketlength = vf_array[vfpacketbase[f]].len[c - fontbc[f]];
+}
+
+eightbits packetbyte()
+{
+ vfpacketlength--;
+ return *packet_data_ptr++;
+}
+
void pushpacketstate()
{
alloc_array(packet, 1, SMALL_ARRAY_SIZE);
- packet_ptr->font = f;
packet_ptr->dataptr = packet_data_ptr;
packet_ptr->len = vfpacketlength;
packet_ptr++;
@@ -79,33 +89,18 @@ void poppacketstate()
if (packet_ptr == packet_array)
pdftex_fail("packet stack empty, impossible to pop");
packet_ptr--;
- f = packet_ptr->font;
packet_data_ptr = packet_ptr->dataptr;
vfpacketlength = packet_ptr->len;
}
-void startpacket(internalfontnumber f, integer c)
-{
- packet_data_ptr = vf_array[vfpacketbase[f]].data[c - fontbc[f]];
- vfpacketlength = vf_array[vfpacketbase[f]].len[c - fontbc[f]];
-}
-
-eightbits packetbyte()
-{
- vfpacketlength--;
- return *packet_data_ptr++;
-}
-
void vf_free(void)
{
vf_entry *v;
- int n;
char **p;
if (vf_array != NULL) {
for (v = vf_array; v < vf_ptr; v++) {
xfree(v->len);
- n = fontec[v->font] - fontbc[v->font] + 1;
- for (p = v->data; p - v->data < n; p++)
+ for (p = v->data; p - v->data < v->char_count; p++)
xfree(*p);
xfree(v->data);
}
@@ -113,3 +108,42 @@ void vf_free(void)
}
xfree(packet_array);
}
+
+/* this function was copied/borrowed/stolen from dvipdfm code */
+#define SIGNED_QUAD scaled
+#define fixword integer
+SIGNED_QUAD sqxfw(SIGNED_QUAD sq, fixword fw)
+{
+ int sign = 1;
+ unsigned long a, b, c, d, ad, bd, bc, ac;
+ unsigned long e, f, g, h, i, j, k;
+ unsigned long result;
+ /* Make positive. */
+ if (sq < 0) {
+ sign = -sign;
+ sq = -sq;
+ }
+ if (fw < 0) {
+ sign = -sign;
+ fw = -fw;
+ }
+ a = ((unsigned long) sq) >> 16u;
+ b = ((unsigned long) sq) & 0xffffu;
+ c = ((unsigned long) fw) >> 16u;
+ d = ((unsigned long) fw) & 0xffffu;
+ ad = a * d;
+ bd = b * d;
+ bc = b * c;
+ ac = a * c;
+ e = bd >> 16u;
+ f = ad >> 16u;
+ g = ad & 0xffffu;
+ h = bc >> 16u;
+ i = bc & 0xffffu;
+ j = ac >> 16u;
+ k = ac & 0xffffu;
+ result = (e + g + i + (1 << 3)) >> 4u; /* 1<<3 is for rounding */
+ result += (f + h + k) << 12u;
+ result += j << 28u;
+ return (sign > 0) ? result : -result;
+}
diff --git a/Build/source/texk/web2c/pdftexdir/writeenc.c b/Build/source/texk/web2c/pdftexdir/writeenc.c
index f4c299479d9..e420cf70d29 100644
--- a/Build/source/texk/web2c/pdftexdir/writeenc.c
+++ b/Build/source/texk/web2c/pdftexdir/writeenc.c
@@ -1,5 +1,5 @@
/*
-Copyright (c) 1996-2005 Han The Thanh, <thanh@pdftex.org>
+Copyright (c) 1996-2007 Han The Thanh, <thanh@pdftex.org>
This file is part of pdfTeX.
@@ -13,11 +13,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with pdfTeX; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+You should have received a copy of the GNU General Public License along
+with pdfTeX; if not, write to the Free Software Foundation, Inc., 51
+Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: writeenc.c,v 1.3 2005/12/26 14:20:13 hahe Exp hahe $
+$Id: writeenc.c 200 2007-07-11 13:11:12Z oneiros $
*/
#include "ptexlib.h"
@@ -93,7 +93,7 @@ void epdf_write_enc(char **glyph_names, integer fe_objnum)
assert(fe_objnum != 0);
pdfbegindict(fe_objnum, 1);
pdf_puts("/Type /Encoding\n");
- pdf_printf("/Differences [");
+ pdf_puts("/Differences [");
for (i = 0, i_old = -2; i < 256; i++)
if (glyph_names[i] != notdef) {
if (i == i_old + 1) /* no gap */
@@ -119,7 +119,7 @@ void write_enc(char **glyph_names, struct avl_table *tx_tree, integer fe_objnum)
assert(fe_objnum != 0);
pdfbegindict(fe_objnum, 1);
pdf_puts("/Type /Encoding\n");
- pdf_printf("/Differences [");
+ pdf_puts("/Differences [");
avl_t_init(&t, tx_tree);
for (i_old = -2, p = (int *) avl_t_first(&t, tx_tree); p != NULL;
p = (int *) avl_t_next(&t)) {
diff --git a/Build/source/texk/web2c/pdftexdir/writefont.c b/Build/source/texk/web2c/pdftexdir/writefont.c
index 3a7a13cd5d3..76e2a3a43ef 100644
--- a/Build/source/texk/web2c/pdftexdir/writefont.c
+++ b/Build/source/texk/web2c/pdftexdir/writefont.c
@@ -13,11 +13,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with pdfTeX; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+You should have received a copy of the GNU General Public License along
+with pdfTeX; if not, write to the Free Software Foundation, Inc., 51
+Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: writefont.c,v 1.3 2005/12/27 19:04:42 hahe Exp $
+$Id: writefont.c 200 2007-07-11 13:11:12Z oneiros $
*/
#include "ptexlib.h"
@@ -137,9 +137,32 @@ static void preset_fontmetrics(fd_entry * fd, internalfontnumber f)
fd->font_dim[i].set = true;
}
+static void fix_fontmetrics(fd_entry * fd)
+{
+ intparm *p = (intparm *) fd->font_dim;
+ if (!p[FONTBBOX1_CODE].set || !p[FONTBBOX2_CODE].set ||
+ !p[FONTBBOX3_CODE].set || !p[FONTBBOX4_CODE].set) {
+ pdftex_warn("font `%s' doesn't have a BoundingBox", fd->fm->ff_name);
+ return;
+ }
+ if (!p[ASCENT_CODE].set) {
+ p[ASCENT_CODE].val = p[FONTBBOX4_CODE].val;
+ p[ASCENT_CODE].set = true;
+ }
+ if (!p[DESCENT_CODE].set) {
+ p[DESCENT_CODE].val = p[FONTBBOX2_CODE].val;
+ p[DESCENT_CODE].set = true;
+ }
+ if (!p[CAPHEIGHT_CODE].set) {
+ p[CAPHEIGHT_CODE].val = p[FONTBBOX4_CODE].val;
+ p[CAPHEIGHT_CODE].set = true;
+ }
+}
+
static void write_fontmetrics(fd_entry * fd)
{
int i;
+ fix_fontmetrics(fd);
if (fd->font_dim[FONTBBOX1_CODE].set && fd->font_dim[FONTBBOX2_CODE].set
&& fd->font_dim[FONTBBOX3_CODE].set && fd->font_dim[FONTBBOX4_CODE].set)
pdf_printf("/%s [%i %i %i %i]\n", font_key[FONTBBOX1_CODE].pdfname,
@@ -413,8 +436,29 @@ static void write_fontfile(fd_entry * fd)
static void write_fontdescriptor(fd_entry * fd)
{
+ static const int std_flags[] = {
+ /* indices for << start with 0, but bits start with 1, so the numbers
+ * for << are 1 lower than the bits in table 5.20 */
+ /* *INDENT-OFF* */
+ 1 + 2 + (1 << 5), /* Courier */
+ 1 + 2 + (1 << 5) + (1 << 18),/* Courier-Bold */
+ 1 + 2 + (1 << 5) + (1 << 6), /* Courier-Oblique */
+ 1 + 2 + (1 << 5) + (1 << 6) + (1 << 18),/* Courier-BoldOblique */
+ (1 << 5), /* Helvetica */
+ (1 << 5) + (1 << 18),/* Helvetica-Bold */
+ (1 << 5) + (1 << 6), /* Helvetica-Oblique */
+ (1 << 5) + (1 << 6) + (1 << 18),/* Helvetica-BoldOblique */
+ 4, /* Symbol */
+ 2 + (1 << 5), /* Times-Roman */
+ 2 + (1 << 5) + (1 << 18),/* Times-Bold */
+ 2 + (1 << 5) + (1 << 6), /* Times-Italic */
+ 2 + (1 << 5) + (1 << 6) + (1 << 18),/* Times-BoldItalic */
+ 4 /* ZapfDingbats */
+ /* *INDENT-ON* */
+ };
char *glyph;
struct avl_traverser t;
+ int fd_flags;
assert(fd != NULL && fd->fm != NULL);
if (is_fontfile(fd->fm))
@@ -426,10 +470,21 @@ static void write_fontdescriptor(fd_entry * fd)
pdfbegindict(fd->fd_objnum, 1);
pdf_puts("/Type /FontDescriptor\n");
write_fontname(fd, "FontName");
- if (!fd->ff_found && fd->fm->fd_flags == 4)
- pdf_puts("/Flags 34\n"); /* assumes a roman sans serif font */
- else
- pdf_printf("/Flags %i\n", (int) fd->fm->fd_flags);
+ if (fd->fm->fd_flags != FD_FLAGS_NOT_SET_IN_MAPLINE)
+ fd_flags = (int) fd->fm->fd_flags;
+ else if (fd->ff_found)
+ fd_flags = FD_FLAGS_DEFAULT_EMBED;
+ else {
+ fd_flags = is_std_t1font(fd->fm)
+ ? std_flags[check_std_t1font(fd->fm->ps_name)]
+ : FD_FLAGS_DEFAULT_NON_EMBED;
+ pdftex_warn
+ ("No flags specified for non-embedded font `%s' (%s) (I'm using %i): "
+ "fix your map entry.",
+ fd->fm->ps_name != NULL ? fd->fm->ps_name : "No name given",
+ fd->fm->tfm_name, fd_flags);
+ }
+ pdf_printf("/Flags %i\n", fd_flags);
write_fontmetrics(fd);
if (fd->ff_found) {
if (is_subsetted(fd->fm) && is_type1(fd->fm)) {
@@ -617,3 +672,4 @@ void dopdffont(integer font_objnum, internalfontnumber f)
}
/**********************************************************************/
+// vim: ts=4
diff --git a/Build/source/texk/web2c/pdftexdir/writeimg.c b/Build/source/texk/web2c/pdftexdir/writeimg.c
index 1af5abec8a7..8bd1227c6df 100644
--- a/Build/source/texk/web2c/pdftexdir/writeimg.c
+++ b/Build/source/texk/web2c/pdftexdir/writeimg.c
@@ -13,11 +13,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with pdfTeX; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+You should have received a copy of the GNU General Public License along
+with pdfTeX; if not, write to the Free Software Foundation, Inc., 51
+Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: //depot/Build/source.development/TeX/texk/web2c/pdftexdir/writeimg.c#17 $
+$Id: writeimg.c 200 2007-07-11 13:11:12Z oneiros $
*/
#include "ptexlib.h"
@@ -283,6 +283,7 @@ integer readimage(strnumber s, integer page_num, strnumber page_name,
pdftex_fail("cannot find image file");
/* kpse_find_file perhaps changed the file name */
cur_file_name = img_name(img);
+ recorder_record_input(cur_file_name);
/* type checks */
checktypebyheader(img);
checktypebyextension(img);
@@ -314,7 +315,7 @@ integer readimage(strnumber s, integer page_num, strnumber page_name,
if (pdfversion < 4) {
pdftex_fail
("JBIG2 images only possible with at least PDF 1.4; you are generating PDF 1.%i",
- (int)pdfversion);
+ (int) pdfversion);
}
jbig2_ptr(img) = xtalloc(1, JBIG2_IMAGE_INFO);
img_type(img) = IMAGE_TYPE_JBIG2;
@@ -358,6 +359,8 @@ void writeimage(integer img)
void deleteimage(integer img)
{
+ if (iniversion)
+ return; // The image may be \dump{}ed to a format
switch (img_type(img)) {
case IMAGE_TYPE_PDF:
epdf_doc = pdf_ptr(img)->doc;
@@ -383,3 +386,162 @@ void img_free()
{
xfree(image_array);
}
+
+
+/* To allow the use of \pdfrefximage inside saved boxes in -ini mode,
+ * the information in the array has to be (un)dumped with the format.
+ * The next two routines take care of that.
+ *
+ * Most of the work involved in setting up the images is simply
+ * executed again. This solves the many possible errors resulting from
+ * the split in two separate runs.
+
+ * There was only one problem remaining: The pdfversion and
+ * pdfinclusionerrorlevel can have changed inbetween the call to
+ * readimage() and dump time. That is why they are passed as arguments
+ * to undumpimagemeta once more.
+ */
+
+/* some of the dumped values are really type int, not integer,
+ * but since the macro falls back to generic_dump anyway, that
+ * does not matter.
+ */
+
+#define dumpsizet generic_dump
+#define dumpinteger generic_dump
+
+#define undumpsizet generic_undump
+#define undumpinteger generic_undump
+
+/* (un)dumping a string means dumping the allocation size, followed
+ * by the bytes. The trailing \0 is dumped as well, because that
+ * makes the code simpler.
+ */
+
+#define dumpcharptr(a) \
+ do { \
+ integer x; \
+ if (a!=NULL) { \
+ x = strlen(a)+1; \
+ dumpinteger(x); dumpthings(*a, x); \
+ } else { \
+ x = 0; dumpinteger(x); \
+ } \
+ } while (0)
+
+#define undumpcharptr(s) \
+ do { \
+ integer x; \
+ char *a; \
+ undumpinteger (x); \
+ if (x>0) { \
+ a = malloc(x); \
+ undumpthings(*a,x); \
+ s = a ; \
+ } else { s = NULL; } \
+ } while (0)
+
+
+
+void dumpimagemeta()
+{
+ int cur_image, img;
+
+ dumpsizet(image_limit);
+ cur_image = (image_ptr - image_array);
+ dumpinteger(cur_image);
+
+ for (img = 0; img < cur_image; img++) {
+
+ dumpcharptr(img_name(img));
+ dumpinteger(img_type(img));
+ dumpinteger(img_color(img));
+ dumpinteger(img_width(img));
+ dumpinteger(img_height(img));
+ dumpinteger(img_xres(img));
+ dumpinteger(img_yres(img));
+ dumpinteger(img_pages(img));
+ dumpinteger(img_colorspace_ref(img));
+
+ /* the image_struct is not dumped at all, except for a few
+ variables that are needed to restore the contents */
+
+ if (img_type(img) == IMAGE_TYPE_PDF) {
+ dumpinteger(pdf_ptr(img)->page_box);
+ dumpinteger(pdf_ptr(img)->selected_page);
+ } else if (img_type(img) == IMAGE_TYPE_JBIG2) {
+ dumpinteger(jbig2_ptr(img)->selected_page);
+ }
+
+ }
+}
+
+void undumpimagemeta(integer pdfversion, integer pdfinclusionerrorlevel)
+{
+ int cur_image, img;
+
+ undumpsizet(image_limit);
+
+ image_array = xtalloc(image_limit, image_entry);
+ undumpinteger(cur_image);
+ image_ptr = image_array + cur_image;
+
+ for (img = 0; img < cur_image; img++) {
+ undumpcharptr(img_name(img));
+ undumpinteger(img_type(img));
+ undumpinteger(img_color(img));
+ undumpinteger(img_width(img));
+ undumpinteger(img_height(img));
+ undumpinteger(img_xres(img));
+ undumpinteger(img_yres(img));
+ undumpinteger(img_pages(img));
+ undumpinteger(img_colorspace_ref(img));
+
+ /* if img_name(img)==NULL -- which it shouldn't be -- the next line
+ will trigger an assertion failure. */
+ if (kpse_find_file(img_name(img), kpse_tex_format, true) == NULL)
+ pdftex_fail("cannot find image file %s", img_name(img));
+
+ switch (img_type(img)) {
+ case IMAGE_TYPE_PDF:
+ pdf_ptr(img) = xtalloc(1, pdf_image_struct);
+
+ undumpinteger(pdf_ptr(img)->page_box);
+ undumpinteger(pdf_ptr(img)->selected_page);
+
+ read_pdf_info(img_name(img), NULL, pdf_ptr(img)->selected_page,
+ pdf_ptr(img)->page_box, pdfversion,
+ pdfinclusionerrorlevel);
+
+ img_width(img) = bp2int(epdf_width);
+ img_height(img) = bp2int(epdf_height);
+ img_pages(img) = epdf_num_pages;
+ pdf_ptr(img)->orig_x = bp2int(epdf_orig_x);
+ pdf_ptr(img)->orig_y = bp2int(epdf_orig_y);
+ pdf_ptr(img)->doc = epdf_doc;
+ break;
+ case IMAGE_TYPE_PNG:
+ img_pages(img) = 1;
+ read_png_info(img);
+ break;
+ case IMAGE_TYPE_JPG:
+ jpg_ptr(img) = xtalloc(1, JPG_IMAGE_INFO);
+ img_pages(img) = 1;
+ read_jpg_info(img);
+ break;
+ case IMAGE_TYPE_JBIG2:
+ if (pdfversion < 4) {
+ pdftex_fail
+ ("JBIG2 images only possible with at least PDF 1.4; you are generating PDF 1.%i",
+ (int) pdfversion);
+ }
+ jbig2_ptr(img) = xtalloc(1, JBIG2_IMAGE_INFO);
+ img_type(img) = IMAGE_TYPE_JBIG2;
+ undumpinteger(jbig2_ptr(img)->selected_page);
+ read_jbig2_info(img);
+ break;
+ default:
+ pdftex_fail("unknown type of image");
+ }
+ }
+}
diff --git a/Build/source/texk/web2c/pdftexdir/writejbig2.c b/Build/source/texk/web2c/pdftexdir/writejbig2.c
index 15de6e101df..2f21e320771 100644
--- a/Build/source/texk/web2c/pdftexdir/writejbig2.c
+++ b/Build/source/texk/web2c/pdftexdir/writejbig2.c
@@ -1,5 +1,5 @@
/***********************************************************************
-Copyright (c) 2002-2006 Han The Thanh, <thanh@pdftex.org>
+Copyright (c) 2002-2007 Han The Thanh, <thanh@pdftex.org>
This file is part of pdfTeX.
@@ -14,8 +14,8 @@ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
-with pdfTeX; if not, write to the Free Software Foundation, Inc., 59
-Temple Place, Suite 330, Boston, MA 02111-1307 USA
+with pdfTeX; if not, write to the Free Software Foundation, Inc., 51
+Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
This is experimental JBIG2 image support to pdfTeX. JBIG2 image decoding
is part of Adobe PDF-1.4, and requires Acroread 5.0 or later.
@@ -75,7 +75,7 @@ object exists, reference it. Else create fresh one.
09 Dec. 2002: JBIG2 seg. page numbers > 0 are now set to 1, see PDF Ref.
-$Id: writejbig2.c,v 1.347 2006/05/31 19:18:32 hahe Exp hahe $
+$Id: writejbig2.c 200 2007-07-11 13:11:12Z oneiros $
***********************************************************************/
#include "writejbig2.h"
diff --git a/Build/source/texk/web2c/pdftexdir/writejbig2.h b/Build/source/texk/web2c/pdftexdir/writejbig2.h
index 90a211e1995..91ebe759d3e 100644
--- a/Build/source/texk/web2c/pdftexdir/writejbig2.h
+++ b/Build/source/texk/web2c/pdftexdir/writejbig2.h
@@ -1,5 +1,5 @@
/***********************************************************************
-Copyright (c) 2002-2006 Han The Thanh, <thanh@pdftex.org>
+Copyright (c) 2002-2007 Han The Thanh, <thanh@pdftex.org>
This file is part of pdfTeX.
@@ -14,13 +14,13 @@ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
-with pdfTeX; if not, write to the Free Software Foundation, Inc., 59
-Temple Place, Suite 330, Boston, MA 02111-1307 USA
+with pdfTeX; if not, write to the Free Software Foundation, Inc., 51
+Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
This is experimental JBIG2 image support to pdfTeX. JBIG2 image decoding
is part of Adobe PDF-1.4, and requires Acroread 5.0 or later.
-$Id: writejbig2.h,v 1.40 2006/05/31 19:18:51 hahe Exp hahe $
+$Id: writejbig2.h 200 2007-07-11 13:11:12Z oneiros $
***********************************************************************/
#include <stdlib.h>
diff --git a/Build/source/texk/web2c/pdftexdir/writejpg.c b/Build/source/texk/web2c/pdftexdir/writejpg.c
index 32778bb4eca..e7d5a9ee0a3 100644
--- a/Build/source/texk/web2c/pdftexdir/writejpg.c
+++ b/Build/source/texk/web2c/pdftexdir/writejpg.c
@@ -1,5 +1,5 @@
/*
-Copyright (c) 1996-2006 Han The Thanh, <thanh@pdftex.org>
+Copyright (c) 1996-2007 Han The Thanh, <thanh@pdftex.org>
This file is part of pdfTeX.
@@ -13,11 +13,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with pdfTeX; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+You should have received a copy of the GNU General Public License along
+with pdfTeX; if not, write to the Free Software Foundation, Inc., 51
+Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: //depot/Build/source.development/TeX/texk/web2c/pdftexdir/writejpg.c#10 $
+$Id: writejpg.c 200 2007-07-11 13:11:12Z oneiros $
*/
#include "ptexlib.h"
diff --git a/Build/source/texk/web2c/pdftexdir/writepng.c b/Build/source/texk/web2c/pdftexdir/writepng.c
index 54bd3ca4d57..85b93003271 100644
--- a/Build/source/texk/web2c/pdftexdir/writepng.c
+++ b/Build/source/texk/web2c/pdftexdir/writepng.c
@@ -1,5 +1,5 @@
/*
-Copyright (c) 1996-2004 Han The Thanh, <thanh@pdftex.org>
+Copyright (c) 1996-2007 Han The Thanh, <thanh@pdftex.org>
This file is part of pdfTeX.
@@ -13,11 +13,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with pdfTeX; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+You should have received a copy of the GNU General Public License along
+with pdfTeX; if not, write to the Free Software Foundation, Inc., 51
+Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: writepng.c,v 1.2 2006/01/06 22:35:43 hahe Exp hahe $
+$Id: writepng.c 200 2007-07-11 13:11:12Z oneiros $
*/
#include "ptexlib.h"
@@ -427,14 +427,15 @@ void copy_png(integer img)
pdftex_fail("writepng: fseek in PNG file failed");
}
} while (endflag == false);
- pdf_printf("/Length %d\n", streamlength);
- pdf_printf("/Filter /FlateDecode\n");
- pdf_printf("/DecodeParms << ");
- pdf_printf("/Colors %d ", png_info(img)->color_type == 2 ? 3 : 1);
- pdf_printf("/Columns %d ", (int) png_info(img)->width);
- pdf_printf("/BitsPerComponent %i ", (int) png_info(img)->bit_depth);
- pdf_printf("/Predictor %d ", 10); /* actual predictor defined on line basis */
- pdf_printf(">>\n>>\nstream\n");
+ pdf_printf("/Length %d\n"
+ "/Filter/FlateDecode\n"
+ "/DecodeParms<<"
+ "/Colors %d"
+ "/Columns %d"
+ "/BitsPerComponent %i"
+ "/Predictor 10>>\n>>\nstream\n", streamlength,
+ png_info(img)->color_type == 2 ? 3 : 1,
+ (int) png_info(img)->width, (int) png_info(img)->bit_depth);
/* 2nd pass to copy data */
endflag = false;
if (fseek(fp, 8, SEEK_SET) != 0)
diff --git a/Build/source/texk/web2c/pdftexdir/writet1.c b/Build/source/texk/web2c/pdftexdir/writet1.c
index 9d2bffb6276..923a0ca4ed2 100644
--- a/Build/source/texk/web2c/pdftexdir/writet1.c
+++ b/Build/source/texk/web2c/pdftexdir/writet1.c
@@ -1,5 +1,5 @@
/*
-Copyright (c) 1996-2006 Han The Thanh, <thanh@pdftex.org>
+Copyright (c) 1996-2007 Han The Thanh, <thanh@pdftex.org>
This file is part of pdfTeX.
@@ -13,11 +13,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with pdfTeX; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+You should have received a copy of the GNU General Public License along
+with pdfTeX; if not, write to the Free Software Foundation, Inc., 51
+Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: writet1.c,v 1.6 2006/12/12 20:38:11 hahe Exp hahe $
+$Id: writet1.c 200 2007-07-11 13:11:12Z oneiros $
*/
#include "ptexlib.h"
@@ -25,7 +25,7 @@ $Id: writet1.c,v 1.6 2006/12/12 20:38:11 hahe Exp hahe $
#include <kpathsea/c-proto.h>
#include <string.h>
-#define t1_log(s) tex_printf(s)
+#define t1_log(s) tex_printf("%s",s)
#define get_length1() t1_length1 = t1_offset() - t1_save_offset
#define get_length2() t1_length2 = t1_offset() - t1_save_offset
#define get_length3() t1_length3 = fixedcontent? t1_offset() - t1_save_offset : 0
@@ -245,7 +245,7 @@ char **load_enc_file(char *enc_name)
char **glyph_names;
set_cur_file_name(enc_name);
if (!enc_open()) {
- pdftex_warn("cannot open encoding file for reading");
+ pdftex_fail("cannot open encoding file for reading");
cur_file_name = NULL;
return NULL;
}
@@ -539,9 +539,7 @@ static void t1_check_block_len(boolean decrypt)
c = edecrypt(c);
l = t1_block_length;
if (!(l == 0 && (c == 10 || c == 13))) {
- pdftex_warn("%i bytes more than expected were ignored", l + 1);
- while (l-- > 0)
- t1_getbyte();
+ pdftex_fail("%i bytes more than expected", l + 1);
}
}
@@ -576,7 +574,7 @@ static void t1_stop_eexec(void)
if (last_hexbyte == 0)
t1_puts("00");
else
- pdftex_warn("unexpected data after eexec");
+ pdftex_fail("unexpected data after eexec");
}
}
t1_cs = false;
@@ -922,11 +920,12 @@ static boolean t1_open_fontfile(const char *open_name_prefix)
{
ff_entry *ff;
ff = check_ff_exist(fd_cur->fm->ff_name, is_truetype(fd_cur->fm));
- if (ff->ff_path != NULL)
+ if (ff->ff_path != NULL) {
t1_file = xfopen(cur_file_name = ff->ff_path, FOPEN_RBIN_MODE);
- else {
+ recorder_record_input(ff->ff_path);
+ } else {
set_cur_file_name(fd_cur->fm->ff_name);
- pdftex_warn("cannot open Type 1 font file for reading");
+ pdftex_fail("cannot open Type 1 font file for reading");
return false;
}
t1_init_params(open_name_prefix);
@@ -1032,8 +1031,8 @@ static boolean is_cc_init = false;
stack_ptr -= N
#define stack_error(N) { \
- pdftex_warn("CharString: invalid access (%i) to stack (%i entries)", \
- (int) N, (int)(stack_ptr - cc_stack)); \
+ pdftex_fail("CharString: invalid access (%i) to stack (%i entries)", \
+ (int) N, (int)(stack_ptr - cc_stack)); \
goto cs_error; \
}
@@ -1106,7 +1105,7 @@ static void cc_init(void)
#define mark_cs(s) cs_mark(s, 0)
__attribute__ ((format(printf, 3, 4)))
-static void cs_warn(const char *cs_name, int subr, const char *fmt, ...)
+static void cs_fail(const char *cs_name, int subr, const char *fmt, ...)
{
char buf[SMALL_BUF_SIZE];
va_list args;
@@ -1114,9 +1113,9 @@ static void cs_warn(const char *cs_name, int subr, const char *fmt, ...)
vsprintf(buf, fmt, args);
va_end(args);
if (cs_name == NULL)
- pdftex_warn("Subr (%i): %s", (int) subr, buf);
+ pdftex_fail("Subr (%i): %s", (int) subr, buf);
else
- pdftex_warn("CharString (/%s): %s", cs_name, buf);
+ pdftex_fail("CharString (/%s): %s", cs_name, buf);
}
static void cs_mark(const char *cs_name, int subr)
@@ -1188,22 +1187,22 @@ static void cs_mark(const char *cs_name, int subr)
cs_len--;
}
if (b >= CS_MAX) {
- cs_warn(cs_name, subr, "command value out of range: %i",
+ cs_fail(cs_name, subr, "command value out of range: %i",
(int) b);
goto cs_error;
}
cc = cc_tab + b;
if (!cc->valid) {
- cs_warn(cs_name, subr, "command not valid: %i", (int) b);
+ cs_fail(cs_name, subr, "command not valid: %i", (int) b);
goto cs_error;
}
if (cc->bottom) {
if (stack_ptr - cc_stack < cc->nargs)
- cs_warn(cs_name, subr,
+ cs_fail(cs_name, subr,
"less arguments on stack (%i) than required (%i)",
(int) (stack_ptr - cc_stack), (int) cc->nargs);
else if (stack_ptr - cc_stack > cc->nargs)
- cs_warn(cs_name, subr,
+ cs_fail(cs_name, subr,
"more arguments on stack (%i) than required (%i)",
(int) (stack_ptr - cc_stack), (int) cc->nargs);
}
@@ -1213,7 +1212,7 @@ static void cs_mark(const char *cs_name, int subr)
cc_pop(1);
mark_subr(a1);
if (!subr_tab[a1].valid) {
- cs_warn(cs_name, subr, "cannot call subr (%i)", (int) a1);
+ cs_fail(cs_name, subr, "cannot call subr (%i)", (int) a1);
goto cs_error;
}
break;
@@ -1384,7 +1383,8 @@ static void t1_read_subrs()
t1_getline();
while (!(t1_charstrings() || t1_subrs())) {
t1_scan_param();
- t1_putline();
+ if (!t1_prefix("/UniqueID")) /* ignore UniqueID for subsetted fonts */
+ t1_putline();
t1_getline();
}
found:
diff --git a/Build/source/texk/web2c/pdftexdir/writet3.c b/Build/source/texk/web2c/pdftexdir/writet3.c
index d50de0bb52f..b5ad919c709 100644
--- a/Build/source/texk/web2c/pdftexdir/writet3.c
+++ b/Build/source/texk/web2c/pdftexdir/writet3.c
@@ -1,5 +1,5 @@
/*
-Copyright (c) 1996-2006 Han The Thanh, <thanh@pdftex.org>
+Copyright (c) 1996-2007 Han The Thanh, <thanh@pdftex.org>
This file is part of pdfTeX.
@@ -13,11 +13,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with pdfTeX; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+You should have received a copy of the GNU General Public License along
+with pdfTeX; if not, write to the Free Software Foundation, Inc., 51
+Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: writet3.c,v 1.10 2005/12/26 14:26:18 hahe Exp hahe $
+$Id: writet3.c 200 2007-07-11 13:11:12Z oneiros $
*/
#include "ptexlib.h"
@@ -113,8 +113,7 @@ static void t3_write_glyph(internalfontnumber f)
"%i %i %i %i %i %i %i %i =", &glyph_index,
&width, &height, &depth, &llx, &lly, &urx, &ury) != 8) {
remove_eol(p, t3_line_array);
- pdftex_warn("invalid glyph preamble: `%s'", t3_line_array);
- return;
+ pdftex_fail("invalid glyph preamble: `%s'", t3_line_array);
}
if (glyph_index < fontbc[f] || glyph_index > fontec[f])
return;
@@ -193,11 +192,10 @@ static boolean writepk(internalfontnumber f)
if (name == NULL ||
!FILESTRCASEEQ(cur_file_name, font_ret.name) ||
!kpse_bitmap_tolerance((float) font_ret.dpi, (float) dpi)) {
- pdftex_warn("Font %s at %i not found", cur_file_name, (int) dpi);
- cur_file_name = NULL;
- return false;
+ pdftex_fail("Font %s at %i not found", cur_file_name, (int) dpi);
}
t3_file = xfopen(name, FOPEN_RBIN_MODE);
+ recorder_record_input(name);
t3_image_used = true;
is_pk_font = true;
tex_printf(" <%s", (char *) name);
@@ -290,10 +288,7 @@ void writet3(int objnum, internalfontnumber f)
sscanf(t3_line_array + strlen(t3_font_scale_str) + 1, "%g",
&t3_font_scale) < 1 || t3_font_scale <= 0
|| t3_font_scale > 1000) {
- pdftex_warn("missing or invalid font scale");
- t3_close();
- cur_file_name = NULL;
- return;
+ pdftex_fail("missing or invalid font scale");
}
while (!t3_eof())
t3_write_glyph(f);
diff --git a/Build/source/texk/web2c/pdftexdir/writettf.c b/Build/source/texk/web2c/pdftexdir/writettf.c
index 9de6fd54c6c..971b0b1c7e7 100644
--- a/Build/source/texk/web2c/pdftexdir/writettf.c
+++ b/Build/source/texk/web2c/pdftexdir/writettf.c
@@ -1,5 +1,5 @@
/*
-Copyright (c) 1996-2006 Han The Thanh, <thanh@pdftex.org>
+Copyright (c) 1996-2007 Han The Thanh, <thanh@pdftex.org>
This file is part of pdfTeX.
@@ -13,11 +13,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with pdfTeX; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+You should have received a copy of the GNU General Public License along
+with pdfTeX; if not, write to the Free Software Foundation, Inc., 51
+Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: //depot/Build/source.development/TeX/texk/web2c/pdftexdir/writettf.c#16 $
+$Id: writettf.c 200 2007-07-11 13:11:12Z oneiros $
*/
#include "ptexlib.h"
@@ -302,7 +302,9 @@ static void ttf_copy_encoding(void)
e = ttfenc_tab + *q;
e->code = charcodes[*q];
if (e->code == -1)
- pdftex_warn("character %i is not mapped to any charcode", *q);
+ pdftex_warn
+ ("character %i in subfont %s is not mapped to any charcode",
+ *q, fd_cur->fm->tfm_name);
else {
assert(e->code < 0x10000);
sprintf(buf, "/c%4.4X", (int) e->code);
@@ -1335,9 +1337,7 @@ void writettf(fd_entry * fd)
set_cur_file_name(fd_cur->fm->ff_name);
if (is_subsetted(fd_cur->fm) && (fd_cur->fe == NULL)
&& !is_subfont(fd_cur->fm)) {
- pdftex_warn("Subset TrueType must be a reencoded or a subfont");
- cur_file_name = NULL;
- return;
+ pdftex_fail("Subset TrueType must be a reencoded or a subfont");
}
if (!ttf_open()) {
pdftex_fail("cannot open TrueType font file for reading");
diff --git a/Build/source/texk/web2c/pdftexdir/writettf.h b/Build/source/texk/web2c/pdftexdir/writettf.h
index e80ae7c3e7d..33a0a215806 100644
--- a/Build/source/texk/web2c/pdftexdir/writettf.h
+++ b/Build/source/texk/web2c/pdftexdir/writettf.h
@@ -1,5 +1,5 @@
/*
-Copyright (c) 1996-2006 Han The Thanh, <thanh@pdftex.org>
+Copyright (c) 1996-2007 Han The Thanh, <thanh@pdftex.org>
This file is part of pdfTeX.
@@ -13,11 +13,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with pdfTeX; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+You should have received a copy of the GNU General Public License along
+with pdfTeX; if not, write to the Free Software Foundation, Inc., 51
+Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: //depot/Build/source.development/TeX/texk/web2c/pdftexdir/writettf.h#1 $
+$Id: writettf.h 200 2007-07-11 13:11:12Z oneiros $
*/
typedef signed char TTF_CHAR;
diff --git a/Build/source/texk/web2c/pdftexdir/writezip.c b/Build/source/texk/web2c/pdftexdir/writezip.c
index a24d7fffdd1..0ae328dd316 100644
--- a/Build/source/texk/web2c/pdftexdir/writezip.c
+++ b/Build/source/texk/web2c/pdftexdir/writezip.c
@@ -1,5 +1,5 @@
/*
-Copyright (c) 1996-2002 Han The Thanh, <thanh@pdftex.org>
+Copyright (c) 1996-2007 Han The Thanh, <thanh@pdftex.org>
This file is part of pdfTeX.
@@ -13,11 +13,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with pdfTeX; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+You should have received a copy of the GNU General Public License along
+with pdfTeX; if not, write to the Free Software Foundation, Inc., 51
+Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: writezip.c,v 1.2 2006/01/14 20:35:43 hahe Exp $
+$Id: writezip.c 200 2007-07-11 13:11:12Z oneiros $
*/
#include "ptexlib.h"
@@ -26,26 +26,42 @@ $Id: writezip.c,v 1.2 2006/01/14 20:35:43 hahe Exp $
#define ZIP_BUF_SIZE 32768
-#define check_err(f, fn) \
- if (f != Z_OK) \
- pdftex_fail("zlib: %s() failed", fn)
+#define check_err(f, fn) \
+ if (f != Z_OK) \
+ pdftex_fail("zlib: %s() failed (error code %d)", fn, f)
-static char zipbuf[ZIP_BUF_SIZE];
+static char *zipbuf = NULL;
static z_stream c_stream; /* compression stream */
void writezip(boolean finish)
{
int err;
- assert(getpdfcompresslevel() > 0);
+ static int level_old = 0;
+ int level = getpdfcompresslevel();
+ assert(level > 0);
cur_file_name = NULL;
if (pdfstreamlength == 0) {
- c_stream.zalloc = (alloc_func) 0;
- c_stream.zfree = (free_func) 0;
- c_stream.opaque = (voidpf) 0;
- check_err(deflateInit(&c_stream, getpdfcompresslevel()), "deflateInit");
+ if (zipbuf == NULL) {
+ zipbuf = xtalloc(ZIP_BUF_SIZE, char);
+ c_stream.zalloc = (alloc_func) 0;
+ c_stream.zfree = (free_func) 0;
+ c_stream.opaque = (voidpf) 0;
+ check_err(deflateInit(&c_stream, level), "deflateInit");
+ } else {
+ if (level != level_old) { /* \pdfcompresslevel change in mid document */
+ check_err(deflateEnd(&c_stream), "deflateEnd");
+ c_stream.zalloc = (alloc_func) 0; /* these 3 lines no need, just to be safe */
+ c_stream.zfree = (free_func) 0;
+ c_stream.opaque = (voidpf) 0;
+ check_err(deflateInit(&c_stream, level), "deflateInit");
+ } else
+ check_err(deflateReset(&c_stream), "deflateReset");
+ }
+ level_old = level;
c_stream.next_out = (Bytef *) zipbuf;
c_stream.avail_out = ZIP_BUF_SIZE;
}
+ assert(zipbuf != NULL);
c_stream.next_in = pdfbuf;
c_stream.avail_in = pdfptr;
for (;;) {
@@ -68,8 +84,15 @@ void writezip(boolean finish)
xfwrite(zipbuf, 1, ZIP_BUF_SIZE - c_stream.avail_out, pdffile);
pdflastbyte = zipbuf[ZIP_BUF_SIZE - c_stream.avail_out - 1];
}
- check_err(deflateEnd(&c_stream), "deflateEnd");
xfflush(pdffile);
}
pdfstreamlength = c_stream.total_out;
}
+
+void zip_free(void)
+{
+ if (zipbuf != NULL) {
+ check_err(deflateEnd(&c_stream), "deflateEnd");
+ free(zipbuf);
+ }
+}