From dc7195d9c40c947f61bd001635de6e8b2cb99167 Mon Sep 17 00:00:00 2001 From: Context Git Mirror Bot Date: Tue, 7 Jul 2015 22:15:04 +0200 Subject: 2015-07-07 21:45:00 --- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4202 -> 4202 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/font-cff.lua | 6 +- tex/context/base/font-inj.lua | 3 +- tex/context/base/font-otc.lua | 17 ++- tex/context/base/font-otf.lua | 9 +- tex/context/base/font-otr.lua | 160 +++++++++++---------- tex/context/base/lang-hyp.mkiv | 5 + tex/context/base/lxml-ini.mkiv | 5 + tex/context/base/lxml-tex.lua | 8 +- tex/context/base/math-fbk.lua | 2 +- tex/context/base/math-frc.mkiv | 11 +- tex/context/base/meta-imp-outlines.mkiv | 7 +- tex/context/base/mtx-context-listing.tex | 9 +- tex/context/base/node-nut.lua | 21 ++- tex/context/base/page-mix.lua | 29 +++- tex/context/base/spac-ver.lua | 49 +++++-- tex/context/base/status-files.pdf | Bin 24438 -> 24416 bytes tex/context/base/status-lua.pdf | Bin 253676 -> 254210 bytes tex/context/base/strc-doc.lua | 4 + tex/context/base/trac-deb.lua | 16 +-- tex/context/base/trac-log.lua | 4 +- tex/generic/context/luatex/luatex-fonts-merged.lua | 11 +- 24 files changed, 243 insertions(+), 137 deletions(-) (limited to 'tex') diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 8cd739503..910276a43 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2015.07.01 21:40} +\newcontextversion{2015.07.07 21:43} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf index 9a613cc88..a1918c9bd 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 2c3cc0eb0..6b47c4a98 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -39,7 +39,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2015.07.01 21:40} +\edef\contextversion{2015.07.07 21:43} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/font-cff.lua b/tex/context/base/font-cff.lua index c6707ff35..2f0198ece 100644 --- a/tex/context/base/font-cff.lua +++ b/tex/context/base/font-cff.lua @@ -50,7 +50,7 @@ local parsecharstrings local resetcharstrings local parseprivates -local defaultstrings = { [0] = -- hijacked from ff +local defaultstrings = { [0] = -- taken from ff ".notdef", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", @@ -1449,8 +1449,8 @@ local function readcharsets(f,data,dictionary) end elseif format == 1 or format == 2 then local readcount = format == 1 and readbyte or readushort - local i = 0 - while i<= nofglyphs do + local i = 1 + while i <= nofglyphs do local sid = readushort(f) local n = readcount(f) for s=sid,sid+n do diff --git a/tex/context/base/font-inj.lua b/tex/context/base/font-inj.lua index 783d67425..62e806f8b 100644 --- a/tex/context/base/font-inj.lua +++ b/tex/context/base/font-inj.lua @@ -146,7 +146,8 @@ end function injections.setcursive(start,nxt,factor,rlmode,exit,entry,tfmstart,tfmnext) -- hm: nuts or nodes local dx = factor*(exit[1]-entry[1]) local dy = -factor*(exit[2]-entry[2]) - local ws, wn = tfmstart.width, tfmnext.width + local ws = tfmstart.width + local wn = tfmnext.width nofregisteredcursives = nofregisteredcursives + 1 if rlmode < 0 then dx = -(dx + wn) diff --git a/tex/context/base/font-otc.lua b/tex/context/base/font-otc.lua index a3afcd9e1..db8587741 100644 --- a/tex/context/base/font-otc.lua +++ b/tex/context/base/font-otc.lua @@ -6,9 +6,10 @@ if not modules then modules = { } end modules ['font-otc'] = { license = "see context related readme files" } -local format, insert = string.format, table.insert +local format, insert, sortedkeys = string.format, table.insert, table.sortedkeys local type, next = type, next local lpegmatch = lpeg.match +local utfbyte = utf.byte -- we assume that the other otf stuff is loaded already @@ -28,8 +29,10 @@ local setmetatableindex = table.setmetatableindex local types = { substitution = "gsub_single", + single = "gsub_single", ligature = "gsub_ligature", alternate = "gsub_alternate", + multiple = "gsub_multiple", } setmetatableindex(types, function(t,k) t[k] = k return k end) -- "key" @@ -46,7 +49,7 @@ local function addfeature(data,feature,specifications) -- already present else local sequences = resources.sequences - local fontfeatures = resources.features + local fontfeatures = resources.features or everywhere local unicodes = resources.unicodes local lookuptypes = resources.lookuptypes local splitter = lpeg.splitter(" ",unicodes) @@ -182,7 +185,13 @@ otf.enhancers.addfeature = addfeature local extrafeatures = { } function otf.addfeature(name,specification) - extrafeatures[name] = specification + if type(name) == "table" then + specification = name + name = specification.name + end + if type(name) == "string" then + extrafeatures[name] = specification + end end local function enhance(data,filename,raw) @@ -211,6 +220,7 @@ local tlig_specification = { type = "ligature", features = everywhere, data = tlig, + name = "ctx_tlig", order = { "tlig" }, flags = noflags, prepend = true, @@ -235,6 +245,7 @@ local trep_specification = { type = "substitution", features = everywhere, data = trep, + name = "ctx_trep", order = { "trep" }, flags = noflags, prepend = true, diff --git a/tex/context/base/font-otf.lua b/tex/context/base/font-otf.lua index 28a129cc1..edd9ed2de 100644 --- a/tex/context/base/font-otf.lua +++ b/tex/context/base/font-otf.lua @@ -451,6 +451,7 @@ function otf.load(filename,sub,featurefile) -- second argument (format) is gone end end if reload then + starttiming("fontloader") report_otf("loading %a, hash %a",filename,hash) local fontdata, messages if sub then @@ -522,7 +523,6 @@ function otf.load(filename,sub,featurefile) -- second argument (format) is gone tounicodetable = Ct(splitter), }, } - starttiming(data) report_otf("file size: %s", size) enhancers.apply(data,filename,fontdata) local packtime = { } @@ -539,10 +539,10 @@ function otf.load(filename,sub,featurefile) -- second argument (format) is gone if cleanup > 1 then collectgarbage("collect") end - stoptiming(data) + stoptiming("fontloader") if elapsedtime then -- not in generic - report_otf("preprocessing and caching time %s, packtime %s", - elapsedtime(data),packdata and elapsedtime(packtime) or 0) + report_otf("loading, optimizing, packing and caching time %s, pack time %s", + elapsedtime("fontloader"),packdata and elapsedtime(packtime) or 0) end close_font(fontdata) -- free memory if cleanup > 3 then @@ -553,6 +553,7 @@ function otf.load(filename,sub,featurefile) -- second argument (format) is gone collectgarbage("collect") end else + stoptiming("fontloader") data = nil report_otf("loading failed due to read error") end diff --git a/tex/context/base/font-otr.lua b/tex/context/base/font-otr.lua index 1b53601a9..ddbe6d271 100644 --- a/tex/context/base/font-otr.lua +++ b/tex/context/base/font-otr.lua @@ -32,10 +32,6 @@ if not modules then modules = { } end modules ['font-otr'] = { -- Optimizing the widths wil be done anyway as it save quite some on a cjk font -- and the existing (old) code if okay. --- todo: duplicates --- todo: markclasses : checking needed (see font-otf) --- --- todo: check all unsigned / signed (will be done last) -- todo: more messages (only if really needed) -- -- todo (in old loader and new one) math: @@ -47,19 +43,36 @@ if not modules then modules = { } end modules ['font-otr'] = { -- vert_variants -> vvariants -> next in tex, so better 'sizes' -- horiz_variants -> hvariants -> next in tex, so better 'sizes' -- +-- considered, in math: +-- -- start -> first (so we can skip the first same-size one) -- end -> last -- --- We can optimize kern pairs (i.e. simple h only positioning) later if we want --- which is easier as then we know if we have clashes between features. We can have --- kerns as well as moves (smaller files) --- -- Widths and weights are kind of messy: for instance lmmonolt has a pfmweight of -- 400 while it should be 300. So, for now we mostly stick to the old compromis. -- We don't really need all those language tables so they might be dropped some -- day. +-- The new reader is faster on some aspects and slower on other. The memory footprint +-- is lower. The string reader is a bit faster than the file reader. The new reader +-- gives more efficient tables and has bit more analysis. In practice these times are +-- not that relevant because we cache. The otf files take a it more time because we +-- need to calculate the boundingboxes. In theory the processing of text should be +-- somewhat faster especially for complex fonts with many lookups. +-- +-- old new str reader +-- lmroman12-regular.otf 0.103 0.203 0.195 +-- latinmodern-math.otf 0.454 0.768 0.712 +-- husayni.ttf 1.142 1.526 1.259 +-- +-- If there is demand I will consider making a ff compatible table dumper but it's +-- probably more fun to provide a way to show features applied. + +-- I experimented a bit with f:readbyte(n) and f:readshort() and so and it is indeed +-- faster but it might not be the real bottleneck as we still need to juggle data. It +-- is probably more memory efficient as no intermediate strings are involved. + if not characters then require("char-def") require("char-ini") @@ -90,7 +103,7 @@ handlers.otf = otf local readers = otf.readers or { } otf.readers = readers --- local streamreader = utilities.streams -- faster on big files +----- streamreader = utilities.streams -- faster on big files local streamreader = utilities.files -- faster on identify readers.streamreader = streamreader @@ -130,6 +143,8 @@ end local tableversion = 0.001 local privateoffset = fonts.constructors and fonts.constructors.privateoffset or 0xF0000 -- 0x10FFFF +readers.tableversion = tableversion + local reportedskipped = { } local function reportskippedtable(tag) @@ -585,7 +600,7 @@ local languages = { }, } -local standardromanencoding = { [0] = -- hijacked from wikipedia +local standardromanencoding = { [0] = -- taken from wikipedia "notdef", ".null", "nonmarkingreturn", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", @@ -898,11 +913,10 @@ readers.head = function(f,fontdata) glyphformat = readshort(f), } fontdata.fontheader = fontheader - fontdata.nofglyphs = 0 else fontdata.fontheader = { } - fontdata.nofglyphs = 0 end + fontdata.nofglyphs = 0 end -- This table is a rather simple one. No treatment of values is needed here. Most @@ -940,9 +954,8 @@ readers.hhea = function(f,fontdata,specification) end end --- We probably never need all these variables, but we do need the nofglyphs --- when loading other tables. Again we use the microsoft names but see no reason --- to have "max" in each name. +-- We probably never need all these variables, but we do need the nofglyphs when loading other +-- tables. Again we use the microsoft names but see no reason to have "max" in each name. -- fontdata.maximumprofile can be bad @@ -988,8 +1001,8 @@ readers.maxp = function(f,fontdata,specification) end end --- Here we filter the (advance) widths (that can be different from the boundingbox --- width of course). +-- Here we filter the (advance) widths (that can be different from the boundingbox width of +-- course). readers.hmtx = function(f,fontdata,specification) if specification.glyphs then @@ -1028,10 +1041,9 @@ readers.hmtx = function(f,fontdata,specification) end end --- The post table relates to postscript (printing) but has some relevant --- properties for other usage as well. We just use the names from the microsoft --- specification. The version 2.0 description is somewhat fuzzy but it is a --- hybrid with overloads. +-- The post table relates to postscript (printing) but has some relevant properties for other +-- usage as well. We just use the names from the microsoft specification. The version 2.0 +-- description is somewhat fuzzy but it is a hybrid with overloads. readers.post = function(f,fontdata,specification) local datatable = fontdata.tables.post @@ -1103,9 +1115,10 @@ readers.cff = function(f,fontdata,specification) end end --- Not all cmaps make sense .. e.g. dfont is obsolete and probably more are not --- relevant. Let's see what we run into. There is some weird calculation going --- on here because we offset in a table being a blob of memory or file. +-- Not all cmaps make sense .. e.g. dfont is obsolete and probably more are not relevant. Let's see +-- what we run into. There is some weird calculation going on here because we offset in a table +-- being a blob of memory or file. Anyway, I can't stand lunatic formats like this esp when there +-- is no real gain. local formatreaders = { } @@ -1129,7 +1142,7 @@ formatreaders[4] = function(f,fontdata,offset) for i=1,nofsegments do endchars[i] = readushort(f) end - local reserved = readushort(f) + local reserved = readushort(f) -- 0 for i=1,nofsegments do startchars[i] = readushort(f) end @@ -1153,31 +1166,34 @@ formatreaders[4] = function(f,fontdata,offset) if startchar == 0xFFFF and endchar == 0xFFFF then break elseif offset == 0 then - for char=startchar,endchar do - local unicode = char - local index = mod(char + delta,65536) + for unicode=startchar,endchar do + index = mod(unicode + delta,65536) if index and index > 0 then local glyph = glyphs[index] - if not glyph.unicode then - glyph.unicode = unicode + if glyph then + if not glyph.unicode then + glyph.unicode = unicode + end + mapping[index] = unicode + -- report("case 1: %C %04i %s",unicode,index,glyphs[index].name) end - mapping[index] = unicode - -- report("%C %04i %05i %s",unicode,index,glyphs[index].name) end end else local shift = (segment-nofsegments+offset/2) - startchar - for char=startchar,endchar do - local unicode = mod(char + delta,65536) - local slot = shift + char - local index = indices[slot] + for unicode=startchar,endchar do + local slot = shift + unicode + local index = indices[slot] if index and index > 0 then + index = mod(index + delta,65536) local glyph = glyphs[index] - if not glyph.unicode then - glyph.unicode = unicode + if glyph then + if not glyph.unicode then + glyph.unicode = unicode + end + mapping[index] = unicode + -- report("case 2: %C %04i %s",unicode,index,glyphs[index].name) end - mapping[index] = unicode - -- report("%C %04i %05i %s",unicode,index,glyphs[index].name) end end end @@ -1349,10 +1365,10 @@ function readers.cmap(f,fontdata,specification) -- checkcmap(f,fontdata,records,0, 3, 4) -- checkcmap(f,fontdata,records,1, 0, 6) checkcmap(f,fontdata,records,0, 5,14) --- variantcid = records[0] and records[0][5] --- if variantcid then --- formatreaders[14](f,fontdata,offset,variantcid[14]) --- end + -- variantcid = records[0] and records[0][5] + -- if variantcid then + -- formatreaders[14](f,fontdata,offset,variantcid[14]) + -- end -- fontdata.cidmaps = { version = version, @@ -1365,11 +1381,9 @@ function readers.cmap(f,fontdata,specification) end end --- The glyf table depends on the loca table. We have one entry to much --- in the locations table (the last one is a dummy) because we need to --- calculate the size of a glyph blob from the delta, although we not --- need it in our usage (yet). We can remove the locations table when --- we're done (todo: cleanup finalizer). +-- The glyf table depends on the loca table. We have one entry to much in the locations table (the +-- last one is a dummy) because we need to calculate the size of a glyph blob from the delta, +-- although we not need it in our usage (yet). We can remove the locations table when we're done. function readers.loca(f,fontdata,specification) if specification.glyphs then @@ -1383,9 +1397,8 @@ function readers.glyf(f,fontdata,specification) -- part goes to cff module end end --- Here we have a table that we really need for later processing although a more --- advanced gpos table can also be available. Todo: we need a 'fake' lookup for --- this (analogue to ff). +-- Here we have a table that we really need for later processing although a more advanced gpos table +-- can also be available. Todo: we need a 'fake' lookup for this (analogue to ff). function readers.kern(f,fontdata,specification) if specification.kerns then @@ -1514,7 +1527,7 @@ local function packoutlines(data,makesequence) for i=1,#segments do local segment = segments[i] local h = concat(segment," ") - if hash[h] > 1 then + if hash[h] > 1 then -- minimal one shared in order to hash local idx = reverse[h] if not idx then last = last + 1 @@ -1866,39 +1879,32 @@ function readers.loadfont(filename,n) -- return { tableversion = tableversion, - -- cache_uuid = false, -- only when cached - -- cache_version = false, -- only when cached + creator = "context mkiv", size = fontdata.filesize, time = fontdata.filetime, - -- warnings = { }, glyphs = fontdata.glyphs, descriptions = fontdata.descriptions, format = fontdata.format, goodies = { }, - -- lookups = { }, metadata = getinfo(fontdata,n), properties = { hasitalics = fontdata.hasitalics or false, }, resources = { - -- anchor_to_lookup = fontdata.anchor_to_lookup or { }, - creator = "context mkiv", - duplicates = { }, -- todo - features = fontdata.features, - filename = fontdata.filename, - -- lookup_to_anchor = fontdata.lookup_to_anchor or { }, - sublookups = fontdata.sublookups, - subtables = fontdata.subtables, - -- lookuptags = { }, -- will be metatable using offsets: gsub-1, gpos-1 etc - lookuptypes = fontdata.lookuptypes or { }, - marks = fontdata.marks or { }, - markclasses = fontdata.markclasses or { }, - marksets = fontdata.marksets or { }, - private = privateoffset, - sequences = fontdata.sequences, - variants = fontdata.variants, -- variant -> unicode -> glyph - version = getname(fontdata,"version"), - cidinfo = fontdata.cidinfo, + duplicates = { }, -- todo + features = fontdata.features, + filename = fontdata.filename, + sublookups = fontdata.sublookups, + subtables = fontdata.subtables, + marks = fontdata.marks or { }, + markclasses = fontdata.markclasses or { }, + marksets = fontdata.marksets or { }, + private = privateoffset, + sequences = fontdata.sequences, + variants = fontdata.variants, -- variant -> unicode -> glyph + version = getname(fontdata,"version"), + cidinfo = fontdata.cidinfo, + mathconstants = fontdata.mathconstants, }, } end @@ -1955,6 +1961,10 @@ function readers.expand(fontdata) report("the %a helper is not yet implemented","unpack") end +function readers.compact(fontdata) + report("the %a helper is not yet implemented","compact") +end + -- if fonts.hashes then diff --git a/tex/context/base/lang-hyp.mkiv b/tex/context/base/lang-hyp.mkiv index 927f5a057..329837c76 100644 --- a/tex/context/base/lang-hyp.mkiv +++ b/tex/context/base/lang-hyp.mkiv @@ -129,6 +129,11 @@ \unexpanded\def\sethyphenationfeatures[#1]% {\clf_sethyphenationfeatures{#1}} +\unexpanded\def\resethyphenationfeatures + {\hyphenationattribute\attributeunsetvalue} + +\resethyphenationfeatures + % todo: \start ... \stop too \unexpanded\def\registerhyphenationpattern diff --git a/tex/context/base/lxml-ini.mkiv b/tex/context/base/lxml-ini.mkiv index 4a6d530db..fc8a4fdbd 100644 --- a/tex/context/base/lxml-ini.mkiv +++ b/tex/context/base/lxml-ini.mkiv @@ -177,6 +177,11 @@ \def\xmlinfo #1{\hbox{\ttxx[\clf_xmlinfo{#1}]}} \def\xmlshow #1{\startpacked\ttx\xmlverbatim{#1}\stoppacked} +% the next one is handy for mode runs because it enforces a consistent +% #1 indexing (needed when using \xmltext{main:123}{...} like calls + +\let\xmladdindex \clf_xmladdindex + % we need to pass the last argument as function, so \def\xmlsetfunction#1#2#3{\ctxcommand{xmlsetfunction("#1",\!!bs#2\!!es,#3)}} diff --git a/tex/context/base/lxml-tex.lua b/tex/context/base/lxml-tex.lua index 5b4b16184..48e75e9c1 100644 --- a/tex/context/base/lxml-tex.lua +++ b/tex/context/base/lxml-tex.lua @@ -354,6 +354,12 @@ end lxml.addindex = addindex +implement { + name = "xmladdindex", + arguments = { "string" }, + actions = addindex, +} + -- another cache local function lxmlapplylpath(id,pattern) -- better inline, saves call @@ -1214,7 +1220,7 @@ local function command(collected,cmd,otherwise) local ix = e.ix local name = e.name if name and not ix then - lxml.addindex(name,false,true) + addindex(name,false,true) ix = e.ix end if not ix or not name then diff --git a/tex/context/base/math-fbk.lua b/tex/context/base/math-fbk.lua index ab3a726d1..564ece8d7 100644 --- a/tex/context/base/math-fbk.lua +++ b/tex/context/base/math-fbk.lua @@ -338,7 +338,7 @@ local function accent_to_extensible(target,newchr,original,oldchr,height,depth,s local addprivate = fonts.helpers.addprivate if swap then swap = characters[swap] - height = swap.depth + height = swap.depth or 0 depth = 0 else height = height or 0 diff --git a/tex/context/base/math-frc.mkiv b/tex/context/base/math-frc.mkiv index cbe342b66..bbee610eb 100644 --- a/tex/context/base/math-frc.mkiv +++ b/tex/context/base/math-frc.mkiv @@ -326,14 +326,13 @@ }% }\endgroup} -\unexpanded\def\xfrac {\begingroup\let\xfrac\xxfrac\math_frac_alternative\scriptstyle} -\unexpanded\def\xxfrac{\begingroup \math_frac_alternative\scriptscriptstyle} -%D The \type {xx} variant looks still ugly, so maybe it's best to say: +\definemathfraction[xfrac] [\c!alternative=\v!inner,\c!mathstyle=\s!script] +\definemathfraction[xxfrac][\c!alternative=\v!inner,\c!mathstyle=\s!scriptscript] -\unexpanded\def\xxfrac#1#2% - {\begingroup - \math_frac_alternative\scriptscriptstyle{#1}{\raise.25\exheight\hbox{$\scriptscriptstyle#2$}}} +\let\normalxfrac\xfrac + +\unexpanded\def\xfrac#1#2{\normalxfrac{\let\xfrac\xxfrac#1}{\let\xfrac\xxfrac#2}} %D Spacing: diff --git a/tex/context/base/meta-imp-outlines.mkiv b/tex/context/base/meta-imp-outlines.mkiv index ceecb9bbe..0f3d1875d 100644 --- a/tex/context/base/meta-imp-outlines.mkiv +++ b/tex/context/base/meta-imp-outlines.mkiv @@ -157,8 +157,11 @@ end \starttext -\setupbodyfont[pagella] -\showshape[character=all,alternative=page] +% \setupbodyfont[pagella] +% \showshape[character=3,alternative=page] + +% \setupbodyfont[pagella] +% \showshape[character=all,alternative=page] % \setupbodyfont[dejavu] % \showshape[character=P,alternative=text] diff --git a/tex/context/base/mtx-context-listing.tex b/tex/context/base/mtx-context-listing.tex index 583aa2b8f..2deffd795 100644 --- a/tex/context/base/mtx-context-listing.tex +++ b/tex/context/base/mtx-context-listing.tex @@ -24,7 +24,8 @@ % --scite : pretty print comform suffix using scite lexer % --bodyfont=list : additional bodyfont settings % --paperformat=spec : paper*print or paperxprint -% --compact : small margins, small font +% --compact : small margins, 8pt font +% --verycompact : small margins, 7pt font % % end help @@ -36,6 +37,12 @@ \setdocumentargument{bodyfont} {8pt} } +\doifdocumentargument {verycompact} { + \setdocumentargument{topspace} {5mm} + \setdocumentargument{backspace}{5mm} + \setdocumentargument{bodyfont} {7pt} +} + \setupbodyfont [dejavu,11pt,tt,\getdocumentargument{bodyfont}] % dejavu is more complete diff --git a/tex/context/base/node-nut.lua b/tex/context/base/node-nut.lua index b133c4e74..fb30ff0dc 100644 --- a/tex/context/base/node-nut.lua +++ b/tex/context/base/node-nut.lua @@ -700,14 +700,21 @@ if propertydata then end nuts.setprop = function(n,k,v) - if v then - local p = propertydata[n] - if p then - p[k] = v - else - propertydata[n] = { [k] = v } - end + local p = propertydata[n] + if p then + p[k] = v + else + propertydata[n] = { [k] = v } + end + end + + nuts.theprop = function(n) + local p = propertydata[n] + if not p then + p = { } + propertydata[n] = p end + return p end nodes.setprop = nodes.setproperty diff --git a/tex/context/base/page-mix.lua b/tex/context/base/page-mix.lua index 61a4f944d..806632881 100644 --- a/tex/context/base/page-mix.lua +++ b/tex/context/base/page-mix.lua @@ -63,6 +63,8 @@ local setbox = nuts.setbox local getskip = nuts.getskip local getattribute = nuts.getattribute +local theprop = nuts.theprop + local nodepool = nuts.pool local new_hlist = nodepool.hlist @@ -272,6 +274,7 @@ local function preparesplit(specification) -- a rather large function if specification.balance ~= v_yes then optimal = maxheight end + local topback = 0 local target = optimal + extra local overflow = target > maxheight - preheight local threshold = specification.threshold or 0 @@ -291,6 +294,7 @@ local function preparesplit(specification) -- a rather large function depth = 0, inserts = { }, delta = 0, + back = 0, } end @@ -611,7 +615,6 @@ end line = line + 1 local inserts, currentskips, nextskips, inserttotal = nil, 0, 0, 0 local advance = getfield(current,"height") --- + getfield(current,"depth") -- when > strutdp if trace_state then report_state("%-7s > column %s, content: %s","line",column,listtoutf(getlist(current),true,true)) end @@ -628,6 +631,23 @@ end if state == "quit" then return true end +-- if state == "next" then -- only when profile +-- local unprofiled = theprop(current).unprofiled +-- if unprofiled then +-- local h = unprofiled.height +-- local s = unprofiled.strutht +-- local t = s/2 +-- print("profiled",h,s) +-- local snapped = theprop(current).snapped +-- if snapped then +-- inspect(snapped) +-- end +-- if h < s + t then +-- result.back = - (h - s) +-- advance = s +-- end +-- end +-- end height = height + depth + skip + advance + inserttotal if state == "next" then height = height + nextskips @@ -742,6 +762,13 @@ local function finalize(result) local h = r.head if h then setfield(h,"prev",nil) +if r.back then + local k = new_glue(r.back) + setfield(h,"prev",k) + setfield(k,"next",h) + h = k + r.head = h +end local t = r.tail if t then setfield(t,"next",nil) diff --git a/tex/context/base/spac-ver.lua b/tex/context/base/spac-ver.lua index c48c79c42..18b04f3fc 100644 --- a/tex/context/base/spac-ver.lua +++ b/tex/context/base/spac-ver.lua @@ -38,20 +38,20 @@ local formatters = string.formatters local P, C, R, S, Cc = lpeg.P, lpeg.C, lpeg.R, lpeg.S, lpeg.Cc -local nodes = nodes -local node = node -local trackers = trackers -local attributes = attributes -local context = context -local tex = tex +local nodes = nodes +local node = node +local trackers = trackers +local attributes = attributes +local context = context +local tex = tex -local texlists = tex.lists -local texgetdimen = tex.getdimen -local texsetdimen = tex.setdimen -local texnest = tex.nest +local texlists = tex.lists +local texgetdimen = tex.getdimen +local texsetdimen = tex.setdimen +local texnest = tex.nest -local variables = interfaces.variables -local implement = interfaces.implement +local variables = interfaces.variables +local implement = interfaces.implement -- vertical space handler @@ -108,6 +108,8 @@ local vpack_node = nuts.vpack local writable_spec = nuts.writable_spec local nodereference = nuts.reference +local theprop = nuts.theprop + local listtoutf = nodes.listtoutf local nodeidstostring = nodes.idstostring @@ -116,7 +118,6 @@ local nodepool = nuts.pool local new_penalty = nodepool.penalty local new_kern = nodepool.kern local new_rule = nodepool.rule -local new_glue = nodepool.glue local new_gluespec = nodepool.gluespec local nodecodes = nodes.nodecodes @@ -308,7 +309,18 @@ end -- check variables.none etc +local function fixedprofile(current) + if builders.profiling then + return builders.profiling.fixedprofile(current) + else + return false + end +end + local function snap_hlist(where,current,method,height,depth) -- method.strut is default + if fixedprofile(current) then + return + end local list = getlist(current) local t = trace_vsnapping and { } if t then @@ -360,6 +372,17 @@ local function snap_hlist(where,current,method,height,depth) -- method.strut is local plusdp = snapdp local snaphtdp = snapht + snapdp +-- local properties = theprop(current) +-- local unsnapped = properties.unsnapped +-- if not unsnapped then -- experiment +-- properties.unsnapped = { +-- height = h, +-- depth = d, +-- snapht = snapht, +-- snapdp = snapdp, +-- } +-- end + if method.box then local br = 1 - br if br < 0 then diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 6c0039c43..2c3b549c4 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index 4aea7255e..0fee76e32 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/context/base/strc-doc.lua b/tex/context/base/strc-doc.lua index 029d68a9d..3019c7a66 100644 --- a/tex/context/base/strc-doc.lua +++ b/tex/context/base/strc-doc.lua @@ -115,6 +115,10 @@ end -- -- -- sections -- -- -- +-- This is just a quick way to have access to prefixes and the numbers (section entry in a ref) +-- is not the list entry. An alternative is to use the list index of the last numbered section. In +-- that case we should check a buse of the current structure. + local collected = allocate() local tobesaved = allocate() diff --git a/tex/context/base/trac-deb.lua b/tex/context/base/trac-deb.lua index d998295c1..224c8de22 100644 --- a/tex/context/base/trac-deb.lua +++ b/tex/context/base/trac-deb.lua @@ -104,13 +104,10 @@ end local savedluaerror = nil local function errorreporter(luaerror) - if luaerror then - logs.enable("lua error") -- - return logs.reporter("lua error") - else - logs.enable("tex error") - return logs.reporter("tex error") - end + local category = luaerror and "lua error" or "tex error" + local report = logs.reporter(category) + logs.enable(category) + return report end function tracers.showlines(filename,linenumber,offset,luaerrorline) @@ -185,7 +182,6 @@ local function processerror(offset) local lasttexerror = status.lasterrorstring or "?" local lastluaerror = status.lastluaerrorstring or lasttexerror local luaerrorline = match(lastluaerror,[[lua%]?:.-(%d+)]]) or (lastluaerror and find(lastluaerror,"?:0:",1,true) and 0) - local report = errorreporter(luaerrorline) tracers.printerror { filename = filename, linenumber = linenumber, @@ -213,10 +209,10 @@ function tracers.printerror(specification) else report_nl() if luaerrorline then - report("error on line %s in file %s:\n\n%s",linenumber,filename,lastluaerror) + report("lua error on line %s in file %s:\n\n%s",linenumber,filename,lastluaerror) -- report("error on line %s in file %s:\n\n%s",linenumber,filename,lasttexerror) else - report("error on line %s in file %s: %s",linenumber,filename,lasttexerror) + report("tex error on line %s in file %s: %s",linenumber,filename,lasttexerror) if tex.show_context then report_nl() tex.show_context() diff --git a/tex/context/base/trac-log.lua b/tex/context/base/trac-log.lua index ce620e6cf..1e91fc404 100644 --- a/tex/context/base/trac-log.lua +++ b/tex/context/base/trac-log.lua @@ -626,7 +626,7 @@ end -- so far -local function setblocked(category,value) +local function setblocked(category,value) -- v.state == value == true : disable if category == true then -- lock all category, value = "*", true @@ -644,7 +644,7 @@ local function setblocked(category,value) end else states = utilities.parsers.settings_to_hash(category,type(states)=="table" and states or nil) - for c, _ in next, states do + for c in next, states do local v = data[c] if v then v.state = value diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 6597ca93c..c0ad6bda9 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 07/01/15 21:40:12 +-- merge date : 07/07/15 21:43:15 do -- begin closure to overcome local limits and interference @@ -7428,6 +7428,7 @@ function otf.load(filename,sub,featurefile) end end if reload then + starttiming("fontloader") report_otf("loading %a, hash %a",filename,hash) local fontdata,messages if sub then @@ -7489,7 +7490,6 @@ function otf.load(filename,sub,featurefile) tounicodetable=Ct(splitter), }, } - starttiming(data) report_otf("file size: %s",size) enhancers.apply(data,filename,fontdata) local packtime={} @@ -7506,10 +7506,10 @@ function otf.load(filename,sub,featurefile) if cleanup>1 then collectgarbage("collect") end - stoptiming(data) + stoptiming("fontloader") if elapsedtime then - report_otf("preprocessing and caching time %s, packtime %s", - elapsedtime(data),packdata and elapsedtime(packtime) or 0) + report_otf("loading, optimizing, packing and caching time %s, pack time %s", + elapsedtime("fontloader"),packdata and elapsedtime(packtime) or 0) end close_font(fontdata) if cleanup>3 then @@ -7520,6 +7520,7 @@ function otf.load(filename,sub,featurefile) collectgarbage("collect") end else + stoptiming("fontloader") data=nil report_otf("loading failed due to read error") end -- cgit v1.2.3