summaryrefslogtreecommitdiff
path: root/Build/source
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2015-10-05 20:49:02 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2015-10-05 20:49:02 +0000
commit9f0c232e474828b1552ecd430a237b28e8e57e7f (patch)
tree11223de78961eed1d125e9d1e1eb5bb056e1f43c /Build/source
parenta3a26fc921f8182b70d96386e6d76ce051ed247f (diff)
web2c/luatexdir: Sync with the upstream trunk.
git-svn-id: svn://tug.org/texlive/trunk@38555 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rw-r--r--Build/source/texk/web2c/luatexdir/ChangeLog16
-rw-r--r--Build/source/texk/web2c/luatexdir/font/writecff.w1
-rw-r--r--Build/source/texk/web2c/luatexdir/font/writefont.w14
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/lnodelib.c25
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/lpdflib.c1
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/luatoken.w1
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/lookups.c34
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettf.c133
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettfatt.c29
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinefont.h4
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/tottf.c3
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/src/luafflib.c132
-rw-r--r--Build/source/texk/web2c/luatexdir/luatex.c8
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/commands.w2
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/dumpdata.w4
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/equivalents.h4
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/filename.w2
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/maincontrol.w4
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/printing.w2
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/texmath.w177
20 files changed, 373 insertions, 223 deletions
diff --git a/Build/source/texk/web2c/luatexdir/ChangeLog b/Build/source/texk/web2c/luatexdir/ChangeLog
index 7ead13f9f81..c6acabbcf6d 100644
--- a/Build/source/texk/web2c/luatexdir/ChangeLog
+++ b/Build/source/texk/web2c/luatexdir/ChangeLog
@@ -1,3 +1,19 @@
+2015-10-05 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * Completely sync with the upstream trunk.
+ Changed files are
+ font/writecff.w, font/writefont.w,
+ lua/lnodelib.c, lua/lpdflib.c, lua/luatoken.w,
+ luafontloader/fontforge/fontforge/lookups.c,
+ luafontloader/fontforge/fontforge/parsettf.c,
+ luafontloader/fontforge/fontforge/parsettfatt.c,
+ luafontloader/fontforge/fontforge/splinefont.h,
+ luafontloader/fontforge/fontforge/tottf.c,
+ luafontloader/src/luafflib.c,
+ luatex.c,
+ tex/commands.w, tex/dumpdata.w, tex/equivalents.h, tex/filename.w,
+ tex/maincontrol.w, tex/printing.w, tex/texmath.w.
+
2015-10-01 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
* pdf/pdfgen.w: Sync with the upstream trunk.
diff --git a/Build/source/texk/web2c/luatexdir/font/writecff.w b/Build/source/texk/web2c/luatexdir/font/writecff.w
index 0a070f5bf83..d6e05bca4db 100644
--- a/Build/source/texk/web2c/luatexdir/font/writecff.w
+++ b/Build/source/texk/web2c/luatexdir/font/writecff.w
@@ -3407,6 +3407,7 @@ void write_cid_cff(PDF pdf, cff_font * cffont, fd_entry * fd)
pdf_out_block(pdf, stream, l);
pdf_end_stream(pdf);
pdf_end_obj(pdf);
+ xfree(stream);
}
}
diff --git a/Build/source/texk/web2c/luatexdir/font/writefont.w b/Build/source/texk/web2c/luatexdir/font/writefont.w
index 1846df0109e..b5eb8ae711a 100644
--- a/Build/source/texk/web2c/luatexdir/font/writefont.w
+++ b/Build/source/texk/web2c/luatexdir/font/writefont.w
@@ -957,6 +957,14 @@ static void write_cid_charwidth_array(PDF pdf, fo_entry * fo)
pdf_end_obj(pdf);
}
+static void destroy_glw_cid_entry(void *pa, void *pb)
+{
+ glw_entry *e = (glw_entry *) pa;
+ (void) pb;
+ xfree(e);
+}
+
+
static void create_cid_fontdictionary(PDF pdf, internal_font_number f)
{
fm_entry *fm = font_map(f);
@@ -980,6 +988,12 @@ static void create_cid_fontdictionary(PDF pdf, internal_font_number f)
write_fontdescriptor(pdf, fo->fd);
write_cid_fontdictionary(pdf, fo, f);
+ if (fo->fd) {
+ if (fo->fd->gl_tree){
+ avl_destroy(fo->fd->gl_tree,destroy_glw_cid_entry);
+ }
+ xfree(fo->fd);
+ }
xfree(fo);
}
diff --git a/Build/source/texk/web2c/luatexdir/lua/lnodelib.c b/Build/source/texk/web2c/luatexdir/lua/lnodelib.c
index bbf3fa56f2b..3e8830f793c 100644
--- a/Build/source/texk/web2c/luatexdir/lua/lnodelib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/lnodelib.c
@@ -632,6 +632,31 @@ static int lua_nodelib_direct_getfont(lua_State * L)
return 1;
}
+
+/* node.direct.getfont */
+/* a new one, waiting some patched from HH
+static int lua_nodelib_direct_getfont(lua_State * L)
+{
+ halfword n, t;
+ n = (halfword) lua_tonumber(L, 1);
+ if (n != null) {
+ t = type(n);
+ if (t == glyph_node) {
+ lua_pushnumber(L, font(n));
+ } else if ((t == math_char_node) || (t == math_text_char_node)) {
+ lua_pushnumber(L, fam_fnt(math_fam(n), 0));
+ } else {
+ lua_pushnil(L);
+ }
+ } else {
+ lua_pushnil(L);
+ }
+ return 1;
+}
+*/
+
+
+
/* node.getchar */
static int lua_nodelib_getcharacter(lua_State * L)
diff --git a/Build/source/texk/web2c/luatexdir/lua/lpdflib.c b/Build/source/texk/web2c/luatexdir/lua/lpdflib.c
index 7db30410816..71580145ba7 100644
--- a/Build/source/texk/web2c/luatexdir/lua/lpdflib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/lpdflib.c
@@ -494,6 +494,7 @@ static int l_reserveobj(lua_State * L)
case 1:
if (!lua_isstring(L, -1))
luaL_error(L, "pdf.reserveobj() optional argument must be string");
+ st_s = luaL_checkstring(L, 1);
if (lua_key_eq(st_s, annot)) {
pdf_last_annot = pdf_create_obj(static_pdf, obj_type_annot, 0);
} else {
diff --git a/Build/source/texk/web2c/luatexdir/lua/luatoken.w b/Build/source/texk/web2c/luatexdir/lua/luatoken.w
index c832fb84acb..cf91a6f7bf8 100644
--- a/Build/source/texk/web2c/luatexdir/lua/luatoken.w
+++ b/Build/source/texk/web2c/luatexdir/lua/luatoken.w
@@ -301,6 +301,7 @@ void tokenlist_to_luastring(lua_State * L, int p)
char *s;
s = tokenlist_to_cstring(p, 1, &l);
lua_pushlstring(L, s, (size_t) l);
+ free(s);
}
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/lookups.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/lookups.c
index 85bcd91b94f..243d4ec6a44 100644
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/lookups.c
+++ b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/lookups.c
@@ -22,7 +22,7 @@
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "fontforgevw.h"
#include <chardata.h>
@@ -1179,14 +1179,14 @@ static struct {
uint32 tag;
} localscripts[] = {
{ N_("Arabic"), CHR('a','r','a','b') },
- { N_("Aramaic"), CHR('a','r','a','m') },
+ { N_("Aramaic"), CHR('a','r','a','m') }, /* Only in ff */
{ N_("Armenian"), CHR('a','r','m','n') },
- { N_("Avestan"), CHR('a','v','e','s') },
+ { N_("Avestan"), CHR('a','v','e','s') }, /* Only in ff */
{ N_("Balinese"), CHR('b','a','l','i') },
{ N_("Batak"), CHR('b','a','t','k') },
{ N_("Bengali"), CHR('b','e','n','g') },
{ N_("Bengali2"), CHR('b','n','g','2') },
- { N_("Bliss Symbolics"), CHR('b','l','i','s') },
+ { N_("Bliss Symbolics"), CHR('b','l','i','s') }, /* Only in ff */
{ N_("Bopomofo"), CHR('b','o','p','o') },
{ N_("Brāhmī"), CHR('b','r','a','h') },
{ N_("Braille"), CHR('b','r','a','i') },
@@ -1198,11 +1198,11 @@ static struct {
{ N_("Cherokee"), CHR('c','h','a','m') },
{ N_("Cham"), CHR('c','h','a','m') },
{ N_("Cherokee"), CHR('c','h','e','r') },
- { N_("Cirth"), CHR('c','i','r','t') },
+ { N_("Cirth"), CHR('c','i','r','t') }, /* Only in ff */
{ N_("CJK Ideographic"), CHR('h','a','n','i') },
{ N_("Coptic"), CHR('c','o','p','t') },
{ N_("Cypro-Minoan"), CHR('c','p','r','t') },
- { N_("Cypriot syllabary"), CHR('c','p','m','n') },
+ { N_("Cypriot syllabary"), CHR('c','p','m','n') }, /* Only in ff */
{ N_("Cyrillic"), CHR('c','y','r','l') },
{ N_("Default"), CHR('D','F','L','T') },
{ N_("Deseret (Mormon)"), CHR('d','s','r','t') },
@@ -1242,35 +1242,35 @@ static struct {
{ N_("Latin"), CHR('l','a','t','n') },
{ N_("Lepcha (Róng)"), CHR('l','e','p','c') },
{ N_("Limbu"), CHR('l','i','m','b') }, /* Not in ISO 15924 !!!!!, just guessing */
- { N_("Linear A"), CHR('l','i','n','a') },
+ { N_("Linear A"), CHR('l','i','n','a') }, /* Only in ff */
{ N_("Linear B"), CHR('l','i','n','b') },
{ N_("Lycian"), CHR('l','y','c','i') },
{ N_("Lydian"), CHR('l','y','d','i') },
{ N_("Mandaean"), CHR('m','a','n','d') },
/* { N_("Mayan hieroglyphs"), CHR('m','a','y','a') },*/
{ N_("Malayālam"), CHR('m','l','y','m') },
- { N_("Malayālam2"), CHR('m','l','y','2') },
+ { N_("Malayālam2"), CHR('m','l','y','2') }, /* Only in ff, should be mlm2 */
{ N_("Mathematical Alphanumeric Symbols"), CHR('m','a','t','h') },
{ N_("Mongolian"), CHR('m','o','n','g') },
- { N_("Musical"), CHR('m','u','s','i') },
+ { N_("Musical"), CHR('m','u','s','i') }, /* Only in ff, should be musc */
{ N_("Myanmar"), CHR('m','y','m','r') },
{ N_("New Tai Lue"), CHR('t','a','l','u') },
{ N_("N'Ko"), CHR('n','k','o',' ') },
{ N_("Ogham"), CHR('o','g','a','m') },
{ N_("Ol Chiki"), CHR('o','l','c','k') },
{ N_("Old Italic (Etruscan, Oscan, etc.)"), CHR('i','t','a','l') },
- { N_("Old Permic"), CHR('p','e','r','m') },
+ { N_("Old Permic"), CHR('p','e','r','m') }, /* Only in ff */
{ N_("Old Persian cuneiform"), CHR('x','p','e','o') },
{ N_("Oriya"), CHR('o','r','y','a') },
{ N_("Oriya2"), CHR('o','r','y','2') },
{ N_("Osmanya"), CHR('o','s','m','a') },
- { N_("Pahlavi"), CHR('p','a','l','v') },
+ { N_("Pahlavi"), CHR('p','a','l','v') }, /* Only in ff */
{ N_("Phags-pa"), CHR('p','h','a','g') },
{ N_("Phoenician"), CHR('p','h','n','x') },
- { N_("Phaistos"), CHR('p','h','s','t') },
- { N_("Pollard Phonetic"), CHR('p','l','r','d') },
+ { N_("Phaistos"), CHR('p','h','s','t') }, /* Only in ff */
+ { N_("Pollard Phonetic"), CHR('p','l','r','d') }, /* Only in ff */
{ N_("Rejang"), CHR('r','j','n','g') },
- { N_("Rongorongo"), CHR('r','o','r','o') },
+ { N_("Rongorongo"), CHR('r','o','r','o') }, /* Only in ff */
{ N_("Runic"), CHR('r','u','n','r') },
{ N_("Saurashtra"), CHR('s','a','u','r') },
{ N_("Shavian"), CHR('s','h','a','w') },
@@ -1287,15 +1287,15 @@ static struct {
{ N_("Tamil2"), CHR('t','m','l','2') },
{ N_("Telugu"), CHR('t','e','l','u') },
{ N_("Telugu2"), CHR('t','e','l','2') },
- { N_("Tengwar"), CHR('t','e','n','g') },
+ { N_("Tengwar"), CHR('t','e','n','g') }, /* Only in ff */
{ N_("Thaana"), CHR('t','h','a','a') },
{ N_("Thai"), CHR('t','h','a','i') },
{ N_("Tibetan"), CHR('t','i','b','t') },
{ N_("Tifinagh (Berber)"), CHR('t','f','n','g') },
- { N_("Ugaritic"), CHR('u','g','r','t') }, /* Not in ISO 15924 !!!!!, just guessing */
+ { N_("Ugaritic"), CHR('u','g','r','t') }, /* Only in ff, should be ugar */
{ N_("Vai"), CHR('v','a','i',' ') },
/* { N_("Visible Speech"), CHR('v','i','s','p') },*/
- { N_("Cuneiform, Ugaritic"), CHR('x','u','g','a') },
+ { N_("Cuneiform, Ugaritic"), CHR('x','u','g','a') }, /* Only in ff */
{ N_("Yi") , CHR('y','i',' ',' ') },
/* { N_("Private Use Script 1"), CHR('q','a','a','a') },*/
/* { N_("Private Use Script 2"), CHR('q','a','a','b') },*/
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettf.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettf.c
index 92efbc7800f..0a79633f11e 100644
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettf.c
+++ b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettf.c
@@ -938,7 +938,7 @@ return;
free(tabs);
fseek(ttf,restore_this_pos,SEEK_SET);
}
-
+
static struct tablenames { uint32 tag; char *name; } stdtables[] = {
{ CHR('a','c','n','t'), N_("accent attachment table") },
{ CHR('a','v','a','r'), N_("axis variation table") },
@@ -1546,7 +1546,7 @@ static char *FindLangEntry(struct ttfinfo *info, int id ) {
for ( cur=info->names; cur!=NULL && cur->names[id]==NULL; cur=cur->next );
if ( cur==NULL )
return( NULL );
- ret = copy(cur->names[id]);
+ ret = copy(cur->names[id]);
return( ret );
}
@@ -1602,7 +1602,7 @@ static void readttfcopyrights(FILE *ttf,struct ttfinfo *info) {
name = getushort(ttf);
str_len = getushort(ttf);
stroff = getushort(ttf);
-
+
TTFAddLangStr(ttf,info,name,str_len,tableoff+stroff,
platform,specific,language);
}
@@ -2114,11 +2114,11 @@ return( sc );
LogError(_("Bad glyph (%d), its definition extends beyond the space allowed for it\n"), gid );
info->bad_glyph_data = true;
}
-
+
/* find the bb */
THPatchSplineChar(sc);
}
-
+
return( sc );
}
@@ -3669,20 +3669,30 @@ static void cidfigure(struct ttfinfo *info, struct topdicts *dict,
/*info->map = encmap = EncMapNew(info->glyph_cnt,info->glyph_cnt,&custom);*/
for ( j=0; subdicts[j]!=NULL; ++j );
- info->subfontcnt = j;
+ info->subfontcnt = j;
info->subfonts = gcalloc(j+1,sizeof(SplineFont *));
for ( j=0; subdicts[j]!=NULL; ++j ) {
- info->subfonts[j] = cffsffillup(subdicts[j],strings,scnt,info);
- info->subfonts[j]->map = encmap;
+ info->subfonts[j] = cffsffillup(subdicts[j],strings,scnt,info);
+ info->subfonts[j]->map = encmap;
+ info->subfonts[j]->glyphmin = -1;
}
+ /* here we also deal with glyphmin */
+
for ( i=0; i<info->glyph_cnt; ++i ) {
- sf = info->subfonts[ fdselect[i] ];
- cid = dict->charset[i];
- if ( cid>=sf->glyphcnt ) sf->glyphcnt = sf->glyphmax = cid+1;
- /*if ( cid>=encmap->enccount ) encmap->enccount = cid+1;*/
+ sf = info->subfonts[ fdselect[i] ];
+ cid = dict->charset[i];
+ if ( cid>=sf->glyphcnt ) {
+ if (sf->glyphmin == -1) {
+ sf->glyphmin = cid;
+ }
+ sf->glyphcnt = sf->glyphmax = cid+1;
+ }
+ /*if ( cid>=encmap->enccount )
+ encmap->enccount = cid+1;*/
}
for ( j=0; subdicts[j]!=NULL; ++j )
- info->subfonts[j]->glyphs = gcalloc(info->subfonts[j]->glyphcnt,sizeof(SplineChar *));
+ info->subfonts[j]->glyphs = gcalloc(info->subfonts[j]->glyphcnt,sizeof(SplineChar *));
+
/*encmap->encmax = encmap->enccount;*/
/*encmap->map = galloc(encmap->enccount*sizeof(int));*/
/*memset(encmap->map,-1,encmap->enccount*sizeof(int));*/
@@ -3697,49 +3707,46 @@ static void cidfigure(struct ttfinfo *info, struct topdicts *dict,
map = FindCidMap(info->cidregistry,info->ordering,info->supplement,NULL);
for ( i=0; i<info->glyph_cnt; ++i ) {
- j = fdselect[i];
- sf = info->subfonts[ j ];
-/* The format allows for some dicts that are type1 strings and others that */
-/* are type2s. Which means that the global subrs will have a different bias */
-/* as we flip from font to font. So we can't set the bias when we read in */
-/* the subrs but must wait until we know which font we're working on. */
- cstype = subdicts[j]->charstringtype;
- pscontext.is_type2 = cstype-1;
- pscontext.painttype = subdicts[j]->painttype;
- gsubrs->bias = cstype==1 ? 0 :
- gsubrs->cnt < 1240 ? 107 :
- gsubrs->cnt <33900 ? 1131 : 32768;
- subrs = &subdicts[j]->local_subrs;
- subrs->bias = cstype==1 ? 0 :
- subrs->cnt < 1240 ? 107 :
- subrs->cnt <33900 ? 1131 : 32768;
-
- cid = dict->charset[i];
- /*encmap->map[cid] = cid;*/
- uni = CID2NameUni(map,cid,buffer,sizeof(buffer));
- info->chars[i] = PSCharStringToBB(
- dict->glyphs.values[i], dict->glyphs.lens[i],&pscontext,
- subrs,gsubrs,buffer);
- info->chars[i]->vwidth = sf->ascent+sf->descent;
- info->chars[i]->unicodeenc = uni;
- sf->glyphs[cid] = info->chars[i];
- sf->glyphs[cid]->parent = sf;
- sf->glyphs[cid]->orig_pos = cid; /* Bug! should be i, but I assume sf->chars[orig_pos]->orig_pos==orig_pos */
- if ( sf->glyphs[cid]->layers[ly_fore].refs!=NULL )
- IError( "Reference found in CID font. Can't fix it up");
-
+ j = fdselect[i];
+ sf = info->subfonts[j];
+ /* The format allows for some dicts that are type1 strings and others that */
+ /* are type2s. Which means that the global subrs will have a different bias */
+ /* as we flip from font to font. So we can't set the bias when we read in */
+ /* the subrs but must wait until we know which font we're working on. */
+ cstype = subdicts[j]->charstringtype;
+ pscontext.is_type2 = cstype-1;
+ pscontext.painttype = subdicts[j]->painttype;
+ gsubrs->bias = cstype==1 ? 0 :
+ gsubrs->cnt < 1240 ? 107 :
+ gsubrs->cnt <33900 ? 1131 : 32768;
+ subrs = &subdicts[j]->local_subrs;
+ subrs->bias = cstype==1 ? 0 :
+ subrs->cnt < 1240 ? 107 :
+ subrs->cnt <33900 ? 1131 : 32768;
+ cid = dict->charset[i];
+ /*encmap->map[cid] = cid;*/
+ uni = CID2NameUni(map,cid,buffer,sizeof(buffer));
+ info->chars[i] = PSCharStringToBB(
+ dict->glyphs.values[i], dict->glyphs.lens[i],&pscontext,
+ subrs,gsubrs,buffer);
+ info->chars[i]->vwidth = sf->ascent+sf->descent;
+ info->chars[i]->unicodeenc = uni;
+ sf->glyphs[cid] = info->chars[i];
+ sf->glyphs[cid]->parent = sf;
+ sf->glyphs[cid]->orig_pos = i; /* fixed in 0.80.1 */
+ if ( sf->glyphs[cid]->layers[ly_fore].refs!=NULL )
+ IError( "Reference found in CID font. Can't fix it up");
THPatchSplineChar(sf->glyphs[cid]);
-
- if ( cstype==2 ) {
- if ( sf->glyphs[cid]->width == (int16) 0x8000 )
- sf->glyphs[cid]->width = subdicts[j]->defaultwidthx;
- else
- sf->glyphs[cid]->width += subdicts[j]->nominalwidthx;
- }
- ff_progress_next();
+ if ( cstype==2 ) {
+ if ( sf->glyphs[cid]->width == (int16) 0x8000 )
+ sf->glyphs[cid]->width = subdicts[j]->defaultwidthx;
+ else
+ sf->glyphs[cid]->width += subdicts[j]->nominalwidthx;
+ }
+ ff_progress_next();
}
/* No need to do a reference fixup here-- the chars aren't associated */
- /* with any encoding as is required for seac */
+ /* with any encoding as is required for seac */
}
static int readcffglyphs(FILE *ttf,struct ttfinfo *info) {
@@ -3857,7 +3864,7 @@ static int readtyp1glyphs(FILE *ttf,struct ttfinfo *info) {
i = 0;
fseek(ttf,info->typ1_start+i,SEEK_SET);
}
-
+
tmp = tmpfile();
for ( i=0; i<(int)info->typ1_length; ++i )
putc(getc(ttf),tmp);
@@ -3892,7 +3899,7 @@ return( true );
}
return( false );
}
-
+
static void readttfwidths(FILE *ttf,struct ttfinfo *info) {
int i,j;
int lastwidth = info->emsize, lsb;
@@ -3936,7 +3943,7 @@ static void readttfwidths(FILE *ttf,struct ttfinfo *info) {
LogError( _("Invalid ttf hmtx table (or hhea), numOfLongMetrics is 0\n") );
info->bad_metrics = true;
}
-
+
for ( j=i; j<info->glyph_cnt; ++j ) {
if ( (sc = info->chars[j])!=NULL ) { /* In a ttc file we may skip some */
sc->width = lastwidth;
@@ -4701,7 +4708,7 @@ return;
} else if ( format==2 ) {
int max_sub_head_key = 0, cnt, max_pos= -1;
struct subhead *subheads;
-
+
for ( i=0; i<256; ++i ) {
table[i] = getushort(ttf)/8; /* Sub-header keys */
if ( table[i]>max_sub_head_key ) {
@@ -5703,7 +5710,7 @@ static SplineFont *SFFillFromTTF(struct ttfinfo *info) {
SplineChar *sc;
struct ttf_table *last[2], *tab, *next;
-
+
sf = SplineFontEmpty();
sf->display_size = -default_fv_font_size;
#ifdef LUA_FF_LIB
@@ -5861,7 +5868,7 @@ static SplineFont *SFFillFromTTF(struct ttfinfo *info) {
sf->layers = info->layers;
sf->layer_cnt = info->layer_cnt;
}
-
+
for ( i=0; i<info->glyph_cnt; ++i ) if ( info->chars[i]!=NULL ) {
SCOrderAP(info->chars[i]);
@@ -5982,12 +5989,12 @@ return( 0 );
return( true );
}
-/* I am not sure what happens to the ttinfo struct's members.
+/* I am not sure what happens to the ttinfo struct's members.
perhaps some need free()-ing
*/
-void THPatchSplineChar (SplineChar *sc)
-{
+void THPatchSplineChar (SplineChar *sc)
+{
DBounds bb;
if (sc->layers!=NULL && sc->layers[ly_fore].splines != NULL) {
if (sc->xmax==0 && sc->ymax==0 && sc->xmin==0 && sc->ymin==0) {
@@ -6006,7 +6013,7 @@ void THPatchSplineChar (SplineChar *sc)
sc->layers[ly_fore].refs = NULL;
}
}
-
+
static SplineFont *SFFillFromTTFInfo(struct ttfinfo *info) {
SplineFont *sf ;
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettfatt.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettfatt.c
index 97974e3baf5..85114e1213d 100644
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettfatt.c
+++ b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/parsettfatt.c
@@ -447,7 +447,7 @@ static void addPairPos(struct ttfinfo *info, int glyph1, int glyph2,
uint32 base,FILE *ttf) {
(void)ttf; /* for -Wall */
(void)l; /* for -Wall */
- (void)base; /* for -Wall */
+ (void)base; /* for -Wall */
if ( glyph1<info->glyph_cnt && glyph2<info->glyph_cnt ) {
PST *pos = chunkalloc(sizeof(PST));
pos->type = pst_pair;
@@ -1727,7 +1727,7 @@ return;
}
static void gposContextSubTable(FILE *ttf, int stoffset,
- struct ttfinfo *info, struct lookup *l, struct lookup_subtable *subtable,
+ struct ttfinfo *info, struct lookup *l, struct lookup_subtable *subtable,
struct lookup *alllooks) {
switch( getushort(ttf)) {
case 1:
@@ -1743,7 +1743,7 @@ static void gposContextSubTable(FILE *ttf, int stoffset,
}
static void gposChainingSubTable(FILE *ttf, int stoffset,
- struct ttfinfo *info, struct lookup *l, struct lookup_subtable *subtable,
+ struct ttfinfo *info, struct lookup *l, struct lookup_subtable *subtable,
struct lookup *alllooks) {
switch( getushort(ttf)) {
case 1:
@@ -2570,10 +2570,10 @@ static void gposExtensionSubTable(FILE *ttf, int stoffset,
switch ( lu_type ) {
case 1:
gposSimplePos(ttf,st,info,l,subtable);
- break;
+ break;
case 2:
gposKernSubTable(ttf,st,info,l,subtable);
- break;
+ break;
case 3:
gposCursiveSubTable(ttf,st,info,l,subtable);
break;
@@ -2657,10 +2657,10 @@ static void gposLookupSwitch(FILE *ttf, int st,
switch ( l->type | 0x100 ) {
case gpos_single:
gposSimplePos(ttf,st,info,l,subtable);
- break;
+ break;
case gpos_pair:
gposKernSubTable(ttf,st,info,l,subtable);
- break;
+ break;
case gpos_cursive:
gposCursiveSubTable(ttf,st,info,l,subtable);
break;
@@ -2838,17 +2838,24 @@ void readttfgdef(FILE *ttf,struct ttfinfo *info) {
int coverage, cnt, i,j, format;
uint16 *glyphs, *lc_offsets, *offsets;
uint32 caret_base;
+ uint32 version;
PST *pst;
SplineChar *sc;
fseek(ttf,info->gdef_start,SEEK_SET);
- if ( getlong(ttf)!=0x00010000 )
-return;
+
+ version = getlong(ttf) ;
+ if (version != 0x00010000 && version != 0x00010002)
+ return;
+
info->g_bounds = info->gdef_start + info->gdef_length;
gclass = getushort(ttf);
/* attach list = */ getushort(ttf);
lclo = getushort(ttf); /* ligature caret list */
- mac = getushort(ttf); /* mark attach class */
+ mac = getushort(ttf); /* mark attach class */
+
+ if (version == 0x00010002)
+ getushort(ttf); /* class defs */
if ( gclass!=0 ) {
uint16 *gclasses = getClassDefTable(ttf,info->gdef_start+gclass, info);
@@ -3614,7 +3621,7 @@ void readttfbase(FILE *ttf,struct ttfinfo *info) {
struct Base *curBase;
struct basescript *curScript, *last;
struct baselangextent *cur, *lastLang;
-
+
if ( info->base_start==0 )
return;
fseek(ttf,info->base_start,SEEK_SET);
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinefont.h b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinefont.h
index edb726e0657..ccee275e015 100644
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinefont.h
+++ b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/splinefont.h
@@ -771,7 +771,7 @@ typedef struct bdfprops {
typedef struct bdffont {
struct splinefont *sf;
- int glyphcnt, glyphmax; /* used & allocated sizes of glyphs array */
+ int glyphcnt, glyphmax,glyphmin; /* used & allocated sizes of glyphs array */
BDFChar **glyphs; /* an array of charcnt entries */
int16 pixelsize;
int16 ascent, descent;
@@ -1484,7 +1484,7 @@ typedef struct splinefont {
struct splinefont *next;
int ascent, descent;
int uniqueid; /* Not copied when reading in!!!! */
- int glyphcnt, glyphmax; /* allocated size of glyphs array */
+ int glyphcnt, glyphmax,glyphmin; /* allocated size of glyphs array */
SplineChar **glyphs;
unsigned int changed: 1;
unsigned int changed_since_autosave: 1;
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/tottf.c b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/tottf.c
index 89a0da5860b..3a1f02c273e 100644
--- a/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/tottf.c
+++ b/Build/source/texk/web2c/luatexdir/luafontloader/fontforge/fontforge/tottf.c
@@ -480,6 +480,7 @@ return;
sf->glyphs = gcalloc(max,sizeof(SplineChar *));
sf->glyphcnt = sf->glyphmax = max;
+ sf->glyphmin = 0;
for ( k=0; k<sf->subfontcnt; ++k )
for ( i=0; i<sf->subfonts[k]->glyphcnt; ++i ) if ( sf->subfonts[k]->glyphs[i]!=NULL )
sf->glyphs[i] = sf->subfonts[k]->glyphs[i];
@@ -1896,7 +1897,7 @@ static int dumpcff(struct alltabs *at,SplineFont *sf,enum fontformat format,
SFDummyUpCIDs(&at->gi,sf); /* life is easier if we ignore the seperate fonts of a cid keyed fonts and treat it as flat */
ret = dumpcidglyphs(sf,at);
free(sf->glyphs); sf->glyphs = NULL;
- sf->glyphcnt = sf->glyphmax = 0;
+ sf->glyphcnt = sf->glyphmax = sf->glyphmin = 0;
}
free( at->gi.bygid );
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/src/luafflib.c b/Build/source/texk/web2c/luatexdir/luafontloader/src/luafflib.c
index f2791367b61..3f2ce922bf7 100644
--- a/Build/source/texk/web2c/luatexdir/luafontloader/src/luafflib.c
+++ b/Build/source/texk/web2c/luatexdir/luafontloader/src/luafflib.c
@@ -1,5 +1,5 @@
/* luafflib.c
-
+
Copyright 2007-2010 Taco Hoekwater <taco@luatex.org>
This file is part of LuaTeX.
@@ -49,7 +49,7 @@ extern int readbinfile(FILE * f, unsigned char **b, int *s);
#define FONT_GLYPHS_METATABLE "fontloader.splinefont.glyphs"
#define FONT_GLYPH_METATABLE "fontloader.splinefont.glyph"
-#define LUA_OTF_VERSION "0.3"
+#define LUA_OTF_VERSION "0.4"
static char *possub_type_enum[] = {
"null", "position", "pair", "substitution",
@@ -154,7 +154,7 @@ void handle_glyphvariants(lua_State * L, struct glyphvariants *vars);
void handle_mathkern(lua_State * L, struct mathkern *mk);
int handle_altuni(lua_State * L, struct altuni *au);
-int is_userdata(lua_State *L, int b, char *utype)
+int is_userdata(lua_State *L, int b, char *utype)
{
if (lua_type(L,b) == LUA_TUSERDATA) {
lua_getmetatable(L, b);
@@ -162,7 +162,7 @@ int is_userdata(lua_State *L, int b, char *utype)
if (lua_compare(L, -2, -1, LUA_OPEQ)) {
lua_pop(L,2);
return 1;
- }
+ }
lua_pop(L,2);
}
return 0;
@@ -287,7 +287,7 @@ static int ff_close(lua_State * L)
/*fputs("ff_close called",stderr); */
sf = check_isfont(L, 1);
if (*sf != NULL) {
- if ((*sf)->fv) { // condition might be improved
+ if ((*sf)->fv) { /* condition might be improved */
FontViewClose((*sf)->fv);
} else {
EncMapFree((*sf)->map);
@@ -561,7 +561,7 @@ void do_handle_lookup_subtable(lua_State * L, struct lookup_subtable *subtable)
/* dump_intfield (L,"unused", subtable->unused); */
/* The next one is true if there is no fpst, false otherwise */
/*
- dump_intfield (L,"per_glyph_pst_or_kern",subtable->per_glyph_pst_or_kern);
+ dump_intfield (L,"per_glyph_pst_or_kern",subtable->per_glyph_pst_or_kern);
*/
dump_cond_intfield(L, "anchor_classes", subtable->anchor_classes);
dump_cond_intfield(L, "vertical_kerning", subtable->vertical_kerning);
@@ -704,6 +704,8 @@ void handle_splinecharlist(lua_State * L, struct splinecharlist *scl)
/* variant shape. The specifics depend on the selector and script */
/* fid is currently unused, but may, someday, be used to do ttcs */
/* NOTE: GlyphInfo displays vs==-1 as vs==0, and fixes things up */
+
+
int handle_altuni(lua_State * L, struct altuni *au)
{
struct altuni *next = au;
@@ -711,16 +713,18 @@ int handle_altuni(lua_State * L, struct altuni *au)
int k = 1;
lua_checkstack(L, 3);
while (next != NULL) {
- if (next->unienc<0x10FFF) {
- lua_newtable(L);
- dump_intfield(L, "unicode", next->unienc);
- i++;
- if (next->vs != -1)
- dump_intfield(L, "variant", next->vs);
- /* dump_intfield(L, "fid", next->fid); */
- lua_rawseti(L, -2, k++);
- }
- next = next->next;
+ if (next->unienc<0x10FFFF) {
+ lua_newtable(L);
+ dump_intfield(L, "unicode", next->unienc);
+ i++;
+ if (next->vs != -1)
+ dump_intfield(L, "variant", next->vs);
+ /* dump_intfield(L, "fid", next->fid); */
+ lua_rawseti(L, -2, k++);
+ } else {
+ printf("ignoring variant %i %i\n",next->unienc,next->vs);
+ }
+ next = next->next;
}
return i;
}
@@ -1001,7 +1005,9 @@ void handle_splinechar(lua_State * L, struct splinechar *glyph, int hasvmetrics)
lua_pushnumber(L, glyph->ymax);
lua_rawset(L, -3);
lua_setfield(L, -2, "boundingbox");
- /*dump_intfield(L,"orig_pos", glyph->orig_pos); */
+ if (glyph->orig_pos>=0) {
+ dump_intfield(L,"orig_pos",glyph->orig_pos);
+}
if (hasvmetrics) {
dump_intfield(L, "vwidth", glyph->vwidth);
if (glyph->tsb != 0)
@@ -1029,23 +1035,23 @@ void handle_splinechar(lua_State * L, struct splinechar *glyph, int hasvmetrics)
dump_enumfield(L, "class", glyph->glyph_class, glyph_class_enum);
}
/* TH: internal fontforge stuff
- dump_intfield(L,"changed", glyph->changed);
- dump_intfield(L,"changedsincelasthinted", glyph->changedsincelasthinted);
- dump_intfield(L,"manualhints", glyph->manualhints);
+ dump_intfield(L,"changed", glyph->changed);
+ dump_intfield(L,"changedsincelasthinted", glyph->changedsincelasthinted);
+ dump_intfield(L,"manualhints", glyph->manualhints);
dump_intfield(L,"ticked", glyph->ticked);
- dump_intfield(L,"changed_since_autosave", glyph->changed_since_autosave);
- dump_intfield(L,"widthset", glyph->widthset);
- dump_intfield(L,"vconflicts", glyph->vconflicts);
- dump_intfield(L,"hconflicts", glyph->hconflicts);
- dump_intfield(L,"searcherdummy", glyph->searcherdummy);
- dump_intfield(L,"changed_since_search", glyph->changed_since_search);
- dump_intfield(L,"wasopen", glyph->wasopen);
- dump_intfield(L,"namechanged", glyph->namechanged);
- dump_intfield(L,"blended", glyph->blended);
+ dump_intfield(L,"changed_since_autosave", glyph->changed_since_autosave);
+ dump_intfield(L,"widthset", glyph->widthset);
+ dump_intfield(L,"vconflicts", glyph->vconflicts);
+ dump_intfield(L,"hconflicts", glyph->hconflicts);
+ dump_intfield(L,"searcherdummy", glyph->searcherdummy);
+ dump_intfield(L,"changed_since_search", glyph->changed_since_search);
+ dump_intfield(L,"wasopen", glyph->wasopen);
+ dump_intfield(L,"namechanged", glyph->namechanged);
+ dump_intfield(L,"blended", glyph->blended);
dump_intfield(L,"ticked2", glyph->ticked2);
- dump_intfield(L,"unused_so_far", glyph->unused_so_far);
- dump_intfield(L,"numberpointsbackards", glyph->numberpointsbackards);
- dump_intfield(L,"instructions_out_of_date", glyph->instructions_out_of_date);
+ dump_intfield(L,"unused_so_far", glyph->unused_so_far);
+ dump_intfield(L,"numberpointsbackards", glyph->numberpointsbackards);
+ dump_intfield(L,"instructions_out_of_date", glyph->instructions_out_of_date);
dump_intfield(L,"complained_about_ptnums", glyph->complained_about_ptnums);
unsigned int vs_open: 1;
unsigned int unlink_rm_ovrlp_save_undo: 1;
@@ -1987,10 +1993,17 @@ void handle_splinefont(lua_State * L, struct splinefont *sf)
dump_intfield(L, "ascent", sf->ascent);
dump_intfield(L, "descent", sf->descent);
if (sf->uniqueid!=0) {
- dump_intfield(L, "uniqueid", sf->uniqueid);
+ dump_intfield(L, "uniqueid", sf->uniqueid);
+ }
+
+ if (sf->glyphcnt > 0) {
+ dump_intfield(L, "glyphcnt", sf->glyphmax - sf->glyphmin + 1);
+ } else {
+ dump_intfield(L, "glyphcnt", 0);
}
- dump_intfield(L, "glyphcnt", sf->glyphcnt);
- dump_intfield(L, "glyphmax", sf->glyphmax);
+
+ dump_intfield(L, "glyphmax", sf->glyphmax - 1);
+ dump_intfield(L, "glyphmin", sf->glyphmin);
dump_intfield(L, "units_per_em", sf->units_per_em);
if (sf->possub != NULL) {
@@ -2011,7 +2024,7 @@ void handle_splinefont(lua_State * L, struct splinefont *sf)
}
if (fix_notdef) {
- /* some code to ensure that the .notdef ends up in slot 0
+ /* some code to ensure that the .notdef ends up in slot 0
(this will actually be enforced by the CFF writer) */
for (k = 0; k < sf->glyphcnt; k++) {
if (sf->glyphs[k]) {
@@ -2310,7 +2323,7 @@ void do_ff_info(lua_State * L, SplineFont * sf)
dump_stringfield(L, "weight", sf->weight);
dump_intfield(L, "units_per_em", sf->units_per_em);
- /* These are not assigned in info... */
+ /* These are not assigned in info... */
/*dump_intfield(L, "design_range_bottom", sf->design_range_bottom);*/
/*dump_intfield(L, "design_range_top", sf->design_range_top);*/
/*dump_intfield(L, "design_size", sf->design_size);*/
@@ -2320,11 +2333,11 @@ void do_ff_info(lua_State * L, SplineFont * sf)
lua_setfield(L, -2, "pfminfo");
/* Do we need this ? */
- if (sf->names != NULL) {
- lua_newtable(L);
- handle_ttflangname(L, sf->names);
- lua_setfield(L, -2, "names");
- }
+ if (sf->names != NULL) {
+ lua_newtable(L);
+ handle_ttflangname(L, sf->names);
+ lua_setfield(L, -2, "names");
+ }
}
typedef enum {
@@ -2344,6 +2357,7 @@ typedef enum {
FK_uniqueid,
FK_glyphcnt,
FK_glyphmax,
+ FK_glyphmin,
FK_units_per_em,
FK_lookups,
FK_glyphs,
@@ -2418,6 +2432,7 @@ const char *font_keys[] = {
"uniqueid",
"glyphcnt",
"glyphmax",
+ "glyphmin",
"units_per_em",
"lookups",
"glyphs",
@@ -2500,6 +2515,7 @@ typedef enum {
GK_vert_variants,
GK_horiz_variants,
GK_mathkern,
+ GK_orig_pos,
} font_glyph_key_values;
const char *font_glyph_keys[] = {
@@ -2526,6 +2542,7 @@ const char *font_glyph_keys[] = {
"vert_variants",
"horiz_variants",
"mathkern",
+ "orig_pos",
NULL
};
@@ -2573,7 +2590,8 @@ static int ff_glyphs_index(lua_State * L)
lua_pop(L, 1);
gid = luaL_checkinteger(L, 2);
- if (gid < 0 || gid >= sf->glyphmax) {
+ /* if (gid < sf->glyphmin || gid >= sf->glyphmax) {*/
+ if (gid < sf->glyphmin || gid > sf->glyphmax) {
return luaL_error(L, "fontloader.glyphs.__index: index is invalid\n");
}
/* This after-the-fact type discovery is not brilliant,
@@ -2583,7 +2601,7 @@ static int ff_glyphs_index(lua_State * L)
strmatch(sf->origname + strlen(sf->origname) - 4, ".pfb") == 0)) {
fix_notdef = 1;
}
- /* some code to ensure that the .notdef ends up in slot 0
+ /* some code to ensure that the .notdef ends up in slot 0
(this will actually be enforced by the CFF writer) */
if (fix_notdef) {
l = notdef_loc(sf);
@@ -2786,6 +2804,13 @@ static int ff_glyph_index(lua_State * L)
lua_pushnil(L);
}
break;
+ case GK_orig_pos:
+ if (glyph->orig_pos>=0) {
+ lua_pushnumber(L, glyph->orig_pos);
+ } else {
+ lua_pushnil(L);
+ }
+ break;
default:
lua_pushnil(L);
}
@@ -2804,10 +2829,12 @@ static int ff_index(lua_State * L)
"fontloader.__index: expected a (sub)font userdata object\n");
}
sf = *((SplineFont **)lua_touserdata(L, 1));
-
+
if (sf == NULL) {
- return luaL_error(L,
- "fontloader.__index: font is nonexistent or freed already\n");
+ /* return luaL_error(L, */
+ /* "fontloader.__index: font is nonexistent or freed already\n");*/
+ lua_pushnil(L);
+ return 1;
}
if (!lua_isstring(L, 2)) { /* 1 == 'font' */
return luaL_error(L,
@@ -2858,10 +2885,17 @@ static int ff_index(lua_State * L)
lua_pushnumber(L, sf->uniqueid);
break;
case FK_glyphcnt:
- lua_pushnumber(L, sf->glyphcnt);
+ if (sf->glyphcnt > 0) {
+ lua_pushnumber(L, sf->glyphmax - sf->glyphmin + 1);
+ } else {
+ lua_pushnumber(L, 0);
+ }
break;
case FK_glyphmax:
- lua_pushnumber(L, sf->glyphmax);
+ lua_pushnumber(L, sf->glyphmax - 1);
+ break;
+ case FK_glyphmin:
+ lua_pushnumber(L, sf->glyphmin);
break;
case FK_units_per_em:
lua_pushnumber(L, sf->units_per_em);
diff --git a/Build/source/texk/web2c/luatexdir/luatex.c b/Build/source/texk/web2c/luatexdir/luatex.c
index 509c10ef070..29ac66b95e8 100644
--- a/Build/source/texk/web2c/luatexdir/luatex.c
+++ b/Build/source/texk/web2c/luatexdir/luatex.c
@@ -26,11 +26,11 @@
#define TeX
-int luatex_svn = 5238;
+int luatex_svn = luatex_svn_revision;
int luatex_version = 80; /* \.{\\luatexversion} */
-int luatex_revision = '0'; /* \.{\\luatexrevision} */
-int luatex_date_info = 2015051900; /* the compile date is now hardwired */
-const char *luatex_version_string = "beta-0.80.0";
+int luatex_revision = '1'; /* \.{\\luatexrevision} */
+int luatex_date_info = 2015042200; /* the compile date is now hardwired */
+const char *luatex_version_string = "beta-0.80.1";
const char *engine_name = my_name; /* the name of this engine */
#include <kpathsea/c-ctype.h>
diff --git a/Build/source/texk/web2c/luatexdir/tex/commands.w b/Build/source/texk/web2c/luatexdir/tex/commands.w
index fe52171a438..09b86cd17bc 100644
--- a/Build/source/texk/web2c/luatexdir/tex/commands.w
+++ b/Build/source/texk/web2c/luatexdir/tex/commands.w
@@ -1065,6 +1065,8 @@ void initialize_etex_commands(void)
int_base + suppress_ifcsname_error_code, int_base);
primitive_luatex("suppressoutererror", assign_int_cmd,
int_base + suppress_outer_error_code, int_base);
+ primitive_luatex("matheqnogapstep", assign_int_cmd,
+ int_base + math_eqno_gap_step_code, int_base);
primitive_luatex("synctex", assign_int_cmd, int_base + synctex_code,
int_base);
diff --git a/Build/source/texk/web2c/luatexdir/tex/dumpdata.w b/Build/source/texk/web2c/luatexdir/tex/dumpdata.w
index c3ac9dbf37a..4bf7b9c0941 100644
--- a/Build/source/texk/web2c/luatexdir/tex/dumpdata.w
+++ b/Build/source/texk/web2c/luatexdir/tex/dumpdata.w
@@ -26,8 +26,8 @@
#define prev_depth cur_list.prev_depth_field
/* 907 = sum of the values of the bytes of "don knuth" */
-/* The next FORMAT_ID will be 907+2 */
-#define FORMAT_ID (907+1)
+/* The next FORMAT_ID will be 907+3 */
+#define FORMAT_ID (907+2)
#if ((FORMAT_ID>=0) && (FORMAT_ID<=256))
#error Wrong value for FORMAT_ID.
#endif
diff --git a/Build/source/texk/web2c/luatexdir/tex/equivalents.h b/Build/source/texk/web2c/luatexdir/tex/equivalents.h
index bb0cbad873e..3995f024c0e 100644
--- a/Build/source/texk/web2c/luatexdir/tex/equivalents.h
+++ b/Build/source/texk/web2c/luatexdir/tex/equivalents.h
@@ -326,7 +326,9 @@ here, and the |number_regs| \.{\\dimen} registers.
/*suppress errors for failed \.{\\ifcsname} */
# define suppress_outer_error_code (etex_first_integer_code+12) /*suppress errors for \.{\\outer} */
# define suppress_mathpar_error_code (etex_first_integer_code+13) /*suppress errors for \.{\\par}} in math */
-# define synctex_code (etex_first_integer_code+14) /* is synctex file generation enabled ? */
+# define math_eqno_gap_step_code (etex_first_integer_code+14) /* factor/1000 used for distance between eq and eqno */
+# define synctex_code (etex_first_integer_code+15) /* is synctex file generation enabled ? */
+
# define tex_int_pars (synctex_code+1) /* total number of integer parameters */
# define page_direction_code (tex_int_pars)
diff --git a/Build/source/texk/web2c/luatexdir/tex/filename.w b/Build/source/texk/web2c/luatexdir/tex/filename.w
index db0ea298d30..9e5d9c5cc1c 100644
--- a/Build/source/texk/web2c/luatexdir/tex/filename.w
+++ b/Build/source/texk/web2c/luatexdir/tex/filename.w
@@ -204,6 +204,8 @@ void scan_file_name_toks(void)
cur_name = maketexstring(n);
cur_ext = get_nullstr();
}
+ xfree(s);
+
}
diff --git a/Build/source/texk/web2c/luatexdir/tex/maincontrol.w b/Build/source/texk/web2c/luatexdir/tex/maincontrol.w
index fa74ffb2a01..e9139dbcbf0 100644
--- a/Build/source/texk/web2c/luatexdir/tex/maincontrol.w
+++ b/Build/source/texk/web2c/luatexdir/tex/maincontrol.w
@@ -65,6 +65,9 @@
#define pdf_px_dimen dimen_par(pdf_px_dimen_code)
#define pdf_image_resolution int_par(pdf_image_resolution_code)
+
+#define math_eqno_gap_step int_par(math_eqno_gap_step_code)
+
#define escape_char int_par(escape_char_code)
#define max_dead_cycles int_par(max_dead_cycles_code)
#define tolerance int_par(tolerance_code)
@@ -3610,6 +3613,7 @@ void initialize(void)
pdf_image_apply_gamma = 0;
pdf_px_dimen = one_bp;
pdf_draftmode = 0;
+ math_eqno_gap_step = 1000 ;
cs_text(frozen_protection) = maketexstring("inaccessible");
format_ident = maketexstring(" (INITEX)");
cs_text(end_write) = maketexstring("endwrite");
diff --git a/Build/source/texk/web2c/luatexdir/tex/printing.w b/Build/source/texk/web2c/luatexdir/tex/printing.w
index f824cb66ea1..b2ca7c9a94e 100644
--- a/Build/source/texk/web2c/luatexdir/tex/printing.w
+++ b/Build/source/texk/web2c/luatexdir/tex/printing.w
@@ -427,7 +427,7 @@ void tprint(const char *sss)
buffer[i++] = s+64;
term_offset += 2;
}
- if (term_offset++ == max_print_line) {
+ if (++term_offset == max_print_line) {
buffer[i++] = '\n';
buffer[i++] = '\0';
fputs(buffer, term_out);
diff --git a/Build/source/texk/web2c/luatexdir/tex/texmath.w b/Build/source/texk/web2c/luatexdir/tex/texmath.w
index f7280b72f37..4ee213ec2b0 100644
--- a/Build/source/texk/web2c/luatexdir/tex/texmath.w
+++ b/Build/source/texk/web2c/luatexdir/tex/texmath.w
@@ -19,7 +19,7 @@
@ @c
-
+// define DEBUG
#include "ptexlib.h"
@ @c
@@ -37,7 +37,7 @@
#define var_code 7
-@ TODO: not sure if this is the right order
+@ TODO: not sure if this is the right order
@c
#define back_error(A,B) do { \
OK_to_interrupt=false; \
@@ -61,6 +61,7 @@ pointer fin_mlist(pointer);
#define every_display equiv(every_display_loc)
#define par_shape_ptr equiv(par_shape_loc)
+#define math_eqno_gap_step int_par(math_eqno_gap_step_code)
@ When \TeX\ reads a formula that is enclosed between \.\$'s, it constructs an
{\sl mlist}, which is essentially a tree structure representing that
@@ -101,7 +102,7 @@ Each noad is five or more words long. The first word contains the
|type| and |subtype| and |link| fields that are already so familiar to
us; the second contains the attribute list pointer, and the third,
fourth an fifth words are called the noad's |nucleus|, |subscr|, and
-|supscr| fields. (This use of a combined attribute list is temporary.
+|supscr| fields. (This use of a combined attribute list is temporary.
Eventually, each of fields need their own list)
Consider, for example, the simple formula `\.{\$x\^2\$}', which would be
@@ -112,7 +113,7 @@ empty, and the |supscr| is a representation of `\.2'.
The |nucleus|, |subscr|, and |supscr| fields are further broken into
subfields. If |p| points to a noad, and if |q| is one of its principal
fields (e.g., |q=subscr(p)|), |q=null| indicates a field with no value (the
-corresponding attribute of noad |p| is not present). Otherwise, there are
+corresponding attribute of noad |p| is not present). Otherwise, there are
several possibilities for the subfields, depending on the |type| of |q|.
\yskip\hang|type(q)=math_char_node| means that |math_fam(q)| refers to one of
@@ -230,7 +231,7 @@ static void unsave_math_fam_data(int gl)
-@ and parameters
+@ and parameters
@c
#define MATHPARAMSTACK 8
@@ -295,7 +296,7 @@ static void unsave_math_param_data(int gl)
}
-@ saving and unsaving of both
+@ saving and unsaving of both
@c
void unsave_math_data(int gl)
@@ -366,10 +367,10 @@ represent variable-size delimiters by giving the ``small'' and ``large''
starting characters, as explained in Chapter~17 of {\sl The \TeX book}.
@:TeXbook}{\sl The \TeX book@>
-A |fraction_noad| is actually quite different from all other noads.
-It has |thickness|, |denominator|, and |numerator| fields instead of
-|nucleus|, |subscr|, and |supscr|. The |thickness| is a scaled value
-that tells how thick to make a fraction rule; however, the special
+A |fraction_noad| is actually quite different from all other noads.
+It has |thickness|, |denominator|, and |numerator| fields instead of
+|nucleus|, |subscr|, and |supscr|. The |thickness| is a scaled value
+that tells how thick to make a fraction rule; however, the special
value |default_code| is used to stand for the
|default_rule_thickness| of the current size. The |numerator| and
|denominator| point to mlists that define a fraction; we always have
@@ -382,7 +383,7 @@ be placed at the left and right of the fraction. In this way, a
-@ The |new_noad| function creates an |ord_noad| that is completely null
+@ The |new_noad| function creates an |ord_noad| that is completely null
@c
pointer new_noad(void)
@@ -417,8 +418,8 @@ And finally, we have the |fence_noad| type, to implement
The |nucleus| of such noads is
replaced by a |delimiter| field; thus, for example, `\.{\\left(}' produces
a |fence_noad| such that |delimiter(p)| holds the family and character
-codes for all left parentheses. A |fence_noad| of subtype |left_noad_side|
-never appears in an mlist except as the first element, and a |fence_noad|
+codes for all left parentheses. A |fence_noad| of subtype |left_noad_side|
+never appears in an mlist except as the first element, and a |fence_noad|
with subtype |right_noad_side| never appears in an mlist
except as the last element; furthermore, we either have both a |left_noad_side|
and a |right_noad_side|, or neither one is present.
@@ -566,7 +567,7 @@ void show_math_node(pointer p)
}
-@ Here are some simple routines used in the display of noads.
+@ Here are some simple routines used in the display of noads.
@c
static void print_fam_and_char(pointer p)
@@ -601,7 +602,7 @@ static void print_delimiter(pointer p)
@ The next subroutine will descend to another level of recursion when a
subsidiary mlist needs to be displayed. The parameter |c| indicates what
character is to become part of the recursion history. An empty mlist is
-distinguished from a missing field, because these are not equivalent
+distinguished from a missing field, because these are not equivalent
(as explained above).
@^recursion@>
@@ -927,11 +928,11 @@ void math_left_brace(void)
opposite, then this function will return true. Discovering that fact
is somewhat odd because it needs traversal of the |save_stack|.
The occurance of displayed equations is weird enough that this is
-probably still better than having yet another field in the |input_stack|
+probably still better than having yet another field in the |input_stack|
structures.
-None of this makes much sense if the inline direction of either one of
-\.{\\pardir} or \.{\\mathdir} is vertical, but in that case the current
+None of this makes much sense if the inline direction of either one of
+\.{\\pardir} or \.{\\mathdir} is vertical, but in that case the current
math machinery is ill suited anyway so I do not bother to test that.
@c
@@ -973,7 +974,7 @@ void enter_display_math(void)
type(tail) == whatsit_node &&
subtype(tail) == local_par_node && vlink(tail) == null)) {
if (vlink(head) == tail) {
- /* bug \#270: |resume_after_display| inserts a |local_par_node|, but if
+ /* bug \#270: |resume_after_display| inserts a |local_par_node|, but if
there is another display immediately following, we have to get rid
of that node */
flush_node(tail);
@@ -1077,7 +1078,7 @@ static delcodeval do_scan_extdef_del_code(int extcode, boolean doclass)
mlchr = 0;
} else if (extcode == xetexnum_mathcode) { /* \.{\\Udelcodenum} */
/* "FF<21bits> */
- /* the largest numeric value is $2^29-1$, but
+ /* the largest numeric value is $2^29-1$, but
the top of bit 21 can't be used as it contains invalid USV's
*/
if (doclass) { /* such a primitive doesn't exist */
@@ -1161,7 +1162,7 @@ mathcodeval scan_mathchar(int extcode)
}
} else if (extcode == xetexnum_mathcode) {
/* "FFT<21bits> */
- /* the largest numeric value is $2^32-1$, but
+ /* the largest numeric value is $2^32-1$, but
the top of bit 21 can't be used as it contains invalid USV's
*/
/* Note: |scan_int| won't accept families 128-255 because these use bit 32 */
@@ -1201,7 +1202,7 @@ void scan_extdef_math_code(int level, int extcode)
}
-@ this reads in a delcode when actually a mathcode is needed
+@ this reads in a delcode when actually a mathcode is needed
@c
mathcodeval scan_delimiter_as_mathchar(int extcode)
{
@@ -1216,8 +1217,8 @@ mathcodeval scan_delimiter_as_mathchar(int extcode)
}
@ this has to match the inverse routine in the pascal code
- where the \.{\\Umathchardef} is executed
-
+ where the \.{\\Umathchardef} is executed
+
@c
mathcodeval mathchar_from_integer(int value, int extcode)
{
@@ -1515,7 +1516,7 @@ void math_radical(void)
else
confusion("math_radical");
if (chr_code == 2) {
- /* the trick with the |vlink(q)| is used by |scan_math|
+ /* the trick with the |vlink(q)| is used by |scan_math|
to decide whether it needs to go on */
q = new_node(math_char_node, 0);
vlink(q) = tail;
@@ -1655,7 +1656,7 @@ void build_choices(void)
@ Subscripts and superscripts are attached to the previous nucleus by the
-action procedure called |sub_sup|.
+action procedure called |sub_sup|.
@c
void sub_sup(void)
@@ -1702,7 +1703,7 @@ that contains the mlist-so-far as its numerator, while the denominator
is yet to come. Finally when the mlist is finished, the denominator will
go into the incompleat fraction noad, and that noad will become the
whole formula, unless it is surrounded by `\.{\\left}' and `\.{\\right}'
-delimiters.
+delimiters.
@c
void math_fraction(void)
@@ -1923,7 +1924,7 @@ void math_left_right(void)
}
-@ \TeX\ gets to the following part of the program when
+@ \TeX\ gets to the following part of the program when
the first `\.\$' ending a display has been scanned.
@c
@@ -1972,7 +1973,7 @@ static void resume_after_display(void)
push_nest();
mode = hmode;
space_factor = 1000;
- tail_append(make_local_par_node()); /* this needs to be intercepted in
+ tail_append(make_local_par_node()); /* this needs to be intercepted in
the display math start ! */
get_x_token();
if (cur_cmd != spacer_cmd)
@@ -1984,11 +1985,11 @@ static void resume_after_display(void)
}
-@ The fussiest part of math mode processing occurs when a displayed formula is
+@ The fussiest part of math mode processing occurs when a displayed formula is
being centered and placed with an optional equation number.
-At this time we are in vertical mode (or internal vertical mode).
+At this time we are in vertical mode (or internal vertical mode).
|p| points to the mlist for the formula.
|a| is either |null| or it points to a box containing the equation number.
@@ -2010,10 +2011,10 @@ static void finish_displayed_math(boolean l, pointer eqno_box, pointer p)
pointer t; /* tail of adjustment list */
pointer pre_t; /* tail of pre-adjustment list */
boolean swap_dir; /* true if the math and surrounding text dirs are opposed */
+ scaled eqno_width;
swap_dir = (int_par(pre_display_direction_code) < 0 ? true : false );
- if (eqno_box != null && swap_dir)
+ if (eqno_box != null && swap_dir)
l = !l;
-
adjust_tail = adjust_head;
pre_adjust_tail = pre_adjust_head;
eq_box = hpack(p, 0, additional, -1);
@@ -2027,10 +2028,12 @@ static void finish_displayed_math(boolean l, pointer eqno_box, pointer p)
line_s = display_indent;
if (eqno_box == null) {
eqno_w = 0;
+ eqno_width = 0;
eqno_w2 = 0;
} else {
eqno_w = width(eqno_box);
- eqno_w2 = eqno_w + get_math_quad(text_size);
+ eqno_width = eqno_w;
+ eqno_w2 = eqno_w + round_xn_over_d(math_eqno_gap_step, get_math_quad(text_size), 1000);
}
if (eq_w + eqno_w2 > line_w) {
/* The user can force the equation number to go on a separate line
@@ -2085,74 +2088,95 @@ static void finish_displayed_math(boolean l, pointer eqno_box, pointer p)
displacement for all three potential lines of the display, even though
`\.{\\parshape}' may specify them differently.
*/
- if (eqno_box && l && (eqno_w == 0)) { /* \.{\\leqno} on a forced single line due to |width=0| */
- /* it follows that |type(a)=hlist_node| */
- shift_amount(eqno_box) = line_s;
- append_to_vlist(eqno_box);
- tail_append(new_penalty(inf_penalty));
- } else {
+ /* \.{\\leqno} on a forced single line due to |width=0| */
+ /* it follows that |type(a)=hlist_node| */
+
+ if (eqno_box && l && (eqno_w == 0)) {
+/* if (math_direction==dir_TLT) { */
+ shift_amount(eqno_box) = 0;
+/* } else { */
+/* } */
+ append_to_vlist(eqno_box);
+ tail_append(new_penalty(inf_penalty));
+ } else {
+
tail_append(new_param_glue(g1));
- }
+
+ }
if (eqno_w != 0) {
r = new_kern(line_w - eq_w - eqno_w - d);
- s = new_kern(width(r) + eqno_w);
if (l) {
if (swap_dir) {
if (math_direction==dir_TLT) {
/* TRT + TLT + \eqno, (swap_dir=true, math_direction=TLT, l=true) */
- vlink(eqno_box) = r;
- vlink(r) = eq_box;
- vlink(eq_box) = s;
- eq_box = eqno_box;
+#ifdef DEBUG
+ fprintf(stderr, "\nDEBUG: CASE 1\n");
+#endif
+ s = new_kern(width(r) + eqno_w);
+ try_couple_nodes(eqno_box,r);
+ try_couple_nodes(r,eq_box);
+ try_couple_nodes(eq_box,s);
} else {
/* TLT + TRT + \eqno, (swap_dir=true, math_direction=TRT, l=true) */
- vlink(eqno_box) = r;
- vlink(r) = eq_box;
- vlink(eq_box) = s;
- eq_box = eqno_box;
+#ifdef DEBUG
+ fprintf(stderr, "\nDEBUG: CASE 2\n");
+#endif
+ try_couple_nodes(eqno_box,r);
+ try_couple_nodes(r,eq_box);
}
} else {
if (math_direction==dir_TLT) {
/* TLT + TLT + \leqno, (swap_dir=false, math_direction=TLT, l=true) */ /* OK */
- vlink(eqno_box) = r;
- vlink(r) = eq_box;
- vlink(eq_box) = s;
- eq_box = eqno_box;
+#ifdef DEBUG
+ fprintf(stderr, "\nDEBUG: CASE 3\n");
+#endif
+ s = new_kern(width(r) + eqno_w);
} else {
/* TRT + TRT + \leqno, (swap_dir=false, math_direction=TRT, l=true) */
- vlink(eqno_box) = r;
- vlink(r) = eq_box;
- vlink(eq_box) = s;
- eq_box = eqno_box;
+#ifdef DEBUG
+ fprintf(stderr, "\nDEBUG: CASE 4\n");
+#endif
+ s = new_kern(width(r));
}
+ try_couple_nodes(eqno_box,r);
+ try_couple_nodes(r,eq_box);
+ try_couple_nodes(eq_box,s);
}
+ eq_box = eqno_box;
} else {
if (swap_dir) {
if (math_direction==dir_TLT) {
/* TRT + TLT + \leqno, (swap_dir=true, math_direction=TLT, l=false) */
- vlink(eq_box) = r;
- vlink(r) = eqno_box;
+#ifdef DEBUG
+ fprintf(stderr, "\nDEBUG: CASE 5\n");
+#endif
} else {
/* TLT + TRT + \leqno, (swap_dir=true, math_direction=TRT, l=false) */
- vlink(eq_box) = r;
- vlink(r) = eqno_box;
+#ifdef DEBUG
+ fprintf(stderr, "\nDEBUG: CASE 6\n");
+#endif
}
+ try_couple_nodes(eq_box,r);
+ try_couple_nodes(r,eqno_box);
} else {
if (math_direction==dir_TLT) {
/* TLT + TLT + \eqno, (swap_dir=false, math_direction=TLT, l=false) */ /* OK */
+#ifdef DEBUG
+ fprintf(stderr, "\nDEBUG: CASE 7\n");
+#endif
s = new_kern(d);
- vlink(s) = eq_box;
- vlink(eq_box) = r;
- vlink(r) = eqno_box;
- eq_box = s;
} else {
/* TRT + TRT + \eqno, (swap_dir=false, math_direction=TRT, l=false) */
- vlink(s) = eq_box;
- vlink(eq_box) = r;
- vlink(r) = eqno_box;
- eq_box = s;
+#ifdef DEBUG
+ fprintf(stderr, "\nDEBUG: CASE 8\n");
+#endif
+ s = new_kern(width(r) + eqno_w);
}
+ try_couple_nodes(s,eq_box);
+ try_couple_nodes(eq_box,r);
+ try_couple_nodes(r,eqno_box);
+ eq_box = s;
}
}
eq_box = hpack(eq_box, 0, additional, -1);
@@ -2160,20 +2184,29 @@ static void finish_displayed_math(boolean l, pointer eqno_box, pointer p)
} else {
shift_amount(eq_box) = line_s + d;
}
+/* check for prev: */
append_to_vlist(eq_box);
if ((eqno_box != null) && (eqno_w == 0) && !l) {
tail_append(new_penalty(inf_penalty));
- shift_amount(eqno_box) = line_s;
+/* if (math_direction==dir_TLT) { */
+ shift_amount(eqno_box) = line_s + line_w - eqno_width ;
+/* } else { */
+/* } */
+/* check for prev: */
append_to_vlist(eqno_box);
g2 = 0;
}
if (t != adjust_head) { /* migrating material comes after equation number */
vlink(tail) = vlink(adjust_head);
+/* needs testing */
+alink(adjust_tail) = alink(tail);
tail = t;
}
if (pre_t != pre_adjust_head) {
vlink(tail) = vlink(pre_adjust_head);
+/* needs testing */
+alink(pre_adjust_tail) = alink(tail);
tail = pre_t;
}
tail_append(new_penalty(int_par(post_display_penalty_code)));
@@ -2277,7 +2310,7 @@ void finish_display_alignment(pointer p, pointer q, halfword saved_prevdepth)
resume_after_display();
}
-@ Interface to \.{\\Umath} and \.{\\mathstyle}
+@ Interface to \.{\\Umath} and \.{\\mathstyle}
@c
void setup_math_style(void)