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.c4
-rw-r--r--Build/source/texk/web2c/luatexdir/font/luafont.c313
-rw-r--r--Build/source/texk/web2c/luatexdir/font/luatexfont.h2
-rw-r--r--Build/source/texk/web2c/luatexdir/font/macnames.c2
-rw-r--r--Build/source/texk/web2c/luatexdir/font/mapfile.c3
-rw-r--r--Build/source/texk/web2c/luatexdir/font/mapfile.h66
-rw-r--r--Build/source/texk/web2c/luatexdir/font/pkin.c2
-rw-r--r--Build/source/texk/web2c/luatexdir/font/sfnt.c2
-rw-r--r--Build/source/texk/web2c/luatexdir/font/sfnt.h2
-rw-r--r--Build/source/texk/web2c/luatexdir/font/subfont.c2
-rw-r--r--Build/source/texk/web2c/luatexdir/font/texfont.c314
-rw-r--r--Build/source/texk/web2c/luatexdir/font/texfont.h21
-rw-r--r--Build/source/texk/web2c/luatexdir/font/tfmofm.c2
-rw-r--r--Build/source/texk/web2c/luatexdir/font/tounicode.c2
-rw-r--r--Build/source/texk/web2c/luatexdir/font/tt_glyf.c2
-rw-r--r--Build/source/texk/web2c/luatexdir/font/tt_glyf.h2
-rw-r--r--Build/source/texk/web2c/luatexdir/font/tt_table.c2
-rw-r--r--Build/source/texk/web2c/luatexdir/font/tt_table.h2
-rw-r--r--Build/source/texk/web2c/luatexdir/font/vfovf.c2
-rw-r--r--Build/source/texk/web2c/luatexdir/font/vfpacket.c2
-rw-r--r--Build/source/texk/web2c/luatexdir/font/writecff.c2
-rw-r--r--Build/source/texk/web2c/luatexdir/font/writecff.h2
-rw-r--r--Build/source/texk/web2c/luatexdir/font/writeenc.c2
-rw-r--r--Build/source/texk/web2c/luatexdir/font/writefont.c23
-rw-r--r--Build/source/texk/web2c/luatexdir/font/writet1.c57
-rw-r--r--Build/source/texk/web2c/luatexdir/font/writet3.c2
-rw-r--r--Build/source/texk/web2c/luatexdir/font/writettf.c2
-rw-r--r--Build/source/texk/web2c/luatexdir/font/writettf.h2
-rw-r--r--Build/source/texk/web2c/luatexdir/font/writetype0.c2
-rw-r--r--Build/source/texk/web2c/luatexdir/font/writetype2.c2
30 files changed, 694 insertions, 151 deletions
diff --git a/Build/source/texk/web2c/luatexdir/font/dofont.c b/Build/source/texk/web2c/luatexdir/font/dofont.c
index 14d785b8a9f..7033dc7be0c 100644
--- a/Build/source/texk/web2c/luatexdir/font/dofont.c
+++ b/Build/source/texk/web2c/luatexdir/font/dofont.c
@@ -22,7 +22,7 @@
#include "luatex-api.h"
static const char _svn_version[] =
- "$Id: dofont.c 2086 2009-03-22 15:32:08Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/src/texk/web2c/luatexdir/font/dofont.c $";
+ "$Id: dofont.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/dofont.c $";
#define TIMERS 0
@@ -121,7 +121,7 @@ do_define_font(integer f, char *cnom, char *caire, scaled s,
return 0;
}
}
- } else {
+ } else if (callback_id==0) {
res = read_tfm_info(f, cnom, caire, s);
if (res) {
set_hyphen_char(f, get_default_hyphen_char());
diff --git a/Build/source/texk/web2c/luatexdir/font/luafont.c b/Build/source/texk/web2c/luatexdir/font/luafont.c
index d9fd6273b06..0de7725c8dd 100644
--- a/Build/source/texk/web2c/luatexdir/font/luafont.c
+++ b/Build/source/texk/web2c/luatexdir/font/luafont.c
@@ -23,7 +23,7 @@
#include "nodes.h"
static const char _svn_version[] =
- "$Id: luafont.c 2086 2009-03-22 15:32:08Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/src/texk/web2c/luatexdir/font/luafont.c $";
+ "$Id: luafont.c 2293 2009-04-15 16:55:18Z taco $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/luafont.c $";
#define noVERBOSE
@@ -97,6 +97,7 @@ const char *MATH_param_names[] = {
"RadicalKernAfterDegree",
"RadicalDegreeBottomRaisePercent",
"MinConnectorOverlap",
+ "SubscriptShiftDownWithSuperscript",
NULL,
};
@@ -108,10 +109,31 @@ static void dump_intfield(lua_State * L, char *n, int c)
}
+void dump_math_kerns (lua_State *L, charinfo *co, int l, int id) {
+ int i;
+ for (i=0; i<l;i++) {
+ lua_newtable(L);
+ if (id==top_left_kern) {
+ dump_intfield(L, "height", co->top_left_math_kern_array[(2*i)]);
+ dump_intfield(L, "kern", co->top_left_math_kern_array[(2*i)+1]);
+ } else if (id==top_right_kern) {
+ dump_intfield(L, "height", co->top_right_math_kern_array[(2*i)]);
+ dump_intfield(L, "kern", co->top_right_math_kern_array[(2*i)+1]);
+ } else if (id==bottom_right_kern) {
+ dump_intfield(L, "height", co->bottom_right_math_kern_array[(2*i)]);
+ dump_intfield(L, "kern", co->bottom_right_math_kern_array[(2*i)+1]);
+ } else if (id==bottom_left_kern) {
+ dump_intfield(L, "height", co->bottom_left_math_kern_array[(2*i)]);
+ dump_intfield(L, "kern", co->bottom_left_math_kern_array[(2*i)+1]);
+ }
+ lua_rawseti(L,-2, (i+1));
+ }
+}
+
void font_char_to_lua(lua_State * L, internalfontnumber f, charinfo * co)
{
- int i;
+ int i, j;
liginfo *l;
kerninfo *ki;
@@ -262,6 +284,43 @@ void font_char_to_lua(lua_State * L, internalfontnumber f, charinfo * co)
}
lua_rawset(L, -3);
}
+
+ lua_newtable(L);
+
+ i = get_charinfo_math_kerns(co, top_right_kern);
+ j = 0;
+ if (i>0) {
+ j++;
+ lua_newtable(L);
+ dump_math_kerns(L, co, i, top_right_kern);
+ lua_setfield(L, -2, "top_right");
+ }
+ i = get_charinfo_math_kerns(co, top_left_kern);
+ if (i>0) {
+ j++;
+ lua_newtable(L);
+ dump_math_kerns(L, co, i, top_left_kern);
+ lua_setfield(L, -2, "top_left");
+ }
+ i = get_charinfo_math_kerns(co, bottom_right_kern);
+ if (i>0) {
+ j++;
+ lua_newtable(L);
+ dump_math_kerns(L, co, i, bottom_right_kern);
+ lua_setfield(L, -2, "bottom_right");
+ }
+ i = get_charinfo_math_kerns(co, bottom_left_kern);
+ if (i>0) {
+ j++;
+ lua_newtable(L);
+ dump_math_kerns(L, co, i, bottom_left_kern);
+ lua_setfield(L, -2, "bottom_left");
+ }
+ if (j>0)
+ lua_setfield(L, -2, "mathkern");
+ else
+ lua_pop(L,1);
+
}
static void write_lua_parameters(lua_State * L, int f)
@@ -656,6 +715,11 @@ make_luaS_index(start);
make_luaS_index(end);
make_luaS_index(advance);
make_luaS_index(glyph);
+make_luaS_index(extensible);
+make_luaS_index(horiz_variants);
+make_luaS_index(vert_variants);
+make_luaS_index(mathkern);
+make_luaS_index(commands);
void init_font_string_pointers(lua_State * L)
{
@@ -709,6 +773,13 @@ void init_font_string_pointers(lua_State * L)
init_luaS_index(end);
init_luaS_index(advance);
init_luaS_index(glyph);
+
+ init_luaS_index(extensible);
+ init_luaS_index(horiz_variants);
+ init_luaS_index(vert_variants);
+ init_luaS_index(mathkern);
+ init_luaS_index(commands);
+
}
static int count_char_packet_bytes(lua_State * L)
@@ -1045,7 +1116,40 @@ static void read_lua_math_parameters(lua_State * L, int f)
lua_pop(L, 1);
}
+#define MIN_INF -0x7FFFFFFF
+
+static void
+store_math_kerns (lua_State * L, charinfo *co, int id )
+{
+ int l, k;
+ scaled ht, krn;
+ if (lua_istable(L, -1) && ((k=lua_objlen(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)) {
+ ht = (scaled)lua_tonumber(L,-1);
+ } else {
+ ht = MIN_INF;
+ }
+ lua_pop(L,1);
+ lua_getfield(L, -1, "kern");
+ if (lua_isnumber(L,-1)) {
+ krn = (scaled)lua_tonumber(L,-1);
+ } else {
+ krn = MIN_INF;
+ }
+ lua_pop(L,1);
+ if (krn>MIN_INF && ht>MIN_INF)
+ add_charinfo_math_kern(co,id,ht,krn);
+ }
+ lua_pop(L,1);
+ }
+ }
+}
+
void
font_char_from_lua(lua_State * L, internal_font_number f, integer i,
integer * l_fonts)
@@ -1094,7 +1198,9 @@ font_char_from_lua(lua_State * L, internal_font_number f, integer i,
set_charinfo_tag(co, list_tag);
set_charinfo_remainder(co, k);
}
- lua_getfield(L, -1, "extensible");
+
+ lua_rawgeti(L, LUA_REGISTRYINDEX, luaS_extensible_index);
+ lua_rawget(L, -2);
if (lua_istable(L, -1)) {
int top, bot, mid, rep;
top = n_numeric_field(L, luaS_top_index, 0);
@@ -1112,7 +1218,8 @@ font_char_from_lua(lua_State * L, internal_font_number f, integer i,
}
lua_pop(L, 1);
- lua_getfield(L, -1, "horiz_variants");
+ lua_rawgeti(L, LUA_REGISTRYINDEX, luaS_horiz_variants_index);
+ lua_rawget(L, -2);
if (lua_istable(L, -1)) {
int glyph, startconnect, endconnect, advance, extender;
extinfo *h;
@@ -1138,8 +1245,8 @@ font_char_from_lua(lua_State * L, internal_font_number f, integer i,
}
lua_pop(L, 1);
-
- lua_getfield(L, -1, "vert_variants");
+ lua_rawgeti(L, LUA_REGISTRYINDEX, luaS_vert_variants_index);
+ lua_rawget(L, -2);
if (lua_istable(L, -1)) {
int glyph, startconnect, endconnect, advance, extender;
extinfo *h;
@@ -1165,6 +1272,32 @@ font_char_from_lua(lua_State * L, internal_font_number f, integer i,
}
lua_pop(L, 1);
+ /* Here is a complete example:
+ ["mathkern"]={
+ ["bottom_left"] ={ { ["height"]=420, ["kern"]=80 }, { ["height"]=520, ["kern"]=4 } },
+ ["bottom_right"]={ { ["height"]=0, ["kern"]=48 } },
+ ["top_left"] ={ { ["height"]=620, ["kern"]=0 }, { ["height"]=720, ["kern"]=-80 } },
+ ["top_right"] ={ { ["height"]=676, ["kern"]=115 }, { ["height"]=776, ["kern"]=45 } },
+ }
+ */
+ lua_rawgeti(L, LUA_REGISTRYINDEX, luaS_mathkern_index);
+ lua_rawget(L, -2);
+ if (lua_istable(L, -1)) {
+ lua_getfield(L, -1, "top_left");
+ store_math_kerns(L, co, top_left_kern);
+ lua_pop(L,1);
+ lua_getfield(L, -1, "top_right");
+ store_math_kerns(L, co, top_right_kern);
+ lua_pop(L,1);
+ lua_getfield(L, -1, "bottom_right");
+ store_math_kerns(L, co, bottom_right_kern);
+ lua_pop(L,1);
+ lua_getfield(L, -1, "bottom_left");
+ store_math_kerns(L, co, bottom_left_kern);
+ lua_pop(L,1);
+ }
+ lua_pop(L, 1);
+
nk = count_hash_items(L, luaS_index(kerns));
if (nk > 0) {
ckerns = xcalloc((nk + 1), sizeof(kerninfo));
@@ -1214,7 +1347,8 @@ font_char_from_lua(lua_State * L, internal_font_number f, integer i,
}
/* packet commands */
- lua_getfield(L, -1, "commands");
+ lua_rawgeti(L, LUA_REGISTRYINDEX, luaS_commands_index);
+ lua_rawget(L, -2);
if (lua_istable(L, -1)) {
lua_pushnil(L); /* first key */
if (lua_next(L, -2) != 0) {
@@ -1583,6 +1717,24 @@ static void nesting_prepend(halfword nest, halfword newn)
}
+static void nesting_prepend_list(halfword nest, halfword newn)
+{
+ halfword head = vlink(nest);
+ assert(alink(nest) == null);
+ assert(alink(newn) == null);
+ couple_nodes(nest, newn);
+ if (head == null) {
+ assert(tlink(nest) == null);
+ tlink(nest) = tail_of_list(newn);
+ } else {
+ halfword tail = tail_of_list(newn);
+ assert(alink(head) == nest);
+ assert(tail_of_list(head) == tlink(nest));
+ couple_nodes(tail, head);
+ }
+}
+
+
static int test_ligature(liginfo * lig, halfword left, halfword right)
{
if (type(left) != glyph_node)
@@ -1702,6 +1854,18 @@ static halfword handle_lig_nest(halfword root, halfword cur)
}
+static void print_disc(halfword cur)
+{
+ halfword n;
+ fprintf (stdout, "cur(%d,%d) {", cur, subtype(cur));
+ n = vlink_pre_break(cur); show_node_list(n);
+ fprintf (stdout, "}{");
+ n = vlink_post_break(cur); show_node_list(n);
+ fprintf (stdout, "}{");
+ n = vlink_no_break(cur); show_node_list(n);
+ fprintf (stdout, "}\n");
+}
+
static halfword handle_lig_word(halfword cur)
{
halfword right = null;
@@ -1819,88 +1983,75 @@ static halfword handle_lig_word(halfword cur)
}
/* A discretionary followed by ... */
} else if (type(cur) == disc_node) {
+
assert_disc(cur);
/* If {?}{x}{?} or {?}{?}{y} then ... */
if (vlink_no_break(cur) != null || vlink_post_break(cur) != null) {
halfword fwd;
- halfword lists[511]; /* max 8 levels */
-
- int i, max_depth = 0;
- lists[max_depth++] =
- handle_lig_nest(post_break(cur), vlink_post_break(cur));
- lists[max_depth++] =
- handle_lig_nest(no_break(cur), vlink_no_break(cur));
- while (1) {
- if ((fwd = vlink(cur)) == null)
- return cur;
- if (type(fwd) == glyph_node) {
- halfword next;
- for (i = 0; i < max_depth; i++) {
- liginfo lig;
- halfword tail = tlink(lists[i]);
- if (tail != null && test_ligature(&lig, tail, fwd))
- goto add_glyph_to_all;
- }
- /* if we get here, nothing had a ligature, so we stop */
+ liginfo lig;
+ if (vlink_post_break(cur)!=null)
+ handle_lig_nest(post_break(cur),vlink_post_break(cur));
+ if (vlink_no_break(cur)!=null)
+ handle_lig_nest(no_break(cur),vlink_no_break(cur));
+ while ((fwd = vlink(cur)) != null ) {
+ if (type(fwd) != glyph_node) break;
+ halfword nob = tlink_no_break(cur);
+ halfword pst = tlink_post_break(cur);
+ if ((nob == null || !test_ligature(&lig, nob, fwd)) &&
+ (pst == null || !test_ligature(&lig, pst, fwd)) )
break;
- add_glyph_to_all:
- for (i = 0; i < max_depth; i++) {
- halfword copy = copy_node(fwd);
- halfword tail = tlink(lists[i]);
- nesting_append(lists[i], copy);
- if (tail == null)
- continue; /* first character - never a ligature */
- handle_lig_nest(lists[i], tail);
+ nesting_append(no_break(cur),copy_node(fwd));
+ handle_lig_nest(no_break(cur),nob);
+ halfword next = vlink(fwd);
+ uncouple_node(fwd);
+ try_couple_nodes(cur, next);
+ nesting_append(post_break(cur),fwd);
+ handle_lig_nest(post_break(cur),pst);
+ }
+ if (fwd != null && type(fwd) == disc_node) {
+ halfword next = vlink(fwd);
+ if (vlink_no_break(fwd)==null &&
+ vlink_post_break(fwd)==null &&
+ next != null &&
+ type(next) == glyph_node &&
+ ((tlink_post_break(cur)!= null &&
+ test_ligature(&lig,tlink_post_break(cur),next)) ||
+ (tlink_no_break(cur)!= null &&
+ test_ligature(&lig,tlink_no_break(cur),next)))) {
+ /* Building an init_disc followed by a select_disc
+ * {a-}{b}{AB} {-}{}{} 'c'
+ */
+ halfword last = vlink(next);
+ uncouple_node(next);
+ try_couple_nodes(fwd, last);
+ /* {a-}{b}{AB} {-}{c}{} */
+ nesting_append(post_break(fwd),copy_node(next));
+ /* {a-}{b}{AB} {-}{c}{-} */
+ if (vlink_no_break(cur)!=null) {
+ nesting_prepend(no_break(fwd),copy_node(vlink_pre_break(fwd)));
}
- next = vlink(fwd);
- uncouple_node(fwd);
- try_couple_nodes(cur, next);
- flush_node(fwd);
- } else if (type(fwd) == disc_node) {
- halfword next;
- /* MAGIC WARNING
- * A disc followed by a disc can have different kernings
- * depending on which path is choosen, and it is impossible to
- * store the possible kernings: fe {}{A}{W} {V}{}{A}
- * So we _always_ add discs so only a simple path remains. */
- int m = max_depth; /* as max_depth changes in this loop */
- for (i = 0; i < m; i++) {
- halfword copy = copy_node(fwd);
- halfword tail = tlink(lists[i]);
- if (tail != null) {
- halfword prev = alink(tail);
- assert(alink(tail) != null);
- uncouple_node(tail);
- vlink(prev) = null;
- if (prev == lists[i]) {
- tlink(prev) = null;
- } else {
- tlink(lists[i]) = prev;
- }
- nesting_prepend(pre_break(copy), tail);
- nesting_prepend(no_break(copy),
- copy_node(tail));
- }
- nesting_append(lists[i], copy);
- handle_lig_nest(pre_break(copy),
- vlink_pre_break(copy));
- assert(max_depth < 256);
- lists[max_depth++] =
- handle_lig_nest(no_break(copy),
- vlink_no_break(copy));
- lists[i] =
- handle_lig_nest(post_break(copy),
- vlink_post_break(copy));
+ /* {a-}{b}{AB} {b-}{c}{-} */
+ if (vlink_post_break(cur)!=null)
+ nesting_prepend_list(pre_break(fwd),copy_node_list(vlink_post_break(cur)));
+ /* {a-}{b}{AB} {b-}{c}{AB-} */
+ if (vlink_no_break(cur)!=null) {
+ nesting_prepend_list(no_break(fwd),copy_node_list(vlink_no_break(cur)));
}
- next = vlink(fwd);
- uncouple_node(fwd);
- try_couple_nodes(cur, next);
- flush_node(fwd);
- } else {
- return cur;
+ /* {a-}{b}{ABC} {b-}{c}{AB-} */
+ halfword tail = tlink_no_break(cur);
+ nesting_append(no_break(cur),copy_node(next));
+ handle_lig_nest(no_break(cur),tail);
+ /* {a-}{BC}{ABC} {b-}{c}{AB-} */
+ tail = tlink_post_break(cur);
+ nesting_append(post_break(cur),next);
+ handle_lig_nest(post_break(cur),tail);
+ /* and set the subtypes */
+ subtype(cur) = init_disc;
+ subtype(fwd) = select_disc;
}
}
}
+
} else { /* NO GLYPH NOR DISC */
/* fprintf(stdout,"This is a %d node\n",type(cur)); */
/* assert(0); *//* TODO howcome there can be a glue here? */
@@ -2131,7 +2282,7 @@ halfword new_ligkern(halfword head, halfword tail)
tail = run_lua_ligkern_callback(head, tail, callback_id);
if (tail == null)
tail = tail_of_list(head);
- } else {
+ } else if (callback_id == 0) {
tail = handle_ligaturing(head, tail);
}
@@ -2140,7 +2291,7 @@ halfword new_ligkern(halfword head, halfword tail)
tail = run_lua_ligkern_callback(head, tail, callback_id);
if (tail == null)
tail = tail_of_list(head);
- } else {
+ } else if (callback_id == 0) {
halfword nest = new_node(nesting_node, 1);
halfword cur = vlink(head);
halfword aft = vlink(tail);
diff --git a/Build/source/texk/web2c/luatexdir/font/luatexfont.h b/Build/source/texk/web2c/luatexdir/font/luatexfont.h
index ceee8bf69f3..c3a9e8aeada 100644
--- a/Build/source/texk/web2c/luatexdir/font/luatexfont.h
+++ b/Build/source/texk/web2c/luatexdir/font/luatexfont.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: luatexfont.h 1783 2009-01-18 12:51:01Z oneiros $ */
+/* $Id: luatexfont.h 2271 2009-04-12 23:42:21Z oneiros $ */
#ifndef LUATEXFONT_H
# define LUATEXFONT_H 1
diff --git a/Build/source/texk/web2c/luatexdir/font/macnames.c b/Build/source/texk/web2c/luatexdir/font/macnames.c
index ae7720cc8dd..367c1d231c3 100644
--- a/Build/source/texk/web2c/luatexdir/font/macnames.c
+++ b/Build/source/texk/web2c/luatexdir/font/macnames.c
@@ -19,7 +19,7 @@
with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */
static const char __svn_version[] =
- "$Id: macnames.c 1223 2008-05-02 13:39:55Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/src/texk/web2c/luatexdir/font/macnames.c $";
+ "$Id: macnames.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/macnames.c $";
const char notdef[] = ".notdef";
diff --git a/Build/source/texk/web2c/luatexdir/font/mapfile.c b/Build/source/texk/web2c/luatexdir/font/mapfile.c
index c97cdf59782..551ff59e49e 100644
--- a/Build/source/texk/web2c/luatexdir/font/mapfile.c
+++ b/Build/source/texk/web2c/luatexdir/font/mapfile.c
@@ -26,7 +26,8 @@
#include "luatex-api.h"
static const char _svn_version[] =
- "$Id: mapfile.c 1870 2009-02-19 10:03:13Z taco $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/src/texk/web2c/luatexdir/font/mapfile.c $";
+ "$Id: mapfile.c 2271 2009-04-12 23:42:21Z oneiros $ "
+ "$URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/mapfile.c $";
#define FM_BUF_SIZE 1024
diff --git a/Build/source/texk/web2c/luatexdir/font/mapfile.h b/Build/source/texk/web2c/luatexdir/font/mapfile.h
new file mode 100644
index 00000000000..e07c70047ec
--- /dev/null
+++ b/Build/source/texk/web2c/luatexdir/font/mapfile.h
@@ -0,0 +1,66 @@
+/* mapfile.h
+
+ Copyright 2009 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/>. */
+
+/* $Id: mapfile.h 2271 2009-04-12 23:42:21Z oneiros $ */
+
+#ifndef MAPFILE_H
+# define MAPFILE_H
+/**********************************************************************/
+
+typedef struct {
+ /* parameters scanned from the map file: */
+ char *tfm_name; /* TFM file name (1st field in map line) */
+ char *sfd_name; /* subfont directory name, like @sfd_name@ */
+ char *ps_name; /* PostScript name (optional 2nd field in map line) */
+ integer fd_flags; /* font descriptor /Flags (PDF Ref. section 5.7.1) */
+ integer slant; /* SlantFont */
+ integer extend; /* ExtendFont */
+ char *encname; /* encoding file name */
+ char *ff_name; /* font file name */
+ unsigned short type; /* various flags */
+ short pid; /* Pid for truetype fonts */
+ short eid; /* Eid for truetype fonts */
+ /* parameters NOT scanned from the map file: */
+ subfont_entry *subfont; /* subfont mapping */
+ unsigned short links; /* link flags from tfm_tree and ps_tree */
+ boolean in_use; /* true if this structure has been referenced already */
+} fm_entry;
+
+typedef struct {
+ char *ff_name; /* base name of font file */
+ char *ff_path; /* full path to font file */
+} ff_entry;
+
+/**********************************************************************/
+
+fm_entry *lookup_fontmap(char *);
+boolean hasfmentry(internalfontnumber);
+void fm_free(void);
+void fm_read_info(void);
+ff_entry *check_ff_exist(char *, boolean);
+void pdfmapfile(integer);
+void pdfmapline(integer);
+void pdf_init_map_file(string map_name);
+fm_entry *new_fm_entry(void);
+void delete_fm_entry(fm_entry *);
+int avl_do_entry(fm_entry *, int);
+int check_std_t1font(char *s);
+
+/**********************************************************************/
+#endif
diff --git a/Build/source/texk/web2c/luatexdir/font/pkin.c b/Build/source/texk/web2c/luatexdir/font/pkin.c
index 99f64f29c11..46118e17505 100644
--- a/Build/source/texk/web2c/luatexdir/font/pkin.c
+++ b/Build/source/texk/web2c/luatexdir/font/pkin.c
@@ -45,7 +45,7 @@
#include "luatexfont.h"
static const char _svn_version[] =
- "$Id: pkin.c 1712 2009-01-02 10:54:55Z taco $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/src/texk/web2c/luatexdir/font/pkin.c $";
+ "$Id: pkin.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/pkin.c $";
/*
* Now we have some routines to get stuff from the pk file. pkbyte returns
diff --git a/Build/source/texk/web2c/luatexdir/font/sfnt.c b/Build/source/texk/web2c/luatexdir/font/sfnt.c
index b705ef7240b..da3eacf76f4 100644
--- a/Build/source/texk/web2c/luatexdir/font/sfnt.c
+++ b/Build/source/texk/web2c/luatexdir/font/sfnt.c
@@ -40,7 +40,7 @@
#include "sfnt.h"
static const char _svn_version[] =
- "$Id: sfnt.c 1592 2008-11-28 13:23:51Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/src/texk/web2c/luatexdir/font/sfnt.c $";
+ "$Id: sfnt.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/sfnt.c $";
#ifdef XETEX
UNSIGNED_BYTE ft_unsigned_byte(sfnt * f)
diff --git a/Build/source/texk/web2c/luatexdir/font/sfnt.h b/Build/source/texk/web2c/luatexdir/font/sfnt.h
index 87b373730be..5d9bd2c973f 100644
--- a/Build/source/texk/web2c/luatexdir/font/sfnt.h
+++ b/Build/source/texk/web2c/luatexdir/font/sfnt.h
@@ -19,7 +19,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: sfnt.h 1223 2008-05-02 13:39:55Z oneiros $ */
+/* $Id: sfnt.h 2271 2009-04-12 23:42:21Z oneiros $ */
#ifndef _SFNT_H_
# define _SFNT_H_
diff --git a/Build/source/texk/web2c/luatexdir/font/subfont.c b/Build/source/texk/web2c/luatexdir/font/subfont.c
index fecd5ed7857..33620092321 100644
--- a/Build/source/texk/web2c/luatexdir/font/subfont.c
+++ b/Build/source/texk/web2c/luatexdir/font/subfont.c
@@ -22,7 +22,7 @@
#include <string.h>
static const char _svn_version[] =
- "$Id: subfont.c 1783 2009-01-18 12:51:01Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/src/texk/web2c/luatexdir/font/subfont.c $";
+ "$Id: subfont.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/subfont.c $";
static struct avl_table *sfd_tree = NULL;
diff --git a/Build/source/texk/web2c/luatexdir/font/texfont.c b/Build/source/texk/web2c/luatexdir/font/texfont.c
index 1daf6a5b56b..7eac52c7d06 100644
--- a/Build/source/texk/web2c/luatexdir/font/texfont.c
+++ b/Build/source/texk/web2c/luatexdir/font/texfont.c
@@ -35,7 +35,7 @@
#include "luatex-api.h"
static const char _svn_version[] =
- "$Id: texfont.c 2064 2009-03-20 13:13:14Z taco $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/src/texk/web2c/luatexdir/font/texfont.c $";
+ "$Id: texfont.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/texfont.c $";
#define proper_char_index(c) (c<=font_ec(f) && c>=font_bc(f))
#define dxfree(a,b) { xfree(a); a = b ; }
@@ -129,6 +129,7 @@ integer new_font(void)
ci = xcalloc(1, sizeof(charinfo));
set_charinfo_name(ci, xstrdup(".notdef"));
font_tables[id]->charinfo = ci;
+ font_tables[id]->charinfo_size = 1;
font_tables[id]->charinfo_cache = NULL;
return id;
@@ -147,13 +148,15 @@ charinfo *get_charinfo(internal_font_number f, integer c)
if (proper_char_index(c)) {
glyph = get_sa_item(Characters(f), c);
if (!glyph) {
- /* this could be optimized using controlled growth */
- font_bytes += sizeof(charinfo);
+
glyph = ++font_tables[f]->charinfo_count;
- do_realloc(font_tables[f]->charinfo, (glyph + 1), charinfo);
- memset(&(font_tables[f]->charinfo[glyph]), 0, sizeof(charinfo));
+ if (glyph>=font_tables[f]->charinfo_size) {
+ font_bytes += (16*sizeof(charinfo));
+ do_realloc(font_tables[f]->charinfo, (glyph + 16), charinfo);
+ memset(&(font_tables[f]->charinfo[glyph]), 0, (16*sizeof(charinfo)));
+ font_tables[f]->charinfo_size += 16;
+ }
font_tables[f]->charinfo[glyph].ef = 1000; /* init */
- font_tables[f]->charinfo_size = glyph;
set_sa_item(font_tables[f]->characters, c, glyph, 1); /* 1= global */
}
return &(font_tables[f]->charinfo[glyph]);
@@ -256,6 +259,53 @@ charinfo *copy_charinfo(charinfo * ci)
set_charinfo_hor_variants(co,
copy_variants(get_charinfo_hor_variants(ci)));
}
+ /* TODO: copy mathkerns */
+ x = ci->top_left_math_kerns;
+ co->top_left_math_kerns = x;
+ if (x > 0) {
+ co->top_left_math_kern_array = xmalloc(2 * sizeof(scaled) * x);
+ for (k = 0; k < co->top_left_math_kerns; k++) {
+ co->top_left_math_kern_array[(2 * k)] =
+ ci->top_left_math_kern_array[(2 * k)];
+ co->top_left_math_kern_array[(2 * k) + 1] =
+ ci->top_left_math_kern_array[(2 * k) + 1];
+ }
+ }
+ x = ci->top_right_math_kerns;
+ co->top_right_math_kerns = x;
+ if (x > 0) {
+ co->top_right_math_kern_array = xmalloc(2 * sizeof(scaled) * x);
+ for (k = 0; k < co->top_right_math_kerns; k++) {
+ co->top_right_math_kern_array[(2 * k)] =
+ ci->top_right_math_kern_array[(2 * k)];
+ co->top_right_math_kern_array[(2 * k) + 1] =
+ ci->top_right_math_kern_array[(2 * k) + 1];
+ }
+ }
+ x = ci->bottom_right_math_kerns;
+ co->bottom_right_math_kerns = x;
+ if (x > 0) {
+ co->bottom_right_math_kern_array = xmalloc(2 * sizeof(scaled) * x);
+ for (k = 0; k < co->bottom_right_math_kerns; k++) {
+ co->bottom_right_math_kern_array[(2 * k)] =
+ ci->bottom_right_math_kern_array[(2 * k)];
+ co->bottom_right_math_kern_array[(2 * k) + 1] =
+ ci->bottom_right_math_kern_array[(2 * k) + 1];
+ }
+ }
+ x = ci->bottom_left_math_kerns;
+ co->bottom_left_math_kerns = x;
+ if (x > 0) {
+ co->bottom_left_math_kern_array = xmalloc(2 * sizeof(scaled) * x);
+ for (k = 0; k < co->bottom_left_math_kerns; k++) {
+ co->bottom_left_math_kern_array[(2 * k)] =
+ ci->bottom_left_math_kern_array[(2 * k)];
+ co->bottom_left_math_kern_array[(2 * k) + 1] =
+ ci->bottom_left_math_kern_array[(2 * k) + 1];
+ }
+ }
+
+
return co;
}
@@ -365,7 +415,7 @@ void dump_variant(extinfo * ext)
extinfo *undump_variant(void)
{
- int x;
+ integer x;
extinfo *ext;
undump_int(x);
if (x == 0)
@@ -570,6 +620,136 @@ void set_charinfo_hor_variants(charinfo * ci, extinfo * ext)
}
+int get_charinfo_math_kerns(charinfo * ci, int id)
+{
+
+ int k = 0; /* all callers check for result>0 */
+ if (id == top_left_kern) {
+ k = ci->top_left_math_kerns;
+ } else if (id == bottom_left_kern) {
+ k = ci->bottom_left_math_kerns;
+ } else if (id == bottom_right_kern) {
+ k = ci->bottom_right_math_kerns;
+ } else if (id == top_right_kern) {
+ k = ci->top_right_math_kerns;
+ } else {
+ tconfusion("get_charinfo_math_kerns");
+ }
+ return k;
+}
+
+void add_charinfo_math_kern(charinfo * ci, int id, scaled ht, scaled krn)
+{
+ int k;
+ if (id == top_left_kern) {
+ k = ci->top_left_math_kerns;
+ do_realloc(ci->top_left_math_kern_array, ((k + 1) * 2), sizeof(scaled));
+ ci->top_left_math_kern_array[(2 * (k))] = ht;
+ ci->top_left_math_kern_array[((2 * (k)) + 1)] = krn;
+ ci->top_left_math_kerns++;
+ } else if (id == bottom_left_kern) {
+ k = ci->bottom_left_math_kerns;
+ do_realloc(ci->bottom_left_math_kern_array, ((k + 1) * 2),
+ sizeof(scaled));
+ ci->bottom_left_math_kern_array[(2 * (k))] = ht;
+ ci->bottom_left_math_kern_array[(2 * (k)) + 1] = krn;
+ ci->bottom_left_math_kerns++;
+ } else if (id == bottom_right_kern) {
+ k = ci->bottom_right_math_kerns;
+ do_realloc(ci->bottom_right_math_kern_array, ((k + 1) * 2),
+ sizeof(scaled));
+ ci->bottom_right_math_kern_array[(2 * (k))] = ht;
+ ci->bottom_right_math_kern_array[(2 * (k)) + 1] = krn;
+ ci->bottom_right_math_kerns++;
+ } else if (id == top_right_kern) {
+ k = ci->top_right_math_kerns;
+ do_realloc(ci->top_right_math_kern_array, ((k + 1) * 2),
+ sizeof(scaled));
+ ci->top_right_math_kern_array[(2 * (k))] = ht;
+ ci->top_right_math_kern_array[(2 * (k)) + 1] = krn;
+ ci->top_right_math_kerns++;
+ } else {
+ tconfusion("add_charinfo_math_kern");
+ }
+}
+
+
+static void dump_math_kerns(charinfo * ci)
+{
+ integer k, l;
+ l = ci->top_left_math_kerns;
+ dump_int(l);
+ for (k = 0; k < l; k++) {
+ dump_int(ci->top_left_math_kern_array[(2 * k)]);
+ dump_int(ci->top_left_math_kern_array[(2 * k) + 1]);
+ }
+ l = ci->bottom_left_math_kerns;
+ dump_int(l);
+ for (k = 0; k < l; k++) {
+ dump_int(ci->bottom_left_math_kern_array[(2 * k)]);
+ dump_int(ci->bottom_left_math_kern_array[(2 * k) + 1]);
+ }
+ l = ci->bottom_right_math_kerns;
+ dump_int(l);
+ for (k = 0; k < l; k++) {
+ dump_int(ci->bottom_right_math_kern_array[(2 * k)]);
+ dump_int(ci->bottom_right_math_kern_array[(2 * k) + 1]);
+ }
+ l = ci->top_right_math_kerns;
+ dump_int(l);
+ for (k = 0; k < l; k++) {
+ dump_int(ci->bottom_left_math_kern_array[(2 * k)]);
+ dump_int(ci->bottom_left_math_kern_array[(2 * k) + 1]);
+ }
+}
+
+static void undump_math_kerns(charinfo * ci)
+{
+ int k;
+ integer x;
+ undump_int(x);
+ ci->top_left_math_kerns = (int) x;
+ if (x > 0)
+ ci->top_left_math_kern_array = xmalloc(2 * sizeof(scaled) * x);
+ for (k = 0; k < ci->top_left_math_kerns; k++) {
+ undump_int(x);
+ ci->top_left_math_kern_array[(2 * k)] = (scaled) x;
+ undump_int(x);
+ ci->top_left_math_kern_array[(2 * k) + 1] = (scaled) x;
+ }
+ undump_int(x);
+ ci->bottom_left_math_kerns = (int) x;
+ if (x > 0)
+ ci->bottom_left_math_kern_array = xmalloc(2 * sizeof(scaled) * x);
+ for (k = 0; k < ci->bottom_left_math_kerns; k++) {
+ undump_int(x);
+ ci->bottom_left_math_kern_array[(2 * k)] = (scaled) x;
+ undump_int(x);
+ ci->bottom_left_math_kern_array[(2 * k) + 1] = (scaled) x;
+ }
+ undump_int(x);
+ ci->bottom_right_math_kerns = (int) x;
+ if (x > 0)
+ ci->bottom_right_math_kern_array = xmalloc(2 * sizeof(scaled) * x);
+ for (k = 0; k < ci->bottom_right_math_kerns; k++) {
+ undump_int(x);
+ ci->bottom_right_math_kern_array[(2 * k)] = (scaled) x;
+ undump_int(x);
+ ci->bottom_right_math_kern_array[(2 * k) + 1] = (scaled) x;
+ }
+ undump_int(x);
+ ci->top_right_math_kerns = (int) x;
+ if (x > 0)
+ ci->top_right_math_kern_array = xmalloc(2 * sizeof(scaled) * x);
+ for (k = 0; k < ci->top_right_math_kerns; k++) {
+ undump_int(x);
+ ci->top_right_math_kern_array[(2 * k)] = (scaled) x;
+ undump_int(x);
+ ci->top_right_math_kern_array[(2 * k) + 1] = (scaled) x;
+ }
+}
+
+
/* In TeX, extensibles were fairly simple things.
This function squeezes a TFM extensible into the vertical extender structures.
|advance==0| is a special case for TFM fonts, because finding the proper
@@ -1041,7 +1221,9 @@ boolean font_shareable(internal_font_number f, internal_font_number k)
}
} else {
if ((font_filename(k) != NULL && font_filename(f) != NULL &&
- strcmp(font_filename(k), font_filename(f)) == 0)
+ strcmp(font_filename(k), font_filename(f)) == 0 &&
+ font_fullname(k) != NULL && font_fullname(f) != NULL &&
+ strcmp(font_fullname(k), font_fullname(f)) == 0)
|| (pdf_font_auto_expand(f)
&& (pdf_font_blink(f) != 0) /* 0 = nullfont */
&&same_font_name(k, pdf_font_blink(f)))) {
@@ -1244,7 +1426,7 @@ scaled get_kern(internal_font_number f, integer lc, integer rc)
void dump_charinfo(int f, int c)
{
charinfo *co;
- int x;
+ integer x;
liginfo *lig;
kerninfo *kern;
dump_int(c);
@@ -1301,15 +1483,53 @@ void dump_charinfo(int f, int c)
dump_charinfo_variants(get_charinfo_vert_variants(co));
dump_charinfo_variants(get_charinfo_hor_variants(co));
}
+ dump_math_kerns(co);
+}
+
+void dump_font_entry(texfont * f)
+{
+ dump_int(f->_font_size);
+ dump_int(f->_font_dsize);
+ dump_int(f->_font_cidversion);
+ dump_int(f->_font_cidsupplement);
+ dump_int(f->_font_ec);
+ dump_int(f->_font_checksum);
+ dump_int(f->_font_used);
+ dump_int(f->_font_touched);
+ dump_int(f->_font_cache_id);
+ dump_int(f->_font_encodingbytes);
+ dump_int(f->_font_slant);
+ dump_int(f->_font_extend);
+ dump_int(f->_font_tounicode);
+ dump_int(f->_font_type);
+ dump_int(f->_font_format);
+ dump_int(f->_font_embedding);
+ dump_int(f->_font_bc);
+ dump_int(f->_hyphen_char);
+ dump_int(f->_skew_char);
+ dump_int(f->_font_natural_dir);
+ dump_int(f->_font_params);
+ dump_int(f->_font_math_params);
+ dump_int(f->ligatures_disabled);
+ dump_int(f->_pdf_font_num);
+ dump_int(f->_pdf_font_size);
+ dump_int(f->_pdf_font_blink);
+ dump_int(f->_pdf_font_elink);
+ dump_int(f->_pdf_font_expand_ratio);
+ dump_int(f->_pdf_font_shrink);
+ dump_int(f->_pdf_font_stretch);
+ dump_int(f->_pdf_font_step);
+ dump_int(f->_pdf_font_auto_expand);
+ dump_int(f->_pdf_font_attr);
}
void dump_font(int f)
{
- int i, x;
+ integer i, x;
set_font_used(f, 0);
font_tables[f]->charinfo_cache = NULL;
- dump_things(*(font_tables[f]), 1);
+ dump_font_entry(font_tables[f]);
dump_string(font_name(f));
dump_string(font_area(f));
dump_string(font_filename(f));
@@ -1346,7 +1566,7 @@ void dump_font(int f)
int undump_charinfo(int f)
{
charinfo *co;
- int x, i;
+ integer x, i;
char *s = NULL;
liginfo *lig = NULL;
kerninfo *kern = NULL;
@@ -1427,6 +1647,7 @@ int undump_charinfo(int f)
set_charinfo_vert_variants(co, undump_charinfo_variants());
set_charinfo_hor_variants(co, undump_charinfo_variants());
}
+ undump_math_kerns(co);
return i;
}
@@ -1437,25 +1658,59 @@ int undump_charinfo(int f)
a(f,s); }
+void undump_font_entry(texfont * f)
+{
+ integer x = 0;
+ /* *INDENT-OFF* */
+ undump_int(x); f->_font_size = x;
+ undump_int(x); f->_font_dsize = x;
+ undump_int(x); f->_font_cidversion = x;
+ undump_int(x); f->_font_cidsupplement = x;
+ undump_int(x); f->_font_ec = x;
+ undump_int(x); f->_font_checksum = x;
+ undump_int(x); f->_font_used = x;
+ undump_int(x); f->_font_touched = x;
+ undump_int(x); f->_font_cache_id = x;
+ undump_int(x); f->_font_encodingbytes = x;
+ undump_int(x); f->_font_slant = x;
+ undump_int(x); f->_font_extend = x;
+ undump_int(x); f->_font_tounicode = x;
+ undump_int(x); f->_font_type = x;
+ undump_int(x); f->_font_format = x;
+ undump_int(x); f->_font_embedding = x;
+ undump_int(x); f->_font_bc = x;
+ undump_int(x); f->_hyphen_char = x;
+ undump_int(x); f->_skew_char = x;
+ undump_int(x); f->_font_natural_dir = x;
+ undump_int(x); f->_font_params = x;
+ undump_int(x); f->_font_math_params = x;
+ undump_int(x); f->ligatures_disabled = x;
+ undump_int(x); f->_pdf_font_num = x;
+ undump_int(x); f->_pdf_font_size = x;
+ undump_int(x); f->_pdf_font_blink = x;
+ undump_int(x); f->_pdf_font_elink = x;
+ undump_int(x); f->_pdf_font_expand_ratio = x;
+ undump_int(x); f->_pdf_font_shrink = x;
+ undump_int(x); f->_pdf_font_stretch = x;
+ undump_int(x); f->_pdf_font_step = x;
+ undump_int(x); f->_pdf_font_auto_expand = x;
+ undump_int(x); f->_pdf_font_attr = x;
+ /* *INDENT-ON* */
+}
+
+
+
void undump_font(int f)
{
- int x, i;
+ integer x, i;
texfont *tt;
charinfo *ci;
char *s;
grow_font_table(f);
- font_tables[f] = NULL;
- font_bytes += sizeof(texfont);
tt = xmalloc(sizeof(texfont));
- undump_things(*tt, 1);
- /* these |char *| need resetting */
- tt->_font_name = NULL;
- tt->_font_area = NULL;
- tt->_font_filename = NULL;
- tt->_font_fullname = NULL;
- tt->_font_encodingname = NULL;
- tt->_font_cidregistry = NULL;
- tt->_font_cidordering = NULL;
+ memset(tt, 0, sizeof(texfont));
+ font_bytes += sizeof(texfont);
+ undump_font_entry(tt);
font_tables[f] = tt;
undump_font_string(set_font_name);
@@ -1476,23 +1731,16 @@ void undump_font(int f)
font_bytes += i;
math_param_base(f) = xmalloc(i);
undump_things(*math_param_base(f), (font_math_params(f) + 1));
- } else {
- math_param_base(f) = NULL;
}
- font_tables[f]->_left_boundary = NULL;
undump_int(x);
if (x) {
i = undump_charinfo(f);
- }
- /* left boundary */
- font_tables[f]->_right_boundary = NULL;
+ } /* left boundary */
undump_int(x);
if (x) {
i = undump_charinfo(f);
- }
-
- /* right boundary */
+ } /* right boundary */
font_tables[f]->characters = new_sa_tree(1, 0); /* stack size 1, default item value 0 */
ci = xcalloc(1, sizeof(charinfo));
set_charinfo_name(ci, xstrdup(".notdef"));
diff --git a/Build/source/texk/web2c/luatexdir/font/texfont.h b/Build/source/texk/web2c/luatexdir/font/texfont.h
index f91d00dc2b1..8723364a96c 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 2057 2009-03-19 15:45:47Z taco $ */
+/* $Id: texfont.h 2271 2009-04-12 23:42:21Z oneiros $ */
/* 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
@@ -75,6 +75,14 @@ typedef struct charinfo {
char *tounicode; /* unicode equivalent */
extinfo *hor_variants; /* horizontal variants */
extinfo *vert_variants; /* vertical variants */
+ int top_left_math_kerns;
+ int top_right_math_kerns;
+ int bottom_right_math_kerns;
+ int bottom_left_math_kerns;
+ scaled *top_left_math_kern_array;
+ scaled *top_right_math_kern_array;
+ scaled *bottom_right_math_kern_array;
+ scaled *bottom_left_math_kern_array;
} charinfo;
@@ -394,11 +402,17 @@ typedef enum {
/* now for characters */
+typedef enum {
+ top_right_kern = 1,
+ bottom_right_kern = 2,
+ bottom_left_kern = 3,
+ top_left_kern = 4
+} font_math_kern_codes;
+
extern charinfo *get_charinfo(internal_font_number f, integer c);
extern integer char_exists(internal_font_number f, integer c);
extern charinfo *char_info(internal_font_number f, integer c);
-
extern void set_charinfo_width(charinfo * ci, scaled val);
extern void set_charinfo_height(charinfo * ci, scaled val);
extern void set_charinfo_depth(charinfo * ci, scaled val);
@@ -419,6 +433,9 @@ extern void set_charinfo_ef(charinfo * ci, scaled val);
extern void set_charinfo_lp(charinfo * ci, scaled val);
extern void set_charinfo_rp(charinfo * ci, scaled val);
+extern void add_charinfo_math_kern(charinfo *ci, int type, scaled ht, scaled krn);
+extern int get_charinfo_math_kerns(charinfo * ci, int id);
+
# define set_char_used(f,a,b) do { \
if (char_exists(f,a)) \
set_charinfo_used(char_info(f,a),b); \
diff --git a/Build/source/texk/web2c/luatexdir/font/tfmofm.c b/Build/source/texk/web2c/luatexdir/font/tfmofm.c
index 36364ba6d44..2e373e71081 100644
--- a/Build/source/texk/web2c/luatexdir/font/tfmofm.c
+++ b/Build/source/texk/web2c/luatexdir/font/tfmofm.c
@@ -22,7 +22,7 @@
#include "luatexfont.h"
static const char _svn_version[] =
- "$Id: tfmofm.c 2086 2009-03-22 15:32:08Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/src/texk/web2c/luatexdir/font/tfmofm.c $";
+ "$Id: tfmofm.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/tfmofm.c $";
/* Here are some macros that help process ligatures and kerns */
diff --git a/Build/source/texk/web2c/luatexdir/font/tounicode.c b/Build/source/texk/web2c/luatexdir/font/tounicode.c
index 29ee8c9bd0b..31f07c9a253 100644
--- a/Build/source/texk/web2c/luatexdir/font/tounicode.c
+++ b/Build/source/texk/web2c/luatexdir/font/tounicode.c
@@ -20,7 +20,7 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: tounicode.c 2029 2009-03-14 19:10:25Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/src/texk/web2c/luatexdir/font/tounicode.c $";
+ "$Id: tounicode.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/tounicode.c $";
#define isXdigit(c) (isdigit(c) || ('A' <= (c) && (c) <= 'F'))
#define UNI_UNDEF -1
diff --git a/Build/source/texk/web2c/luatexdir/font/tt_glyf.c b/Build/source/texk/web2c/luatexdir/font/tt_glyf.c
index b024897f82d..bb7a344e049 100644
--- a/Build/source/texk/web2c/luatexdir/font/tt_glyf.c
+++ b/Build/source/texk/web2c/luatexdir/font/tt_glyf.c
@@ -32,7 +32,7 @@
#include "writettf.h"
static const char _svn_version[] =
- "$Id: tt_glyf.c 1592 2008-11-28 13:23:51Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/src/texk/web2c/luatexdir/font/tt_glyf.c $";
+ "$Id: tt_glyf.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/tt_glyf.c $";
#define NUM_GLYPH_LIMIT 65534
#define TABLE_DATA_ALLOC_SIZE 40960
diff --git a/Build/source/texk/web2c/luatexdir/font/tt_glyf.h b/Build/source/texk/web2c/luatexdir/font/tt_glyf.h
index 0ca8465c33d..1a82f936af9 100644
--- a/Build/source/texk/web2c/luatexdir/font/tt_glyf.h
+++ b/Build/source/texk/web2c/luatexdir/font/tt_glyf.h
@@ -19,7 +19,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: tt_glyf.h 1223 2008-05-02 13:39:55Z oneiros $ */
+/* $Id: tt_glyf.h 2271 2009-04-12 23:42:21Z oneiros $ */
#ifndef _TT_GLYF_H_
# define _TT_GLYF_H_
diff --git a/Build/source/texk/web2c/luatexdir/font/tt_table.c b/Build/source/texk/web2c/luatexdir/font/tt_table.c
index 3df19723c2b..908a85cfdb9 100644
--- a/Build/source/texk/web2c/luatexdir/font/tt_table.c
+++ b/Build/source/texk/web2c/luatexdir/font/tt_table.c
@@ -34,7 +34,7 @@
#include "tt_table.h"
static const char _svn_version[] =
- "$Id: tt_table.c 1588 2008-11-28 13:18:54Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/src/texk/web2c/luatexdir/font/tt_table.c $";
+ "$Id: tt_table.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/tt_table.c $";
/*
tables contains information refered by other tables
diff --git a/Build/source/texk/web2c/luatexdir/font/tt_table.h b/Build/source/texk/web2c/luatexdir/font/tt_table.h
index 5dcd17d5b66..7fae8515646 100644
--- a/Build/source/texk/web2c/luatexdir/font/tt_table.h
+++ b/Build/source/texk/web2c/luatexdir/font/tt_table.h
@@ -19,7 +19,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: tt_table.h 1223 2008-05-02 13:39:55Z oneiros $ */
+/* $Id: tt_table.h 2271 2009-04-12 23:42:21Z oneiros $ */
#ifndef _TT_TABLE_H_
# define _TT_TABLE_H_
diff --git a/Build/source/texk/web2c/luatexdir/font/vfovf.c b/Build/source/texk/web2c/luatexdir/font/vfovf.c
index fefcd16b756..b52596f68e3 100644
--- a/Build/source/texk/web2c/luatexdir/font/vfovf.c
+++ b/Build/source/texk/web2c/luatexdir/font/vfovf.c
@@ -23,7 +23,7 @@
#include "luatexfont.h"
static const char _svn_version[] =
- "$Id: vfovf.c 2057 2009-03-19 15:45:47Z taco $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/src/texk/web2c/luatexdir/font/vfovf.c $";
+ "$Id: vfovf.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/vfovf.c $";
/* this is a hack! */
#define font_max 5000
diff --git a/Build/source/texk/web2c/luatexdir/font/vfpacket.c b/Build/source/texk/web2c/luatexdir/font/vfpacket.c
index e4fa429b4ef..f8f4bad02f7 100644
--- a/Build/source/texk/web2c/luatexdir/font/vfpacket.c
+++ b/Build/source/texk/web2c/luatexdir/font/vfpacket.c
@@ -21,7 +21,7 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: vfpacket.c 2048 2009-03-17 22:04:00Z hhenkel $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/src/texk/web2c/luatexdir/font/vfpacket.c $";
+ "$Id: vfpacket.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/vfpacket.c $";
/*
The |do_vf_packet| procedure is called in order to interpret the
diff --git a/Build/source/texk/web2c/luatexdir/font/writecff.c b/Build/source/texk/web2c/luatexdir/font/writecff.c
index 274c4ad1567..d2b038785b0 100644
--- a/Build/source/texk/web2c/luatexdir/font/writecff.c
+++ b/Build/source/texk/web2c/luatexdir/font/writecff.c
@@ -22,7 +22,7 @@
#include "writecff.h"
static const char _svn_version[] =
- "$Id: writecff.c 1592 2008-11-28 13:23:51Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/src/texk/web2c/luatexdir/font/writecff.c $";
+ "$Id: writecff.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writecff.c $";
#define get_offset(s,n) get_unsigned(s, (n))
#define get_card8(a) a->stream[a->offset++]
diff --git a/Build/source/texk/web2c/luatexdir/font/writecff.h b/Build/source/texk/web2c/luatexdir/font/writecff.h
index 2d92a8723ae..8f3fdac675a 100644
--- a/Build/source/texk/web2c/luatexdir/font/writecff.h
+++ b/Build/source/texk/web2c/luatexdir/font/writecff.h
@@ -19,7 +19,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: writecff.h 1518 2008-09-30 08:18:10Z taco $ */
+/* $Id: writecff.h 2271 2009-04-12 23:42:21Z oneiros $ */
#ifndef _CFF_LIMITS_H_
# define _CFF_LIMITS_H_
diff --git a/Build/source/texk/web2c/luatexdir/font/writeenc.c b/Build/source/texk/web2c/luatexdir/font/writeenc.c
index 648992ba6cd..575d5b61c3d 100644
--- a/Build/source/texk/web2c/luatexdir/font/writeenc.c
+++ b/Build/source/texk/web2c/luatexdir/font/writeenc.c
@@ -21,7 +21,7 @@
#include "ptexlib.h"
static const char _svn_version[] =
- "$Id: writeenc.c 1407 2008-07-15 10:49:28Z taco $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/src/texk/web2c/luatexdir/font/writeenc.c $";
+ "$Id: writeenc.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writeenc.c $";
/**********************************************************************/
/* All encoding entries go into AVL tree for fast search by name. */
diff --git a/Build/source/texk/web2c/luatexdir/font/writefont.c b/Build/source/texk/web2c/luatexdir/font/writefont.c
index 5c6b2d905a0..b15b71489e8 100644
--- a/Build/source/texk/web2c/luatexdir/font/writefont.c
+++ b/Build/source/texk/web2c/luatexdir/font/writefont.c
@@ -22,7 +22,7 @@
#include "luatexfont.h"
static const char _svn_version[] =
- "$Id: writefont.c 2097 2009-03-23 22:45:03Z hhenkel $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/src/texk/web2c/luatexdir/font/writefont.c $";
+ "$Id: writefont.c 2274 2009-04-13 12:10:20Z taco $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writefont.c $";
void write_cid_fontdictionary(fo_entry * fo, internalfontnumber f);
void create_cid_fontdictionary(fm_entry * fm, integer font_objnum,
@@ -713,6 +713,21 @@ void create_fontdictionary(fm_entry * fm, integer font_objnum,
/**********************************************************************/
+static int has_ttf_outlines(fm_entry *fm)
+{
+ FILE *f = fopen(fm->ff_name,"rb");
+ if (f!=NULL) {
+ int ch1 = getc(f);
+ int ch2 = getc(f);
+ int ch3 = getc(f);
+ int ch4 = getc(f);
+ fclose (f);
+ if (ch1=='O' && ch2=='T' && ch3=='T' && ch4=='O')
+ return 0;
+ return 1;
+ }
+ return 0;
+}
void do_pdf_font(integer font_objnum, internalfontnumber f)
{
@@ -740,7 +755,11 @@ void do_pdf_font(integer font_objnum, internalfontnumber f)
switch (font_format(f)) {
case opentype_format:
- set_opentype(fm);
+ if (has_ttf_outlines(fm)) {
+ set_truetype(fm);
+ } else {
+ set_opentype(fm);
+ }
break;
case truetype_format:
set_truetype(fm);
diff --git a/Build/source/texk/web2c/luatexdir/font/writet1.c b/Build/source/texk/web2c/luatexdir/font/writet1.c
index 809ec3db014..46563a6fb76 100644
--- a/Build/source/texk/web2c/luatexdir/font/writet1.c
+++ b/Build/source/texk/web2c/luatexdir/font/writet1.c
@@ -25,7 +25,7 @@
#include "luatex-api.h"
static const char _svn_version[] =
- "$Id: writet1.c 2078 2009-03-22 00:17:18Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/src/texk/web2c/luatexdir/font/writet1.c $";
+ "$Id: writet1.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writet1.c $";
#define t1_log(str) if(tracefilenames) tex_printf("%s", str)
#define get_length1() t1_length1 = t1_offset() - t1_save_offset
@@ -837,6 +837,8 @@ static void t1_scan_param(void)
return;
if (t1_prefix(lenIV)) {
t1_lenIV = t1_scan_num(t1_line_array + strlen(lenIV), 0);
+ if (t1_lenIV < 0)
+ pdftex_fail("negative value of lenIV is not supported");
return;
}
t1_scan_keys();
@@ -1224,10 +1226,44 @@ static void cs_fail(const char *cs_name, int subr, const char *fmt, ...)
pdftex_fail("CharString (/%s): %s", cs_name, buf);
}
+/* fix a return-less subr by appending CS_RETURN */
+static void append_cs_return(cs_entry * ptr)
+{
+ unsigned short cr;
+ int i;
+ byte *p, *q, *data, *new_data;
+ assert(ptr != NULL && ptr->valid && ptr->used);
+
+ /* decrypt the cs data to t1_buf_array, append CS_RETURN */
+ p = (byte *) t1_buf_array;
+ data = ptr->data + 4;
+ cr = 4330;
+ for (i = 0; i < ptr->cslen; i++)
+ *p++ = cs_getchar();
+ *p = CS_RETURN;
+
+ /* encrypt the new cs data to new_data */
+ new_data = xtalloc(ptr->len + 1, byte);
+ memcpy(new_data, ptr->data, 4);
+ p = new_data + 4;
+ q = (byte *) t1_buf_array;
+ cr = 4330;
+ for (i = 0; i < ptr->cslen + 1; i++)
+ *p++ = cencrypt(*q++, &cr);
+ memcpy(p, ptr->data + 4 + ptr->cslen, ptr->len - ptr->cslen - 4);
+
+ /* update *ptr */
+ xfree(ptr->data);
+ ptr->data = new_data;
+ ptr->len++;
+ ptr->cslen++;
+}
+
static void cs_mark(const char *cs_name, int subr)
{
byte *data;
int i, b, cs_len;
+ int last_cmd = 0;
integer a, a1, a2;
unsigned short cr;
static integer lastargOtherSubr3 = 3; /* the argument of last call to
@@ -1312,6 +1348,7 @@ static void cs_mark(const char *cs_name, int subr)
"more arguments on stack (%i) than required (%i)",
(int) (stack_ptr - cc_stack), (int) cc->nargs);
}
+ last_cmd = b;
switch (cc - cc_tab) {
case CS_CALLSUBR:
a1 = cc_get(-1);
@@ -1352,6 +1389,12 @@ static void cs_mark(const char *cs_name, int subr)
}
}
}
+ if (cs_name == NULL && last_cmd != CS_RETURN) {
+ pdftex_warn("last command in subr `%i' is not a RETURN; "
+ "I will add it now but please consider fixing the font",
+ (int) subr);
+ append_cs_return(ptr);
+ }
return;
cs_error: /* an error occured during parsing */
cc_clear();
@@ -1596,14 +1639,12 @@ static void t1_flush_cs(boolean is_subr)
if (is_subr) {
cr = 4330;
cs_len = 0;
+ /* at this point we have t1_lenIV >= 0;
+ * a negative value would be caught in t1_scan_param() */
return_cs = xtalloc(t1_lenIV + 1, byte);
- if (t1_lenIV >= 0) {
- for (cs_len = 0, r = return_cs; cs_len < t1_lenIV; cs_len++, r++)
- *r = cencrypt(0x00, &cr);
- *r = cencrypt(CS_RETURN, &cr);
- } else {
- *return_cs = CS_RETURN;
- }
+ for (cs_len = 0, r = return_cs; cs_len < t1_lenIV; cs_len++, r++)
+ *r = cencrypt(0x00, &cr);
+ *r = cencrypt(CS_RETURN, &cr);
cs_len++;
}
diff --git a/Build/source/texk/web2c/luatexdir/font/writet3.c b/Build/source/texk/web2c/luatexdir/font/writet3.c
index 4e349860d22..3d3f46fe2c6 100644
--- a/Build/source/texk/web2c/luatexdir/font/writet3.c
+++ b/Build/source/texk/web2c/luatexdir/font/writet3.c
@@ -25,7 +25,7 @@
#include "luatexfont.h"
static const char _svn_version[] =
- "$Id: writet3.c 1712 2009-01-02 10:54:55Z taco $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/src/texk/web2c/luatexdir/font/writet3.c $";
+ "$Id: writet3.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writet3.c $";
#define T3_BUF_SIZE 1024
diff --git a/Build/source/texk/web2c/luatexdir/font/writettf.c b/Build/source/texk/web2c/luatexdir/font/writettf.c
index fafd7c6eab4..6a989db833f 100644
--- a/Build/source/texk/web2c/luatexdir/font/writettf.c
+++ b/Build/source/texk/web2c/luatexdir/font/writettf.c
@@ -23,7 +23,7 @@
#include <string.h>
static const char _svn_version[] =
- "$Id: writettf.c 1592 2008-11-28 13:23:51Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/src/texk/web2c/luatexdir/font/writettf.c $";
+ "$Id: writettf.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writettf.c $";
#define DEFAULT_NTABS 14
#define NEW_CMAP_SIZE 2
diff --git a/Build/source/texk/web2c/luatexdir/font/writettf.h b/Build/source/texk/web2c/luatexdir/font/writettf.h
index 42a57a72c8f..b0db58ef2f1 100644
--- a/Build/source/texk/web2c/luatexdir/font/writettf.h
+++ b/Build/source/texk/web2c/luatexdir/font/writettf.h
@@ -18,7 +18,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: writettf.h 1592 2008-11-28 13:23:51Z oneiros $ */
+/* $Id: writettf.h 2271 2009-04-12 23:42:21Z oneiros $ */
#ifndef WRITETTF_H
# define WRITETTF_H 1
diff --git a/Build/source/texk/web2c/luatexdir/font/writetype0.c b/Build/source/texk/web2c/luatexdir/font/writetype0.c
index 846314bedab..ea7c7822a2f 100644
--- a/Build/source/texk/web2c/luatexdir/font/writetype0.c
+++ b/Build/source/texk/web2c/luatexdir/font/writetype0.c
@@ -22,7 +22,7 @@
#include "writecff.h"
static const char _svn_version[] =
- "$Id: writetype0.c 1783 2009-01-18 12:51:01Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/src/texk/web2c/luatexdir/font/writetype0.c $";
+ "$Id: writetype0.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writetype0.c $";
void writetype0(fd_entry * fd)
{
diff --git a/Build/source/texk/web2c/luatexdir/font/writetype2.c b/Build/source/texk/web2c/luatexdir/font/writetype2.c
index ba98772b931..7eb84d8f5de 100644
--- a/Build/source/texk/web2c/luatexdir/font/writetype2.c
+++ b/Build/source/texk/web2c/luatexdir/font/writetype2.c
@@ -25,7 +25,7 @@
#include "tt_glyf.h"
static const char _svn_version[] =
- "$Id: writetype2.c 1783 2009-01-18 12:51:01Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/src/texk/web2c/luatexdir/font/writetype2.c $";
+ "$Id: writetype2.c 2271 2009-04-12 23:42:21Z oneiros $ $URL: http://scm.foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/font/writetype2.c $";
/* forward*/
void make_tt_subset(fd_entry * fd, unsigned char *buffer, integer buflen);