From c9ac836b7b44d49c623ad8052639ca7beeaf1311 Mon Sep 17 00:00:00 2001 From: Context Git Mirror Bot Date: Sun, 13 Sep 2015 17:15:07 +0200 Subject: 2015-09-13 13:33:00 --- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4183 -> 4179 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/font-lib.mkvi | 18 +++++++++--------- tex/context/base/lang-hyp.lua | 9 ++++++++- tex/context/base/lang-ini.mkiv | 1 + tex/context/base/lxml-ini.lua | 2 +- tex/context/base/mult-prm.lua | 2 ++ tex/context/base/node-fnt.lua | 6 +++++- tex/context/base/node-ltp.lua | 17 ++++++++++++++++- tex/context/base/s-fonts-ligatures.mkiv | 2 ++ tex/context/base/spac-prf.lua | 19 +++++-------------- tex/context/base/status-files.pdf | Bin 24494 -> 24475 bytes tex/context/base/status-lua.pdf | Bin 255917 -> 255762 bytes tex/context/base/strc-flt.mkvi | 10 +++++++++- tex/context/base/syst-ini.mkiv | 5 +++++ tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 17 files changed, 66 insertions(+), 31 deletions(-) (limited to 'tex') diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 03b2e6e2c..67fe48da8 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.09.11 11:03} +\newcontextversion{2015.09.13 13:31} %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 7aab26a70..64cefe13c 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 7801adc77..16418ea07 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.09.11 11:03} +\edef\contextversion{2015.09.13 13:31} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/font-lib.mkvi b/tex/context/base/font-lib.mkvi index 4ed14d27f..a40f8905a 100644 --- a/tex/context/base/font-lib.mkvi +++ b/tex/context/base/font-lib.mkvi @@ -47,12 +47,12 @@ \registerctxluafile{font-oti}{1.001} % otf initialization \registerctxluafile{font-ott}{1.001} % otf tables (first) -% \iffalse % new methods -\iftrue % old methods +% \iffalse % use new loader +\iftrue % use old loader \registerctxluafile{font-otf}{1.001} % otf main \registerctxluafile{font-otb}{1.001} % otf main base - \registerctxluafile{font-inj}{1.001} % kern injector + \registerctxluafile{font-inj}{1.001} % otf kern injector \registerctxluafile{font-ota}{1.001} % otf analyzers \registerctxluafile{font-otn}{1.001} % otf main node \registerctxluafile{font-otd}{1.001} % otf dynamics (does an overload) @@ -63,16 +63,16 @@ \else - \registerctxluafile{font-otl}{1.001} % otf - \registerctxluafile{font-oto}{1.001} % otb - \registerctxluafile{font-otj}{1.001} % inj - \registerctxluafile{font-oup}{1.001} % otp + \registerctxluafile{font-otl}{1.001} % otf replacement + \registerctxluafile{font-oto}{1.001} % otb replacement + \registerctxluafile{font-otj}{1.001} % inj replacement + \registerctxluafile{font-oup}{1.001} % otp replacement \registerctxluafile{font-ota}{1.001} - \registerctxluafile{font-ots}{1.001} % otn + \registerctxluafile{font-ots}{1.001} % otn replacement \registerctxluafile{font-otd}{1.001} \registerctxluafile{font-otc}{1.001} \registerctxluafile{font-oth}{1.001} - \registerctxluafile{font-osd}{1.001} % odv + \registerctxluafile{font-osd}{1.001} % odv replacement \fi diff --git a/tex/context/base/lang-hyp.lua b/tex/context/base/lang-hyp.lua index 496cfd19b..8e17721ed 100644 --- a/tex/context/base/lang-hyp.lua +++ b/tex/context/base/lang-hyp.lua @@ -818,7 +818,7 @@ if context then local joinerchars = featureset.joiners local alternative = featureset.alternative local rightwordmin = tonumber(featureset.rightwordmin) - local charmin = tonumber(featureset.charmin) + local charmin = tonumber(featureset.charmin) -- luatex now also has hyphenationmin local leftcharmin = tonumber(featureset.leftcharmin) local rightcharmin = tonumber(featureset.rightcharmin) local rightedge = featureset.rightedge @@ -958,6 +958,7 @@ if context then local characters = nil local unicodes = nil local exhyphenchar = tex.exhyphenchar + -- local discpenalty = tex.discpenalty -- makes no sense globally local extrachars = nil local hyphenchars = nil local language = nil @@ -1180,6 +1181,9 @@ if context then if attributes then setfield(disc,"attr",attributes) end + -- if discpenalty > 0 then + -- setfield(disc,"penalty",discpenalty) + -- end -- could be a replace as well insert_before(first,current,disc) elseif type(r) == "table" then @@ -1201,6 +1205,9 @@ if context then if attributes then setfield(disc,"attr",attributes) end + -- if discpenalty > 0 then + -- setfield(disc,"penalty",discpenalty) + -- end insert_before(first,current,disc) else setfield(current,"char",characters[r]) diff --git a/tex/context/base/lang-ini.mkiv b/tex/context/base/lang-ini.mkiv index fa3de9a9a..492128706 100644 --- a/tex/context/base/lang-ini.mkiv +++ b/tex/context/base/lang-ini.mkiv @@ -485,6 +485,7 @@ {% these values are stored along with glyph nodes \lefthyphenmin \numexpr0\languageparameter\s!lefthyphenmin +\hyphenminoffset\relax \righthyphenmin\numexpr0\languageparameter\s!righthyphenmin+\hyphenminoffset\relax + \hyphenationmin\numexpr0\languageparameter\s!hyphenmin\relax % these values are stored with the language (global!) \prehyphenchar \languageparameter\s!righthyphenchar\relax \posthyphenchar\languageparameter\s!lefthyphenchar \relax} diff --git a/tex/context/base/lxml-ini.lua b/tex/context/base/lxml-ini.lua index 115403395..20c635f11 100644 --- a/tex/context/base/lxml-ini.lua +++ b/tex/context/base/lxml-ini.lua @@ -119,7 +119,7 @@ implement { name = "xmlaftersetup", actions = lxml.installsetup, implement { name = "xmlprependdocumentsetup", actions = lxml.installsetup, arguments = { 1, "string", "string" } } implement { name = "xmlappenddocumentsetup", actions = lxml.installsetup, arguments = { 2, "string", "string" } } implement { name = "xmlbeforedocumentsetup", actions = lxml.installsetup, arguments = { 3, "string", "string", "string" } } -implement { name = "xmlafterdocumentsetup", actions = lxml.installsetup, arguments = { 4, "string", "string" } } +implement { name = "xmlafterdocumentsetup", actions = lxml.installsetup, arguments = { 4, "string", "string", "string" } } implement { name = "xmlremovesetup", actions = lxml.removesetup, arguments = { "string", "string" } } -- 1:* implement { name = "xmlremovedocumentsetup", actions = lxml.removesetup, arguments = { "string", "string" } } implement { name = "xmlflushdocumentsetups", actions = lxml.flushsetups, arguments = { "string", "string", "string" } } -- 2:* diff --git a/tex/context/base/mult-prm.lua b/tex/context/base/mult-prm.lua index 9d6fc7810..29bdc870f 100644 --- a/tex/context/base/mult-prm.lua +++ b/tex/context/base/mult-prm.lua @@ -246,6 +246,8 @@ return { "posthyphenchar", "preexhyphenchar", "prehyphenchar", + "hyphenationmin", + "discpenalty", "primitive", "savecatcodetable", "scantextokens", diff --git a/tex/context/base/node-fnt.lua b/tex/context/base/node-fnt.lua index 4272f304b..ae2f8831c 100644 --- a/tex/context/base/node-fnt.lua +++ b/tex/context/base/node-fnt.lua @@ -138,7 +138,11 @@ function fonts.setdiscexpansion(v) end end -fonts.setdiscexpansion(true) +function fonts.getdiscexpansion() + return expanders and true or false +end + +-- fonts.setdiscexpansion(true) function handlers.characters(head) -- either next or not, but definitely no already processed list diff --git a/tex/context/base/node-ltp.lua b/tex/context/base/node-ltp.lua index e4956f7df..6de0a1547 100644 --- a/tex/context/base/node-ltp.lua +++ b/tex/context/base/node-ltp.lua @@ -21,6 +21,8 @@ if not modules then modules = { } end modules ['node-par'] = { -- todo: check and improve protrusion -- todo: arabic etc (we could use pretty large scales there) .. marks and cursive +-- todo: optimize a bit more (less par.*) + --[[ This code is derived from traditional TeX and has bits of pdfTeX, Aleph (Omega), and of course LuaTeX. So, @@ -2239,6 +2241,19 @@ function constructors.methods.basic(head,d) local line_break_dir = par.line_break_dir if second_pass or subtype <= automatic_disc_code then local actual_pen = subtype == automatic_disc_code and par.ex_hyphen_penalty or par.hyphen_penalty + -- > 0.81 + -- local actual_pen = getfield(current,"penalty") + -- if actual_pen == 0 then + -- -- take that one + -- elseif subtype == automatic_disc_code then + -- actual_pen = par.ex_hyphen_penalty + -- else + -- actual_pen = par.hyphen_penalty + -- end + -- + if discpenalty > 0 then + actual_pen = discpenalty + end local pre = getfield(current,"pre") if not pre then -- trivial pre-break disc_width.size = 0 @@ -2311,7 +2326,7 @@ function constructors.methods.basic(head,d) elseif id == kern_code then if getsubtype(current) == userkern_code then local v = getnext(current) --- if par.auto_breaking and getid(v) == glue_code then + -- if par.auto_breaking and getid(v) == glue_code then if auto_breaking and getid(v) == glue_code then p_active, n_active = try_break(0, unhyphenated_code, par, first_p, current, checked_expansion) end diff --git a/tex/context/base/s-fonts-ligatures.mkiv b/tex/context/base/s-fonts-ligatures.mkiv index 657d6c069..fc49ec5c5 100644 --- a/tex/context/base/s-fonts-ligatures.mkiv +++ b/tex/context/base/s-fonts-ligatures.mkiv @@ -156,10 +156,12 @@ \stoptexdefinition \starttexdefinition showotfligaturesexample #1#2 + \ctxlua{document.currentdiscexpansion = fonts.getdiscexpansion()}% \showotfligaturescaptions {#1} \showotfligatureslines {#2} \showotfligaturesparagraphs{#2} \showotfligaturesextremes {#2} + \ctxlua{fonts.setdiscexpansion(document.currentdiscexpansion)}% \stoptexdefinition % todo: n -> and split in lua diff --git a/tex/context/base/spac-prf.lua b/tex/context/base/spac-prf.lua index 47b51ea30..39603ec96 100644 --- a/tex/context/base/spac-prf.lua +++ b/tex/context/base/spac-prf.lua @@ -477,10 +477,10 @@ local function inject(top,bot,amount) -- todo: look at penalties setattr(glue,a_profilemethod,0) setattr(glue,a_visual,getattr(top,a_visual)) -- + setfield(bot,"prev",glue) setfield(glue,"next",bot) setfield(glue,"prev",top) setfield(top,"next",glue) - setfield(bot,"prev",glue) end methods[v_none] = function() @@ -550,7 +550,6 @@ methods[v_fixed] = function(top,bot,t_profile,b_profile,specification) return true end - local delta = getdelta(t_profile,b_profile) local dp = strutdp @@ -574,7 +573,7 @@ methods[v_fixed] = function(top,bot,t_profile,b_profile,specification) end - if delta < lineheight + distance then + if total < lineheight then setfield(top,"depth",strutdp) setfield(bot,"height",strutht) return true @@ -589,26 +588,18 @@ methods[v_fixed] = function(top,bot,t_profile,b_profile,specification) total = total - height + strutht end + local delta = getdelta(t_profile,b_profile) + local target = total - delta local factor = specification.factor or 1 - -- local lines = specification.lines or 0 local step = lineheight / factor local correction = 0 local nofsteps = 0 - while correction < target - step do -- a loop is more accurate, for now + while correction < target - step - distance do -- a loop is more accurate, for now correction = correction + step nofsteps = nofsteps + 1 end - -- target + distance = wanted - -- total - correction = calculated - - local d = (total - correction) - (target + distance) - - if d > 0 then - correction = correction - d - end - if trace_profile then report("top line : %s %05i > %s",t_profile.shown and "+" or "-",top,nodes.toutf(getlist(top))) report("bottom line : %s %05i > %s",b_profile.shown and "+" or "-",bot,nodes.toutf(getlist(bot))) diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 48bab2595..3c6a08724 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 25be80fa2..986fa8141 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-flt.mkvi b/tex/context/base/strc-flt.mkvi index be2958fbf..02aae2224 100644 --- a/tex/context/base/strc-flt.mkvi +++ b/tex/context/base/strc-flt.mkvi @@ -157,6 +157,8 @@ \c!ntop=2, \c!nbottom=0, \c!nlines=4, % used? + \c!topoffset=\zeropoint, + \c!bottomoffset=\zeropoint, %\c!local=, %\c!bottombefore=, % e.g. \vfill %\c!bottomafter=, @@ -552,10 +554,14 @@ \def\strc_floats_start_place_indeed[#settings][#userdata]% {\strc_floats_reset_variables \edef\savedfloatlocation{\floatcaptionparameter\c!location}% + \setexpandedfloatcaptionparameter\c!topoffset {\floatparameter\c!topoffset}% + \setexpandedfloatcaptionparameter\c!bottomoffset{\floatparameter\c!bottomoffset}% \setupcurrentfloatcaption[\c!location=,\c!reference=,\c!title=,\c!marking=,\c!list=,\c!bookmark=,#settings]% + \setexpandedfloatparameter\c!topoffset {\floatcaptionparameter\c!topoffset}% + \setexpandedfloatparameter\c!bottomoffset{\floatcaptionparameter\c!bottomoffset}% \def\m_strc_floats_saved_userdata{#2}% \edef\floatlocation{\floatcaptionparameter\c!location}% - \setupcurrentfloatcaption[\c!location=\savedfloatlocation]% + \setfloatcaptionparameter\c!location{\savedfloatlocation}% not expanded \ifx\floatlocation\empty \edef\floatlocation{\floatparameter\c!default}% \fi @@ -741,6 +747,8 @@ {\global\d_page_sides_topskip \zeropoint \global\d_page_sides_bottomskip\zeropoint \global\d_strc_floats_margin \zeropoint}% + \global\advance\d_page_sides_topskip \floatparameter\c!topoffset + \global\advance\d_page_sides_bottomskip\floatparameter\c!bottomoffset \else \processallactionsinset [\floatlocation] diff --git a/tex/context/base/syst-ini.mkiv b/tex/context/base/syst-ini.mkiv index 67cc389a2..83cb00b9f 100644 --- a/tex/context/base/syst-ini.mkiv +++ b/tex/context/base/syst-ini.mkiv @@ -1100,6 +1100,11 @@ \matheqnogapstep \zerocount \fi +%D New primitives: + +\ifdefined\hyphenationmin \else \newcount\hyphenationmin \fi +\ifdefined\discpenalty \else \newcount\discpenalty \fi + %D While cleaning this code up a bit I was listening to Heather Nova's \CD\ Redbird. %D The first song on that \CD\ ends with a few lines suitable for ending this %D initialization module: diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index a255835cc..25aef72a0 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 : 09/11/15 11:03:20 +-- merge date : 09/13/15 13:31:08 do -- begin closure to overcome local limits and interference -- cgit v1.2.3