diff options
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/font')
24 files changed, 298 insertions, 228 deletions
diff --git a/Build/source/texk/web2c/luatexdir/font/dofont.w b/Build/source/texk/web2c/luatexdir/font/dofont.w index 3dad8b50abe..57e35858102 100644 --- a/Build/source/texk/web2c/luatexdir/font/dofont.w +++ b/Build/source/texk/web2c/luatexdir/font/dofont.w @@ -24,7 +24,7 @@ static const char _svn_version[] = "$Id: dofont.w 3584 2010-04-02 17:45:55Z hhenkel $ " - "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/dofont.w $"; + "$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 diff --git a/Build/source/texk/web2c/luatexdir/font/luafont.w b/Build/source/texk/web2c/luatexdir/font/luafont.w index 6ea114de45a..181e825847c 100644 --- a/Build/source/texk/web2c/luatexdir/font/luafont.w +++ b/Build/source/texk/web2c/luatexdir/font/luafont.w @@ -19,8 +19,8 @@ @ @c static const char _svn_version[] = - "$Id: luafont.w 3612 2010-04-13 09:29:42Z taco $ " -"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/luafont.w $"; + "$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 $"; #include "ptexlib.h" #include "lua/luatex-api.h" @@ -103,6 +103,24 @@ const char *MATH_param_names[] = { NULL, }; +/* here for now, may be useful elsewhere */ + +int ff_checkoption (lua_State *L, int narg, const char *def, + const char *const lst[]); + +int ff_checkoption (lua_State *L, int narg, const char *def, + const char *const lst[]) { + const char *name = (def) ? luaL_optstring(L, narg, def) : + luaL_checkstring(L, narg); + int i; + for (i=0; lst[i]; i++) + if (strcmp(lst[i], name) == 0) + return i; + return -1; +} + + + static void dump_intfield(lua_State * L, const char *n, int c) { lua_pushstring(L, n); @@ -368,7 +386,7 @@ static void write_lua_math_parameters(lua_State * L, int f) { int k; lua_newtable(L); - for (k = 1; k < font_math_params(f); k++) { + for (k = 1; k <= font_math_params(f); k++) { lua_pushnumber(L, font_math_param(f, k)); if (k <= MATH_param_max) { lua_setfield(L, -2, MATH_param_names[k]); @@ -455,11 +473,11 @@ int font_to_lua(lua_State * L, int f) lua_pushnumber(L,pdf_font_num(f)); lua_setfield(L,-2,"pdf_num"); } - if (pdf_font_blink(f) != 0) { + if (pdf_font_blink(f) != null_font) { lua_pushnumber(L,pdf_font_blink(f)); lua_setfield(L,-2,"pdf_blink"); } - if (pdf_font_elink(f) != 0) { + if (pdf_font_elink(f) != null_font) { lua_pushnumber(L,pdf_font_elink(f)); lua_setfield(L,-2,"pdf_elink"); } @@ -708,6 +726,7 @@ make_luaS_index(font); make_luaS_index(char); make_luaS_index(slot); make_luaS_index(comment); +make_luaS_index(nop); make_luaS_index(push); make_luaS_index(pop); make_luaS_index(rule); @@ -763,6 +782,7 @@ static void init_font_string_pointers(lua_State * L) init_luaS_index(char); init_luaS_index(slot); init_luaS_index(comment); + init_luaS_index(nop); init_luaS_index(push); init_luaS_index(pop); init_luaS_index(rule); @@ -823,7 +843,8 @@ static int count_char_packet_bytes(lua_State * L) } else if (luaS_ptr_eq(s, slot)) { l += 10; ff = 1; - } else if (luaS_ptr_eq(s, comment)) {; + } else if (luaS_ptr_eq(s, comment) || luaS_ptr_eq(s, nop)) { + ; } else if (luaS_ptr_eq(s, push) || luaS_ptr_eq(s, pop)) { l++; } else if (luaS_ptr_eq(s, rule)) { @@ -834,10 +855,15 @@ static int count_char_packet_bytes(lua_State * L) } else if (luaS_ptr_eq(s, special)) { size_t len; lua_rawgeti(L, -2, 2); - (void) lua_tolstring(L, -1, &len); - lua_pop(L, 1); - if (len > 0) { - l = (int) (l + 5 + (int) len); + if (lua_isstring(L, -1)) { + (void) lua_tolstring(L, -1, &len); + 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; @@ -905,16 +931,16 @@ read_char_packets(lua_State * L, int *l_fonts, charinfo * co, int atsize) } else if (luaS_ptr_eq(s, slot)) { cmd = packet_nop_code; lua_rawgeti(L, -2, 2); - n = (int) lua_tointeger(L, -1); + n = (int) luaL_checkinteger(L, -1); ff = (n > max_f ? l_fonts[1] : l_fonts[n]); lua_rawgeti(L, -3, 3); - n = (int) lua_tointeger(L, -1); + n = (int) luaL_checkinteger(L, -1); lua_pop(L, 2); append_packet(packet_font_code); do_store_four(ff); append_packet(packet_char_code); do_store_four(n); - } else if (luaS_ptr_eq(s, comment)) { + } else if (luaS_ptr_eq(s, comment) || luaS_ptr_eq(s, nop)) { cmd = packet_nop_code; } else if (luaS_ptr_eq(s, node)) { cmd = packet_node_code; @@ -942,7 +968,7 @@ read_char_packets(lua_State * L, int *l_fonts, charinfo * co, int atsize) case packet_font_code: append_packet(cmd); lua_rawgeti(L, -2, 2); - n = (int) lua_tointeger(L, -1); + n = (int) luaL_checkinteger(L, -1); ff = (n > max_f ? l_fonts[1] : l_fonts[n]); do_store_four(ff); lua_pop(L, 1); @@ -957,7 +983,7 @@ read_char_packets(lua_State * L, int *l_fonts, charinfo * co, int atsize) case packet_char_code: append_packet(cmd); lua_rawgeti(L, -2, 2); - n = (int) lua_tointeger(L, -1); + n = (int) luaL_checkinteger(L, -1); do_store_four(n); lua_pop(L, 1); break; @@ -965,24 +991,24 @@ read_char_packets(lua_State * L, int *l_fonts, charinfo * co, int atsize) case packet_down_code: append_packet(cmd); lua_rawgeti(L, -2, 2); - n = (int) lua_tointeger(L, -1); + n = (int) luaL_checkinteger(L, -1); do_store_four(sp_to_dvi(n, atsize)); lua_pop(L, 1); break; case packet_rule_code: append_packet(cmd); lua_rawgeti(L, -2, 2); - n = (int) lua_tointeger(L, -1); + n = (int) luaL_checkinteger(L, -1); do_store_four(sp_to_dvi(n, atsize)); lua_rawgeti(L, -3, 3); - n = (int) lua_tointeger(L, -1); + n = (int) luaL_checkinteger(L, -1); do_store_four(sp_to_dvi(n, atsize)); lua_pop(L, 2); break; case packet_special_code: append_packet(cmd); lua_rawgeti(L, -2, 2); - s = lua_tolstring(L, -1, &l); + s = luaL_checklstring(L, -1, &l); if (l > 0) { do_store_four(l); m = (int) l; @@ -1125,10 +1151,10 @@ static void read_lua_math_parameters(lua_State * L, int f) if (lua_isnumber(L, -2)) { lua_number2int(i, lua_tonumber(L, -2)); } else if (lua_isstring(L, -2)) { - i = luaL_checkoption(L, -2, NULL, MATH_param_names); + i = ff_checkoption(L, -2, NULL, MATH_param_names); } lua_number2int(n, lua_tonumber(L, -1)); - if (i != 0) { + if (i > 0) { set_font_math_param(f, i, n); } lua_pop(L, 1); /* pop value */ @@ -1221,9 +1247,9 @@ font_char_from_lua(lua_State * L, internal_font_number f, int i, set_charinfo_tounicode(co, NULL); if (has_math) { - j = n_numeric_field(L, luaS_top_accent_index, 0); + j = n_numeric_field(L, luaS_top_accent_index, INT_MIN); set_charinfo_top_accent(co, j); - j = n_numeric_field(L, luaS_bot_accent_index, 0); + j = n_numeric_field(L, luaS_bot_accent_index, INT_MIN); set_charinfo_bot_accent(co, j); k = n_numeric_field(L, luaS_next_index, -1); if (k >= 0) { @@ -2221,6 +2247,10 @@ static void add_kern_before(halfword left, halfword right) assert(vlink(prev) == right); couple_nodes(prev, kern); couple_nodes(kern, right); + /* update the attribute list (inherit from left) */ + delete_attribute_ref(node_attr(kern)); + add_node_attr_ref(node_attr(left)); + node_attr(kern) = node_attr(left); } } } @@ -2237,6 +2267,10 @@ static void add_kern_after(halfword left, halfword right, halfword aft) assert(next == null || alink(next) == aft); couple_nodes(aft, kern); try_couple_nodes(kern, next); + /* update the attribute list (inherit from left == aft) */ + delete_attribute_ref(node_attr(kern)); + add_node_attr_ref(node_attr(aft)); + node_attr(kern) = node_attr(aft); } } } @@ -2341,22 +2375,25 @@ static halfword run_lua_ligkern_callback(halfword head, halfword tail, int callback_id) { lua_State *L = Luas; + int i; + int top = lua_gettop(L); if (!get_callback(L, callback_id)) { lua_pop(L, 2); return tail; } nodelist_to_lua(L, head); nodelist_to_lua(L, tail); - if (lua_pcall(L, 2, 1, 0) != 0) { - fprintf(stdout, "error: %s\n", lua_tostring(L, -1)); - lua_pop(L, 2); - lua_error(L); + if ((i=lua_pcall(L, 2, 0, 0)) != 0) { + luatex_error(L, (i == LUA_ERRRUN ? 0 : 1)); return tail; } + /* next two lines disabled to be compatible with the manual */ +#if 0 tail = nodelist_from_lua(L); if (fix_node_lists) +#endif fix_node_list(head); - lua_pop(L, 2); + lua_settop(L, top); return tail; } diff --git a/Build/source/texk/web2c/luatexdir/font/luatexfont.h b/Build/source/texk/web2c/luatexdir/font/luatexfont.h index fa2d2ac6c6d..15c48c7f50b 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 3433 2010-02-20 10:03:04Z hhenkel $ */ +/* $Id: luatexfont.h 3790 2010-08-02 20:00:17Z oneiros $ */ #ifndef LUATEXFONT_H # define LUATEXFONT_H @@ -200,8 +200,8 @@ extern char notdef[]; /* vfovf.c */ void vf_expand_local_fonts(internal_font_number f); -internal_font_number letter_space_font(halfword u, internal_font_number f, - int e); +internal_font_number letter_space_font(internal_font_number f, + int e, boolean nolig); internal_font_number auto_expand_font(internal_font_number f, int e); void pdf_check_vf(internal_font_number f); internal_font_number copy_font_info(internal_font_number f); diff --git a/Build/source/texk/web2c/luatexdir/font/mapfile.w b/Build/source/texk/web2c/luatexdir/font/mapfile.w index 8d06d046628..413e7832f78 100644 --- a/Build/source/texk/web2c/luatexdir/font/mapfile.w +++ b/Build/source/texk/web2c/luatexdir/font/mapfile.w @@ -20,8 +20,8 @@ with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */ static const char _svn_version[] = - "$Id: mapfile.w 3584 2010-04-02 17:45:55Z hhenkel $ " - "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/mapfile.w $"; + "$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 $"; #include <math.h> #include "ptexlib.h" @@ -528,14 +528,14 @@ static void fm_read_info(void) fm_file = NULL; } } else { - pdftex_warn("cannot open font map file"); + pdftex_warn("cannot open font map file (%s)", cur_file_name); } } else { - pdftex_warn("cannot open font map file"); + pdftex_warn("cannot open font map file (%s)", cur_file_name); } } else { if (!fm_open(cur_file_name)) { - pdftex_warn("cannot open font map file"); + pdftex_warn("cannot open font map file (%s)", cur_file_name); } else { fm_read_file(); tex_printf("{%s", cur_file_name); diff --git a/Build/source/texk/web2c/luatexdir/font/pkin.w b/Build/source/texk/web2c/luatexdir/font/pkin.w index a807ab39d0c..19e6b5db48d 100644 --- a/Build/source/texk/web2c/luatexdir/font/pkin.w +++ b/Build/source/texk/web2c/luatexdir/font/pkin.w @@ -53,7 +53,7 @@ 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/branches/0.60.x/source/texk/web2c/luatexdir/font/pkin.w $"; + "$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 diff --git a/Build/source/texk/web2c/luatexdir/font/sfnt.h b/Build/source/texk/web2c/luatexdir/font/sfnt.h index a67bd02d890..dda13643ff6 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 3404 2010-01-28 11:17:10Z taco $ */ +/* $Id: sfnt.h 3765 2010-07-29 07:10:21Z taco $ */ #ifndef _SFNT_H_ # define _SFNT_H_ diff --git a/Build/source/texk/web2c/luatexdir/font/sfnt.w b/Build/source/texk/web2c/luatexdir/font/sfnt.w index a6482e29846..26653508b0f 100644 --- a/Build/source/texk/web2c/luatexdir/font/sfnt.w +++ b/Build/source/texk/web2c/luatexdir/font/sfnt.w @@ -32,8 +32,8 @@ #include "font/sfnt.h" static const char _svn_version[] = - "$Id: sfnt.w 3584 2010-04-02 17:45:55Z hhenkel $ " -"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/sfnt.w $"; + "$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 $"; diff --git a/Build/source/texk/web2c/luatexdir/font/subfont.w b/Build/source/texk/web2c/luatexdir/font/subfont.w index b7ea88064cf..fced62d248e 100644 --- a/Build/source/texk/web2c/luatexdir/font/subfont.w +++ b/Build/source/texk/web2c/luatexdir/font/subfont.w @@ -23,8 +23,8 @@ #include <string.h> static const char _svn_version[] = - "$Id: subfont.w 3584 2010-04-02 17:45:55Z hhenkel $ " -"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/subfont.w $"; + "$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; @@ -149,13 +149,13 @@ static sfd_entry *read_sfd(char *sfd_name) if (!(run_callback(callback_id, "S->bSd", cur_file_name, &file_opened, &sfd_buffer, &sfd_size) && file_opened && sfd_size > 0)) { - pdftex_warn("cannot open SFD file for reading"); + pdftex_warn("cannot open SFD file for reading (%s)", cur_file_name); cur_file_name = NULL; return NULL; } } else { if (!sfd_open(cur_file_name)) { - pdftex_warn("cannot open SFD file for reading"); + pdftex_warn("cannot open SFD file for reading (%s)", cur_file_name); cur_file_name = NULL; return NULL; } diff --git a/Build/source/texk/web2c/luatexdir/font/texfont.h b/Build/source/texk/web2c/luatexdir/font/texfont.h index 9281b19ec0d..5c33c20af81 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 3723 2010-06-18 09:19:27Z taco $ */ +/* $Id: texfont.h 3853 2010-09-03 18:05:14Z 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 @@ -38,11 +38,11 @@ typedef struct liginfo { int adj; int lig; int type; -#else +# else int type; int lig; int adj; -#endif +# endif } liginfo; /* these are dumped en block, so they need endianness tests */ @@ -50,10 +50,10 @@ typedef struct kerninfo { # ifdef WORDS_BIGENDIAN int adj; scaled sc; -#else +# else scaled sc; int adj; -#endif +# endif } kerninfo; typedef struct extinfo { @@ -172,7 +172,7 @@ typedef struct texfont { int ligatures_disabled; int _pdf_font_num; /* maps to a PDF resource ID */ - internal_font_number _pdf_font_blink; /* link to base font for expanded fonts */ + internal_font_number _pdf_font_blink; /* link to base font for expanded fonts */ internal_font_number _pdf_font_elink; /* link to expanded fonts for base font */ str_number _pdf_font_attr; /* pointer to additional attributes */ } texfont; diff --git a/Build/source/texk/web2c/luatexdir/font/texfont.w b/Build/source/texk/web2c/luatexdir/font/texfont.w index 3943da67cb3..85c02131933 100644 --- a/Build/source/texk/web2c/luatexdir/font/texfont.w +++ b/Build/source/texk/web2c/luatexdir/font/texfont.w @@ -33,8 +33,8 @@ problematic |if 0 != null|. @c static const char _svn_version[] = - "$Id: texfont.w 3634 2010-04-19 19:52:48Z taco $ " -"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/texfont.w $"; + "$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 $"; #include "ptexlib.h" #include "lua/luatex-api.h" @@ -115,6 +115,8 @@ int new_font(void) font_tables[id]->_right_boundary = NULL; font_tables[id]->_param_base = NULL; font_tables[id]->_math_param_base = NULL; + font_tables[id]->_pdf_font_blink = null_font; + font_tables[id]->_pdf_font_elink = null_font; set_font_bc(id, 1); /* ec = 0 */ set_hyphen_char(id, '-'); @@ -1124,10 +1126,10 @@ int copy_font(int f) if (font_cidordering(f) != NULL) set_font_cidordering(k, xstrdup(font_cidordering(f))); - i = (int) (sizeof(*param_base(f)) * (unsigned) font_params(f)); + i = (int) (sizeof(*param_base(f)) * (unsigned) (font_params(f)+1)); font_bytes += i; - param_base(k) = xmalloc((unsigned) i); - memcpy(param_base(k), param_base(f), (size_t) i); + param_base(k) = xmalloc((unsigned) (i+1)); + memcpy(param_base(k), param_base(f), (size_t) (i)); if (font_math_params(f) > 0) { i = (int) (sizeof(*math_param_base(f)) * @@ -1151,6 +1153,8 @@ int copy_font(int f) ci = copy_charinfo(right_boundary(f)); set_charinfo(k, right_boundarychar, ci); } + /* not updated yet: */ + font_tables[k]->charinfo_count = font_tables[f]->charinfo_count; return k; } diff --git a/Build/source/texk/web2c/luatexdir/font/tfmofm.w b/Build/source/texk/web2c/luatexdir/font/tfmofm.w index a007ac48b48..6a3e77d78d1 100644 --- a/Build/source/texk/web2c/luatexdir/font/tfmofm.w +++ b/Build/source/texk/web2c/luatexdir/font/tfmofm.w @@ -21,8 +21,8 @@ #include "ptexlib.h" static const char _svn_version[] = - "$Id: tfmofm.w 3634 2010-04-19 19:52:48Z taco $ " -"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/tfmofm.w $"; + "$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 $"; @ Here are some macros that help process ligatures and kerns @c diff --git a/Build/source/texk/web2c/luatexdir/font/tounicode.w b/Build/source/texk/web2c/luatexdir/font/tounicode.w index 14bf9bedad9..9647d9e049c 100644 --- a/Build/source/texk/web2c/luatexdir/font/tounicode.w +++ b/Build/source/texk/web2c/luatexdir/font/tounicode.w @@ -22,8 +22,8 @@ #include "ptexlib.h" static const char _svn_version[] = - "$Id: tounicode.w 3584 2010-04-02 17:45:55Z hhenkel $ " -"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/tounicode.w $"; + "$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 $"; @ @c #define isXdigit(c) (isdigit(c) || ('A' <= (c) && (c) <= 'F')) @@ -141,7 +141,7 @@ static long check_unicode_value(char *s, boolean multiple_value) { int l = (int) strlen(s); int i; - long code; + long code = 0; /* anything that is not |UNI_UNDEF| will do */ if (l == 0) return UNI_UNDEF; @@ -538,9 +538,11 @@ int write_cid_tounicode(PDF pdf, fo_entry * fo, internal_font_number f) i++; } else { /* |gtab[i].code >= 0| */ j = i; - while (i < 65536 && gtab[i + 1].code >= 0 && - gtab[i].code + 1 == gtab[i + 1].code) - i++; + k = i % 256; + while (i < 65536 && k<255 && gtab[i + 1].code >= 0 && + gtab[i].code + 1 == gtab[i + 1].code) { + i++; k++; + } /* at this point i is the last entry of the subrange */ i++; /* move i to the next entry */ range_size[j] = i - j; diff --git a/Build/source/texk/web2c/luatexdir/font/tt_glyf.w b/Build/source/texk/web2c/luatexdir/font/tt_glyf.w index 2a1fcf02f66..f0774647fe1 100644 --- a/Build/source/texk/web2c/luatexdir/font/tt_glyf.w +++ b/Build/source/texk/web2c/luatexdir/font/tt_glyf.w @@ -31,7 +31,7 @@ static const char _svn_version[] = "$Id: tt_glyf.w 3584 2010-04-02 17:45:55Z hhenkel $ " -"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/tt_glyf.w $"; +"$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 diff --git a/Build/source/texk/web2c/luatexdir/font/tt_table.w b/Build/source/texk/web2c/luatexdir/font/tt_table.w index 744baa8e6bf..f53e2659336 100644 --- a/Build/source/texk/web2c/luatexdir/font/tt_table.w +++ b/Build/source/texk/web2c/luatexdir/font/tt_table.w @@ -28,7 +28,7 @@ static const char _svn_version[] = "$Id: tt_table.w 3584 2010-04-02 17:45:55Z hhenkel $ " -"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/tt_table.w $"; +"$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 diff --git a/Build/source/texk/web2c/luatexdir/font/vfovf.w b/Build/source/texk/web2c/luatexdir/font/vfovf.w index 68852e209e5..2448b1d732c 100644 --- a/Build/source/texk/web2c/luatexdir/font/vfovf.w +++ b/Build/source/texk/web2c/luatexdir/font/vfovf.w @@ -22,8 +22,8 @@ #include "ptexlib.h" static const char _svn_version[] = - "$Id: vfovf.w 3612 2010-04-13 09:29:42Z taco $ " - "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/vfovf.w $"; + "$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 $"; @ @c /* this is a hack! */ @@ -1507,26 +1507,20 @@ void vf_expand_local_fonts(internal_font_number f) @ @c internal_font_number -letter_space_font(halfword u, internal_font_number f, int e) +letter_space_font(internal_font_number f, int e, boolean nolig) { internal_font_number k; - scaled w, r; - + scaled w; + int c; + charinfo *co; char *new_font_name; - int vf_z; - int vf_alpha; - int vf_beta; - memory_word tmp_w; /* accumulator */ - /* read a new font and expand the character widths */ - k = read_font_info(u, font_name(f), font_size(f), font_natural_dir(f)); - set_no_ligatures(k); /* disable ligatures for letter-spaced fonts */ -#if 0 - for (i = 0;i <= font_widths(k);i++) { - set_font_width(k,i,font_width(f,i)+round_xn_over_d(quad(k), e, 1000)); - } -#endif + k = copy_font(f); + + if (nolig) + set_no_ligatures(k); /* disable ligatures for letter-spaced fonts */ + /* append eg '+100ls' to font name */ new_font_name = xmalloc((unsigned) (strlen(font_name(k)) + 8)); /* |abs(e) <= 1000| */ if (e > 0) { @@ -1539,86 +1533,45 @@ letter_space_font(halfword u, internal_font_number f, int e) /* create the corresponding virtual font */ set_font_type(k, virtual_font_type); - - vf_z = font_size(f); - vf_replace_z(); - w = round_xn_over_d(quad(f), e, 2000); - if (w > 0) { - tmp_b0 = 0; - } else { - tmp_b0 = 255; - w = vf_alpha + w; - } - r = w * vf_beta; - tmp_b1 = (quarterword) (r / vf_z); - r = r % vf_z; - if (r == 0) { - tmp_b2 = 0; - } else { - r = r * 256; - tmp_b2 = (quarterword) (r / vf_z); - r = r % vf_z; - } - if (r == 0) { - tmp_b3 = 0; - } else { - r = r * 256; - tmp_b3 = (quarterword) (r / vf_z); + + for (c=font_bc(k);c<=font_ec(k);c++) { + if (quick_char_exists(k, c)) { + int half_w; + int vf_np = 0; + eight_bits *vpackets = xmalloc((unsigned) (10+10+1)); + if (e<0) { + half_w = -round_xn_over_d(quad(k), -e, 2000); + } else { + half_w = round_xn_over_d(quad(k), e, 2000); + } + co = get_charinfo(k, c); + w = char_width(k, c)+2*half_w; + set_charinfo_width(co, w); + + append_packet(packet_right_code); + append_four(half_w); + append_fnt_set(f); + append_packet(packet_char_code); + append_four(c); + append_packet(packet_right_code); + append_four(half_w); + append_packet(packet_end_code); + + set_charinfo_packets(co, vpackets); + } } + /* now patch the quad size */ + /* Patch 20100922: do not do this, to remain compatible with pdftex */ #if 0 - vf_packet_base[k] = new_vf_packet(k); - - for (c=font_bc(k);c<=font_ec(k);c++) { - string_room(17); - append_fnt_set(f); - append_packet(right1 + 3); - append_packet(tmp_b0); - append_packet(tmp_b1); - append_packet(tmp_b2); - append_packet(tmp_b3); - - append_packet(set1); - append_packet(c); - - append_packet(right1 + 3); - append_packet(tmp_b0); - append_packet(tmp_b1); - append_packet(tmp_b2); - append_packet(tmp_b3); - s = make_string(); - store_packet(k, c, s); - flush_str(s); - } + if (e<0) { + set_font_param(k, quad_code, -round_xn_over_d(quad(k), 1000-e, 1000)); + } else { + set_font_param(k, quad_code, round_xn_over_d(quad(k), 1000+e, 1000)); + } #endif return k; } -@ the fontname has [+-]\d+ls at the end -@c -#if 0 -static boolean is_letterspaced_font(internal_font_number f) -{ - char *i, *j; - if (font_type(f) != virtual_font_type) - return false; - j = font_name(f); - i = j + strlen(j); - if ((*(i - 1) != 'l') || (*i != 's')) - return false; - i = i - 2; - while (i >= j) { - if ((*i < '0') || (*i > '9')) - break; - i--; - } - if (i < j) - return false; - if ((*i != '+') && (*i != '-')) - return false; - return true; -} -#endif - @ @c internal_font_number copy_font_info(internal_font_number f) { diff --git a/Build/source/texk/web2c/luatexdir/font/vfpacket.w b/Build/source/texk/web2c/luatexdir/font/vfpacket.w index 8a222e04c04..f26b774721d 100644 --- a/Build/source/texk/web2c/luatexdir/font/vfpacket.w +++ b/Build/source/texk/web2c/luatexdir/font/vfpacket.w @@ -1,7 +1,7 @@ % vfpacket.w % Copyright 1996-2006 Han The Thanh <thanh@@pdftex.org> -% Copyright 2006-2009 Taco Hoekwater <taco@@luatex.org> +% Copyright 2006-2011 Taco Hoekwater <taco@@luatex.org> % This file is part of LuaTeX. @@ -22,8 +22,8 @@ #include "ptexlib.h" static const char _svn_version[] = - "$Id: vfpacket.w 3584 2010-04-02 17:45:55Z hhenkel $ " - "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/vfpacket.w $"; + "$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 @@ -189,7 +189,7 @@ void do_vf_packet(PDF pdf, internal_font_number vf_f, int c) if (has_packet(lf, (int) k)) do_vf_packet(pdf, lf, (int) k); else - pdf_place_glyph(pdf, lf, (int) k); + backend_out[glyph_node] (pdf, lf, (int) k); } cur.h = cur.h + char_width(lf, (int) k); break; diff --git a/Build/source/texk/web2c/luatexdir/font/writecff.w b/Build/source/texk/web2c/luatexdir/font/writecff.w index afbf9ef8ff9..6f818d9e422 100644 --- a/Build/source/texk/web2c/luatexdir/font/writecff.w +++ b/Build/source/texk/web2c/luatexdir/font/writecff.w @@ -23,9 +23,11 @@ #include "font/writecff.h" +extern int cidset; + static const char _svn_version[] = - "$Id: writecff.w 3584 2010-04-02 17:45:55Z hhenkel $ " -"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/writecff.w $"; + "$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)) @@ -3162,6 +3164,28 @@ void write_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. */ + if (1) { + int cid; + 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++) { + glyph->id = cid; + if (avl_find(fd->gl_tree,glyph) != NULL) { + 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); + } + } + /* this happens if the internal metrics do not agree with the actual disk font */ if (gid < num_glyphs) { WARN("embedded subset is smaller than expected: %d instead of %d glyphs.", gid, num_glyphs); @@ -3283,7 +3307,6 @@ card16 cff_charsets_lookup(cff_font * cff, card16 cid) @ @c #define is_cidfont(a) ((a)->flag & FONTTYPE_CIDFONT) #define CID_MAX 65535 - void write_cid_cff(PDF pdf, cff_font * cffont, fd_entry * fd) { cff_index *charstrings, *cs_idx; @@ -3335,7 +3358,6 @@ void write_cid_cff(PDF pdf, cff_font * cffont, fd_entry * fd) glyph = xtalloc(1, glw_entry); } - cid = 0; last_cid = 0; num_glyphs = 0; for (cid = 0; cid <= CID_MAX; cid++) { @@ -3349,6 +3371,27 @@ 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. */ + 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); + } + } + + cff_read_fdselect(cffont); cff_read_fdarray(cffont); cff_read_private(cffont); diff --git a/Build/source/texk/web2c/luatexdir/font/writeenc.w b/Build/source/texk/web2c/luatexdir/font/writeenc.w index b8db3e9791b..1e097ad8fcc 100644 --- a/Build/source/texk/web2c/luatexdir/font/writeenc.w +++ b/Build/source/texk/web2c/luatexdir/font/writeenc.w @@ -22,8 +22,8 @@ #include "ptexlib.h" static const char _svn_version[] = - "$Id: writeenc.w 3612 2010-04-13 09:29:42Z taco $ " -"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/writeenc.w $"; + "$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 $"; @ All encoding entries go into AVL tree for fast search by name. @c diff --git a/Build/source/texk/web2c/luatexdir/font/writefont.w b/Build/source/texk/web2c/luatexdir/font/writefont.w index d130b976bf1..5db7218f15a 100644 --- a/Build/source/texk/web2c/luatexdir/font/writefont.w +++ b/Build/source/texk/web2c/luatexdir/font/writefont.w @@ -20,8 +20,8 @@ @ @c static const char _svn_version[] = - "$Id: writefont.w 3612 2010-04-13 09:29:42Z taco $ " -"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/writefont.w $"; + "$Id: writefont.w 3836 2010-08-29 09:29:04Z taco $ " +"$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/font/writefont.w $"; #include "ptexlib.h" #include "lua/luatex-api.h" @@ -468,6 +468,7 @@ static void write_fontfile(PDF pdf, fd_entry * fd) @ @c +int cidset = 0; static void write_fontdescriptor(PDF pdf, fd_entry * fd) { static const int std_flags[] = { @@ -494,7 +495,7 @@ 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| */ 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) @@ -549,14 +550,11 @@ static void write_fontdescriptor(PDF pdf, fd_entry * fd) assert(0); } } - /* TODO: Optional keys for CID fonts. - - The most interesting ones are + if (cidset !=0) + pdf_printf(pdf, "/CIDSet %i 0 R\n", cidset); + /* TODO: Other optional keys for CID fonts. + The most interesting one is \.{/Style << /Panose <12-byte string>>>} - and - \.{/CIDSET <stream>} - the latter can be used in subsets, to give the included CIDs - as a bitmap on the whole list. */ pdf_end_dict(pdf); } diff --git a/Build/source/texk/web2c/luatexdir/font/writet1.w b/Build/source/texk/web2c/luatexdir/font/writet1.w index ccb2196c451..64d76712309 100644 --- a/Build/source/texk/web2c/luatexdir/font/writet1.w +++ b/Build/source/texk/web2c/luatexdir/font/writet1.w @@ -16,12 +16,12 @@ % 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: writet1.w 3612 2010-04-13 09:29:42Z taco $ " -"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/writet1.w $"; + "$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 $"; #include "ptexlib.h" #include <string.h> @@ -231,8 +231,8 @@ static cs_entry *subr_tab; static char *subr_array_start, *subr_array_end; static int subr_max, subr_size, subr_size_pos; -@ This list contains the begin/end tokens commonly used in the -/Subrs array of a Type 1 font. +@ This list contains the begin/end tokens commonly used in the +/Subrs array of a Type 1 font. @c static const char *cs_token_pairs_list[][2] = { @@ -286,7 +286,7 @@ char **load_enc_file(char *enc_name) cur_file_name = luatex_find_file(enc_name, find_enc_file_callback); if (cur_file_name == NULL) { - pdftex_fail("cannot find encoding file for reading"); + pdftex_fail("cannot find encoding file '%s' for reading", enc_name); } callback_id = callback_defined(read_enc_file_callback); enc_curbyte = 0; @@ -295,12 +295,12 @@ char **load_enc_file(char *enc_name) if (run_callback(callback_id, "S->bSd", cur_file_name, &file_opened, &enc_buffer, &enc_size)) { if ((!file_opened) || enc_size == 0) { - pdftex_fail("cannot open encoding file for reading"); + pdftex_fail("cannot open encoding file '%s' for reading", cur_file_name); } } } else { if (!enc_open(cur_file_name)) { - pdftex_fail("cannot open encoding file for reading"); + pdftex_fail("cannot open encoding file '%s' for reading", cur_file_name); } enc_read_file(); enc_close(); @@ -326,7 +326,7 @@ char **load_enc_file(char *enc_name) *r != ' ' && *r != 10 && *r != ']' && *r != '/'; *p++ = *r++); *p = 0; skip(r, ' '); - if (names_count > 256) + if (names_count >= 256) pdftex_fail("encoding vector contains more than 256 names"); if (strcmp(buf, notdef) != 0) glyph_names[names_count] = xstrdup(buf); @@ -652,7 +652,7 @@ static void t1_stop_eexec(PDF pdf) t1_in_eexec = 2; } -@ macros for various transforms; unused, left for reference +@ macros for various transforms; unused, left for reference @c #ifdef T1TRANSFORMMACROS @@ -785,13 +785,13 @@ static char **t1_builtin_enc(void) } /* At this moment \.{/Encoding} is the prefix of |t1_line_array|, and the encoding is not a predefined encoding. - + We have two possible forms of Encoding vector. The first case is - + \.{/Encoding [/a /b /c...] readonly def} - + and the second case can look like - + {\obeylines \.{/Encoding 256 array 0 1 255 {1 index exch /.notdef put} for} \.{dup 0 /x put} @@ -1297,7 +1297,7 @@ static void cs_mark(const char *cs_name, int subr) ptr->used = false; } -@ AVL search tree for glyph code by glyph name +@ AVL search tree for glyph code by glyph name @c static int comp_t1_glyphs(const void *pa, const void *pb, void *p __attribute__ ((unused))) @@ -1622,11 +1622,36 @@ static void t1_mark_glyphs(void) } -@ +@ When |t1_subset_charstrings| is called, the |t1_line_array| contains \.{/CharStrings}. +When we hit a case like this: +{\obeylines \tt + dup/CharStrings + 229 dict dup begin +} +we read the next line and concatenate to |t1_line_array| before moving on. That is +what |t1_check_unusual_charstring| is for. + @c +static void t1_check_unusual_charstring(void) +{ + char *p = strstr(t1_line_array, charstringname) + strlen(charstringname); + int i; + /* if no number follows "/CharStrings", let's read the next line */ + if (sscanf(p, "%i", &i) != 1) { + strcpy(t1_buf_array, t1_line_array); + t1_getline(); + strcat(t1_buf_array, t1_line_array); + strcpy(t1_line_array, t1_buf_array); + t1_line_ptr = eol(t1_line_array); + } +} + static void t1_subset_charstrings(PDF pdf) { cs_entry *ptr; + + t1_check_unusual_charstring(); + cs_size_pos = (int) (strstr(t1_line_array, charstringname) + strlen(charstringname) - t1_line_array + 1); diff --git a/Build/source/texk/web2c/luatexdir/font/writet3.w b/Build/source/texk/web2c/luatexdir/font/writet3.w index b138df57c94..63988a80a28 100644 --- a/Build/source/texk/web2c/luatexdir/font/writet3.w +++ b/Build/source/texk/web2c/luatexdir/font/writet3.w @@ -20,8 +20,8 @@ @ @c static const char _svn_version[] = - "$Id: writet3.w 3584 2010-04-02 17:45:55Z hhenkel $ " -"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/writet3.w $"; + "$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 $"; #include "ptexlib.h" #include <kpathsea/tex-glyph.h> @@ -187,8 +187,7 @@ 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++; - pdf_new_dict(pdf, obj_type_others, 0, 0); - t3_char_procs[cd.charcode] = pdf->obj_ptr; + t3_char_procs[cd.charcode] = pdf_new_dict(pdf, obj_type_others, 0, 0); pdf_begin_stream(pdf); pdf_print_real(pdf, (int) t3_char_widths[cd.charcode], 2); pdf_printf(pdf, " 0 %i %i %i %i d1\n", diff --git a/Build/source/texk/web2c/luatexdir/font/writettf.w b/Build/source/texk/web2c/luatexdir/font/writettf.w index 2a7c5c644c0..bc93ad5c7aa 100644 --- a/Build/source/texk/web2c/luatexdir/font/writettf.w +++ b/Build/source/texk/web2c/luatexdir/font/writettf.w @@ -24,8 +24,8 @@ #include <string.h> static const char _svn_version[] = - "$Id: writettf.w 3612 2010-04-13 09:29:42Z taco $ " -"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/writettf.w $"; + "$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 @@ -1703,7 +1703,7 @@ void writettf(PDF pdf, fd_entry * fd) cur_file_name = luatex_find_file(fd_cur->fm->ff_name, find_truetype_file_callback); if (cur_file_name == NULL) { - pdftex_fail("cannot find TrueType font file for reading"); + pdftex_fail("cannot find TrueType font file for reading (%s)", fd_cur->fm->ff_name); } callback_id = callback_defined(read_truetype_file_callback); if (callback_id > 0) { @@ -1711,11 +1711,11 @@ void writettf(PDF pdf, fd_entry * fd) &file_opened, &ttf_buffer, &ttf_size) && file_opened && ttf_size > 0) { } else { - pdftex_fail("cannot open TrueType font file for reading"); + pdftex_fail("cannot open TrueType font file for reading (%s)", cur_file_name); } } else { if (!ttf_open(cur_file_name)) { - pdftex_fail("cannot open TrueType font file for reading"); + pdftex_fail("cannot open TrueType font file for reading (%s)", cur_file_name); } ttf_read_file(); ttf_close(); @@ -1808,7 +1808,7 @@ void writeotf(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"); + 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) { @@ -1816,11 +1816,11 @@ void writeotf(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"); + 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"); + pdftex_fail("cannot open OpenType font file for reading (%s)", cur_file_name); } ttf_read_file(); ttf_close(); diff --git a/Build/source/texk/web2c/luatexdir/font/writetype0.w b/Build/source/texk/web2c/luatexdir/font/writetype0.w index 818a23b5ca1..945350a1384 100644 --- a/Build/source/texk/web2c/luatexdir/font/writetype0.w +++ b/Build/source/texk/web2c/luatexdir/font/writetype0.w @@ -23,8 +23,8 @@ #include "font/writecff.h" static const char _svn_version[] = - "$Id: writetype0.w 3584 2010-04-02 17:45:55Z hhenkel $ " -"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/writetype0.w $"; + "$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,7 @@ 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"); + 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 +56,11 @@ 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"); + 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"); + pdftex_fail("cannot open OpenType font file for reading (%s)", cur_file_name); } ttf_read_file(); ttf_close(); diff --git a/Build/source/texk/web2c/luatexdir/font/writetype2.w b/Build/source/texk/web2c/luatexdir/font/writetype2.w index 66b97f7d201..12124f6edb8 100644 --- a/Build/source/texk/web2c/luatexdir/font/writetype2.w +++ b/Build/source/texk/web2c/luatexdir/font/writetype2.w @@ -27,7 +27,7 @@ #include "font/tt_glyf.h" static const char _svn_version[] = - "$Id: writetype2.w 3612 2010-04-13 09:29:42Z taco $ $URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/font/writetype2.w $"; + "$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 @@ -152,7 +152,7 @@ void writetype2(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"); + 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) { @@ -160,11 +160,11 @@ void writetype2(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"); + 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"); + pdftex_fail("cannot open OpenType font file for reading (%s)", cur_file_name); } ttf_read_file(); ttf_close(); @@ -259,11 +259,12 @@ 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) { long i, cid; - unsigned int last_cid; + unsigned int last_cid = 0; glw_entry *found; struct avl_traverser t; unsigned char *cidtogidmap; @@ -395,6 +396,26 @@ void make_tt_subset(PDF pdf, fd_entry * fd, unsigned char *buffer, int buflen) 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. */ + 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); + } + } + /* TODO other stuff that needs fixing: */ /* DW, W, DW2, and W2 */ @@ -408,19 +429,7 @@ void make_tt_subset(PDF pdf, fd_entry * fd, unsigned char *buffer, int buflen) add_TTCIDVMetrics(font->fontdict, glyphs, used_chars, cidtogidmap, last_cid); } #endif - /* CIDSet */ -#if 0 - { - pdf_obj *cidset; - - cidset = pdf_new_stream(STREAM_COMPRESS); - pdf_add_stream(cidset, used_chars, last_cid/8 + 1); - pdf_add_dict(font->descriptor, - pdf_new_name("CIDSet"), - pdf_ref_obj(cidset)); - pdf_release_obj(cidset); - } -#endif + xfree(used_chars); sfnt_close(sfont); return; |