diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2014-02-03 13:01:31 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2014-02-03 13:01:31 +0000 |
commit | 4dc568b1e2c01476f34b6c014da3bc487b71aacf (patch) | |
tree | a6a389e1a3915bdc1b618eb2aeae27fd7f21b68a /Build/source/texk/web2c/luatexdir/pdf | |
parent | 4a985ab4153e6ba130b801d4cec60709b0a44e47 (diff) |
Import LuaTeX snapshot 0.78.3
git-svn-id: svn://tug.org/texlive/trunk@32854 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/pdf')
27 files changed, 171 insertions, 215 deletions
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfaction.w b/Build/source/texk/web2c/luatexdir/pdf/pdfaction.w index c03a5b88456..9bc503a8ec8 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfaction.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfaction.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = "$Id: pdfaction.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/tags/beta-0.76.0/source/texk/web2c/luatexdir/pdf/pdfaction.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdfaction.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfannot.w b/Build/source/texk/web2c/luatexdir/pdf/pdfannot.w index caee220e9ec..88f548de3eb 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfannot.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfannot.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = "$Id: pdfannot.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/tags/beta-0.76.0/source/texk/web2c/luatexdir/pdf/pdfannot.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdfannot.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfcolorstack.w b/Build/source/texk/web2c/luatexdir/pdf/pdfcolorstack.w index 43275fc9e59..5b1c736e7dd 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfcolorstack.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfcolorstack.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = "$Id: pdfcolorstack.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/tags/beta-0.76.0/source/texk/web2c/luatexdir/pdf/pdfcolorstack.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdfcolorstack.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfdest.w b/Build/source/texk/web2c/luatexdir/pdf/pdfdest.w index a6f39fb7eea..7b0c7261713 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfdest.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfdest.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = "$Id: pdfdest.w 4448 2012-06-21 15:07:03Z taco $" - "$URL: https://foundry.supelec.fr/svn/luatex/tags/beta-0.76.0/source/texk/web2c/luatexdir/pdf/pdfdest.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdfdest.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdffont.h b/Build/source/texk/web2c/luatexdir/pdf/pdffont.h index b20caf91ccc..728b2903ec2 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdffont.h +++ b/Build/source/texk/web2c/luatexdir/pdf/pdffont.h @@ -1,6 +1,6 @@ /* pdffont.h - Copyright 2010 Taco Hoekwater <taco@luatex.org> + Copyright 2010-2013 Taco Hoekwater <taco@luatex.org> This file is part of LuaTeX. @@ -17,26 +17,23 @@ You should have received a copy of the GNU General Public License along with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */ -/* $Id: pdffont.h 4576 2013-02-08 20:42:57Z hhenkel $ */ +/* $Id: pdffont.h 4679 2013-12-19 15:47:53Z luigi $ */ #ifndef PDFFONT_H # define PDFFONT_H -extern void output_one_char(PDF pdf, internal_font_number ffi, int c); +extern scaled_whd output_one_char(PDF pdf, halfword p); extern void pdf_init_font(PDF pdf, internal_font_number f); extern internal_font_number pdf_set_font(PDF pdf, internal_font_number f); extern int pk_dpi; /* PK pixel density value from \.{texmf.cnf} */ -extern void copy_expand_params(internal_font_number k, internal_font_number f, - int e); -extern internal_font_number tfm_lookup(char *s, scaled fs, int e); -extern internal_font_number expand_font(internal_font_number f, int e); +extern internal_font_number tfm_lookup(char *s, scaled fs); extern void set_expand_params(internal_font_number f, boolean auto_expand, int stretch_limit, int shrink_limit, - int font_step, int expand_ratio); + int font_step); extern void read_expand_font(void); extern void new_letterspaced_font(small_number a); @@ -45,4 +42,6 @@ extern void make_font_copy(small_number a); extern void pdf_include_chars(PDF); extern void glyph_to_unicode(void); +extern int fix_expand_value(internal_font_number f, int e); + #endif diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdffont.w b/Build/source/texk/web2c/luatexdir/pdf/pdffont.w index 5a1cee3d28b..967869b318c 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdffont.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdffont.w @@ -1,6 +1,6 @@ % pdffont.w % -% Copyright 2009-2012 Taco Hoekwater <taco@@luatex.org> +% Copyright 2009-2014 Taco Hoekwater <taco@@luatex.org> % % This file is part of LuaTeX. % @@ -21,8 +21,8 @@ @ @c static const char _svn_version[] = - "$Id: pdffont.w 4576 2013-02-08 20:42:57Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/tags/beta-0.76.0/source/texk/web2c/luatexdir/pdf/pdffont.w $"; + "$Id: pdffont.w 4710 2014-01-02 13:26:55Z oneiros $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdffont.w $"; #include "ptexlib.h" @@ -41,13 +41,18 @@ should check whether the used character is a virtual or real character. The |has_packet()| C macro checks for this condition. -@ The following code typesets a character to PDF output +@ The following code typesets a character to PDF output @c -void output_one_char(PDF pdf, internal_font_number ffi, int c) +scaled_whd output_one_char(PDF pdf, halfword p) { scaled_whd ci; /* the real width, height and depth of the character */ - ci = get_charinfo_whd(ffi, c); + internal_font_number f = font(p); + int c = character(p); + int ex_glyph = ex_glyph(p)/1000; + ci = get_charinfo_whd(f, c); + //ci.wd = round_xn_over_d(ci.wd, 1000 + ex_glyph, 1000); + ci.wd = ext_xn_over_d(ci.wd, 1000000 + ex_glyph(p), 1000000); switch (pdf->posstruct->dir) { case dir_TLT: break; @@ -65,13 +70,14 @@ void output_one_char(PDF pdf, internal_font_number ffi, int c) default: assert(0); } - if (has_packet(ffi, c)) { - do_vf_packet(pdf, ffi, c); + if (has_packet(f, c)) { + do_vf_packet(pdf, f, c, ex_glyph); } else - backend_out[glyph_node] (pdf, ffi, c); /* |pdf_place_glyph(pdf, ffi, c);| */ + backend_out[glyph_node] (pdf, f, c, ex_glyph); /* |pdf_place_glyph(pdf, f, c, ex_glyph);| */ + return ci; } -@ Mark |f| as a used font; set |font_used(f)|, |font_size(f)| and |pdf_font_num(f)| +@ Mark |f| as a used font; set |font_used(f)|, |font_size(f)| and |pdf_font_num(f)| @c static void pdf_use_font(internal_font_number f, int fontnum) { @@ -92,28 +98,17 @@ indicates that the corresponding font shares the font resource with the font static boolean font_shareable(internal_font_number f, internal_font_number k) { int ret = 0; - internal_font_number b; /* possible base font */ /* For some lua-loaded (for instance AFM) fonts, it is normal to have a zero cidregistry, and such fonts do not have a fontmap entry yet at this point, so the test should use the other branch */ if (font_cidregistry(f) == NULL && font_cidregistry(k) == NULL && font_encodingbytes(f) != 2 && font_encodingbytes(k) != 2) { if (font_map(k) != NULL && - font_map(f) != NULL && - (same(font_name, k, f) || - (font_auto_expand(f) && - (b = pdf_font_blink(k)) != null_font && same(font_name, k, b)))) { + font_map(f) != NULL && (same(font_name, k, f))) { ret = 1; } -#ifdef DEBUG - printf("\nfont_shareable(%d:%d, %d:%d): => %d\n", f, pdf_font_blink(f), - k, pdf_font_blink(k), ret); -#endif } else { - if ((same(font_filename, k, f) && same(font_fullname, k, f)) - || (font_auto_expand(f) - && (b = pdf_font_blink(k)) != null_font - && same(font_name, k, b))) { + if ((same(font_filename, k, f) && same(font_fullname, k, f))) { ret = 1; } #ifdef DEBUG @@ -125,25 +120,25 @@ static boolean font_shareable(internal_font_number f, internal_font_number k) return ret; } -@ create a font object +@ create a font object @c void pdf_init_font(PDF pdf, internal_font_number f) { - internal_font_number k, b; + internal_font_number k/*, b*/; fm_entry *fm; int i, l; assert(!font_used(f)); - /* if |f| is auto expanded then ensure the base font is initialized */ - - if (font_auto_expand(f) && ((b = pdf_font_blink(f)) != null_font)) { - if (!font_used(b)) - pdf_init_font(pdf, b); - set_font_map(f, font_map(b)); - /* propagate slant and extend from unexpanded base font */ - set_font_slant(f, font_slant(b)); - set_font_extend(f, font_extend(b)); - } + ///* if |f| is auto expanded then ensure the base font is initialized */ + // + // if (font_auto_expand(f) && ((b = pdf_font_blink(f)) != null_font)) { + // if (!font_used(b)) + // pdf_init_font(pdf, b); + // set_font_map(f, font_map(b)); + // /* propagate slant and extend from unexpanded base font */ + // set_font_slant(f, font_slant(b)); + // set_font_extend(f, font_extend(b)); + //} /* check whether |f| can share the font object with some |k|: we have 2 cases here: 1) |f| and |k| have the same tfm name (so they have been loaded at different sizes, eg 'cmr10' and 'cmr10 at 11pt'); 2) |f| has been auto @@ -179,7 +174,7 @@ void pdf_init_font(PDF pdf, internal_font_number f) pdf_use_font(f, l); } -@ set the actual font on PDF page +@ set the actual font on PDF page @c internal_font_number pdf_set_font(PDF pdf, internal_font_number f) { @@ -198,17 +193,7 @@ internal_font_number pdf_set_font(PDF pdf, internal_font_number f) } @ Here come some subroutines to deal with expanded fonts for HZ-algorithm. -@c -void copy_expand_params(internal_font_number k, internal_font_number f, int e) -{ /* set expansion-related parameters for an expanded font |k|, based on the base - font |f| and the expansion amount |e| */ - set_font_expand_ratio(k, e); - set_font_step(k, font_step(f)); - set_font_auto_expand(k, font_auto_expand(f)); - set_pdf_font_blink(k, f); -} - -@ return 1 == identical +return 1 == identical @c static boolean cmp_font_name(int id, char *tt) { @@ -224,19 +209,18 @@ static boolean cmp_font_name(int id, char *tt) } @ @c -internal_font_number tfm_lookup(char *s, scaled fs, int e) +internal_font_number tfm_lookup(char *s, scaled fs) { /* looks up for a TFM with name |s| loaded at |fs| size; if found then flushes |s| */ internal_font_number k; if (fs != 0) { for (k = 1; k <= max_font_id(); k++) { - if (cmp_font_name(k, s) && font_size(k) == fs - && font_expand_ratio(k) == e) { + if (cmp_font_name(k, s) && font_size(k) == fs) { return k; } } } else { for (k = 1; k <= max_font_id(); k++) { - if (cmp_font_name(k, s) && font_expand_ratio(k) == e) { + if (cmp_font_name(k, s)) { return k; } } @@ -245,26 +229,7 @@ internal_font_number tfm_lookup(char *s, scaled fs, int e) } @ @c -static internal_font_number load_expand_font(internal_font_number f, int e) -{ /* loads font |f| expanded by |e| thousandths into font memory; |e| is nonzero - and is a multiple of |font_step(f)| */ - internal_font_number k; - k = tfm_lookup(font_name(f), font_size(f), e); - if (k == null_font) { - if (font_auto_expand(f)) { - k = auto_expand_font(f, e); - font_id_text(k) = font_id_text(f); - } else { - k = read_font_info(null_cs, font_name(f), font_size(f), - font_natural_dir(f)); - } - } - copy_expand_params(k, f, e); - return k; -} - -@ @c -static int fix_expand_value(internal_font_number f, int e) +int fix_expand_value(internal_font_number f, int e) { /* return the multiple of |font_step(f)| that is nearest to |e| */ int step; int max_expand; @@ -274,10 +239,10 @@ static int fix_expand_value(internal_font_number f, int e) if (e < 0) { e = -e; neg = true; - max_expand = -font_expand_ratio(font_shrink(f)); + max_expand = font_max_shrink(f); } else { neg = false; - max_expand = font_expand_ratio(font_stretch(f)); + max_expand = font_max_stretch(f); } if (e > max_expand) { e = max_expand; @@ -292,49 +257,13 @@ static int fix_expand_value(internal_font_number f, int e) } @ @c -static internal_font_number get_expand_font(internal_font_number f, int e) -{ /* look up and create if not found an expanded version of |f|; |f| is an - expandable font; |e| is nonzero and is a multiple of |font_step(f)| */ - internal_font_number k; - k = pdf_font_elink(f); - while (k != null_font) { - if (font_expand_ratio(k) == e) - return k; - k = pdf_font_elink(k); - } - k = load_expand_font(f, e); - set_pdf_font_elink(k, pdf_font_elink(f)); - set_pdf_font_elink(f, k); - return k; -} - -@ @c -internal_font_number expand_font(internal_font_number f, int e) -{ /* looks up for font |f| expanded by |e| thousandths, |e| is an arbitrary value - between max stretch and max shrink of |f|; if not found then creates it */ - if (e == 0) - return f; - e = fix_expand_value(f, e); - if (e == 0) - return f; - if (pdf_font_elink(f) == null_font) - pdf_error("font expansion", "uninitialized pdf_font_elink"); - return get_expand_font(f, e); -} - -@ @c void set_expand_params(internal_font_number f, boolean auto_expand, - int stretch_limit, int shrink_limit, - int font_step, int expand_ratio) + int stretch_limit, int shrink_limit, int font_step) { /* expand a font with given parameters */ set_font_step(f, font_step); set_font_auto_expand(f, auto_expand); - if (stretch_limit > 0) - set_font_stretch(f, get_expand_font(f, stretch_limit)); - if (shrink_limit > 0) - set_font_shrink(f, get_expand_font(f, -shrink_limit)); - if (expand_ratio != 0) - set_font_expand_ratio(f, expand_ratio); + set_font_max_shrink(f, shrink_limit); + set_font_max_stretch(f, stretch_limit); } @ @c @@ -348,9 +277,9 @@ void read_expand_font(void) f = cur_val; if (f == null_font) pdf_error("font expansion", "invalid font identifier"); - if (pdf_font_blink(f) != null_font) - pdf_error("font expansion", - "\\pdffontexpand cannot be used this way (the base font has been expanded)"); + //if (pdf_font_blink(f) != null_font) + // pdf_error("font expansion", + // "\\pdffontexpand cannot be used this way (the base font has been expanded)"); scan_optional_equals(); scan_int(); stretch_limit = fix_int(cur_val, 0, 1000); @@ -377,25 +306,21 @@ void read_expand_font(void) back_input(); } - /* check if the font can be expanded */ - if (font_expand_ratio(f) != 0) - pdf_error("font expansion", - "this font has been expanded by another font so it cannot be used now"); if (font_step(f) != 0) { /* this font has been expanded, ensure the expansion parameters are identical */ if (font_step(f) != font_step) pdf_error("font expansion", "font has been expanded with different expansion step"); - if (((font_stretch(f) == null_font) && (stretch_limit != 0)) || - ((font_stretch(f) != null_font) - && (font_expand_ratio(font_stretch(f)) != stretch_limit))) + if (((font_max_stretch(f) == 0) && (stretch_limit != 0)) || + ((font_max_stretch(f) > 0) + && (font_max_stretch(f) != stretch_limit))) pdf_error("font expansion", "font has been expanded with different stretch limit"); - if (((font_shrink(f) == null_font) && (shrink_limit != 0)) || - ((font_shrink(f) != null_font) - && (-font_expand_ratio(font_shrink(f)) != shrink_limit))) + if (((font_max_shrink(f) == 0) && (shrink_limit != 0)) || + ((font_max_shrink(f) > 0) + && (font_max_shrink(f) != shrink_limit))) pdf_error("font expansion", "font has been expanded with different shrink limit"); @@ -408,9 +333,7 @@ void read_expand_font(void) "font should be expanded before its first use", true, true); set_expand_params(f, auto_expand, stretch_limit, shrink_limit, - font_step, 0); - if (font_type(f) == virtual_font_type) - vf_expand_local_fonts(f); + font_step); } } diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.h b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.h index daf6c81cba0..89fca3af9dd 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.h +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.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: pdfgen.h 4558 2013-01-19 14:21:59Z oneiros $ */ +/* $Id: pdfgen.h 4679 2013-12-19 15:47:53Z luigi $ */ #ifndef PDFGEN_H # define PDFGEN_H @@ -182,6 +182,7 @@ extern void zip_free(PDF); /* functions that do not output stuff */ extern scaled round_xn_over_d(scaled x, int n, unsigned int d); + extern char *convertStringToPDFString(const char *in, int len); extern void init_start_time(PDF); diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w index 50730d3b56f..83e5a27e4c8 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w @@ -19,8 +19,8 @@ @ @c static const char _svn_version[] = - "$Id: pdfgen.w 4568 2013-01-27 13:10:11Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/tags/beta-0.76.0/source/texk/web2c/luatexdir/pdf/pdfgen.w $"; + "$Id: pdfgen.w 4718 2014-01-02 15:35:31Z taco $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdfgen.w $"; #include "ptexlib.h" @@ -768,9 +768,9 @@ scaled round_xn_over_d(scaled x, int n, unsigned int d) x = -(x); positive = false; } - t = (unsigned) ((x % 0100000) * n); - u = (unsigned) (((unsigned) (x) / 0100000) * (unsigned) n + (t / 0100000)); - v = (u % d) * 0100000 + (t % 0100000); + t = (unsigned) ((x % 0100000) * n);//printf("t=%d\n",t); + u = (unsigned) (((unsigned) (x) / 0100000) * (unsigned) n + (t / 0100000));//printf("u=%d\n",u); + v = (u % d) * 0100000 + (t % 0100000);//printf("v=%d\n",v); if (u / d >= 0100000) arith_error = true; else @@ -784,6 +784,7 @@ scaled round_xn_over_d(scaled x, int n, unsigned int d) return (-(scaled) u); } + @ @c void pdf_add_bp(PDF pdf, scaled s) { /* print scaled as |bp| */ diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfglyph.h b/Build/source/texk/web2c/luatexdir/pdf/pdfglyph.h index b469ea61e1d..563a59847bc 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfglyph.h +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfglyph.h @@ -1,6 +1,6 @@ /* pdfglyph.h - Copyright 2009 Taco Hoekwater <taco@luatex.org> + Copyright 2009-2013 Taco Hoekwater <taco@luatex.org> This file is part of LuaTeX. @@ -17,14 +17,14 @@ You should have received a copy of the GNU General Public License along with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */ -/* $Id: pdfglyph.h 4575 2013-02-08 20:42:52Z hhenkel $ */ +/* $Id: pdfglyph.h 4679 2013-12-19 15:47:53Z luigi $ */ #ifndef PDFGLYPH_H # define PDFGLYPH_H void end_chararray(PDF pdf); void end_charmode(PDF pdf); -void pdf_place_glyph(PDF pdf, internal_font_number f, int c); +void pdf_place_glyph(PDF pdf, internal_font_number f, int c, int ex); void pdf_print_charwidth(PDF pdf, internal_font_number f, int i); #endif diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfglyph.w b/Build/source/texk/web2c/luatexdir/pdf/pdfglyph.w index f1b92379154..c9fa5775198 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfglyph.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfglyph.w @@ -19,8 +19,8 @@ @ @c static const char _svn_version[] = - "$Id: pdfglyph.w 4575 2013-02-08 20:42:52Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/tags/beta-0.76.0/source/texk/web2c/luatexdir/pdf/pdfglyph.w $"; + "$Id: pdfglyph.w 4718 2014-01-02 15:35:31Z taco $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdfglyph.w $"; #include "ptexlib.h" #include "pdf/pdfpage.h" @@ -46,14 +46,13 @@ void pdf_print_charwidth(PDF pdf, internal_font_number f, int i) { pdffloat cw; pdfstructure *p = pdf->pstruct; - assert(pdf_font_blink(f) == null_font); /* must use unexpanded font! */ cw.m = pdf_char_width(p, f, i); cw.e = p->cw.e; print_pdffloat(pdf, cw); } @ @c -static void setup_fontparameters(PDF pdf, internal_font_number f) +static void setup_fontparameters(PDF pdf, internal_font_number f, int ex_glyph) { float slant, extend, expand, scale = 1.0; float u = 1.0; @@ -68,7 +67,7 @@ static void setup_fontparameters(PDF pdf, internal_font_number f) p->fs.m = i64round(font_size(f) / u / one_bp * ten_pow[p->fs.e]); slant = font_slant(f) / 1000.0; extend = font_extend(f) / 1000.0; - expand = 1.0 + font_expand_ratio(f) / 1000.0; + expand = 1.0 + (ex_glyph/1) / 1000.0; p->tj_delta.e = p->cw.e - 1; /* "- 1" makes less corrections inside []TJ */ /* no need to be more precise than TeX (1sp) */ while (p->tj_delta.e > 0 @@ -82,7 +81,9 @@ static void setup_fontparameters(PDF pdf, internal_font_number f) ten_pow[e_tj + p->cw.e] * scale / (ten_pow[p->pdf.h.e] * pdf2double(p->fs) * pdf2double(p->tm[0])); -} + p->cur_ex = ex_glyph ; /* we keep track of the state of ex */ +} + @ @c static void set_font(PDF pdf) @@ -192,29 +193,60 @@ void end_chararray(PDF pdf) } @ @c -void pdf_place_glyph(PDF pdf, internal_font_number f, int c) +void pdf_place_glyph(PDF pdf, internal_font_number f, int c, int ex) { boolean move; pdfstructure *p = pdf->pstruct; scaledpos pos = pdf->posstruct->pos; + if (!char_exists(f, c)) return; - /* ensure to be within BT...ET */ - if (is_pagemode(p)) { - pdf_goto_textmode(pdf); - p->need_tf = true; - } - /* all font setup */ - if (f != pdf->f_cur || p->need_tf) { - setup_fontparameters(pdf, f); - if (p->need_tf || p->f_pdf != p->f_pdf_cur || p->fs.m != p->fs_cur.m) { - pdf_goto_textmode(pdf); - set_font(pdf); - } else if (p->tm0_cur.m != p->tm[0].m) { - /* catch in-line HZ expand change due to efcode */ - p->need_tm = true; - } - } + +/* + p->need_tf : okay, set somewhere else + f != pdf->f_cur : font change + p->f_pdf != p->f_pdf_cur : font change + p->fs.m ~= p->fs_cur.m : move + is_pagemode(p) -> stream change + p->tm0_cur.m -> p->tm[0].m : also move +*/ + + /* fix issue 857 */ + /* /\* ensure to be within BT...ET *\/ */ + /* if (is_pagemode(p)) { */ + /* pdf_goto_textmode(pdf); */ + /* p->need_tf = true; */ + /* } */ + /* /\* all font setup *\/ */ + /* if (true || f != pdf->f_cur || p->need_tf) { */ + /* setup_fontparameters(pdf, f, ex); */ + /* if (p->need_tf || p->f_pdf != p->f_pdf_cur || p->fs.m != p->fs_cur.m) { */ + /* pdf_goto_textmode(pdf); */ + /* set_font(pdf); */ + /* } else if (p->tm0_cur.m != p->tm[0].m) { */ + /* /\* catch in-line HZ expand change due to efcode *\/ */ + /* p->need_tm = true; */ + /* } */ + /* } */ + + + /* LS/HH: We need to adapt the tm when a font changes. A change can be a change in + id (frontend) or pdf reference (backend, as we share font resources). At + such a change we also need to adapt to the slant and extend. Initially + we also need to take the exfactor of a glyph into account. When the font is + unchanged, we still need to check each glyph for a change in exfactor. We + store the current one on the state record so that we can minimize testing. */ + + /* is the p->need_tf test really needed ? */ + if (p->need_tf || f != pdf->f_cur || p->f_pdf != p->f_pdf_cur || p->fs.m != p->fs_cur.m || is_pagemode(p)) { + pdf_goto_textmode(pdf); + setup_fontparameters(pdf, f, ex); + set_font(pdf); + } else if (p->tm0_cur.m != p->tm[0].m || p->cur_ex != ex) { + setup_fontparameters(pdf, f, ex); + p->need_tm = true; + } + /* all movements */ move = calc_pdfpos(p, pos); /* within text or chararray or char mode */ if (move || p->need_tm) { @@ -222,7 +254,7 @@ void pdf_place_glyph(PDF pdf, internal_font_number f, int c) && (p->pdf_bt_pos.v.m + p->tm[5].m) != p->pdf.v.m) || (p->wmode == WMODE_V && (p->pdf_bt_pos.h.m + p->tm[4].m) != p->pdf.h.m) - || p->tj_delta.m >= 1000000 || p->tj_delta.m <= -1000000) { + || abs(p->tj_delta.m) >= 1000000) { pdf_goto_textmode(pdf); set_textmatrix(pdf, pos); begin_chararray(pdf); diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfimage.w b/Build/source/texk/web2c/luatexdir/pdf/pdfimage.w index 9103cdd1126..fd81a2d55d0 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfimage.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfimage.w @@ -19,8 +19,8 @@ @ @c static const char _svn_version[] = - "$Id: pdfimage.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/tags/beta-0.76.0/source/texk/web2c/luatexdir/pdf/pdfimage.w $"; + "$Id: pdfimage.w 4718 2014-01-02 15:35:31Z taco $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdfimage.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdflink.w b/Build/source/texk/web2c/luatexdir/pdf/pdflink.w index 112a4be2f57..73ce55d8e3d 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdflink.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdflink.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = "$Id: pdflink.w 4451 2012-07-05 21:13:01Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/tags/beta-0.76.0/source/texk/web2c/luatexdir/pdf/pdflink.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdflink.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdflistout.w b/Build/source/texk/web2c/luatexdir/pdf/pdflistout.w index 816726c9a74..07655248edb 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdflistout.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdflistout.w @@ -21,8 +21,8 @@ @ @c static const char _svn_version[] = - "$Id: pdflistout.w 4576 2013-02-08 20:42:57Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/tags/beta-0.76.0/source/texk/web2c/luatexdir/pdf/pdflistout.w $"; + "$Id: pdflistout.w 4679 2013-12-19 15:47:53Z luigi $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdflistout.w $"; #include "ptexlib.h" @@ -143,23 +143,22 @@ static scaled simple_advance_width(halfword p) scaled w = 0; while ((q != null) && (vlink(q) != null)) { q = vlink(q); - if (is_char_node(q)) { + switch (type(q)) { + case glyph_node: w += glyph_width(q); - } else { - switch (type(q)) { - case hlist_node: - case vlist_node: - case rule_node: - case margin_kern_node: - case kern_node: - w += width(q); - break; - case disc_node: - if (vlink(no_break(q)) != null) - w += simple_advance_width(no_break(q)); - default: - break; - } + break; + case hlist_node: + case vlist_node: + case rule_node: + case margin_kern_node: + case kern_node: + w += width(q); + break; + case disc_node: + if (vlink(no_break(q)) != null) + w += simple_advance_width(no_break(q)); + default: + break; } } return w; @@ -377,8 +376,7 @@ void hlist_out(PDF pdf, halfword this_box) tmpcur.v = cur.v - y_displace(p); synch_pos_with_cur(pdf->posstruct, refpos, tmpcur); } - output_one_char(pdf, font(p), character(p)); - ci = get_charinfo_whd(font(p), character(p)); + ci = output_one_char(pdf, p); if (textdir_parallel(localpos.dir, dir_TLT)) cur.h += ci.wd; else diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfliteral.w b/Build/source/texk/web2c/luatexdir/pdf/pdfliteral.w index 5900d6539d3..e4aba134dda 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfliteral.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfliteral.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = "$Id: pdfliteral.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/tags/beta-0.76.0/source/texk/web2c/luatexdir/pdf/pdfliteral.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdfliteral.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfluaapi.w b/Build/source/texk/web2c/luatexdir/pdf/pdfluaapi.w index ee49c6e8ada..dab5bc741ae 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfluaapi.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfluaapi.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = "$Id: pdfluaapi.w 4524 2012-12-20 15:38:02Z taco $" - "$URL: https://foundry.supelec.fr/svn/luatex/tags/beta-0.76.0/source/texk/web2c/luatexdir/pdf/pdfluaapi.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdfluaapi.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfobj.w b/Build/source/texk/web2c/luatexdir/pdf/pdfobj.w index 34e2238b77c..f2d0647c00c 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfobj.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfobj.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = "$Id: pdfobj.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/tags/beta-0.76.0/source/texk/web2c/luatexdir/pdf/pdfobj.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdfobj.w $"; #include "ptexlib.h" #include "lua/luatex-api.h" diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfoutline.w b/Build/source/texk/web2c/luatexdir/pdf/pdfoutline.w index 1faf69c6e66..a54cd563301 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfoutline.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfoutline.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = "$Id: pdfoutline.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/tags/beta-0.76.0/source/texk/web2c/luatexdir/pdf/pdfoutline.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdfoutline.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfpage.w b/Build/source/texk/web2c/luatexdir/pdf/pdfpage.w index 0b05d6a354e..e089a8ed83c 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfpage.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfpage.w @@ -19,8 +19,8 @@ @ @c static const char _svn_version[] = - "$Id: pdfpage.w 4612 2013-03-25 09:15:18Z taco $" - "$URL: https://foundry.supelec.fr/svn/luatex/tags/beta-0.76.0/source/texk/web2c/luatexdir/pdf/pdfpage.w $"; + "$Id: pdfpage.w 4718 2014-01-02 15:35:31Z taco $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdfpage.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfpagetree.w b/Build/source/texk/web2c/luatexdir/pdf/pdfpagetree.w index bff0cf343d8..8d5708d1027 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfpagetree.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfpagetree.w @@ -19,8 +19,8 @@ @ @c static const char _svn_version[] = - "$Id: pdfpagetree.w 4612 2013-03-25 09:15:18Z taco $" - "$URL: https://foundry.supelec.fr/svn/luatex/tags/beta-0.76.0/source/texk/web2c/luatexdir/pdf/pdfpagetree.w $"; + "$Id: pdfpagetree.w 4634 2013-04-21 14:45:45Z hhenkel $" + "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdfpagetree.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfrule.w b/Build/source/texk/web2c/luatexdir/pdf/pdfrule.w index a73aa57484f..a7ed050a644 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfrule.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfrule.w @@ -19,8 +19,8 @@ @ @c static const char _svn_version[] = - "$Id: pdfrule.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/tags/beta-0.76.0/source/texk/web2c/luatexdir/pdf/pdfrule.w $"; + "$Id: pdfrule.w 4718 2014-01-02 15:35:31Z taco $" + "$URL: https://foundry.supelec.fr/svn/luatex/trunk/source/texk/web2c/luatexdir/pdf/pdfrule.w $"; #include "ptexlib.h" #include "pdf/pdfpage.h" diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfsaverestore.w b/Build/source/texk/web2c/luatexdir/pdf/pdfsaverestore.w index 27bbb4851d2..1b6859566a3 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfsaverestore.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfsaverestore.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = "$Id: pdfsaverestore.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/tags/beta-0.76.0/source/texk/web2c/luatexdir/pdf/pdfsaverestore.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdfsaverestore.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfsetmatrix.w b/Build/source/texk/web2c/luatexdir/pdf/pdfsetmatrix.w index 994c5d8a903..34f3ead258c 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfsetmatrix.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfsetmatrix.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = "$Id: pdfsetmatrix.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/tags/beta-0.76.0/source/texk/web2c/luatexdir/pdf/pdfsetmatrix.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdfsetmatrix.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfshipout.w b/Build/source/texk/web2c/luatexdir/pdf/pdfshipout.w index ce9e8da5f45..61342ed7786 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfshipout.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfshipout.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = "$Id: pdfshipout.w 4451 2012-07-05 21:13:01Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/tags/beta-0.76.0/source/texk/web2c/luatexdir/pdf/pdfshipout.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdfshipout.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdftables.w b/Build/source/texk/web2c/luatexdir/pdf/pdftables.w index 1b9a2fa806b..ba8495137a2 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdftables.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdftables.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = "$Id: pdftables.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/tags/beta-0.76.0/source/texk/web2c/luatexdir/pdf/pdftables.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdftables.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfthread.w b/Build/source/texk/web2c/luatexdir/pdf/pdfthread.w index 04788b0a468..5855647cddc 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfthread.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfthread.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = "$Id: pdfthread.w 4451 2012-07-05 21:13:01Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/tags/beta-0.76.0/source/texk/web2c/luatexdir/pdf/pdfthread.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdfthread.w $"; #include "ptexlib.h" diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdftypes.h b/Build/source/texk/web2c/luatexdir/pdf/pdftypes.h index d1ae3ee532c..91d58419495 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdftypes.h +++ b/Build/source/texk/web2c/luatexdir/pdf/pdftypes.h @@ -1,6 +1,6 @@ /* pdftypes.h - Copyright 2009-2011 Taco Hoekwater <taco@luatex.org> + Copyright 2009-2013 Taco Hoekwater <taco@luatex.org> This file is part of LuaTeX. @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */ -/* $Id: pdftypes.h 4558 2013-01-19 14:21:59Z oneiros $ */ +/* $Id: pdftypes.h 4718 2014-01-02 15:35:31Z taco $ */ #ifndef PDFTYPES_H # define PDFTYPES_H @@ -67,7 +67,7 @@ the types explicitly defined in this header, and stay away from types like */ typedef struct { - int64_t m; /* mantissa (significand) */ + int64_t m; /* mantissa (significand) */ int e; /* exponent * -1 */ } pdffloat; @@ -139,6 +139,7 @@ typedef struct { int ishex; /* Whether the current char string is <> or () */ int need_tf; /* flag whether Tf needs to be set */ int need_tm; /* flag whether Tm needs to be set */ + int cur_ex; /* the current glyph ex factor */ } pdfstructure; typedef struct obj_entry_ { @@ -249,6 +250,7 @@ typedef struct vf_struct_ { int packet_stack_minlevel; /* to check stack underflow */ internal_font_number lf; /* local font number, resolved */ int fs_f; /* local font size */ + int ex_glyph; /* expansion value; ex_glyph = 0 means unexpanded */ int packet_cur_s; /* do_vf_packet() nesting level */ posstructure *refpos; int vflua; /* flag, whether vf.*() functions are allowed */ diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfxform.w b/Build/source/texk/web2c/luatexdir/pdf/pdfxform.w index 8472a88bd40..17d7291f950 100644 --- a/Build/source/texk/web2c/luatexdir/pdf/pdfxform.w +++ b/Build/source/texk/web2c/luatexdir/pdf/pdfxform.w @@ -20,7 +20,7 @@ @ @c static const char _svn_version[] = "$Id: pdfxform.w 4442 2012-05-25 22:40:34Z hhenkel $" - "$URL: https://foundry.supelec.fr/svn/luatex/tags/beta-0.76.0/source/texk/web2c/luatexdir/pdf/pdfxform.w $"; + "$URL: https://foundry.supelec.fr/svn/luatex/branches/ex-glyph/source/texk/web2c/luatexdir/pdf/pdfxform.w $"; #include "ptexlib.h" |