summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir/font
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/font')
-rw-r--r--Build/source/texk/web2c/luatexdir/font/dofont.w35
-rw-r--r--Build/source/texk/web2c/luatexdir/font/luafont.w221
-rw-r--r--Build/source/texk/web2c/luatexdir/font/luatexfont.h8
-rw-r--r--Build/source/texk/web2c/luatexdir/font/mapfile.w44
-rw-r--r--Build/source/texk/web2c/luatexdir/font/pkin.w38
-rw-r--r--Build/source/texk/web2c/luatexdir/font/sfnt.w23
-rw-r--r--Build/source/texk/web2c/luatexdir/font/subfont.w18
-rw-r--r--Build/source/texk/web2c/luatexdir/font/texfont.h6
-rw-r--r--Build/source/texk/web2c/luatexdir/font/texfont.w17
-rw-r--r--Build/source/texk/web2c/luatexdir/font/tfmofm.w26
-rw-r--r--Build/source/texk/web2c/luatexdir/font/tounicode.w55
-rw-r--r--Build/source/texk/web2c/luatexdir/font/tt_glyf.w26
-rw-r--r--Build/source/texk/web2c/luatexdir/font/tt_table.w21
-rw-r--r--Build/source/texk/web2c/luatexdir/font/vfovf.w26
-rw-r--r--Build/source/texk/web2c/luatexdir/font/vfpacket.w363
-rw-r--r--Build/source/texk/web2c/luatexdir/font/writecff.w89
-rw-r--r--Build/source/texk/web2c/luatexdir/font/writeenc.w49
-rw-r--r--Build/source/texk/web2c/luatexdir/font/writefont.w235
-rw-r--r--Build/source/texk/web2c/luatexdir/font/writet1.w16
-rw-r--r--Build/source/texk/web2c/luatexdir/font/writet3.w152
-rw-r--r--Build/source/texk/web2c/luatexdir/font/writettf.w28
-rw-r--r--Build/source/texk/web2c/luatexdir/font/writetype0.w35
-rw-r--r--Build/source/texk/web2c/luatexdir/font/writetype2.w100
23 files changed, 883 insertions, 748 deletions
diff --git a/Build/source/texk/web2c/luatexdir/font/dofont.w b/Build/source/texk/web2c/luatexdir/font/dofont.w
index 57e35858102..059f5a4fb71 100644
--- a/Build/source/texk/web2c/luatexdir/font/dofont.w
+++ b/Build/source/texk/web2c/luatexdir/font/dofont.w
@@ -1,31 +1,30 @@
% dofont.w
%
-% Copyright 2006-2010 Taco Hoekwater <taco@@luatex.org>
+% Copyright 2006-2010 Taco Hoekwater <taco@@luatex.org>
%
-% This file is part of LuaTeX.
+% This file is part of LuaTeX.
%
-% LuaTeX 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.
+% LuaTeX 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.
%
-% LuaTeX is distributed in the hope that it will be useful, but WITHOUT
-% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-% FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
-% License for more details.
+% LuaTeX is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+% License for more details.
%
-% You should have received a copy of the GNU General Public License along
-% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
+% You should have received a copy of the GNU General Public License along
+% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
@ @c
-#include "ptexlib.h"
+static const char _svn_version[] =
+ "$Id: dofont.w 4524 2012-12-20 15:38:02Z taco $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/dofont.w $";
+#include "ptexlib.h"
#include "lua/luatex-api.h"
-static const char _svn_version[] =
- "$Id: dofont.w 3584 2010-04-02 17:45:55Z hhenkel $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/dofont.w $";
-
@ a bit more interfacing is needed for proper error reporting
@c
@@ -69,7 +68,7 @@ static int do_define_font(int f, const char *cnom, scaled s, int natural_dir)
destroy_saved_callback(callback_id);
/* |lua_pop(Luas, 1);| *//* done by |font_from_lua| */
} else if (lua_isnumber(Luas, -1)) {
- lua_number2int(r, lua_tonumber(Luas, -1));
+ r=(int)lua_tonumber(Luas, -1);
destroy_saved_callback(callback_id);
delete_font(f);
lua_pop(Luas, 1);
diff --git a/Build/source/texk/web2c/luatexdir/font/luafont.w b/Build/source/texk/web2c/luatexdir/font/luafont.w
index 181e825847c..02113a4ff3b 100644
--- a/Build/source/texk/web2c/luatexdir/font/luafont.w
+++ b/Build/source/texk/web2c/luatexdir/font/luafont.w
@@ -1,26 +1,26 @@
% luafont.w
%
-% Copyright 2006-2010 Taco Hoekwater <taco@@luatex.org>
+% Copyright 2006-2011 Taco Hoekwater <taco@@luatex.org>
%
-% This file is part of LuaTeX.
+% This file is part of LuaTeX.
%
-% LuaTeX 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.
+% LuaTeX 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.
%
-% LuaTeX is distributed in the hope that it will be useful, but WITHOUT
-% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-% FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
-% License for more details.
+% LuaTeX is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+% License for more details.
%
-% You should have received a copy of the GNU General Public License along
-% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
+% You should have received a copy of the GNU General Public License along
+% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
@ @c
static const char _svn_version[] =
- "$Id: luafont.w 4125 2011-04-11 09:06:59Z taco $ "
-"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/luafont.w $";
+ "$Id: luafont.w 4524 2012-12-20 15:38:02Z taco $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/luafont.w $";
#include "ptexlib.h"
#include "lua/luatex-api.h"
@@ -156,7 +156,6 @@ static void dump_math_kerns(lua_State * L, charinfo * co, int l, int id)
static void font_char_to_lua(lua_State * L, internal_font_number f, charinfo * co)
{
- int i, j;
liginfo *l;
kerninfo *ki;
@@ -273,6 +272,7 @@ static void font_char_to_lua(lua_State * L, internal_font_number f, charinfo * c
}
ki = get_charinfo_kerns(co);
if (ki != NULL) {
+ int i;
lua_pushstring(L, "kerns");
lua_createtable(L, 10, 1);
for (i = 0; !kern_end(ki[i]); i++) {
@@ -288,6 +288,7 @@ static void font_char_to_lua(lua_State * L, internal_font_number f, charinfo * c
}
l = get_charinfo_ligatures(co);
if (l != NULL) {
+ int i;
lua_pushstring(L, "ligatures");
lua_createtable(L, 10, 1);
for (i = 0; !lig_end(l[i]); i++) {
@@ -309,7 +310,8 @@ static void font_char_to_lua(lua_State * L, internal_font_number f, charinfo * c
}
lua_newtable(L);
-
+ {
+ int i, j;
i = get_charinfo_math_kerns(co, top_right_kern);
j = 0;
if (i > 0) {
@@ -343,7 +345,7 @@ static void font_char_to_lua(lua_State * L, internal_font_number f, charinfo * c
lua_setfield(L, -2, "mathkern");
else
lua_pop(L, 1);
-
+ }
}
static void write_lua_parameters(lua_State * L, int f)
@@ -468,7 +470,7 @@ int font_to_lua(lua_State * L, int f)
/* pdf parameters */
/* skip the first four for now, that are very much interal */
-#if 0
+#if 0
if (pdf_font_num(f) != 0) {
lua_pushnumber(L,pdf_font_num(f));
lua_setfield(L,-2,"pdf_num");
@@ -570,16 +572,29 @@ static int count_hash_items(lua_State * L, int name_index)
@ @c
#define streq(a,b) (strcmp(a,b)==0)
-#define append_packet(k) { cpackets[np++] = (eight_bits)(k); }
+#define append_packet(k) { *(cp++) = (eight_bits) (k); }
-#define do_store_four(l) { \
- append_packet((l&0xFF000000)>>24); \
- append_packet((l&0x00FF0000)>>16); \
- append_packet((l&0x0000FF00)>>8); \
- append_packet((l&0x000000FF)); }
+#define do_store_four(l) { \
+ append_packet((l & 0xFF000000) >> 24); \
+ append_packet((l & 0x00FF0000) >> 16); \
+ append_packet((l & 0x0000FF00) >> 8); \
+ append_packet((l & 0x000000FF)); \
+}
-/*
-*/
+@ @c
+static void append_float(eight_bits ** cpp, float a)
+{
+ unsigned int i;
+ eight_bits *cp = *cpp;
+ union U {
+ float a;
+ eight_bits b[sizeof(float)];
+ } u;
+ u.a = a;
+ for (i = 0; i < sizeof(float); i++)
+ append_packet(u.b[i]);
+ *cpp = cp;
+}
#define lua_roundnumber(a,b) (int)floor((double)lua_tonumber(L,-1)+0.5)
@@ -617,7 +632,7 @@ static int enum_field(lua_State * L, const char *name, int dflt,
lua_pushstring(L, name);
lua_rawget(L, -2);
if (lua_isnumber(L, -1)) {
- lua_number2int(i, lua_tonumber(L, -1));
+ i=(int)lua_tonumber(L, -1);
} else if (lua_isstring(L, -1)) {
s = lua_tostring(L, -1);
k = 0;
@@ -757,6 +772,8 @@ make_luaS_index(horiz_variants);
make_luaS_index(vert_variants);
make_luaS_index(mathkern);
make_luaS_index(commands);
+make_luaS_index(scale);
+make_luaS_index(lua);
static void init_font_string_pointers(lua_State * L)
{
@@ -817,7 +834,8 @@ static void init_font_string_pointers(lua_State * L)
init_luaS_index(vert_variants);
init_luaS_index(mathkern);
init_luaS_index(commands);
-
+ init_luaS_index(scale);
+ init_luaS_index(lua);
}
static int count_char_packet_bytes(lua_State * L)
@@ -825,7 +843,7 @@ static int count_char_packet_bytes(lua_State * L)
register int i;
register int l = 0;
int ff = 0;
- for (i = 1; i <= (int) lua_objlen(L, -1); i++) {
+ for (i = 1; i <= (int) lua_rawlen(L, -1); i++) {
lua_rawgeti(L, -1, i);
if (lua_istable(L, -1)) {
lua_rawgeti(L, -1, 1);
@@ -849,10 +867,12 @@ static int count_char_packet_bytes(lua_State * L)
l++;
} else if (luaS_ptr_eq(s, rule)) {
l += 9;
- } else if (luaS_ptr_eq(s, right) ||
- luaS_ptr_eq(s, node) || luaS_ptr_eq(s, down)) {
+ } else if (luaS_ptr_eq(s, right) || luaS_ptr_eq(s, node)
+ || luaS_ptr_eq(s, down) || luaS_ptr_eq(s, image)) {
l += 5;
- } else if (luaS_ptr_eq(s, special)) {
+ } else if (luaS_ptr_eq(s, scale)) {
+ l += sizeof(float) + 1;
+ } else if (luaS_ptr_eq(s, special) || luaS_ptr_eq(s, lua)) {
size_t len;
lua_rawgeti(L, -2, 2);
if (lua_isstring(L, -1)) {
@@ -860,13 +880,11 @@ static int count_char_packet_bytes(lua_State * L)
lua_pop(L, 1);
if (len > 0) {
l = (int) (l + 5 + (int) len);
- }
+ }
} else {
lua_pop(L, 1);
fprintf(stdout, "invalid packet special!\n");
}
- } else if (luaS_ptr_eq(s, image)) {
- l += 5;
} else {
fprintf(stdout, "unknown packet command %s!\n", s);
}
@@ -880,8 +898,6 @@ static int count_char_packet_bytes(lua_State * L)
return l;
}
-
-
static scaled sp_to_dvi(halfword sp, halfword atsize)
{
double result, mult;
@@ -898,9 +914,8 @@ read_char_packets(lua_State * L, int *l_fonts, charinfo * co, int atsize)
size_t l;
int cmd;
const char *s;
- eight_bits *cpackets;
+ eight_bits *cpackets, *cp;
int ff = 0;
- int np = 0;
int max_f = 0;
int pc = count_char_packet_bytes(L);
if (pc <= 0)
@@ -910,8 +925,8 @@ read_char_packets(lua_State * L, int *l_fonts, charinfo * co, int atsize)
while (l_fonts[(max_f + 1)] != 0)
max_f++;
- cpackets = xmalloc((unsigned) (pc + 1));
- for (i = 1; i <= (int) lua_objlen(L, -1); i++) {
+ cp = cpackets = xmalloc((unsigned) (pc + 1));
+ for (i = 1; i <= (int) lua_rawlen(L, -1); i++) {
lua_rawgeti(L, -1, i);
if (lua_istable(L, -1)) {
/* fetch the command code */
@@ -958,6 +973,10 @@ read_char_packets(lua_State * L, int *l_fonts, charinfo * co, int atsize)
cmd = packet_special_code;
} else if (luaS_ptr_eq(s, image)) {
cmd = packet_image_code;
+ } else if (luaS_ptr_eq(s, scale)) {
+ cmd = packet_scale_code;
+ } else if (luaS_ptr_eq(s, lua)) {
+ cmd = packet_lua_code;
}
switch (cmd) {
@@ -1006,6 +1025,7 @@ read_char_packets(lua_State * L, int *l_fonts, charinfo * co, int atsize)
lua_pop(L, 2);
break;
case packet_special_code:
+ case packet_lua_code:
append_packet(cmd);
lua_rawgeti(L, -2, 2);
s = luaL_checklstring(L, -1, &l);
@@ -1032,22 +1052,24 @@ read_char_packets(lua_State * L, int *l_fonts, charinfo * co, int atsize)
lua_call(L, 1, 1);
} /* img ... */
luaL_checkudata(L, -1, TYPE_IMG); /* img ... --- just typecheck */
- n = luaL_ref(L, LUA_GLOBALSINDEX); /* ... */
+ n = luaL_ref(L, LUA_REGISTRYINDEX); /* ... */
do_store_four(n);
break;
case packet_nop_code:
break;
+ case packet_scale_code:
+ append_packet(cmd);
+ lua_rawgeti(L, -2, 2);
+ append_float(&cp, (float) luaL_checknumber(L, -1));
+ lua_pop(L, 1);
+ break;
default:
- fprintf(stdout,
- "Unknown char packet code %s (char %d in font %s)\n",
- s, (int) c, font_name(f));
+ fprintf(stdout, "Unknown char packet code %s\n", s);
}
}
lua_pop(L, 1); /* command code */
} else {
- fprintf(stdout,
- "Found a `commands' item that is not a table (char %d in font %s)\n",
- (int) c, font_name(f));
+ fprintf(stdout, "Found a `commands' item that is not a table\n");
}
lua_pop(L, 1); /* command table */
}
@@ -1056,7 +1078,6 @@ read_char_packets(lua_State * L, int *l_fonts, charinfo * co, int atsize)
return;
}
-
@ @c
static void read_lua_cidinfo(lua_State * L, int f)
{
@@ -1089,7 +1110,7 @@ static void read_lua_parameters(lua_State * L, int f)
lua_pushnil(L); /* first key */
while (lua_next(L, -2) != 0) {
if (lua_isnumber(L, -2)) {
- lua_number2int(i, lua_tonumber(L, -2));
+ i=(int)lua_tonumber(L, -2);
if (i > n)
n = i;
}
@@ -1149,11 +1170,11 @@ static void read_lua_math_parameters(lua_State * L, int f)
lua_pushnil(L);
while (lua_next(L, -2) != 0) {
if (lua_isnumber(L, -2)) {
- lua_number2int(i, lua_tonumber(L, -2));
+ i=(int)lua_tonumber(L, -2);
} else if (lua_isstring(L, -2)) {
i = ff_checkoption(L, -2, NULL, MATH_param_names);
}
- lua_number2int(n, lua_tonumber(L, -1));
+ n=(int)lua_tonumber(L, -1);
if (i > 0) {
set_font_math_param(f, i, n);
}
@@ -1171,13 +1192,13 @@ static void store_math_kerns(lua_State * L, charinfo * co, int id)
{
int l, k, i;
scaled ht, krn;
- if (lua_istable(L, -1) && ((k = (int) lua_objlen(L, -1)) > 0)) {
+ if (lua_istable(L, -1) && ((k = (int) lua_rawlen(L, -1)) > 0)) {
for (l = 0; l < k; l++) {
lua_rawgeti(L, -1, (l + 1));
if (lua_istable(L, -1)) {
lua_getfield(L, -1, "height");
if (lua_isnumber(L, -1)) {
- lua_number2int(i, lua_tonumber(L, -1));
+ i=(int)lua_tonumber(L, -1);
ht = (scaled) i;
} else {
ht = MIN_INF;
@@ -1185,7 +1206,7 @@ static void store_math_kerns(lua_State * L, charinfo * co, int id)
lua_pop(L, 1);
lua_getfield(L, -1, "kern");
if (lua_isnumber(L, -1)) {
- lua_number2int(i, lua_tonumber(L, -1));
+ i=(int)lua_tonumber(L, -1);
krn = (scaled) i;
} else {
krn = MIN_INF;
@@ -1369,7 +1390,7 @@ font_char_from_lua(lua_State * L, internal_font_number f, int i,
while (lua_next(L, -2) != 0) {
k = non_boundarychar;
if (lua_isnumber(L, -2)) {
- lua_number2int(k, lua_tonumber(L, -2)); /* adjacent char */
+ k=(int)lua_tonumber(L, -2); /* adjacent char */
if (k < 0)
k = non_boundarychar;
} else if (lua_isstring(L, -2)) {
@@ -1431,7 +1452,7 @@ font_char_from_lua(lua_State * L, internal_font_number f, int i,
while (lua_next(L, -2) != 0) {
k = non_boundarychar;
if (lua_isnumber(L, -2)) {
- lua_number2int(k, lua_tonumber(L, -2)); /* adjacent char */
+ k=(int)lua_tonumber(L, -2); /* adjacent char */
if (k < 0) {
k = non_boundarychar;
}
@@ -1478,7 +1499,7 @@ font_char_from_lua(lua_State * L, internal_font_number f, int i,
-@ The caller has to fix the state of the lua stack when there is an error!
+@ The caller has to fix the state of the lua stack when there is an error!
@c
int font_from_lua(lua_State * L, int f)
@@ -1592,7 +1613,7 @@ int font_from_lua(lua_State * L, int f)
if (lua_istable(L, -1)) {
lua_getfield(L, -1, "id");
if (lua_isnumber(L, -1)) {
- lua_number2int(l_fonts[i], lua_tonumber(L, -1));
+ l_fonts[i]=(int)lua_tonumber(L, -1);
lua_pop(L, 2); /* pop id and entry */
continue;
}
@@ -1681,16 +1702,16 @@ int font_from_lua(lua_State * L, int f)
lua_pushnil(L); /* first key */
while (lua_next(L, -2) != 0) {
if (lua_isnumber(L, -2)) {
- lua_number2int(i, lua_tonumber(L, -2));
+ i=(int)lua_tonumber(L, -2);
if (i >= 0) {
font_char_from_lua(L, f, i, l_fonts, !no_math);
}
} else if (lua_isstring(L, -2)) {
- const char *ss = lua_tostring(L, -2);
- if (luaS_ptr_eq(ss, left_boundary)) {
+ const char *ss1 = lua_tostring(L, -2);
+ if (luaS_ptr_eq(ss1, left_boundary)) {
font_char_from_lua(L, f, left_boundarychar, l_fonts,
!no_math);
- } else if (luaS_ptr_eq(ss, right_boundary)) {
+ } else if (luaS_ptr_eq(ss1, right_boundary)) {
font_char_from_lua(L, f, right_boundarychar, l_fonts,
!no_math);
}
@@ -1770,55 +1791,55 @@ int font_from_lua(lua_State * L, int f)
assert((vlink_no_break(a)==null && tlink_no_break(a)==null) || \
tail_of_list(vlink_no_break(a))==tlink_no_break(a));
-static void nesting_append(halfword nest, halfword newn)
+static void nesting_append(halfword nest1, halfword newn)
{
- halfword tail = tlink(nest);
- assert(alink(nest) == null);
+ halfword tail = tlink(nest1);
+ assert(alink(nest1) == null);
assert(vlink(newn) == null);
assert(alink(newn) == null);
if (tail == null) {
- assert(vlink(nest) == null);
- couple_nodes(nest, newn);
+ assert(vlink(nest1) == null);
+ couple_nodes(nest1, newn);
} else {
assert(vlink(tail) == null);
- assert(tail_of_list(vlink(nest)) == tail);
+ assert(tail_of_list(vlink(nest1)) == tail);
couple_nodes(tail, newn);
}
- tlink(nest) = newn;
+ tlink(nest1) = newn;
}
-static void nesting_prepend(halfword nest, halfword newn)
+static void nesting_prepend(halfword nest1, halfword newn)
{
- halfword head = vlink(nest);
- assert(alink(nest) == null);
+ halfword head = vlink(nest1);
+ assert(alink(nest1) == null);
assert(vlink(newn) == null);
assert(alink(newn) == null);
- couple_nodes(nest, newn);
+ couple_nodes(nest1, newn);
if (head == null) {
- assert(tlink(nest) == null);
- tlink(nest) = newn;
+ assert(tlink(nest1) == null);
+ tlink(nest1) = newn;
} else {
- assert(alink(head) == nest);
- assert(tail_of_list(head) == tlink(nest));
+ assert(alink(head) == nest1);
+ assert(tail_of_list(head) == tlink(nest1));
couple_nodes(newn, head);
}
}
-static void nesting_prepend_list(halfword nest, halfword newn)
+static void nesting_prepend_list(halfword nest1, halfword newn)
{
- halfword head = vlink(nest);
- assert(alink(nest) == null);
+ halfword head = vlink(nest1);
+ assert(alink(nest1) == null);
assert(alink(newn) == null);
- couple_nodes(nest, newn);
+ couple_nodes(nest1, newn);
if (head == null) {
- assert(tlink(nest) == null);
- tlink(nest) = tail_of_list(newn);
+ assert(tlink(nest1) == null);
+ tlink(nest1) = tail_of_list(newn);
} else {
halfword tail = tail_of_list(newn);
- assert(alink(head) == nest);
- assert(tail_of_list(head) == tlink(nest));
+ assert(alink(head) == nest1);
+ assert(tail_of_list(head) == tlink(nest1));
couple_nodes(tail, head);
}
}
@@ -2137,9 +2158,9 @@ static halfword handle_lig_word(halfword cur)
/* Building an |init_disc| followed by a |select_disc|
\.{{a-}{b}{AB} {-}{}{}} 'c'
*/
- halfword last = vlink(next), tail;
+ halfword last1 = vlink(next), tail;
uncouple_node(next);
- try_couple_nodes(fwd, last);
+ try_couple_nodes(fwd, last1);
/* \.{{a-}{b}{AB} {-}{c}{}} */
nesting_append(post_break(fwd), copy_node(next));
/* \.{{a-}{b}{AB} {-}{c}{-}} */
@@ -2194,17 +2215,17 @@ static halfword handle_lig_word(halfword cur)
return cur;
}
-@ Return value is the new tail, head should be a dummy
+@ Return value is the new tail, head should be a dummy
@c
halfword handle_ligaturing(halfword head, halfword tail)
{
- halfword save_tail; /* trick to allow explicit |node==null| tests */
+ halfword save_tail1; /* trick to allow explicit |node==null| tests */
halfword cur, prev;
if (vlink(head) == null)
return tail;
- save_tail = vlink(tail);
+ save_tail1 = vlink(tail);
vlink(tail) = null;
/* |if (fix_node_lists)| */
@@ -2226,8 +2247,8 @@ halfword handle_ligaturing(halfword head, halfword tail)
if (prev == null)
prev = tail;
- if (valid_node(save_tail)) {
- try_couple_nodes(prev, save_tail);
+ if (valid_node(save_tail1)) {
+ try_couple_nodes(prev, save_tail1);
}
return prev;
}
@@ -2421,17 +2442,17 @@ halfword new_ligkern(halfword head, halfword tail)
if (tail == null)
tail = tail_of_list(head);
} else if (callback_id == 0) {
- halfword nest = new_node(nesting_node, 1);
+ halfword nest1 = new_node(nesting_node, 1);
halfword cur = vlink(head);
halfword aft = vlink(tail);
- couple_nodes(nest, cur);
- tlink(nest) = tail;
+ couple_nodes(nest1, cur);
+ tlink(nest1) = tail;
vlink(tail) = null;
- do_handle_kerning(nest, null, null);
- couple_nodes(head, vlink(nest));
- tail = tlink(nest);
+ do_handle_kerning(nest1, null, null);
+ couple_nodes(head, vlink(nest1));
+ tail = tlink(nest1);
try_couple_nodes(tail, aft);
- flush_node(nest);
+ flush_node(nest1);
}
return tail;
}
diff --git a/Build/source/texk/web2c/luatexdir/font/luatexfont.h b/Build/source/texk/web2c/luatexdir/font/luatexfont.h
index 15c48c7f50b..9ed5664b59e 100644
--- a/Build/source/texk/web2c/luatexdir/font/luatexfont.h
+++ b/Build/source/texk/web2c/luatexdir/font/luatexfont.h
@@ -1,6 +1,6 @@
/* luatexfont.h --- General font definitions
- Copyright 2008-2010 Taco Hoekwater <taco@luatex.org>
+ Copyright 2008-2011 Taco Hoekwater <taco@luatex.org>
This file is part of LuaTeX.
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License along
with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */
-/* $Id: luatexfont.h 3790 2010-08-02 20:00:17Z oneiros $ */
+/* $Id: luatexfont.h 4341 2011-07-28 21:24:31Z hhenkel $ */
#ifndef LUATEXFONT_H
# define LUATEXFONT_H
@@ -150,6 +150,10 @@ void replace_packet_fonts(internal_font_number f, int *old_fontid,
int *new_fontid, int count);
int *packet_local_fonts(internal_font_number f, int *num);
+int packet_cur_s; /* current |do_vf_packet()| recursion level */
+int packet_stack_ptr; /* pointer into |packet_stack| */
+vf_struct *new_vfstruct(void);
+
/* writecff.c */
void writetype1w(PDF pdf, fd_entry * fd);
diff --git a/Build/source/texk/web2c/luatexdir/font/mapfile.w b/Build/source/texk/web2c/luatexdir/font/mapfile.w
index 413e7832f78..499e25d0dfe 100644
--- a/Build/source/texk/web2c/luatexdir/font/mapfile.w
+++ b/Build/source/texk/web2c/luatexdir/font/mapfile.w
@@ -1,27 +1,27 @@
-@ @c
-/* mapfile.c
-
- Copyright 1996-2006 Han The Thanh <thanh@@pdftex.org>
- Copyright 2006-2010 Taco Hoekwater <taco@@luatex.org>
-
- This file is part of LuaTeX.
-
- LuaTeX 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.
-
- LuaTeX is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- License for more details.
-
- You should have received a copy of the GNU General Public License along
- with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */
+% mapfile.w
+%
+% Copyright 1996-2006 Han The Thanh <thanh@@pdftex.org>
+% Copyright 2006-2010 Taco Hoekwater <taco@@luatex.org>
+%
+% This file is part of LuaTeX.
+%
+% LuaTeX 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.
+%
+% LuaTeX is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU General Public License along
+% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
+@ @c
static const char _svn_version[] =
- "$Id: mapfile.w 3786 2010-08-02 15:25:12Z taco $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/mapfile.w $";
+ "$Id: mapfile.w 4442 2012-05-25 22:40:34Z hhenkel $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/mapfile.w $";
#include <math.h>
#include "ptexlib.h"
diff --git a/Build/source/texk/web2c/luatexdir/font/pkin.w b/Build/source/texk/web2c/luatexdir/font/pkin.w
index 19e6b5db48d..b46a0b430b0 100644
--- a/Build/source/texk/web2c/luatexdir/font/pkin.w
+++ b/Build/source/texk/web2c/luatexdir/font/pkin.w
@@ -1,22 +1,22 @@
-% pkin.w
-%
-% Copyright 1996-2006 Han The Thanh <thanh@@pdftex.org>
-% Copyright 2006-2008 Taco Hoekwater <taco@@luatex.org>
+% pkin.w
%
-% This file is part of LuaTeX.
+% Copyright 1996-2006 Han The Thanh <thanh@@pdftex.org>
+% Copyright 2006-2008 Taco Hoekwater <taco@@luatex.org>
%
-% LuaTeX 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.
+% This file is part of LuaTeX.
%
-% LuaTeX is distributed in the hope that it will be useful, but WITHOUT
-% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-% FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
-% License for more details.
+% LuaTeX 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.
%
-% You should have received a copy of the GNU General Public License along
-% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
+% LuaTeX is distributed in the hope that it will be useful, but WITHOUT
+% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+% FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+% License for more details.
+%
+% You should have received a copy of the GNU General Public License along
+% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
@
NAME
@@ -47,14 +47,14 @@ Piet Tutelaers <rcpt@@urc.tue.nl>
Modified for use with pdftex by Han The Thanh <thanh@@fi.muni.cz>.
@c
+static const char _svn_version[] =
+ "$Id: pkin.w 4442 2012-05-25 22:40:34Z hhenkel $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/pkin.w $";
+
#include "ptexlib.h"
typedef short shalfword;
-static const char _svn_version[] =
- "$Id: pkin.w 3584 2010-04-02 17:45:55Z hhenkel $"
- "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/pkin.w $";
-
@
Now we have some routines to get stuff from the pk file. pkbyte returns
the next byte from the pk file.
diff --git a/Build/source/texk/web2c/luatexdir/font/sfnt.w b/Build/source/texk/web2c/luatexdir/font/sfnt.w
index 26653508b0f..ace1b82233d 100644
--- a/Build/source/texk/web2c/luatexdir/font/sfnt.w
+++ b/Build/source/texk/web2c/luatexdir/font/sfnt.w
@@ -1,26 +1,29 @@
% sfnt.w
-%
+%
% Copyright 2002 by Jin-Hwan Cho and Shunsaku Hirata,
% the dvipdfmx project team <dvipdfmx@@project.ktug.or.kr>
% Copyright 2006-2008 Taco Hoekwater <taco@@luatex.org>
-
+%
% This file is part of LuaTeX.
-
+%
% LuaTeX 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.
-
+%
% LuaTeX is distributed in the hope that it will be useful, but WITHOUT
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
% FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
% License for more details.
-
+%
% You should have received a copy of the GNU General Public License along
% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
@ Based on dvipdfmx-0.13.2c
@c
+static const char _svn_version[] =
+ "$Id: sfnt.w 4457 2012-07-13 13:16:19Z taco $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/sfnt.w $";
#if HAVE_CONFIG_H
# include <w2c/config.h>
@@ -31,12 +34,6 @@
# include "ptexlib.h"
#include "font/sfnt.h"
-static const char _svn_version[] =
- "$Id: sfnt.w 3765 2010-07-29 07:10:21Z taco $ "
-"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/sfnt.w $";
-
-
-
@ type:
`true' (0x74727565): TrueType (Mac)
@@ -56,14 +53,14 @@ static const char _svn_version[] =
#define SFNT_POSTSCRIPT 0x4f54544fUL
#define SFNT_TTC 0x74746366UL
-sfnt *sfnt_open(unsigned char *buffer, int buflen)
+sfnt *sfnt_open(unsigned char *buff, int buflen)
{
sfnt *sfont;
ULONG type;
sfont = xmalloc(sizeof(sfnt));
sfont->loc = 0;
- sfont->buffer = buffer;
+ sfont->buffer = buff;
sfont->buflen = buflen;
type = sfnt_get_ulong(sfont);
diff --git a/Build/source/texk/web2c/luatexdir/font/subfont.w b/Build/source/texk/web2c/luatexdir/font/subfont.w
index fced62d248e..8cb31b28097 100644
--- a/Build/source/texk/web2c/luatexdir/font/subfont.w
+++ b/Build/source/texk/web2c/luatexdir/font/subfont.w
@@ -1,31 +1,31 @@
% subfont.w
-%
+%
% Copyright 2005-2006 Han The Thanh <thanh@@pdftex.org>
% Copyright 2006-2008 Taco Hoekwater <taco@@luatex.org>
-
+%
% This file is part of LuaTeX.
-
+%
% LuaTeX 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.
-
+%
% LuaTeX is distributed in the hope that it will be useful, but WITHOUT
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
% FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
% License for more details.
-
+%
% You should have received a copy of the GNU General Public License along
% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
@ @c
+static const char _svn_version[] =
+ "$Id: subfont.w 4442 2012-05-25 22:40:34Z hhenkel $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/subfont.w $";
+
#include "ptexlib.h"
#include <string.h>
-static const char _svn_version[] =
- "$Id: subfont.w 3786 2010-08-02 15:25:12Z taco $ "
-"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/subfont.w $";
-
@ @c
static struct avl_table *sfd_tree = NULL;
diff --git a/Build/source/texk/web2c/luatexdir/font/texfont.h b/Build/source/texk/web2c/luatexdir/font/texfont.h
index 5c33c20af81..bb783f35df8 100644
--- a/Build/source/texk/web2c/luatexdir/font/texfont.h
+++ b/Build/source/texk/web2c/luatexdir/font/texfont.h
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License along
with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */
-/* $Id: texfont.h 3853 2010-09-03 18:05:14Z oneiros $ */
+/* $Id: texfont.h 4576 2013-02-08 20:42:57Z hhenkel $ */
/* Here we have the interface to LuaTeX's font system, as seen from the
main pascal program. There is a companion list in luatex.defines to
@@ -599,7 +599,9 @@ typedef enum { packet_char_code,
packet_rule_code,
packet_node_code,
packet_nop_code,
- packet_end_code
+ packet_end_code,
+ packet_scale_code,
+ packet_lua_code,
} packet_command_codes;
extern scaled store_scaled_f(scaled sq, int fw);
diff --git a/Build/source/texk/web2c/luatexdir/font/texfont.w b/Build/source/texk/web2c/luatexdir/font/texfont.w
index 85c02131933..3ac8be176ad 100644
--- a/Build/source/texk/web2c/luatexdir/font/texfont.w
+++ b/Build/source/texk/web2c/luatexdir/font/texfont.w
@@ -1,23 +1,22 @@
-% texfont.w
-
+% texfont.w
+%
% Copyright 2006-2010 Taco Hoekwater <taco@@luatex.org>
-
+%
% This file is part of LuaTeX.
-
+%
% LuaTeX 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.
-
+%
% LuaTeX is distributed in the hope that it will be useful, but WITHOUT
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
% FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
% License for more details.
-
+%
% You should have received a copy of the GNU General Public License along
% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
-
@* Main font API implementation for the original pascal parts.
Stuff to watch out for:
@@ -33,8 +32,8 @@ problematic |if 0 != null|.
@c
static const char _svn_version[] =
- "$Id: texfont.w 3997 2010-11-28 10:37:21Z taco $ "
-"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/texfont.w $";
+ "$Id: texfont.w 4576 2013-02-08 20:42:57Z hhenkel $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/texfont.w $";
#include "ptexlib.h"
#include "lua/luatex-api.h"
diff --git a/Build/source/texk/web2c/luatexdir/font/tfmofm.w b/Build/source/texk/web2c/luatexdir/font/tfmofm.w
index 6a3e77d78d1..23749b2fcea 100644
--- a/Build/source/texk/web2c/luatexdir/font/tfmofm.w
+++ b/Build/source/texk/web2c/luatexdir/font/tfmofm.w
@@ -1,28 +1,28 @@
% tfmofm.w
-%
-% Copyright 2006-2010 Taco Hoekwater <taco@@luatex.org>
-
+%
+% Copyright 2006-2012 Taco Hoekwater <taco@@luatex.org>
+%
% This file is part of LuaTeX.
-
+%
% LuaTeX 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.
-
+%
% LuaTeX is distributed in the hope that it will be useful, but WITHOUT
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
% FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
% License for more details.
-
+%
% You should have received a copy of the GNU General Public License along
-% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
+% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
@ @c
-#include "ptexlib.h"
-
static const char _svn_version[] =
- "$Id: tfmofm.w 3635 2010-04-19 20:07:44Z oneiros $ "
-"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/tfmofm.w $";
+ "$Id: tfmofm.w 4442 2012-05-25 22:40:34Z hhenkel $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/tfmofm.w $";
+
+#include "ptexlib.h"
@ Here are some macros that help process ligatures and kerns
@c
@@ -578,7 +578,7 @@ int read_tfm_info(internal_font_number f, const char *cnom, scaled s)
int a, b, c=0, d=0; /* byte variables */
int i; /* counter */
int font_level, header_length;
- int nco, ncw, npc, nlw, neew;
+ int ncw, nlw, neew;
tfmcharacterinfo ci;
charinfo *co;
four_quarters qw;
@@ -630,9 +630,7 @@ int read_tfm_info(internal_font_number f, const char *cnom, scaled s)
set_font_area(f, NULL);
/* Read the {\.{TFM}} size fields */
- nco = 0;
ncw = 0;
- npc = 0;
read_sixteen(first_two);
if (first_two != 0) {
font_level = -1;
diff --git a/Build/source/texk/web2c/luatexdir/font/tounicode.w b/Build/source/texk/web2c/luatexdir/font/tounicode.w
index 9647d9e049c..471b4a34909 100644
--- a/Build/source/texk/web2c/luatexdir/font/tounicode.w
+++ b/Build/source/texk/web2c/luatexdir/font/tounicode.w
@@ -1,29 +1,29 @@
% tounicode.w
-
+%
% Copyright 2006 Han The Thanh, <thanh@@pdftex.org>
% Copyright 2006-2010 Taco Hoekwater <taco@@luatex.org>
-
+%
% This file is part of LuaTeX.
-
+%
% LuaTeX 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.
-
+%
% LuaTeX is distributed in the hope that it will be useful, but WITHOUT
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
% FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
% License for more details.
-
+%
% You should have received a copy of the GNU General Public License along
% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
@ @c
-#include "ptexlib.h"
-
static const char _svn_version[] =
- "$Id: tounicode.w 3967 2010-11-24 13:41:45Z taco $ "
-"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/tounicode.w $";
+ "$Id: tounicode.w 4599 2013-03-19 15:41:07Z taco $"
+ "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/tounicode.w $";
+
+#include "ptexlib.h"
@ @c
#define isXdigit(c) (isdigit(c) || ('A' <= (c) && (c) <= 'F'))
@@ -174,27 +174,6 @@ static long check_unicode_value(char *s, boolean multiple_value)
return code;
}
-@ @c
-static char *utf16be_str(long code)
-{
- static char buf[SMALL_BUF_SIZE];
- long v;
- unsigned vh, vl;
-
- assert(code >= 0);
-
- if (code <= 0xFFFF)
- sprintf(buf, "%04lX", code);
- else {
- v = code - 0x10000;
- vh = (unsigned) (v / 0x400 + 0xD800);
- vl = (unsigned) (v % 0x400 + 0xDC00);
- sprintf(buf, "%04X%04X", vh, vl);
- }
- return buf;
-}
-
-
@ This function set proper values to |*gp| based on |s|; in case it returns
|gp->code == UNI_EXTRA_STRING| then the caller is responsible for freeing
|gp->unicode_seq| too.
@@ -343,8 +322,11 @@ int write_tounicode(PDF pdf, char **glyph_names, char *name)
else
strcat(buf, builtin_suffix); /* ".enc" not present, this is a builtin
encoding so the name is eg "cmr10-builtin" */
- objnum = pdf_new_objnum(pdf);
- pdf_begin_dict(pdf, objnum, 0);
+ objnum = pdf_create_obj(pdf, obj_type_others, 0);
+ pdf_begin_obj(pdf, objnum, OBJSTM_NEVER);
+ pdf_begin_dict(pdf);
+ pdf_dict_add_streaminfo(pdf);
+ pdf_end_dict(pdf);
pdf_begin_stream(pdf);
pdf_printf(pdf, "%%!PS-Adobe-3.0 Resource-CMap\n"@/
"%%%%DocumentNeededResources: ProcSet (CIDInit)\n"@/
@@ -467,6 +449,7 @@ int write_tounicode(PDF pdf, char **glyph_names, char *name)
"CMapName currentdict /CMap defineresource pop\n"
"end\n" "end\n" "%%%%EndResource\n" "%%%%EOF\n");
pdf_end_stream(pdf);
+ pdf_end_obj(pdf);
return objnum;
}
@@ -487,8 +470,11 @@ int write_cid_tounicode(PDF pdf, fo_entry * fo, internal_font_number f)
(fo->fd->subset_tag != NULL ? fo->fd->subset_tag : "UCS"),
fo->fd->fontname);
- objnum = pdf_new_objnum(pdf);
- pdf_begin_dict(pdf, objnum, 0);
+ objnum = pdf_create_obj(pdf, obj_type_others, 0);
+ pdf_begin_obj(pdf, objnum, OBJSTM_NEVER);
+ pdf_begin_dict(pdf);
+ pdf_dict_add_streaminfo(pdf);
+ pdf_end_dict(pdf);
pdf_begin_stream(pdf);
pdf_printf(pdf, "%%!PS-Adobe-3.0 Resource-CMap\n"@/
"%%%%DocumentNeededResources: ProcSet (CIDInit)\n"@/
@@ -624,5 +610,6 @@ int write_cid_tounicode(PDF pdf, fo_entry * fo, internal_font_number f)
"CMapName currentdict /CMap defineresource pop\n"
"end\n" "end\n" "%%%%EndResource\n" "%%%%EOF\n");
pdf_end_stream(pdf);
+ pdf_end_obj(pdf);
return objnum;
}
diff --git a/Build/source/texk/web2c/luatexdir/font/tt_glyf.w b/Build/source/texk/web2c/luatexdir/font/tt_glyf.w
index f0774647fe1..0b6dc9b6665 100644
--- a/Build/source/texk/web2c/luatexdir/font/tt_glyf.w
+++ b/Build/source/texk/web2c/luatexdir/font/tt_glyf.w
@@ -1,27 +1,31 @@
% tt_glyf.w
-%
+%
% Copyright 2002 by Jin-Hwan Cho and Shunsaku Hirata,
% the dvipdfmx project team <dvipdfmx@@project.ktug.or.kr>
-% Copyright 2006-2010 Taco Hoekwater <taco@@luatex.org>
-
+% Copyright 2006-2012 Taco Hoekwater <taco@@luatex.org>
+%
% This file is part of LuaTeX.
-
+%
% LuaTeX 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.
-
+%
% LuaTeX is distributed in the hope that it will be useful, but WITHOUT
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
% FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
% License for more details.
-
+%
% You should have received a copy of the GNU General Public License along
-% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
+% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
@* Subsetting glyf, updating loca, hmtx, etc.
@ @c
+static const char _svn_version[] =
+ "$Id: tt_glyf.w 4457 2012-07-13 13:16:19Z taco $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/tt_glyf.w $";
+
#include "ptexlib.h"
#include "font/sfnt.h"
@@ -29,10 +33,6 @@
#include "font/tt_glyf.h"
#include "font/writettf.h"
-static const char _svn_version[] =
- "$Id: tt_glyf.w 3584 2010-04-02 17:45:55Z hhenkel $ "
-"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/tt_glyf.w $";
-
@ @c
#define NUM_GLYPH_LIMIT 65534
#define TABLE_DATA_ALLOC_SIZE 40960
@@ -594,7 +594,7 @@ int tt_get_metrics(sfnt * sfont, struct tt_glyphs *g)
for (i = 0; i < g->num_glyphs; i++) {
USHORT gid; /* old gid */
ULONG loc, len;
- SHORT number_of_contours;
+ //SHORT number_of_contours;
gid = g->gd[i].ogid;
if (gid >= maxp->numGlyphs)
@@ -627,7 +627,7 @@ int tt_get_metrics(sfnt * sfont, struct tt_glyphs *g)
}
sfnt_seek_set(sfont, (long) (offset + loc));
- number_of_contours = sfnt_get_short(sfont);
+ /*number_of_contours = */(void)sfnt_get_short(sfont);
/* BoundingBox: FWord x 4 */
g->gd[i].llx = sfnt_get_short(sfont);
diff --git a/Build/source/texk/web2c/luatexdir/font/tt_table.w b/Build/source/texk/web2c/luatexdir/font/tt_table.w
index f53e2659336..051ce62eb6b 100644
--- a/Build/source/texk/web2c/luatexdir/font/tt_table.w
+++ b/Build/source/texk/web2c/luatexdir/font/tt_table.w
@@ -1,35 +1,34 @@
% tt_table.w
-%
+%
% Copyright 2002 by Jin-Hwan Cho and Shunsaku Hirata,
% the dvipdfmx project team <dvipdfmx@@project.ktug.or.kr>
% Copyright 2006-2010 Taco Hoekwater <taco@@luatex.org>
-
+%
% This file is part of LuaTeX.
-
+%
% LuaTeX 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.
-
+%
% LuaTeX is distributed in the hope that it will be useful, but WITHOUT
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
% FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
% License for more details.
-
+%
% You should have received a copy of the GNU General Public License along
-% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
+% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
@ @c
-#include <stdio.h>
+static const char _svn_version[] =
+ "$Id: tt_table.w 4442 2012-05-25 22:40:34Z hhenkel $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/tt_table.w $";
+#include <stdio.h>
#include "ptexlib.h"
#include "font/sfnt.h"
#include "font/tt_table.h"
-static const char _svn_version[] =
- "$Id: tt_table.w 3584 2010-04-02 17:45:55Z hhenkel $ "
-"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/tt_table.w $";
-
@ tables contains information refered by other tables
|maxp->numGlyphs, etc --> loca, etc|
diff --git a/Build/source/texk/web2c/luatexdir/font/vfovf.w b/Build/source/texk/web2c/luatexdir/font/vfovf.w
index 2448b1d732c..c0fa3b88fd1 100644
--- a/Build/source/texk/web2c/luatexdir/font/vfovf.w
+++ b/Build/source/texk/web2c/luatexdir/font/vfovf.w
@@ -1,29 +1,29 @@
% vfovf.w
-
+%
% Copyright 1996-2006 Han The Thanh <thanh@@pdftex.org>
-% Copyright 2006-2009 Taco Hoekwater <taco@@luatex.org>
-
+% Copyright 2006-2012 Taco Hoekwater <taco@@luatex.org>
+%
% This file is part of LuaTeX.
-
+%
% LuaTeX 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.
-
+%
% LuaTeX is distributed in the hope that it will be useful, but WITHOUT
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
% FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
% License for more details.
-
+%
% You should have received a copy of the GNU General Public License along
% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
@ @c
-#include "ptexlib.h"
-
static const char _svn_version[] =
- "$Id: vfovf.w 3898 2010-09-22 06:03:03Z taco $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/vfovf.w $";
+ "$Id: vfovf.w 4442 2012-05-25 22:40:34Z hhenkel $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/vfovf.w $";
+
+#include "ptexlib.h"
@ @c
/* this is a hack! */
@@ -149,7 +149,7 @@ boolean auto_expand_vf(internal_font_number f); /* forward */
vf_z = vf_z / 2; \
vf_alpha += vf_alpha; \
} \
- vf_beta = (char)(256 / vf_alpha); \
+ /*vf_beta = (char)(256 / vf_alpha);*/ \
vf_alpha = (vf_alpha * vf_z); \
}
@@ -671,7 +671,7 @@ void do_vf(internal_font_number f)
vf_stack_index stack_level;
int vf_z; /* multiplier */
int vf_alpha; /* correction for negative values */
- char vf_beta; /* divisor */
+ //char vf_beta; /* divisor */
int vf_np;
eight_bits *vpackets;
memory_word tmp_w; /* accumulator */
@@ -1059,7 +1059,7 @@ int make_vf_table(lua_State * L, const char *cnom, scaled atsize)
vf_stack_index stack_level;
int vf_z; /* multiplier */
int vf_alpha; /* correction for negative values */
- char vf_beta; /* divisor */
+ //char vf_beta; /* divisor */
eight_bits *s;
scaled h, v;
scaled w, x, y, z;
diff --git a/Build/source/texk/web2c/luatexdir/font/vfpacket.w b/Build/source/texk/web2c/luatexdir/font/vfpacket.w
index f26b774721d..bcb6ea52f28 100644
--- a/Build/source/texk/web2c/luatexdir/font/vfpacket.w
+++ b/Build/source/texk/web2c/luatexdir/font/vfpacket.w
@@ -1,224 +1,254 @@
% vfpacket.w
-
+%
% Copyright 1996-2006 Han The Thanh <thanh@@pdftex.org>
% Copyright 2006-2011 Taco Hoekwater <taco@@luatex.org>
-
+%
% This file is part of LuaTeX.
-
+%
% LuaTeX 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.
-
+%
% LuaTeX is distributed in the hope that it will be useful, but WITHOUT
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
% FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
% License for more details.
-
+%
% You should have received a copy of the GNU General Public License along
% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
@ @c
-#include "ptexlib.h"
-
static const char _svn_version[] =
- "$Id: vfpacket.w 4098 2011-04-07 21:01:11Z hhenkel $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/vfpacket.w $";
-
-
-@ 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 font; in such cases |do_vf_packet| calls itself
- recursively. The recursion level, i.e., the number of times this has
- happened, is kept in the global variable |packet_cur_s| and should
- not exceed |packet_max_recursion|.
-
-@c
-#define packet_max_recursion 100
-
-typedef unsigned char packet_stack_index; /* an index into the stack */
-
-typedef struct packet_stack_record {
- scaled stack_h;
- scaled stack_v;
-} packet_stack_record;
-
-
-static packet_stack_index packet_cur_s = 0; /* current recursion level */
-static packet_stack_record packet_stack[packet_max_recursion];
-static packet_stack_index packet_stack_ptr = 0; /* pointer into |packet_stack| */
+ "$Id: vfpacket.w 4442 2012-05-25 22:40:34Z hhenkel $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/vfpacket.w $";
+#include "ptexlib.h"
-@ Some macros for processing character packets.
+@ Some macros for processing character packets.
@c
-#define do_packet_byte() vf_packets[cur_packet_byte++]
-
-#define packet_number(fw) { \
- fw = do_packet_byte(); \
- fw = fw*256 + do_packet_byte(); \
- fw = fw*256 + do_packet_byte(); \
- fw = fw*256 + do_packet_byte(); }
+#define packet_number(fw) { \
+ fw = *(vfp++); \
+ fw = fw * 256 + *(vfp++); \
+ fw = fw * 256 + *(vfp++); \
+ fw = fw * 256 + *(vfp++); \
+}
-#define packet_scaled(a,fs) { int fw; \
- fw = do_packet_byte(); \
- if (fw>127) fw = fw - 256; \
- fw = fw*256 + do_packet_byte(); \
- fw = fw*256 + do_packet_byte(); \
- fw = fw*256 + do_packet_byte(); \
- a = store_scaled_f(fw, fs); }
+#define packet_scaled(a, fs) { \
+ int fw; \
+ fw = *(vfp++); \
+ if (fw > 127) \
+ fw = fw - 256; \
+ fw = fw * 256 + *(vfp++); \
+ fw = fw * 256 + *(vfp++); \
+ fw = fw * 256 + *(vfp++); \
+ a = store_scaled_f(fw, fs); \
+}
+@ @c
+vf_struct *new_vfstruct(void)
+{
+ vf_struct *vp = (vf_struct *) xmalloc(sizeof(vf_struct));
+ vp->packet_stack_level = vp->packet_stack_minlevel = 0;
+ vp->packet_stack =
+ (packet_stack_record *) xmalloc(packet_stack_size *
+ sizeof(packet_stack_record));
+ vp->lf = 0;
+ vp->fs_f = 0;
+ vp->packet_cur_s = 0;
+ vp->refpos = NULL;
+ vp->vflua = false;
+ return vp;
+}
-@ count the number of bytes in a command packet
+@ Count the number of bytes in a command packet.
@c
int vf_packet_bytes(charinfo * co)
{
- eight_bits *vf_packets;
- int cur_packet_byte;
+ eight_bits *vf_packets, *vfp;
unsigned k;
int cmd;
- vf_packets = get_charinfo_packets(co);
+ vfp = vf_packets = get_charinfo_packets(co);
if (vf_packets == NULL) {
return 0;
}
- cur_packet_byte = 0;
- while ((cmd = vf_packets[cur_packet_byte]) != packet_end_code) {
- cur_packet_byte++;
+ while ((cmd = *(vfp++)) != packet_end_code) {
switch (cmd) {
+ case packet_nop_code:
+ case packet_pop_code:
+ case packet_push_code:
+ break;
case packet_char_code:
- case packet_font_code:
- case packet_right_code:
case packet_down_code:
+ case packet_font_code:
+ case packet_image_code:
case packet_node_code:
- cur_packet_byte += 4;
- break;
- case packet_push_code:
- case packet_pop_code:
+ case packet_right_code:
+ vfp += 4;
break;
case packet_rule_code:
- cur_packet_byte += 8;
+ vfp += 8;
break;
case packet_special_code:
packet_number(k); /* +4 */
- cur_packet_byte = (cur_packet_byte + (int) k);
- break;
- case packet_image_code:
- cur_packet_byte += 4;
- break;
- case packet_nop_code:
+ vfp += (int) k;
break;
default:
pdf_error("vf", "invalid DVI command (1)");
}
};
- return (cur_packet_byte + 1);
+ return (vfp - vf_packets);
}
-
-@ typeset the \.{DVI} commands in the
- character packet for character |c| in current font |f|
+@ Typeset the \.{DVI} commands in the character packet
+ for character |c| in current font |f|.
@c
const char *packet_command_names[] = {
"char", "font", "pop", "push", "special", "image",
- "right", "down", "rule", "node", "nop", "end", NULL
+ "right", "down", "rule", "node", "nop", "end", "scale", "lua", NULL
};
+@ @c
+static float packet_float(eight_bits ** vfpp)
+{
+ unsigned int i;
+ union U {
+ float a;
+ eight_bits b[sizeof(float)];
+ } u;
+ eight_bits *vfp = *vfpp;
+ for (i = 0; i < sizeof(float); i++)
+ u.b[i] = *(vfp++);
+ *vfpp = vfp;
+ return u.a;
+}
+@ 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 font; in such cases |do_vf_packet| calls itself
+ recursively. The recursion level, i.e., the number of times this has
+ happened, is kept in the global variable |packet_cur_s| and should
+ not exceed |packet_max_recursion|.
+@c
void do_vf_packet(PDF pdf, internal_font_number vf_f, int c)
{
- internal_font_number lf;
- charinfo *co;
- scaledpos cur = { 0, 0 }, size;
- eight_bits *vf_packets;
- int cur_packet_byte;
- int cmd, fs_f;
- scaled i;
+ eight_bits *vfp;
+ posstructure *save_posstruct, localpos;
+ vf_struct *save_vfstruct, localvfstruct, *vp;
+ int cmd;
unsigned k;
+ scaledpos size;
+ scaled i;
str_number s;
+ float f;
+ packet_stack_record *mat_p;
- posstructure localpos; /* the position structure local within this function */
- posstructure *refpos; /* the list origin pos. on the page, provided by the caller */
+ vfp = get_charinfo_packets(get_charinfo(vf_f, c));
+ assert(vfp != NULL);
- lf = 0; /* for -Wall */
- packet_cur_s++;
- if (packet_cur_s >= packet_max_recursion)
- overflow("max level recursion of virtual fonts", packet_max_recursion);
- co = get_charinfo(vf_f, c);
- vf_packets = get_charinfo_packets(co);
- if (vf_packets == NULL) {
- packet_cur_s--;
- return;
- }
-
- refpos = pdf->posstruct;
+ save_posstruct = pdf->posstruct;
pdf->posstruct = &localpos; /* use local structure for recursion */
- localpos.pos = refpos->pos;
+ localpos.pos = save_posstruct->pos;
localpos.dir = dir_TLT; /* invariably for vf */
- cur_packet_byte = 0;
- fs_f = font_size(vf_f);
- while ((cmd = vf_packets[cur_packet_byte]) != packet_end_code) {
- cur_packet_byte++;
+ save_vfstruct = pdf->vfstruct;
+ vp = pdf->vfstruct = &localvfstruct;
+ localvfstruct = *save_vfstruct;
+
+ vp->packet_stack_minlevel = ++(vp->packet_stack_level);
+ vp->lf = 0;
+ vp->fs_f = font_size(vf_f);
+ vp->packet_cur_s++;
+ if (vp->packet_cur_s == packet_max_recursion)
+ overflow("max level recursion of virtual fonts", packet_max_recursion);
+ vp->refpos = save_posstruct;
+ vp->vflua = false;
+
+ mat_p = &(vp->packet_stack[vp->packet_stack_level]);
+ mat_p->c0 = 1.0;
+ mat_p->c1 = 0.0;
+ mat_p->c2 = 0.0;
+ mat_p->c3 = 1.0;
+ mat_p->pos.h = 0;
+ mat_p->pos.v = 0;
+
+ while ((cmd = *(vfp++)) != packet_end_code) {
#ifdef DEBUG
- if (cmd>packet_end_code) {
- fprintf(stdout, "do_vf_packet(%i,%i) command code = illegal \n", vf_f,c);
- } else {
- fprintf(stdout, "do_vf_packet(%i,%i) command code = %s\n",vf_f, c, packet_command_names[cmd]);
- }
+ if (cmd > packet_end_code) {
+ fprintf(stdout, "do_vf_packet(%i,%i) command code = illegal \n",
+ vf_f, c);
+ } else {
+ fprintf(stdout, "do_vf_packet(%i,%i) command code = %s\n", vf_f, c,
+ packet_command_names[cmd]);
+ }
#endif
switch (cmd) {
case packet_font_code:
- packet_number(lf);
+ packet_number(vp->lf);
break;
case packet_push_code:
- packet_stack[packet_stack_ptr].stack_h = cur.h;
- packet_stack[packet_stack_ptr].stack_v = cur.v;
- packet_stack_ptr++;
+ vp->packet_stack_level++;
+ if (vp->packet_stack_level == packet_stack_size)
+ pdf_error("vf", "packet_stack_level overflow");
+ vp->packet_stack[vp->packet_stack_level] = *mat_p;
+ mat_p = &(vp->packet_stack[vp->packet_stack_level]);
break;
case packet_pop_code:
- packet_stack_ptr--;
- cur.h = packet_stack[packet_stack_ptr].stack_h;
- cur.v = packet_stack[packet_stack_ptr].stack_v;
+ if (vp->packet_stack_level == vp->packet_stack_minlevel)
+ pdf_error("vf", "packet_stack_level underflow");
+ vp->packet_stack_level--;
+ mat_p = &(vp->packet_stack[vp->packet_stack_level]);
break;
case packet_char_code:
packet_number(k);
- if (!char_exists(lf, (int) k)) {
- char_warning(lf, (int) k);
- } else {
- if (has_packet(lf, (int) k))
- do_vf_packet(pdf, lf, (int) k);
+ if (!char_exists(vp->lf, (int) k))
+ char_warning(vp->lf, (int) k);
+ else {
+ if (has_packet(vp->lf, (int) k))
+ do_vf_packet(pdf, vp->lf, (int) k);
else
- backend_out[glyph_node] (pdf, lf, (int) k);
+ backend_out[glyph_node] (pdf, vp->lf, (int) k);
}
- cur.h = cur.h + char_width(lf, (int) k);
+ mat_p->pos.h += char_width(vp->lf, (int) k);
break;
case packet_rule_code:
- packet_scaled(size.v, fs_f); /* height (where is depth?) */
- packet_scaled(size.h, fs_f);
+ packet_scaled(size.v, vp->fs_f); /* height (where is depth?) */
+ packet_scaled(size.h, vp->fs_f);
if (size.h > 0 && size.v > 0)
pdf_place_rule(pdf, 0, size); /* the 0 is unused */
- cur.h = cur.h + size.h;
+ mat_p->pos.h += size.h;
break;
case packet_right_code:
- packet_scaled(i, fs_f);
- cur.h = cur.h + i;
+ packet_scaled(i, vp->fs_f);
+ mat_p->pos.h += i;
break;
case packet_down_code:
- packet_scaled(i, fs_f);
- cur.v = cur.v + i;
+ packet_scaled(i, vp->fs_f);
+ mat_p->pos.v += i;
break;
case packet_special_code:
packet_number(k);
- str_room((unsigned) k);
+ str_room(k);
while (k > 0) {
k--;
- append_char(do_packet_byte());
+ append_char(*(vfp++));
}
s = make_string();
pdf_literal(pdf, s, scan_special, false);
flush_str(s);
break;
+ case packet_lua_code:
+ packet_number(k);
+ vp->vflua = true;
+ if (luaL_loadbuffer
+ (Luas, (const char *) vfp, (size_t) k, "packet_lua_code")
+ || lua_pcall(Luas, 0, LUA_MULTRET, 0))
+ lua_error(Luas);
+ vp->vflua = false;
+ vfp += k;
+ break;
case packet_image_code:
packet_number(k);
vf_out_image(pdf, k);
@@ -229,34 +259,40 @@ void do_vf_packet(PDF pdf, internal_font_number vf_f, int c)
break;
case packet_nop_code:
break;
+ case packet_scale_code:
+ f = packet_float(&vfp);
+ mat_p->c0 = mat_p->c0 * f;
+ mat_p->c3 = mat_p->c3 * f;
+ /* pdf->pstruct->scale = f; *//* scale is still NOP */
+ pdf->pstruct->need_tm = true;
+ pdf->pstruct->need_tf = true;
+ break;
default:
pdf_error("vf", "invalid DVI command (2)");
}
- synch_pos_with_cur(&localpos, refpos, cur); /* trivial case, always TLT */
+ synch_pos_with_cur(&localpos, save_posstruct, mat_p->pos); /* trivial case, always TLT */
}
- packet_cur_s--;
- pdf->posstruct = refpos;
+ pdf->posstruct = save_posstruct;
+ pdf->vfstruct = save_vfstruct;
}
@ @c
int *packet_local_fonts(internal_font_number f, int *num)
{
- int c, cmd, cur_packet_byte, lf, k, l, i;
+ int c, cmd, lf, k, l, i;
int localfonts[256] = { 0 };
int *lfs;
charinfo *co;
- eight_bits *vf_packets;
+ eight_bits *vf_packets, *vfp;
k = 0;
for (c = font_bc(f); c <= font_ec(f); c++) {
if (quick_char_exists(f, c)) {
co = get_charinfo(f, c);
- vf_packets = get_charinfo_packets(co);
+ vfp = vf_packets = get_charinfo_packets(co);
if (vf_packets == NULL)
continue;
- cur_packet_byte = 0;
- while ((cmd = vf_packets[cur_packet_byte]) != packet_end_code) {
- cur_packet_byte++;
+ while ((cmd = *(vfp++)) != packet_end_code) {
switch (cmd) {
case packet_font_code:
packet_number(lf);
@@ -269,26 +305,23 @@ int *packet_local_fonts(internal_font_number f, int *num)
localfonts[k++] = lf;
}
break;
- case packet_push_code:
- case packet_pop_code:
case packet_nop_code:
+ case packet_pop_code:
+ case packet_push_code:
break;
case packet_char_code:
- case packet_right_code:
case packet_down_code:
+ case packet_image_code:
case packet_node_code:
- cur_packet_byte += 4;
+ case packet_right_code:
+ vfp += 4;
break;
case packet_rule_code:
- cur_packet_byte += 8;
+ vfp += 8;
break;
case packet_special_code:
packet_number(i);
- while (i-- > 0)
- (void) do_packet_byte();
- break;
- case packet_image_code:
- cur_packet_byte += 4;
+ vfp += i;
break;
default:
pdf_error("vf", "invalid DVI command (3)");
@@ -305,26 +338,22 @@ int *packet_local_fonts(internal_font_number f, int *num)
return NULL;
}
-
@ @c
void
replace_packet_fonts(internal_font_number f, int *old_fontid,
int *new_fontid, int count)
{
- int c, cmd, cur_packet_byte, lf, k, l;
+ int c, cmd, lf, k, l;
charinfo *co;
- eight_bits *vf_packets;
+ eight_bits *vf_packets, *vfp;
- k = 0;
for (c = font_bc(f); c <= font_ec(f); c++) {
if (quick_char_exists(f, c)) {
co = get_charinfo(f, c);
- vf_packets = get_charinfo_packets(co);
+ vfp = vf_packets = get_charinfo_packets(co);
if (vf_packets == NULL)
continue;
- cur_packet_byte = 0;
- while ((cmd = vf_packets[cur_packet_byte]) != packet_end_code) {
- cur_packet_byte++;
+ while ((cmd = *(vfp++)) != packet_end_code) {
switch (cmd) {
case packet_font_code:
packet_number(lf);
@@ -335,36 +364,32 @@ replace_packet_fonts(internal_font_number f, int *old_fontid,
}
if (l < count) {
k = new_fontid[l];
- vf_packets[(cur_packet_byte - 4)] = (eight_bits)
+ *(vfp - 4) = (eight_bits)
((k & 0xFF000000) >> 24);
- vf_packets[(cur_packet_byte - 3)] = (eight_bits)
+ *(vfp - 3) = (eight_bits)
((k & 0x00FF0000) >> 16);
- vf_packets[(cur_packet_byte - 2)] = (eight_bits)
+ *(vfp - 2) = (eight_bits)
((k & 0x0000FF00) >> 8);
- vf_packets[(cur_packet_byte - 1)] =
- (eight_bits) (k & 0x000000FF);
+ *(vfp - 1) = (eight_bits) (k & 0x000000FF);
}
break;
- case packet_push_code:
- case packet_pop_code:
case packet_nop_code:
+ case packet_pop_code:
+ case packet_push_code:
break;
case packet_char_code:
- case packet_right_code:
case packet_down_code:
+ case packet_image_code:
case packet_node_code:
- cur_packet_byte += 4;
+ case packet_right_code:
+ vfp += 4;
break;
case packet_rule_code:
- cur_packet_byte += 8;
+ vfp += 8;
break;
case packet_special_code:
packet_number(k);
- while (k-- > 0)
- (void) do_packet_byte();
- break;
- case packet_image_code:
- cur_packet_byte += 4;
+ vfp += k;
break;
default:
pdf_error("vf", "invalid DVI command (4)");
diff --git a/Build/source/texk/web2c/luatexdir/font/writecff.w b/Build/source/texk/web2c/luatexdir/font/writecff.w
index 6f818d9e422..0db22f68aee 100644
--- a/Build/source/texk/web2c/luatexdir/font/writecff.w
+++ b/Build/source/texk/web2c/luatexdir/font/writecff.w
@@ -1,34 +1,33 @@
% writecff.w
-
+%
% Copyright 2006-2010 Taco Hoekwater <taco@@luatex.org>
-
+%
% This file is part of LuaTeX.
-
+%
% LuaTeX 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.
-
+%
% LuaTeX is distributed in the hope that it will be useful, but WITHOUT
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
% FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
% License for more details.
-
+%
% You should have received a copy of the GNU General Public License along
-% with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */
+% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
@ @c
+static const char _svn_version[] =
+ "$Id: writecff.w 4551 2013-01-04 16:08:20Z taco $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writecff.w $";
+
#include "ptexlib.h"
#include "lua/luatex-api.h"
-
#include "font/writecff.h"
extern int cidset;
-static const char _svn_version[] =
- "$Id: writecff.w 3848 2010-09-01 08:34:37Z taco $ "
-"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/writecff.w $";
-
@ @c
#define get_offset(s,n) get_unsigned(s, (n))
#define get_card8(a) (card8)(a->stream[a->offset++])
@@ -1767,8 +1766,8 @@ long cff_read_charsets(cff_font * cff)
}
if (count > 0) {
- fprintf(stdout, "count=%d\n", count);
- CFF_ERROR("Charset data possibly broken");
+ /* fprintf(stdout, "count=%d\n", count); */
+ WARN("Charset data possibly broken (num_glyphs too high)");
}
return length;
@@ -2990,7 +2989,7 @@ static void write_fontfile(PDF pdf, cff_font * cffont, char *fullname)
cff_release_index(topdict);
for (i = 0; i < offset; i++)
- fb_putchar(pdf, dest[i]);
+ strbuf_putchar(pdf->fb, dest[i]);
xfree(dest);
return;
@@ -3029,7 +3028,7 @@ void write_cff(PDF pdf, cff_font * cffont, fd_entry * fd)
long size, offset = 0;
card8 *data;
- card16 num_glyphs, cs_count, code, gid, last_cid;
+ card16 num_glyphs, cs_count1, code, gid, last_cid;
double nominal_width, default_width;
@@ -3141,13 +3140,13 @@ void write_cff(PDF pdf, cff_font * cffont, fd_entry * fd)
cs_idx = cff_get_index_header(cffont);
offset = (long) cffont->offset;
- cs_count = cs_idx->count;
- if (cs_count < 2) {
+ cs_count1 = cs_idx->count;
+ if (cs_count1 < 2) {
CFF_ERROR("No valid charstring data found.");
}
/* build the new charstrings entry */
- charstrings = cff_new_index((card16) (cs_count + 1));
+ charstrings = cff_new_index((card16) (cs_count1 + 1));
max_len = 2 * CS_STR_LEN_MAX;
charstrings->data = xcalloc((unsigned) max_len, sizeof(card8));
charstring_len = 0;
@@ -3157,7 +3156,7 @@ void write_cff(PDF pdf, cff_font * cffont, fd_entry * fd)
{
int i;
- for (i = 0; i < cs_count; i++) {
+ for (i = 0; i < cs_count1; i++) {
code = (card16) i;
glyph->id = code;
DO_COPY_CHARSTRING();
@@ -3168,7 +3167,7 @@ void write_cff(PDF pdf, cff_font * cffont, fd_entry * fd)
each (set) bit is a (present) CID. */
if (1) {
int cid;
- cidset = pdf_new_objnum(pdf);
+ cidset = pdf_create_obj(pdf, obj_type_others, 0);
if (cidset != 0) {
size_t l = (last_cid/8)+1;
char *stream = xmalloc(l);
@@ -3179,10 +3178,14 @@ void write_cff(PDF pdf, cff_font * cffont, fd_entry * fd)
stream[(cid / 8)] |= (1 << (7 - (cid % 8)));
}
}
- pdf_begin_dict(pdf, cidset, 0);
+ pdf_begin_obj(pdf, cidset, OBJSTM_NEVER);
+ pdf_begin_dict(pdf);
+ pdf_dict_add_streaminfo(pdf);
+ pdf_end_dict(pdf);
pdf_begin_stream(pdf);
pdf_out_block(pdf, stream, l);
pdf_end_stream(pdf);
+ pdf_end_obj(pdf);
}
}
@@ -3315,7 +3318,7 @@ void write_cid_cff(PDF pdf, cff_font * cffont, fd_entry * fd)
long size, offset = 0;
card8 *data;
- card16 num_glyphs, cs_count, gid, last_cid;
+ card16 num_glyphs, cs_count1, gid, last_cid;
int fdsel, prev_fd, cid_count, cid;
@@ -3372,23 +3375,25 @@ void write_cid_cff(PDF pdf, cff_font * cffont, fd_entry * fd)
}
/* CIDSet: a table of bits indexed by cid, bytes with high order bit first,
- each (set) bit is a (present) CID. */
+ each (set) bit is a (present) CID. */
if (1) {
- cidset = pdf_new_objnum(pdf);
- if (cidset != 0) {
- size_t l = (last_cid/8)+1;
- char *stream = xmalloc(l);
- memset(stream, 0, l);
- for (cid = 1; cid <= (long) last_cid; cid++) {
- if (CIDToGIDMap[2 * cid] || CIDToGIDMap[2 * cid + 1]) {
- stream[(cid / 8)] |= (1 << (7 - (cid % 8)));
- }
- }
- pdf_begin_dict(pdf, cidset, 0);
- pdf_begin_stream(pdf);
- pdf_out_block(pdf, stream, l);
- pdf_end_stream(pdf);
- }
+ cidset = pdf_create_obj(pdf, obj_type_others, 0);
+ if (cidset != 0) {
+ size_t l = (last_cid / 8) + 1;
+ char *stream = xmalloc(l);
+ memset(stream, 0, l);
+ for (cid = 1; cid <= (long) last_cid; cid++) {
+ if (CIDToGIDMap[2 * cid] || CIDToGIDMap[2 * cid + 1]) {
+ stream[(cid / 8)] |= (1 << (7 - (cid % 8)));
+ }
+ }
+ pdf_begin_obj(pdf, cidset, OBJSTM_NEVER);
+ pdf_begin_dict(pdf);
+ pdf_begin_stream(pdf);
+ pdf_out_block(pdf, stream, l);
+ pdf_end_stream(pdf);
+ pdf_end_obj(pdf);
+ }
}
@@ -3403,8 +3408,8 @@ void write_cid_cff(PDF pdf, cff_font * cffont, fd_entry * fd)
cs_idx = cff_get_index_header(cffont);
offset = (long) cffont->offset;
- cs_count = cs_idx->count;
- if (cs_count < 2) {
+ cs_count1 = cs_idx->count;
+ if (cs_count1 < 2) {
CFF_ERROR("No valid charstring data found.");
}
@@ -3418,7 +3423,7 @@ void write_cid_cff(PDF pdf, cff_font * cffont, fd_entry * fd)
fdselect->num_entries = 0;
fdselect->data.ranges = xcalloc(num_glyphs, sizeof(cff_range3));
- charstrings = cff_new_index((card16) (cs_count + 1));
+ charstrings = cff_new_index((card16) (cs_count1 + 1));
max_len = 2 * CS_STR_LEN_MAX;
charstrings->data = xcalloc((unsigned) max_len, sizeof(card8));
charstring_len = 0;
@@ -3551,7 +3556,7 @@ void writetype1w(PDF pdf, fd_entry * fd)
write_cff(pdf, cff, fd);
} else {
for (i = 0; i < tfm_size; i++)
- fb_putchar(pdf, tfm_buffer[i]);
+ strbuf_putchar(pdf->fb, tfm_buffer[i]);
}
fd->ff_found = 1;
} else {
diff --git a/Build/source/texk/web2c/luatexdir/font/writeenc.w b/Build/source/texk/web2c/luatexdir/font/writeenc.w
index 1e097ad8fcc..bf6b3477193 100644
--- a/Build/source/texk/web2c/luatexdir/font/writeenc.w
+++ b/Build/source/texk/web2c/luatexdir/font/writeenc.w
@@ -1,31 +1,31 @@
% writeenc.w
-%
+%
% Copyright 1996-2006 Han The Thanh <thanh@@pdftex.org>
-% Copyright 2006-2008 Taco Hoekwater <taco@@luatex.org>
-
+% Copyright 2006-2011 Taco Hoekwater <taco@@luatex.org>
+%
% This file is part of LuaTeX.
-
+%
% LuaTeX 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.
-
+%
% LuaTeX is distributed in the hope that it will be useful, but WITHOUT
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
% FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
% License for more details.
-
+%
% You should have received a copy of the GNU General Public License along
-% with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */
+% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
@ @c
-#include "ptexlib.h"
-
static const char _svn_version[] =
- "$Id: writeenc.w 3615 2010-04-13 21:59:59Z oneiros $ "
-"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/writeenc.w $";
+ "$Id: writeenc.w 4442 2012-05-25 22:40:34Z hhenkel $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writeenc.w $";
+
+#include "ptexlib.h"
-@ All encoding entries go into AVL tree for fast search by name.
+@ All encoding entries go into AVL tree for fast search by name.
@c
struct avl_table *fe_tree = NULL;
@@ -89,31 +89,32 @@ fe_entry *get_fe_entry(char *s)
@ @c
static void write_enc(PDF pdf, char **glyph_names, struct avl_table *tx_tree,
- int fe_objnum)
+ int fe_objnum)
{
int i_old, *p;
struct avl_traverser t;
assert(glyph_names != NULL);
assert(tx_tree != NULL);
assert(fe_objnum != 0);
- pdf_begin_dict(pdf, fe_objnum, 1);
- pdf_puts(pdf, "/Type /Encoding\n");
- pdf_puts(pdf, "/Differences [");
+ pdf_begin_obj(pdf, fe_objnum, OBJSTM_ALWAYS);
+ pdf_begin_dict(pdf);
+ pdf_dict_add_name(pdf, "Type", "Encoding");
+ pdf_add_name(pdf, "Differences");
+ pdf_begin_array(pdf);
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)) {
- if (*p == i_old + 1) /* no gap */
- pdf_printf(pdf, "/%s", glyph_names[*p]);
+ if (*p == i_old + 1) /* consecutive */
+ pdf_add_name(pdf, glyph_names[*p]);
else {
- if (i_old == -2)
- pdf_printf(pdf, "%i/%s", *p, glyph_names[*p]);
- else
- pdf_printf(pdf, " %i/%s", *p, glyph_names[*p]);
+ pdf_add_int(pdf, *p);
+ pdf_add_name(pdf, glyph_names[*p]);
}
i_old = *p;
}
- pdf_puts(pdf, "]\n");
+ pdf_end_array(pdf);
pdf_end_dict(pdf);
+ pdf_end_obj(pdf);
}
static void write_fontencoding(PDF pdf, fe_entry * fe)
@@ -135,7 +136,7 @@ void write_fontencodings(PDF pdf)
write_fontencoding(pdf, fe);
}
-@ cleaning up...
+@ cleaning up...
@c
static void destroy_fe_entry(void *pa, void *pb)
diff --git a/Build/source/texk/web2c/luatexdir/font/writefont.w b/Build/source/texk/web2c/luatexdir/font/writefont.w
index 5749f633333..44981bacf2f 100644
--- a/Build/source/texk/web2c/luatexdir/font/writefont.w
+++ b/Build/source/texk/web2c/luatexdir/font/writefont.w
@@ -1,27 +1,27 @@
% writefont.w
-
+%
% Copyright 1996-2006 Han The Thanh <thanh@@pdftex.org>
% Copyright 2006-2010 Taco Hoekwater <taco@@luatex.org>
-
+%
% This file is part of LuaTeX.
-
+%
% LuaTeX 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.
-
+%
% LuaTeX is distributed in the hope that it will be useful, but WITHOUT
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
% FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
% License for more details.
-
+%
% You should have received a copy of the GNU General Public License along
-% with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */
+% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
@ @c
static const char _svn_version[] =
- "$Id: writefont.w 4269 2011-05-16 06:08:10Z taco $ "
-"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.70.x/source/texk/web2c/luatexdir/font/writefont.w $";
+ "$Id: writefont.w 4442 2012-05-25 22:40:34Z hhenkel $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writefont.w $";
#include "ptexlib.h"
#include "lua/luatex-api.h"
@@ -177,15 +177,16 @@ static void write_fontmetrics(PDF pdf, fd_entry * fd)
{
int i;
fix_fontmetrics(fd);
- pdf_printf(pdf, "/%s [%i %i %i %i]\n", font_key[FONTBBOX1_CODE].pdfname,
- (int) fd->font_dim[FONTBBOX1_CODE].val,
+ pdf_add_name(pdf, font_key[FONTBBOX1_CODE].pdfname);
+ pdf_begin_array(pdf);
+ pdf_printf(pdf, "%i %i %i %i", (int) fd->font_dim[FONTBBOX1_CODE].val,
(int) fd->font_dim[FONTBBOX2_CODE].val,
(int) fd->font_dim[FONTBBOX3_CODE].val,
(int) fd->font_dim[FONTBBOX4_CODE].val);
+ pdf_end_array(pdf);
for (i = 0; i < GEN_KEY_NUM; i++)
if (fd->font_dim[i].set)
- pdf_printf(pdf, "/%s %i\n", font_key[i].pdfname,
- fd->font_dim[i].val);
+ pdf_dict_add_int(pdf, font_key[i].pdfname, fd->font_dim[i].val);
}
@
@@ -200,15 +201,22 @@ static void preset_fontname(fo_entry * fo, internal_font_number f)
fo->fd->fontname = xstrdup(fo->fm->tfm_name);
}
-static void write_fontname(PDF pdf, fd_entry * fd, const char *key)
+static void pdf_dict_add_fontname(PDF pdf, const char *key, fd_entry * fd)
{
+ char *s;
+ size_t l1 = 0, l2;
assert(fd->fontname != NULL);
- pdf_puts(pdf, "/");
- if (key != NULL)
- pdf_printf(pdf, "%s /", key);
+ assert(key != NULL);
if (fd->subset_tag != NULL)
- pdf_printf(pdf, "%s+", fd->subset_tag);
- pdf_printf(pdf, "%s\n", fd->fontname);
+ l1 = strlen(fd->subset_tag);
+ l2 = strlen(fd->fontname);
+ s = xmalloc(l1 + l2 + 2);
+ if (l1 > 0)
+ snprintf(s, l1 + l2 + 2, "%s+%s", fd->subset_tag, fd->fontname);
+ else
+ snprintf(s, l2 + 1, "%s", fd->fontname);
+ pdf_dict_add_name(pdf, key, s);
+ xfree(s);
}
@
@@ -360,15 +368,15 @@ static void write_charwidth_array(PDF pdf, fo_entry * fo,
struct avl_traverser t;
assert(fo->tx_tree != NULL);
assert(fo->cw_objnum == 0);
- fo->cw_objnum = pdf_new_objnum(pdf);
- pdf_begin_obj(pdf, fo->cw_objnum, 1);
+ fo->cw_objnum = pdf_create_obj(pdf, obj_type_others, 0);
+ pdf_begin_obj(pdf, fo->cw_objnum, OBJSTM_ALWAYS);
avl_t_init(&t, fo->tx_tree);
fip = (int *) avl_t_first(&t, fo->tx_tree);
assert(fip != NULL);
- pdf_puts(pdf, "[");
+ pdf_begin_array(pdf);
for (ip = fip, j = *ip; ip != NULL; ip = (int *) avl_t_next(&t)) {
if (ip != fip)
- pdf_puts(pdf, " ");
+ pdf_out(pdf, ' ');
i = *ip;
while (j < i - 1) {
pdf_puts(pdf, "0 ");
@@ -377,7 +385,7 @@ static void write_charwidth_array(PDF pdf, fo_entry * fo,
j = i;
pdf_print_charwidth(pdf, f, i);
}
- pdf_puts(pdf, "]\n");
+ pdf_end_array(pdf);
pdf_end_obj(pdf);
}
@@ -440,30 +448,35 @@ static void write_fontfile(PDF pdf, fd_entry * fd)
if (!fd->ff_found)
return;
assert(fd->ff_objnum == 0);
- fd->ff_objnum = pdf_new_objnum(pdf);
- pdf_begin_dict(pdf, fd->ff_objnum, 0); /* font file stream */
+ fd->ff_objnum = pdf_create_obj(pdf, obj_type_others, 0);
+ pdf_begin_obj(pdf, fd->ff_objnum, OBJSTM_NEVER); /* font file stream */
+ pdf_begin_dict(pdf);
if (is_cidkeyed(fd->fm)) {
/* No subtype is used for TrueType-based OpenType fonts */
if (is_opentype(fd->fm) || is_type1(fd->fm))
- pdf_puts(pdf, "/Subtype /CIDFontType0C\n");
+ pdf_dict_add_name(pdf, "Subtype", "CIDFontType0C");
#if 0
- else
- pdf_puts(pdf,"/Subtype /OpenType\n");
+ else
+ pdf_dict_add_name(pdf, "Subtype", "OpenType");
#endif
} else {
- if (is_type1(fd->fm))
- pdf_printf(pdf, "/Length1 %i\n/Length2 %i\n/Length3 %i\n",
- (int) t1_length1, (int) t1_length2, (int) t1_length3);
- else if (is_truetype(fd->fm))
- pdf_printf(pdf, "/Length1 %i\n", (int) ttf_length);
+ if (is_type1(fd->fm)) {
+ pdf_dict_add_int(pdf, "Length1", (int) t1_length1);
+ pdf_dict_add_int(pdf, "Length2", (int) t1_length2);
+ pdf_dict_add_int(pdf, "Length3", (int) t1_length3);
+ } else if (is_truetype(fd->fm))
+ pdf_dict_add_int(pdf, "Length1", (int) ttf_length);
else if (is_opentype(fd->fm))
- pdf_puts(pdf, "/Subtype /Type1C\n");
+ pdf_dict_add_name(pdf, "Subtype", "Type1C");
else
assert(0);
}
+ pdf_dict_add_streaminfo(pdf);
+ pdf_end_dict(pdf);
pdf_begin_stream(pdf);
- fb_flush(pdf);
+ strbuf_flush(pdf, pdf->fb);
pdf_end_stream(pdf);
+ pdf_end_obj(pdf);
}
@
@@ -495,14 +508,15 @@ static void write_fontdescriptor(PDF pdf, fd_entry * fd)
struct avl_traverser t;
int fd_flags;
assert(fd != NULL && fd->fm != NULL);
- cidset = 0; /* possibly updated by |write_fontfile| */
+ cidset = 0; /* possibly updated by |write_fontfile| */
if (is_fontfile(fd->fm) && is_included(fd->fm))
write_fontfile(pdf, fd); /* this will set |fd->ff_found| if font file is found */
if (fd->fd_objnum == 0)
- fd->fd_objnum = pdf_new_objnum(pdf);
- pdf_begin_dict(pdf, fd->fd_objnum, 1);
- pdf_puts(pdf, "/Type /FontDescriptor\n");
- write_fontname(pdf, fd, "FontName");
+ fd->fd_objnum = pdf_create_obj(pdf, obj_type_others, 0);
+ pdf_begin_obj(pdf, fd->fd_objnum, OBJSTM_ALWAYS);
+ pdf_begin_dict(pdf);
+ pdf_dict_add_name(pdf, "Type", "FontDescriptor");
+ pdf_dict_add_fontname(pdf, "FontName", fd);
if (fd->fm->fd_flags != FD_FLAGS_NOT_SET_IN_MAPLINE)
fd_flags = (int) fd->fm->fd_flags;
else if (fd->ff_found)
@@ -517,16 +531,16 @@ static void write_fontdescriptor(PDF pdf, fd_entry * fd)
fd->fm->ps_name != NULL ? fd->fm->ps_name : "No name given",
fd->fm->tfm_name, fd_flags);
}
- pdf_printf(pdf, "/Flags %i\n", fd_flags);
+ pdf_dict_add_int(pdf, "Flags", fd_flags);
write_fontmetrics(pdf, fd);
if (fd->ff_found) {
if (is_cidkeyed(fd->fm)) {
if (is_type1(fd->fm))
- pdf_printf(pdf, "/FontFile3 %i 0 R\n", (int) fd->ff_objnum);
+ pdf_dict_add_ref(pdf, "FontFile3", (int) fd->ff_objnum);
else if (is_truetype(fd->fm))
- pdf_printf(pdf, "/FontFile2 %i 0 R\n", (int) fd->ff_objnum);
+ pdf_dict_add_ref(pdf, "FontFile2", (int) fd->ff_objnum);
else if (is_opentype(fd->fm))
- pdf_printf(pdf, "/FontFile3 %i 0 R\n", (int) fd->ff_objnum);
+ pdf_dict_add_ref(pdf, "FontFile3", (int) fd->ff_objnum);
else
assert(0);
} else {
@@ -534,29 +548,32 @@ static void write_fontdescriptor(PDF pdf, fd_entry * fd)
/* /CharSet is optional; names may appear in any order */
assert(fd->gl_tree != NULL);
avl_t_init(&t, fd->gl_tree);
- pdf_puts(pdf, "/CharSet (");
+ pdf_add_name(pdf, "CharSet");
+ pdf_out(pdf, '(');
for (glyph = (char *) avl_t_first(&t, fd->gl_tree);
glyph != NULL; glyph = (char *) avl_t_next(&t))
- pdf_printf(pdf, "/%s", glyph);
- pdf_puts(pdf, ")\n");
+ pdf_add_name(pdf, glyph);
+ pdf_out(pdf, ')');
+ pdf->cave = 0;
}
if (is_type1(fd->fm))
- pdf_printf(pdf, "/FontFile %i 0 R\n", (int) fd->ff_objnum);
+ pdf_dict_add_ref(pdf, "FontFile", (int) fd->ff_objnum);
else if (is_truetype(fd->fm))
- pdf_printf(pdf, "/FontFile2 %i 0 R\n", (int) fd->ff_objnum);
+ pdf_dict_add_ref(pdf, "FontFile2", (int) fd->ff_objnum);
else if (is_opentype(fd->fm))
- pdf_printf(pdf, "/FontFile3 %i 0 R\n", (int) fd->ff_objnum);
+ pdf_dict_add_ref(pdf, "FontFile3", (int) fd->ff_objnum);
else
assert(0);
}
}
- if (cidset !=0)
- pdf_printf(pdf, "/CIDSet %i 0 R\n", cidset);
+ if (cidset != 0)
+ pdf_dict_add_ref(pdf, "CIDSet", cidset);
/* TODO: Other optional keys for CID fonts.
The most interesting one is
\.{/Style << /Panose <12-byte string>>>}
*/
pdf_end_dict(pdf);
+ pdf_end_obj(pdf);
}
static void write_fontdescriptors(PDF pdf)
@@ -591,34 +608,36 @@ static void write_fontdictionary(PDF pdf, fo_entry * fo)
fo->fm->tfm_name);
}
}
- pdf_begin_dict(pdf, fo->fo_objnum, 1);
- pdf_puts(pdf, "/Type /Font\n");
- pdf_puts(pdf, "/Subtype /");
+ pdf_begin_obj(pdf, fo->fo_objnum, OBJSTM_ALWAYS);
+ pdf_begin_dict(pdf);
+ pdf_dict_add_name(pdf, "Type", "Font");
if (is_type1(fo->fm))
- pdf_printf(pdf, "%s\n", "Type1");
+ pdf_dict_add_name(pdf, "Subtype", "Type1");
else if (is_truetype(fo->fm))
- pdf_printf(pdf, "%s\n", "TrueType");
+ pdf_dict_add_name(pdf, "Subtype", "TrueType");
else if (is_opentype(fo->fm))
- pdf_printf(pdf, "%s\n", "Type1");
+ pdf_dict_add_name(pdf, "Subtype", "Type1");
else
assert(0);
assert(fo->fd != NULL && fo->fd->fd_objnum != 0);
- write_fontname(pdf, fo->fd, "BaseFont");
- pdf_printf(pdf, "/FontDescriptor %i 0 R\n", (int) fo->fd->fd_objnum);
+ pdf_dict_add_fontname(pdf, "BaseFont", fo->fd);
+ pdf_dict_add_ref(pdf, "FontDescriptor", (int) fo->fd->fd_objnum);
assert(fo->cw_objnum != 0);
- pdf_printf(pdf, "/FirstChar %i\n/LastChar %i\n/Widths %i 0 R\n",
- (int) fo->first_char, (int) fo->last_char, (int) fo->cw_objnum);
+ pdf_dict_add_int(pdf, "FirstChar", (int) fo->first_char);
+ pdf_dict_add_int(pdf, "LastChar", (int) fo->last_char);
+ pdf_dict_add_ref(pdf, "Widths", (int) fo->cw_objnum);
if ((is_type1(fo->fm) || is_opentype(fo->fm)) && fo->fe != NULL
&& fo->fe->fe_objnum != 0)
- pdf_printf(pdf, "/Encoding %i 0 R\n", (int) fo->fe->fe_objnum);
+ pdf_dict_add_ref(pdf, "Encoding", (int) fo->fe->fe_objnum);
if (fo->tounicode_objnum != 0)
- pdf_printf(pdf, "/ToUnicode %i 0 R\n", (int) fo->tounicode_objnum);
+ pdf_dict_add_ref(pdf, "ToUnicode", (int) fo->tounicode_objnum);
if (pdf_font_attr(fo->tex_font) != get_nullstr() &&
pdf_font_attr(fo->tex_font) != 0) {
pdf_print(pdf, pdf_font_attr(fo->tex_font));
- pdf_puts(pdf, "\n");
+ pdf_out(pdf, '\n');
}
pdf_end_dict(pdf);
+ pdf_end_obj(pdf);
}
static void write_fontdictionaries(PDF pdf)
@@ -661,7 +680,7 @@ static void create_fontdictionary(PDF pdf, internal_font_number f)
fo->fe = get_fe_entry(fo->fm->encname); /* returns |NULL| if .enc file couldn't be opened */
if (fo->fe != NULL && (is_type1(fo->fm) || is_opentype(fo->fm))) {
if (fo->fe->fe_objnum == 0)
- fo->fe->fe_objnum = pdf_new_objnum(pdf); /* then it will be written out */
+ fo->fe->fe_objnum = pdf_create_obj(pdf, obj_type_others, 0); /* then it will be written out */
/* mark encoding pairs used by TeX to optimize encoding vector */
fo->fe->tx_tree = mark_chars(fo, fo->fe->tx_tree, f);
}
@@ -901,24 +920,28 @@ static void write_cid_charwidth_array(PDF pdf, fo_entry * fo)
struct avl_traverser t;
assert(fo->cw_objnum == 0);
- fo->cw_objnum = pdf_new_objnum(pdf);
- pdf_begin_obj(pdf, fo->cw_objnum, 1);
+ fo->cw_objnum = pdf_create_obj(pdf, obj_type_others, 0);
+ pdf_begin_obj(pdf, fo->cw_objnum, OBJSTM_ALWAYS);
avl_t_init(&t, fo->fd->gl_tree);
glyph = (glw_entry *) avl_t_first(&t, fo->fd->gl_tree);
assert(glyph != NULL);
i = (int) glyph->id;
- pdf_printf(pdf, "[ %i [", i);
+ pdf_begin_array(pdf);
+ pdf_add_int(pdf, i);
+ pdf_begin_array(pdf);
for (; glyph != NULL; glyph = (glw_entry *) avl_t_next(&t)) {
j = glyph->wd;
if (glyph->id > (unsigned) (i + 1)) {
- pdf_printf(pdf, "] %i [", glyph->id);
+ pdf_end_array(pdf);
+ pdf_add_int(pdf, glyph->id);
+ pdf_begin_array(pdf);
j = glyph->wd;
}
if (glyph->id == (unsigned) (i + 1))
- pdf_puts(pdf, " ");
+ pdf_out(pdf, ' ');
if (j < 0) {
- pdf_puts(pdf, "-");
+ pdf_out(pdf, '-');
j = -j;
}
@@ -928,7 +951,8 @@ static void write_cid_charwidth_array(PDF pdf, fo_entry * fo)
i = (int) glyph->id;
}
- pdf_puts(pdf, "]]\n");
+ pdf_end_array(pdf);
+ pdf_end_array(pdf);
pdf_end_obj(pdf);
}
@@ -965,44 +989,53 @@ void write_cid_fontdictionary(PDF pdf, fo_entry * fo, internal_font_number f)
fo->tounicode_objnum = write_cid_tounicode(pdf, fo, f);
- pdf_begin_dict(pdf, fo->fo_objnum, 1);
- pdf_puts(pdf, "/Type /Font\n");
- pdf_puts(pdf, "/Subtype /Type0\n");
- pdf_puts(pdf, "/Encoding /Identity-H\n");
- write_fontname(pdf, fo->fd, "BaseFont");
- i = pdf_new_objnum(pdf);
- pdf_printf(pdf, "/DescendantFonts [%i 0 R]\n", i);
+ pdf_begin_obj(pdf, fo->fo_objnum, OBJSTM_ALWAYS);
+ pdf_begin_dict(pdf);
+ pdf_dict_add_name(pdf, "Type", "Font");
+ pdf_dict_add_name(pdf, "Subtype", "Type0");
+ pdf_dict_add_name(pdf, "Encoding", "Identity-H");
+ pdf_dict_add_fontname(pdf, "BaseFont", fo->fd);
+ i = pdf_create_obj(pdf, obj_type_others, 0);
+ pdf_add_name(pdf, "DescendantFonts");
+ pdf_begin_array(pdf);
+ pdf_add_ref(pdf, i);
+ pdf_end_array(pdf);
/* todo: the ToUnicode CMap */
if (fo->tounicode_objnum != 0)
- pdf_printf(pdf, "/ToUnicode %i 0 R\n", (int) fo->tounicode_objnum);
-
+ pdf_dict_add_ref(pdf, "ToUnicode", (int) fo->tounicode_objnum);
pdf_end_dict(pdf);
+ pdf_end_obj(pdf);
- pdf_begin_dict(pdf, i, 1);
- pdf_puts(pdf, "/Type /Font\n");
+ pdf_begin_obj(pdf, i, OBJSTM_ALWAYS);
+ pdf_begin_dict(pdf);
+ pdf_dict_add_name(pdf, "Type", "Font");
if (is_opentype(fo->fm) || is_type1(fo->fm)) {
- pdf_puts(pdf, "/Subtype /CIDFontType0\n");
+ pdf_dict_add_name(pdf, "Subtype", "CIDFontType0");
} else {
- pdf_puts(pdf, "/Subtype /CIDFontType2\n");
- pdf_printf(pdf, "/CIDToGIDMap /Identity\n");
+ pdf_dict_add_name(pdf, "Subtype", "CIDFontType2");
+ pdf_dict_add_name(pdf, "CIDToGIDMap", "Identity");
}
- write_fontname(pdf, fo->fd, "BaseFont");
- pdf_printf(pdf, "/FontDescriptor %i 0 R\n", (int) fo->fd->fd_objnum);
- pdf_printf(pdf, "/W %i 0 R\n", (int) fo->cw_objnum);
- pdf_printf(pdf, "/CIDSystemInfo <<\n");
- pdf_printf(pdf, "/Registry (%s)\n",
- (font_cidregistry(f) ? font_cidregistry(f) : "Adobe"));
- pdf_printf(pdf, "/Ordering (%s)\n",
- (font_cidordering(f) ? font_cidordering(f) : "Identity"));
- pdf_printf(pdf, "/Supplement %u\n", (unsigned int) font_cidsupplement(f));
- pdf_printf(pdf, ">>\n");
+ pdf_dict_add_fontname(pdf, "BaseFont", fo->fd);
+ pdf_dict_add_ref(pdf, "FontDescriptor", (int) fo->fd->fd_objnum);
+ pdf_dict_add_ref(pdf, "W", (int) fo->cw_objnum);
+ pdf_add_name(pdf, "CIDSystemInfo");
+ pdf_begin_dict(pdf);
+ pdf_dict_add_string(pdf, "Registry",
+ (font_cidregistry(f) ? font_cidregistry(f) : "Adobe"));
+ pdf_dict_add_string(pdf, "Ordering",
+ (font_cidordering(f) ? font_cidordering(f) :
+ "Identity"));
+ pdf_dict_add_int(pdf, "Supplement", (int) font_cidsupplement(f));
+ pdf_end_dict(pdf);
/* I doubt there is anything useful that could be written here */
#if 0
- if (pdf_font_attr(fo->tex_font) != get_nullstr()) {
- pdf_print(pdf_font_attr(fo->tex_font));
- pdf_puts(pdf,"\n");
- }
+ if (pdf_font_attr(fo->tex_font) != get_nullstr()) {
+ pdf_out(pdf, '\n');
+ pdf_print(pdf_font_attr(fo->tex_font));
+ pdf_out(pdf, '\n');
+ }
#endif
pdf_end_dict(pdf);
+ pdf_end_obj(pdf);
}
diff --git a/Build/source/texk/web2c/luatexdir/font/writet1.w b/Build/source/texk/web2c/luatexdir/font/writet1.w
index 64d76712309..473746c6827 100644
--- a/Build/source/texk/web2c/luatexdir/font/writet1.w
+++ b/Build/source/texk/web2c/luatexdir/font/writet1.w
@@ -20,8 +20,8 @@
@ @c
static const char _svn_version[] =
- "$Id: writet1.w 3960 2010-11-13 07:34:49Z taco $ "
-"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/writet1.w $";
+ "$Id: writet1.w 4442 2012-05-25 22:40:34Z hhenkel $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writet1.w $";
#include "ptexlib.h"
#include <string.h>
@@ -32,8 +32,8 @@ static const char _svn_version[] =
#define get_length3() t1_length3 = fixedcontent? t1_offset() - t1_save_offset : 0
#define save_offset() t1_save_offset = t1_offset()
-#define t1_putchar(A) fb_putchar(pdf,(A))
-#define t1_offset() fb_offset(pdf)
+#define t1_putchar(A) strbuf_putchar(pdf->fb, (A))
+#define t1_offset() strbuf_offset(pdf->fb)
#define out_eexec_char t1_putchar
#define end_last_eexec_line() \
@@ -41,8 +41,6 @@ static const char _svn_version[] =
#define t1_char(c) c
#define embed_all_glyphs(tex_font) fm_cur->all_glyphs
#define extra_charset() fm_cur->charset
-#define update_subset_tag() \
- strncpy(pdf->fb_array + t1_fontname_offset, fm_cur->subset_tag, 6)
#define fixedcontent false
int t1_length1, t1_length2, t1_length3;
@@ -52,7 +50,6 @@ static int t1_fontname_offset;
static unsigned char *t1_buffer = NULL;
static int t1_size = 0;
static int t1_curbyte = 0;
-
@ @c
#define t1_read_file() \
readbinfile(t1_file,&t1_buffer,&t1_size)
@@ -1364,7 +1361,8 @@ static void t1_subset_ascii_part(PDF pdf)
}
make_subset_tag(fd_cur);
assert(t1_fontname_offset != 0);
- strncpy(pdf->fb_array + t1_fontname_offset, fd_cur->subset_tag, 6);
+ strncpy((char *) pdf->fb->data + t1_fontname_offset, fd_cur->subset_tag,
+ 6);
}
/* now really all glyphs needed from this font are in the |fd_cur->gl_tree| */
if (t1_encoding == ENC_STANDARD)
@@ -1387,7 +1385,7 @@ static void t1_subset_ascii_part(PDF pdf)
destroy_t1_glyph_tree(gl_tree);
if (j == 0)
/* We didn't mark anything for the Encoding array.
- We add \.{dup 0 /.notdef put} for compatibility with Acrobat 5.0. */
+ We add \.{dup 0 /.notdef put} for compatibility with Acrobat 5.0. */
t1_puts(pdf, "dup 0 /.notdef put\n");
t1_puts(pdf, "readonly def\n");
}
diff --git a/Build/source/texk/web2c/luatexdir/font/writet3.w b/Build/source/texk/web2c/luatexdir/font/writet3.w
index 63988a80a28..a86694fc357 100644
--- a/Build/source/texk/web2c/luatexdir/font/writet3.w
+++ b/Build/source/texk/web2c/luatexdir/font/writet3.w
@@ -1,27 +1,27 @@
% writet3.w
-
+%
% Copyright 1996-2006 Han The Thanh <thanh@@pdftex.org>
-% Copyright 2006-2010 Taco Hoekwater <taco@@luatex.org>
-
+% Copyright 2006-2011 Taco Hoekwater <taco@@luatex.org>
+%
% This file is part of LuaTeX.
-
+%
% LuaTeX 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.
-
+%
% LuaTeX is distributed in the hope that it will be useful, but WITHOUT
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
% FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
% License for more details.
-
+%
% You should have received a copy of the GNU General Public License along
% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
@ @c
static const char _svn_version[] =
- "$Id: writet3.w 3882 2010-09-13 22:29:18Z hhenkel $ "
-"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/writet3.w $";
+ "$Id: writet3.w 4442 2012-05-25 22:40:34Z hhenkel $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writet3.w $";
#include "ptexlib.h"
#include <kpathsea/tex-glyph.h>
@@ -98,6 +98,7 @@ static boolean writepk(PDF pdf, internal_font_number f)
kpse_glyph_file_type font_ret;
int llx, lly, urx, ury;
int cw, rw, i, j;
+ pdffloat pf;
halfword *row;
char *name;
char *ftemp = NULL;
@@ -187,9 +188,14 @@ static boolean writepk(PDF pdf, internal_font_number f)
ury = cd.cheight + lly;
update_bbox(llx, lly, urx, ury, t3_glyph_num == 0);
t3_glyph_num++;
- t3_char_procs[cd.charcode] = pdf_new_dict(pdf, obj_type_others, 0, 0);
+ t3_char_procs[cd.charcode] = pdf_create_obj(pdf, obj_type_others, 0);
+ pdf_begin_obj(pdf, t3_char_procs[cd.charcode], OBJSTM_NEVER);
+ pdf_begin_dict(pdf);
+ pdf_dict_add_streaminfo(pdf);
+ pdf_end_dict(pdf);
pdf_begin_stream(pdf);
- pdf_print_real(pdf, (int) t3_char_widths[cd.charcode], 2);
+ setpdffloat(pf, (int) t3_char_widths[cd.charcode], 2);
+ print_pdffloat(pdf, pf);
pdf_printf(pdf, " 0 %i %i %i %i d1\n",
(int) llx, (int) lly, (int) urx, (int) ury);
if (is_null_glyph)
@@ -215,6 +221,7 @@ static boolean writepk(PDF pdf, internal_font_number f)
pdf_puts(pdf, "\nEI\nQ\n");
end_stream:
pdf_end_stream(pdf);
+ pdf_end_obj(pdf);
}
xfree(cd.raster);
cur_file_name = NULL;
@@ -225,11 +232,12 @@ static boolean writepk(PDF pdf, internal_font_number f)
@c
void writet3(PDF pdf, internal_font_number f)
{
-
int i;
+ char s[32];
int wptr, eptr, cptr;
int first_char, last_char;
int pk_font_scale;
+ pdffloat pf;
boolean is_notdef;
t3_glyph_num = 0;
@@ -253,77 +261,123 @@ void writet3(PDF pdf, internal_font_number f)
if (pdf_char_marked(f, i))
break;
last_char = i;
- pdf_begin_dict(pdf, pdf_font_num(f), 1); /* Type 3 font dictionary */
- pdf_puts(pdf, "/Type /Font\n/Subtype /Type3\n");
- pdf_printf(pdf, "/Name /F%i\n", (int) f);
+
+ /* Type 3 font dictionary */
+ pdf_begin_obj(pdf, pdf_font_num(f), OBJSTM_ALWAYS);
+ pdf_begin_dict(pdf);
+ pdf_dict_add_name(pdf, "Type", "Font");
+ pdf_dict_add_name(pdf, "Subtype", "Type3");
+ snprintf(s, 31, "F%i", (int) f);
+ pdf_dict_add_name(pdf, "Name", s);
if (pdf_font_attr(f) != get_nullstr() && pdf_font_attr(f) != 0) {
+ pdf_out(pdf, '\n');
pdf_print(pdf, pdf_font_attr(f));
- pdf_puts(pdf, "\n");
+ pdf_out(pdf, '\n');
}
if (is_pk_font) {
pk_font_scale =
get_pk_font_scale(f, pdf->decimal_digits, pdf->pk_scale_factor);
- pdf_puts(pdf, "/FontMatrix [");
- pdf_print_real(pdf, pk_font_scale, 5);
+ pdf_add_name(pdf, "FontMatrix");
+ pdf_begin_array(pdf);
+ setpdffloat(pf, pk_font_scale, 5);
+ print_pdffloat(pdf, pf);
pdf_puts(pdf, " 0 0 ");
- pdf_print_real(pdf, pk_font_scale, 5);
- pdf_puts(pdf, " 0 0]\n");
- } else
- pdf_printf(pdf, "/FontMatrix [%g 0 0 %g 0 0]\n",
+ print_pdffloat(pdf, pf);
+ pdf_puts(pdf, " 0 0");
+ pdf_end_array(pdf);
+ } else {
+ pdf_add_name(pdf, "FontMatrix");
+ pdf_begin_array(pdf);
+ pdf_printf(pdf, "%g 0 0 %g 0 0",
(double) t3_font_scale, (double) t3_font_scale);
- pdf_printf(pdf, "/%s [ %i %i %i %i ]\n",
- font_key[FONTBBOX1_CODE].pdfname,
- (int) t3_b0, (int) t3_b1, (int) t3_b2, (int) t3_b3);
- pdf_printf(pdf, "/Resources << /ProcSet [ /PDF %s] >>\n",
- t3_image_used ? "/ImageB " : "");
- pdf_printf(pdf, "/FirstChar %i\n/LastChar %i\n", first_char, last_char);
- wptr = pdf_new_objnum(pdf);
- eptr = pdf_new_objnum(pdf);
- cptr = pdf_new_objnum(pdf);
- pdf_printf(pdf, "/Widths %i 0 R\n/Encoding %i 0 R\n/CharProcs %i 0 R\n",
- (int) wptr, (int) eptr, (int) cptr);
+ pdf_end_array(pdf);
+ }
+ pdf_add_name(pdf, font_key[FONTBBOX1_CODE].pdfname);
+ pdf_begin_array(pdf);
+ pdf_add_int(pdf, (int) t3_b0);
+ pdf_add_int(pdf, (int) t3_b1);
+ pdf_add_int(pdf, (int) t3_b2);
+ pdf_add_int(pdf, (int) t3_b3);
+ pdf_end_array(pdf);
+ pdf_add_name(pdf, "Resources");
+ pdf_begin_dict(pdf);
+ pdf_add_name(pdf, "ProcSet");
+ pdf_begin_array(pdf);
+ pdf_add_name(pdf, "PDF");
+ if (t3_image_used)
+ pdf_add_name(pdf, "ImageB");
+ pdf_end_array(pdf);
+ pdf_end_dict(pdf);
+ pdf_dict_add_int(pdf, "FirstChar", first_char);
+ pdf_dict_add_int(pdf, "LastChar", last_char);
+ wptr = pdf_create_obj(pdf, obj_type_others, 0);
+ eptr = pdf_create_obj(pdf, obj_type_others, 0);
+ cptr = pdf_create_obj(pdf, obj_type_others, 0);
+ pdf_dict_add_ref(pdf, "Widths", (int) wptr);
+ pdf_dict_add_ref(pdf, "Encoding", (int) eptr);
+ pdf_dict_add_ref(pdf, "CharProcs", (int) cptr);
pdf_end_dict(pdf);
- pdf_begin_obj(pdf, wptr, 1); /* chars width array */
- pdf_puts(pdf, "[");
+ pdf_end_obj(pdf);
+
+ /* chars width array */
+ pdf_begin_obj(pdf, wptr, OBJSTM_ALWAYS);
+ pdf_begin_array(pdf);
if (is_pk_font)
for (i = first_char; i <= last_char; i++) {
- pdf_print_real(pdf, (int) t3_char_widths[i], 2);
- pdf_puts(pdf, " ");
+ setpdffloat(pf, (int) t3_char_widths[i], 2);
+ print_pdffloat(pdf, pf);
+ pdf_out(pdf, ' ');
} else
for (i = first_char; i <= last_char; i++)
- pdf_printf(pdf, "%i ", (int) t3_char_widths[i]);
- pdf_puts(pdf, "]\n");
+ pdf_add_int(pdf, (int) t3_char_widths[i]);
+ pdf_end_array(pdf);
pdf_end_obj(pdf);
- pdf_begin_dict(pdf, eptr, 1); /* encoding dictionary */
- pdf_printf(pdf, "/Type /Encoding\n/Differences [%i", first_char);
+
+ /* encoding dictionary */
+ pdf_begin_obj(pdf, eptr, OBJSTM_ALWAYS);
+ pdf_begin_dict(pdf);
+ pdf_dict_add_name(pdf, "Type", "Encoding");
+ pdf_add_name(pdf, "Differences");
+ pdf_begin_array(pdf);
+ pdf_add_int(pdf, first_char);
if (t3_char_procs[first_char] == 0) {
- pdf_printf(pdf, "/%s", notdef);
+ pdf_add_name(pdf, notdef);
is_notdef = true;
} else {
- pdf_printf(pdf, "/a%i", first_char);
+ snprintf(s, 31, "a%i", first_char);
+ pdf_add_name(pdf, s);
is_notdef = false;
}
for (i = first_char + 1; i <= last_char; i++) {
if (t3_char_procs[i] == 0) {
if (!is_notdef) {
- pdf_printf(pdf, " %i/%s", i, notdef);
+ pdf_add_int(pdf, i);
+ pdf_add_name(pdf, notdef);
is_notdef = true;
}
} else {
if (is_notdef) {
- pdf_printf(pdf, " %i", i);
+ pdf_add_int(pdf, i);
is_notdef = false;
}
- pdf_printf(pdf, "/a%i", i);
+ snprintf(s, 31, "a%i", i);
+ pdf_add_name(pdf, s);
}
}
- pdf_puts(pdf, "]\n");
+ pdf_end_array(pdf);
pdf_end_dict(pdf);
- pdf_begin_dict(pdf, cptr, 1); /* CharProcs dictionary */
+ pdf_end_obj(pdf);
+
+ /* CharProcs dictionary */
+ pdf_begin_obj(pdf, cptr, OBJSTM_ALWAYS);
+ pdf_begin_dict(pdf);
for (i = first_char; i <= last_char; i++)
- if (t3_char_procs[i] != 0)
- pdf_printf(pdf, "/a%i %i 0 R\n", (int) i, (int) t3_char_procs[i]);
+ if (t3_char_procs[i] != 0) {
+ snprintf(s, 31, "a%i", (int) i);
+ pdf_dict_add_ref(pdf, s, (int) t3_char_procs[i]);
+ }
pdf_end_dict(pdf);
+ pdf_end_obj(pdf);
if (tracefilenames)
tex_printf(">");
cur_file_name = NULL;
diff --git a/Build/source/texk/web2c/luatexdir/font/writettf.w b/Build/source/texk/web2c/luatexdir/font/writettf.w
index bc93ad5c7aa..dc0347f39ea 100644
--- a/Build/source/texk/web2c/luatexdir/font/writettf.w
+++ b/Build/source/texk/web2c/luatexdir/font/writettf.w
@@ -1,38 +1,38 @@
% writettf.w
-%
+%
% Copyright 1996-2006 Han The Thanh <thanh@@pdftex.org>
% Copyright 2006-2010 Taco Hoekwater <taco@@luatex.org>
-
+%
% This file is part of LuaTeX.
-
+%
% LuaTeX 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.
-
+%
% LuaTeX is distributed in the hope that it will be useful, but WITHOUT
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
% FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
% License for more details.
-
+%
% You should have received a copy of the GNU General Public License along
-% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
+% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
@ @c
+static const char _svn_version[] =
+ "$Id: writettf.w 4442 2012-05-25 22:40:34Z hhenkel $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writettf.w $";
+
#include "ptexlib.h"
#include "font/writettf.h"
#include <string.h>
-static const char _svn_version[] =
- "$Id: writettf.w 3789 2010-08-02 19:59:49Z oneiros $ "
-"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/writettf.w $";
-
#define DEFAULT_NTABS 14
#define NEW_CMAP_SIZE 2
-#define ttf_putchar(A) fb_putchar(pdf,(A))
-#define ttf_offset() fb_offset(pdf)
-#define ttf_seek_outbuf(A) fb_seek(pdf,(A))
+#define ttf_putchar(A) strbuf_putchar(pdf->fb, (A))
+#define ttf_offset() strbuf_offset(pdf->fb)
+#define ttf_seek_outbuf(A) strbuf_seek(pdf->fb, (A))
unsigned char *ttf_buffer = NULL;
int ttf_size = 0;
@@ -1260,7 +1260,7 @@ static void ttf_write_dirtab(PDF pdf)
/* adjust checkSumAdjustment */
tmp_ulong = 0;
checksum = 0;
- for (p = pdf->fb_array, i = 0; i < (unsigned) save_offset;) {
+ for (p = (char *) pdf->fb->data, i = 0; i < (unsigned) save_offset;) {
tmp_ulong = (tmp_ulong << 8) + (TTF_ULONG) * p++;
i++;
if (i % 4 == 0) {
diff --git a/Build/source/texk/web2c/luatexdir/font/writetype0.w b/Build/source/texk/web2c/luatexdir/font/writetype0.w
index 945350a1384..d351c6cdeb1 100644
--- a/Build/source/texk/web2c/luatexdir/font/writetype0.w
+++ b/Build/source/texk/web2c/luatexdir/font/writetype0.w
@@ -1,31 +1,31 @@
% writetype0.w
-%
+%
% Copyright 2006-2008 Taco Hoekwater <taco@@luatex.org>
-
+%
% This file is part of LuaTeX.
-
+%
% LuaTeX 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.
-
+%
% LuaTeX is distributed in the hope that it will be useful, but WITHOUT
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
% FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
% License for more details.
-
+%
% You should have received a copy of the GNU General Public License along
% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
@ @c
+static const char _svn_version[] =
+ "$Id: writetype0.w 4442 2012-05-25 22:40:34Z hhenkel $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writetype0.w $";
+
#include "ptexlib.h"
#include "font/writettf.h"
#include "font/writecff.h"
-static const char _svn_version[] =
- "$Id: writetype0.w 3786 2010-08-02 15:25:12Z taco $ "
-"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/writetype0.w $";
-
@ @c
void writetype0(PDF pdf, fd_entry * fd)
{
@@ -48,7 +48,8 @@ void writetype0(PDF pdf, fd_entry * fd)
cur_file_name =
luatex_find_file(fd_cur->fm->ff_name, find_opentype_file_callback);
if (cur_file_name == NULL) {
- pdftex_fail("cannot find OpenType font file for reading (%s)", fd_cur->fm->ff_name);
+ pdftex_fail("cannot find OpenType font file for reading (%s)",
+ fd_cur->fm->ff_name);
}
callback_id = callback_defined(read_opentype_file_callback);
if (callback_id > 0) {
@@ -56,11 +57,13 @@ void writetype0(PDF pdf, fd_entry * fd)
&file_opened, &ttf_buffer, &ttf_size) &&
file_opened && ttf_size > 0) {
} else {
- pdftex_fail("cannot open OpenType font file for reading (%s)", cur_file_name);
+ pdftex_fail("cannot open OpenType font file for reading (%s)",
+ cur_file_name);
}
} else {
if (!otf_open(cur_file_name)) {
- pdftex_fail("cannot open OpenType font file for reading (%s)", cur_file_name);
+ pdftex_fail("cannot open OpenType font file for reading (%s)",
+ cur_file_name);
}
ttf_read_file();
ttf_close();
@@ -93,14 +96,14 @@ void writetype0(PDF pdf, fd_entry * fd)
if (!is_subsetted(fd_cur->fm)) {
/* not subsetted, just do a copy */
for (i = (long) tab->length; i > 0; i--)
- fb_putchar(pdf, (eight_bits) ttf_getnum(1));
+ strbuf_putchar(pdf->fb, (unsigned char) ttf_getnum(1));
} else {
if (cff != NULL) {
if (cff_is_cidfont(cff)) {
write_cid_cff(pdf, cff, fd_cur);
#if 0
- for (i = tab->length; i > 0; i--)
- fb_putchar (ttf_getnum(1));
+ for (i = tab->length; i > 0; i--)
+ strbuf_putchar(pdf->fb, (unsigned char) ttf_getnum(1));
#endif
} else {
write_cff(pdf, cff, fd_cur);
@@ -108,7 +111,7 @@ void writetype0(PDF pdf, fd_entry * fd)
} else {
/* not understood, just do a copy */
for (i = (long) tab->length; i > 0; i--)
- fb_putchar(pdf, (eight_bits) ttf_getnum(1));
+ strbuf_putchar(pdf->fb, (unsigned char) ttf_getnum(1));
}
}
xfree(dir_tab);
diff --git a/Build/source/texk/web2c/luatexdir/font/writetype2.w b/Build/source/texk/web2c/luatexdir/font/writetype2.w
index 12124f6edb8..60b99a06572 100644
--- a/Build/source/texk/web2c/luatexdir/font/writetype2.w
+++ b/Build/source/texk/web2c/luatexdir/font/writetype2.w
@@ -1,6 +1,6 @@
-% writetype0.w
+% writetype2.w
%
-% Copyright 2006-2010 Taco Hoekwater <taco@@luatex.org>
+% Copyright 2006-2012 Taco Hoekwater <taco@@luatex.org>
%
% This file is part of LuaTeX.
%
@@ -18,6 +18,10 @@
% with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
@ @c
+static const char _svn_version[] =
+ "$Id: writetype2.w 4457 2012-07-13 13:16:19Z taco $"
+ "$URL: http://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writetype2.w $";
+
#include "ptexlib.h"
#include "font/writettf.h"
#include "font/writecff.h"
@@ -26,23 +30,20 @@
#include "font/sfnt.h"
#include "font/tt_glyf.h"
-static const char _svn_version[] =
- "$Id: writetype2.w 3848 2010-09-01 08:34:37Z taco $ $URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/writetype2.w $";
-
@ forward declaration
@c
-void make_tt_subset(PDF pdf, fd_entry * fd, unsigned char *buffer, int buflen);
+void make_tt_subset(PDF pdf, fd_entry * fd, unsigned char *buff, int buflen);
@ @c
unsigned long cidtogid_obj = 0;
@ low-level helpers
@c
-#define test_loc(l) \
- if ((f->loc+l)>f->buflen) { \
- fprintf (stderr,"File ended prematurely\n"); \
- uexit(1); \
- }
+#define test_loc(l) \
+ if ((f->loc + l) > f->buflen) { \
+ fprintf(stderr, "File ended prematurely\n"); \
+ uexit(1); \
+ }
BYTE get_unsigned_byte(sfnt * f)
@@ -239,13 +240,13 @@ static struct {
static unsigned long ttc_read_offset(sfnt * sfont, int ttc_idx)
{
- ULONG version;
+ //ULONG version;
unsigned long offset = 0;
unsigned long num_dirs = 0;
sfnt_seek_set(sfont, 4); /* skip version tag */
- version = sfnt_get_ulong(sfont);
+ /*version = */(void)sfnt_get_ulong(sfont);
num_dirs = sfnt_get_ulong(sfont);
if (ttc_idx < 0 || ttc_idx > (int) (num_dirs - 1)) {
fprintf(stderr, "Invalid TTC index number\n");
@@ -260,7 +261,7 @@ static unsigned long ttc_read_offset(sfnt * sfont, int ttc_idx)
@ Creating the subset.
@c
extern int cidset;
-void make_tt_subset(PDF pdf, fd_entry * fd, unsigned char *buffer, int buflen)
+void make_tt_subset(PDF pdf, fd_entry * fd, unsigned char *buff, int buflen)
{
long i, cid;
@@ -277,7 +278,7 @@ void make_tt_subset(PDF pdf, fd_entry * fd, unsigned char *buffer, int buflen)
cidtogidmap = NULL;
- sfont = sfnt_open(buffer, buflen);
+ sfont = sfnt_open(buff, buflen);
if (sfont->type == SFNT_TYPE_TTC) {
i = ff_get_ttc_index(fd->fm->ff_name, fd->fm->ps_name);
@@ -378,56 +379,65 @@ void make_tt_subset(PDF pdf, fd_entry * fd, unsigned char *buffer, int buflen)
/* squeeze in the cidgidmap */
if (cidtogidmap != NULL) {
- cidtogid_obj = (unsigned long) pdf_new_objnum(pdf);
- pdf_begin_dict(pdf, (int) cidtogid_obj, 0);
- pdf_printf(pdf, "/Length %i\n", ((last_cid + 1) * 2));
+ cidtogid_obj = (unsigned long) pdf_create_obj(pdf, obj_type_others, 0);
+ pdf_begin_obj(pdf, (int) cidtogid_obj, OBJSTM_NEVER);
+ pdf_begin_dict(pdf);
+ pdf_dict_add_int(pdf, "Length", ((last_cid + 1) * 2));
pdf_end_dict(pdf);
- pdf_printf(pdf, "stream\n");
+ assert(0); /* code unused */
+ pdf_begin_stream(pdf);
pdf_room(pdf, (int) ((last_cid + 1) * 2));
for (i = 0; i < ((int) (last_cid + 1) * 2); i++) {
pdf_quick_out(pdf, cidtogidmap[i]);
}
- pdf_printf(pdf, "\nendstream\n");
+ pdf_end_stream(pdf);
+ pdf_end_obj(pdf);
}
/* the tff subset */
for (i = 0; i < (int) (fontfile->length); i++)
- fb_putchar(pdf, fontfile->data[i]);
+ strbuf_putchar(pdf->fb, fontfile->data[i]);
pdf_release_obj(fontfile);
/* CIDSet: a table of bits indexed by cid, bytes with high order bit first,
- each (set) bit is a (present) CID. */
+ each (set) bit is a (present) CID. */
if (is_subsetted(fd->fm)) {
- cidset = pdf_new_objnum(pdf);
- if (cidset != 0) {
- size_t l = (last_cid/8)+1;
- char *stream = xmalloc(l);
- memset(stream, 0, l);
- for (cid = 1; cid <= (long) last_cid; cid++) {
- if (used_chars[cid]) {
- stream[(cid / 8)] |= (1 << (7 - (cid % 8)));
- }
- }
- pdf_begin_dict(pdf, cidset, 0);
- pdf_begin_stream(pdf);
- pdf_out_block(pdf, stream, l);
- pdf_end_stream(pdf);
- }
+ cidset = pdf_create_obj(pdf, obj_type_others, 0);
+ if (cidset != 0) {
+ size_t l = (last_cid / 8) + 1;
+ char *stream = xmalloc(l);
+ memset(stream, 0, l);
+ for (cid = 1; cid <= (long) last_cid; cid++) {
+ if (used_chars[cid]) {
+ stream[(cid / 8)] |= (1 << (7 - (cid % 8)));
+ }
+ }
+ pdf_begin_obj(pdf, cidset, OBJSTM_NEVER);
+ pdf_begin_dict(pdf);
+ pdf_dict_add_streaminfo(pdf);
+ pdf_end_dict(pdf);
+ pdf_begin_stream(pdf);
+ pdf_out_block(pdf, stream, l);
+ pdf_end_stream(pdf);
+ pdf_end_obj(pdf);
+ }
}
/* TODO other stuff that needs fixing: */
/* DW, W, DW2, and W2 */
#if 0
- if (opt_flags & CIDFONT_FORCE_FIXEDPITCH) {
- pdf_add_dict(font->fontdict,
- pdf_new_name("DW"), pdf_new_number(1000.0));
- } else {
- add_TTCIDHMetrics(font->fontdict, glyphs, used_chars, cidtogidmap, last_cid);
- if (v_used_chars)
- add_TTCIDVMetrics(font->fontdict, glyphs, used_chars, cidtogidmap, last_cid);
- }
+ if (opt_flags & CIDFONT_FORCE_FIXEDPITCH) {
+ pdf_add_dict(font->fontdict,
+ pdf_new_name("DW"), pdf_new_number(1000.0));
+ } else {
+ add_TTCIDHMetrics(font->fontdict, glyphs, used_chars, cidtogidmap,
+ last_cid);
+ if (v_used_chars)
+ add_TTCIDVMetrics(font->fontdict, glyphs, used_chars, cidtogidmap,
+ last_cid);
+ }
#endif
xfree(used_chars);