From 9b0040ddf1cae9296e155906bdb639377aacb7f4 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Thu, 10 Aug 2017 11:36:42 +0200 Subject: 2017-08-10 10:51:00 --- doc/context/documents/general/qrcs/setup-cs.pdf | Bin 845719 -> 845598 bytes doc/context/documents/general/qrcs/setup-de.pdf | Bin 844318 -> 844215 bytes doc/context/documents/general/qrcs/setup-en.pdf | Bin 848312 -> 848200 bytes doc/context/documents/general/qrcs/setup-fr.pdf | Bin 841686 -> 841561 bytes doc/context/documents/general/qrcs/setup-it.pdf | Bin 843839 -> 843717 bytes doc/context/documents/general/qrcs/setup-nl.pdf | Bin 839914 -> 839794 bytes doc/context/documents/general/qrcs/setup-ro.pdf | Bin 840917 -> 840801 bytes metapost/context/base/mpiv/mp-grap.mpiv | 2 +- scripts/context/lua/mtxrun.lua | 9 +- scripts/context/stubs/mswin/mtxrun.lua | 9 +- scripts/context/stubs/unix/mtxrun | 9 +- scripts/context/stubs/win64/mtxrun.lua | 9 +- tex/context/base/mkii/cont-new.mkii | 2 +- tex/context/base/mkii/context.mkii | 2 +- tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/font-ini.mkvi | 12 + tex/context/base/mkiv/font-ots.lua | 257 ++++++++++++--------- tex/context/base/mkiv/lxml-ini.lua | 2 +- tex/context/base/mkiv/lxml-tex.lua | 140 +++++------ tex/context/base/mkiv/lxml-xml.lua | 4 + tex/context/base/mkiv/publ-imp-aps.mkvi | 18 +- tex/context/base/mkiv/publ-imp-cite.mkvi | 79 ++----- tex/context/base/mkiv/publ-ini.lua | 46 +++- tex/context/base/mkiv/publ-ini.mkiv | 32 ++- tex/context/base/mkiv/status-files.pdf | Bin 25758 -> 25745 bytes tex/context/base/mkiv/status-lua.pdf | Bin 425919 -> 425934 bytes tex/context/interface/mkiv/i-context.pdf | Bin 848312 -> 848200 bytes tex/context/interface/mkiv/i-readme.pdf | Bin 60774 -> 60775 bytes tex/context/modules/mkiv/s-fnt-20.mkiv | 1 + tex/generic/context/luatex/luatex-fonts-merged.lua | 232 +++++++++++-------- 31 files changed, 486 insertions(+), 383 deletions(-) diff --git a/doc/context/documents/general/qrcs/setup-cs.pdf b/doc/context/documents/general/qrcs/setup-cs.pdf index d8b96cb2f..690eb03c6 100644 Binary files a/doc/context/documents/general/qrcs/setup-cs.pdf and b/doc/context/documents/general/qrcs/setup-cs.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-de.pdf b/doc/context/documents/general/qrcs/setup-de.pdf index 5a1d639b4..d9ecba5bf 100644 Binary files a/doc/context/documents/general/qrcs/setup-de.pdf and b/doc/context/documents/general/qrcs/setup-de.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-en.pdf b/doc/context/documents/general/qrcs/setup-en.pdf index 29141d1e3..d79bbd007 100644 Binary files a/doc/context/documents/general/qrcs/setup-en.pdf and b/doc/context/documents/general/qrcs/setup-en.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-fr.pdf b/doc/context/documents/general/qrcs/setup-fr.pdf index 29af2c264..8ae79f67f 100644 Binary files a/doc/context/documents/general/qrcs/setup-fr.pdf and b/doc/context/documents/general/qrcs/setup-fr.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-it.pdf b/doc/context/documents/general/qrcs/setup-it.pdf index 2d0f5b135..4938a0db7 100644 Binary files a/doc/context/documents/general/qrcs/setup-it.pdf and b/doc/context/documents/general/qrcs/setup-it.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-nl.pdf b/doc/context/documents/general/qrcs/setup-nl.pdf index d35aee869..9ae7912eb 100644 Binary files a/doc/context/documents/general/qrcs/setup-nl.pdf and b/doc/context/documents/general/qrcs/setup-nl.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-ro.pdf b/doc/context/documents/general/qrcs/setup-ro.pdf index 39c2ee631..eda23ab37 100644 Binary files a/doc/context/documents/general/qrcs/setup-ro.pdf and b/doc/context/documents/general/qrcs/setup-ro.pdf differ diff --git a/metapost/context/base/mpiv/mp-grap.mpiv b/metapost/context/base/mpiv/mp-grap.mpiv index 3a1d7742a..d8bcc7cbb 100644 --- a/metapost/context/base/mpiv/mp-grap.mpiv +++ b/metapost/context/base/mpiv/mp-grap.mpiv @@ -863,7 +863,7 @@ vardef graph_gridline_picture@#(suffix $)(expr c, f, u)(text w) = if c : graph_xyscale fi shifted (((.5 + mfun_laboff@# dotprod (.5,.5)) * mfun_laboff@#) graph_xyscale) ; image(draw p w ; - label@#(if string f : format(f,u) else : f fi, point 0 of p)) + label@#(if string f : format(f,u) else : f fi, point 0 of p) w) fi enddef ; diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 34d0ecde4..7977871f0 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -15053,7 +15053,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-xml"] = package.loaded["lxml-xml"] or true --- original size: 10300, stripped down to: 7562 +-- original size: 10400, stripped down to: 7659 if not modules then modules={} end modules ['lxml-xml']={ version=1.001, @@ -15182,6 +15182,9 @@ local function xmltotext(root) return xmlserialize(root,xmltexthandler) or "" end end +function xml.serializetotext(root) + return root and xmlserialize(root,xmltexthandler) or "" +end local function text(collected) if collected then local e=collected[1] or collected @@ -20632,8 +20635,8 @@ end -- of closure -- used libraries : l-lua.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 848548 --- stripped bytes : 306909 +-- original bytes : 848648 +-- stripped bytes : 306912 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 34d0ecde4..7977871f0 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -15053,7 +15053,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-xml"] = package.loaded["lxml-xml"] or true --- original size: 10300, stripped down to: 7562 +-- original size: 10400, stripped down to: 7659 if not modules then modules={} end modules ['lxml-xml']={ version=1.001, @@ -15182,6 +15182,9 @@ local function xmltotext(root) return xmlserialize(root,xmltexthandler) or "" end end +function xml.serializetotext(root) + return root and xmlserialize(root,xmltexthandler) or "" +end local function text(collected) if collected then local e=collected[1] or collected @@ -20632,8 +20635,8 @@ end -- of closure -- used libraries : l-lua.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 848548 --- stripped bytes : 306909 +-- original bytes : 848648 +-- stripped bytes : 306912 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 34d0ecde4..7977871f0 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -15053,7 +15053,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-xml"] = package.loaded["lxml-xml"] or true --- original size: 10300, stripped down to: 7562 +-- original size: 10400, stripped down to: 7659 if not modules then modules={} end modules ['lxml-xml']={ version=1.001, @@ -15182,6 +15182,9 @@ local function xmltotext(root) return xmlserialize(root,xmltexthandler) or "" end end +function xml.serializetotext(root) + return root and xmlserialize(root,xmltexthandler) or "" +end local function text(collected) if collected then local e=collected[1] or collected @@ -20632,8 +20635,8 @@ end -- of closure -- used libraries : l-lua.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 848548 --- stripped bytes : 306909 +-- original bytes : 848648 +-- stripped bytes : 306912 -- end library merge diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua index 34d0ecde4..7977871f0 100644 --- a/scripts/context/stubs/win64/mtxrun.lua +++ b/scripts/context/stubs/win64/mtxrun.lua @@ -15053,7 +15053,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-xml"] = package.loaded["lxml-xml"] or true --- original size: 10300, stripped down to: 7562 +-- original size: 10400, stripped down to: 7659 if not modules then modules={} end modules ['lxml-xml']={ version=1.001, @@ -15182,6 +15182,9 @@ local function xmltotext(root) return xmlserialize(root,xmltexthandler) or "" end end +function xml.serializetotext(root) + return root and xmlserialize(root,xmltexthandler) or "" +end local function text(collected) if collected then local e=collected[1] or collected @@ -20632,8 +20635,8 @@ end -- of closure -- used libraries : l-lua.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 848548 --- stripped bytes : 306909 +-- original bytes : 848648 +-- stripped bytes : 306912 -- end library merge diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 1782f0905..8c6744735 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2017.08.09 15:35} +\newcontextversion{2017.08.10 10:46} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii index 36313bf62..cb169808a 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2017.08.09 15:35} +\edef\contextversion{2017.08.10 10:46} %D For those who want to use this: diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index e518a7094..59ff7e2ee 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2017.08.09 15:35} +\newcontextversion{2017.08.10 10:46} %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/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index f6367f228..40444815d 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -41,7 +41,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2017.08.09 15:35} +\edef\contextversion{2017.08.10 10:46} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/font-ini.mkvi b/tex/context/base/mkiv/font-ini.mkvi index 2697dff2e..c0121c18b 100644 --- a/tex/context/base/mkiv/font-ini.mkvi +++ b/tex/context/base/mkiv/font-ini.mkvi @@ -2713,6 +2713,18 @@ \def\saveddefinedfontid {\number\fontid\font} \def\saveddefinedfontname{\fontname\font} +%D Ugly helper: + +\unexpanded\def\saverunningstyleandcolor + {\unexpanded\edef\restorerunningstyleandcolor + {\setfontid \number\fontid\font + \attribute\colormodelattribute \the\attribute\colormodelattribute + \attribute\colorattribute \the\attribute\colorattribute + \attribute\transparencyattribute\the\attribute\transparencyattribute + \relax}} + +\let\restorerunningstyleandcolor\relax + %D Handy for defining additional glyphs: \let\getprivateglyphslot\clf_getprivateglyphslot % kind of private macro diff --git a/tex/context/base/mkiv/font-ots.lua b/tex/context/base/mkiv/font-ots.lua index 43585552b..d8754da32 100644 --- a/tex/context/base/mkiv/font-ots.lua +++ b/tex/context/base/mkiv/font-ots.lua @@ -4062,11 +4062,13 @@ otf.handlers = handlers local setspacekerns = nodes.injections.setspacekerns if not setspacekerns then os.exit() end +local tag = "kern" -- maybe some day a merge + if fontfeatures then function handlers.trigger_space_kerns(head,dataset,sequence,initialrl,font,attr) local features = fontfeatures[font] - local enabled = features and features.spacekern and features.kern + local enabled = features and features.spacekern and features[tag] if enabled then setspacekerns(font,sequence) end @@ -4078,7 +4080,7 @@ else -- generic (no hashes) function handlers.trigger_space_kerns(head,dataset,sequence,initialrl,font,attr) local shared = fontdata[font].shared local features = shared and shared.features - local enabled = features and features.spacekern and features.kern + local enabled = features and features.spacekern and features[tag] if enabled then setspacekerns(font,sequence) end @@ -4087,22 +4089,62 @@ else -- generic (no hashes) end +-- There are fonts out there that change the space but we don't do that kind of +-- things in TeX. + local function hasspacekerns(data) - local sequences = data.resources.sequences - for i=1,#sequences do - local sequence = sequences[i] - local steps = sequence.steps - if steps and sequence.features.kern then - for i=1,#steps do - local coverage = steps[i].coverage - if not coverage then - -- maybe an issue, can't happen - elseif coverage[32] then - return true - else - for k, v in next, coverage do - if v[32] then - return true + local resources = data.resources + local sequences = resources.sequences + local validgpos = resources.features.gpos + if validgpos and sequences then + for i=1,#sequences do + local sequence = sequences[i] + local steps = sequence.steps + if steps and sequence.features[tag] then + local kind = sequence.type + if kind == "gpos_pair" or kind == "gpos_single" then + for i=1,#steps do + local step = steps[i] + local coverage = step.coverage + local rules = step.rules + if rules then + -- not now: analyze (simple) rules + elseif not coverage then + -- nothing to do + elseif kind == "gpos_single" then + -- maybe a message that we ignore + elseif kind == "gpos_pair" then + local format = step.format + if format == "move" or format == "kern" then + local kerns = coverage[32] + if kerns then + return true + end + for k, v in next, coverage do + if v[32] then + return true + end + end + elseif format == "pair" then + local kerns = coverage[32] + if kerns then + for k, v in next, kerns do + local one = v[1] + if one and one ~= true then + return true + end + end + end + for k, v in next, coverage do + local kern = v[32] + if kern then + local one = kern[1] + if one and one ~= true then + return true + end + end + end + end end end end @@ -4119,115 +4161,120 @@ otf.readers.registerextender { end } --- we merge the lookups but we still honor the language / script - local function spaceinitializer(tfmdata,value) -- attr local resources = tfmdata.resources local spacekerns = resources and resources.spacekerns - local properties = tfmdata.properties if value and spacekerns == nil then + local rawdata = tfmdata.shared and tfmdata.shared.rawdata + local properties = rawdata.properties if properties and properties.hasspacekerns then local sequences = resources.sequences - local left = { } - local right = { } - local last = 0 - local feat = nil - for i=1,#sequences do - local sequence = sequences[i] - local steps = sequence.steps - if steps then - local kern = sequence.features.kern - if kern then - if feat then - for script, languages in next, kern do - local f = feat[script] - if f then - for l in next, languages do - f[l] = true - end - else - feat[script] = languages - end - end - else - feat = kern - end - for i=1,#steps do - local step = steps[i] - local coverage = step.coverage - local rules = step.rules - local format = step.format - if rules then - -- not now: analyze (simple) rules - elseif coverage then - -- what to do if we have no [1] but only [2] - local single = format == "gpos_single" - local kerns = coverage[32] - if kerns then - for k, v in next, kerns do - if type(v) ~= "table" then - right[k] = v - elseif single then - right[k] = v[3] - else - local one = v[1] - if one and one ~= true then - right[k] = one[3] + local validgpos = resources.features.gpos + if validgpos and sequences then + local left = { } + local right = { } + local last = 0 + local feat = nil + for i=1,#sequences do + local sequence = sequences[i] + local steps = sequence.steps + if steps then + -- we don't support space kerns in other features + local kern = sequence.features[tag] + if kern then + local kind = sequence.type + if kind == "gpos_pair" or kind == "gpos_single" then + if feat then + for script, languages in next, kern do + local f = feat[script] + if f then + for l in next, languages do + f[l] = true end + else + feat[script] = languages end end + else + feat = kern end - for k, v in next, coverage do - local kern = v[32] - if kern then - if type(kern) ~= "table" then - left[k] = kern - elseif single then - left[k] = kern[3] - else - local one = kern[1] - if one and one ~= true then - left[k] = one[3] + for i=1,#steps do + local step = steps[i] + local coverage = step.coverage + local rules = step.rules + if rules then + -- not now: analyze (simple) rules + elseif not coverage then + -- nothng to do + elseif kind == "gpos_single" then + -- makes no sense in TeX + elseif kind == "gpos_pair" then + local format = step.format + if format == "move" or format == "kern" then + local kerns = coverage[32] + if kerns then + for k, v in next, kerns do + right[k] = v + end + end + for k, v in next, coverage do + local kern = v[32] + if kern then + left[k] = kern + end + end + elseif format == "pair" then + local kerns = coverage[32] + if kerns then + for k, v in next, kerns do + local one = v[1] + if one and one ~= true then + right[k] = one[3] + end + end + end + for k, v in next, coverage do + local kern = v[32] + if kern then + local one = kern[1] + if one and one ~= true then + left[k] = one[3] + end + end end end end end - else - -- can't happen + last = i end + else + -- no steps ... needed for old one ... we could use the basekerns + -- instead end - last = i end - else - -- no steps ... needed for old one ... we could use the basekerns - -- instead end - end - left = next(left) and left or false - right = next(right) and right or false - if left or right then - spacekerns = { - left = left, - right = right, - } - if last > 0 then - local triggersequence = { - -- no steps, see (!!) - features = { kern = feat or { dflt = { dflt = true, } } }, - flags = noflags, - name = "trigger_space_kerns", - order = { "kern" }, - type = "trigger_space_kerns", - left = left, - right = right, + left = next(left) and left or false + right = next(right) and right or false + if left or right then + spacekerns = { + left = left, + right = right, } - insert(sequences,last,triggersequence) + if last > 0 then + local triggersequence = { + -- no steps, see (!!) + features = { [tag] = feat or { dflt = { dflt = true, } } }, + flags = noflags, + name = "trigger_space_kerns", + order = { tag }, + type = "trigger_space_kerns", + left = left, + right = right, + } + insert(sequences,last,triggersequence) + end end - else - spacekerns = false end - else - spacekerns = false end resources.spacekerns = spacekerns end diff --git a/tex/context/base/mkiv/lxml-ini.lua b/tex/context/base/mkiv/lxml-ini.lua index 86d113f7c..09a13eb5c 100644 --- a/tex/context/base/mkiv/lxml-ini.lua +++ b/tex/context/base/mkiv/lxml-ini.lua @@ -110,7 +110,7 @@ implement { name = "xmlpure", actions = lxml.pure, arg implement { name = "xmlflushtext", actions = lxml.text, arguments = "string" } implement { name = "xmlflushpure", actions = lxml.pure, arguments = "string" } implement { name = "xmltobuffer", actions = lxml.tobuffer, arguments = { "string", "string", "string" } } -implement { name = "xmltobufferverbose", actions = lxml.tobuffer, arguments = { "string", "string", "string", true } } +implement { name = "xmltobufferverbose", actions = lxml.tobuffer, arguments = { "string", "string", "string", true, true } } implement { name = "xmltobuffertextonly", actions = lxml.tobuffer, arguments = { "string", "string", "string", false } } implement { name = "xmltofile", actions = lxml.tofile, arguments = { "string", "string", "string" } } implement { name = "xmltoparameters", actions = lxml.toparameters, arguments = "string" } diff --git a/tex/context/base/mkiv/lxml-tex.lua b/tex/context/base/mkiv/lxml-tex.lua index f23919801..cfebee650 100644 --- a/tex/context/base/mkiv/lxml-tex.lua +++ b/tex/context/base/mkiv/lxml-tex.lua @@ -26,71 +26,72 @@ local basename, dirname, joinfile = file.basename, file.dirname, file.join lxml = lxml or { } local lxml = lxml -local catcodenumbers = catcodes.numbers -local ctxcatcodes = catcodenumbers.ctxcatcodes -- todo: use different method -local notcatcodes = catcodenumbers.notcatcodes -- todo: use different method - -local commands = commands -local context = context -local contextsprint = context.sprint -- with catcodes (here we use fast variants, but with option for tracing) - -local synctex = luatex.synctex - -local implement = interfaces.implement - -local xmlelements = xml.elements -local xmlcollected = xml.collected -local xmlsetproperty = xml.setproperty -local xmlwithelements = xml.withelements -local xmlserialize = xml.serialize -local xmlcollect = xml.collect -local xmltext = xml.text -local xmltostring = xml.tostring -local xmlapplylpath = xml.applylpath -local xmlunspecialized = xml.unspecialized -local xmldespecialized = xml.despecialized -- nicer in expanded xml -local xmlprivatetoken = xml.privatetoken -local xmlstripelement = xml.stripelement -local xmlinclusion = xml.inclusion -local xmlinclusions = xml.inclusions -local xmlbadinclusions = xml.badinclusions -local xmlcontent = xml.content -local xmllastmatch = xml.lastmatch -local xmlpushmatch = xml.pushmatch -local xmlpopmatch = xml.popmatch -local xmlstring = xml.string +local catcodenumbers = catcodes.numbers +local ctxcatcodes = catcodenumbers.ctxcatcodes -- todo: use different method +local notcatcodes = catcodenumbers.notcatcodes -- todo: use different method + +local commands = commands +local context = context +local contextsprint = context.sprint -- with catcodes (here we use fast variants, but with option for tracing) + +local synctex = luatex.synctex + +local implement = interfaces.implement + +local xmlelements = xml.elements +local xmlcollected = xml.collected +local xmlsetproperty = xml.setproperty +local xmlwithelements = xml.withelements +local xmlserialize = xml.serialize +local xmlcollect = xml.collect +local xmltext = xml.text +local xmltostring = xml.tostring +local xmlapplylpath = xml.applylpath +local xmlunspecialized = xml.unspecialized +local xmldespecialized = xml.despecialized -- nicer in expanded xml +local xmlprivatetoken = xml.privatetoken +local xmlstripelement = xml.stripelement +local xmlinclusion = xml.inclusion +local xmlinclusions = xml.inclusions +local xmlbadinclusions = xml.badinclusions +local xmlcontent = xml.content +local xmllastmatch = xml.lastmatch +local xmlpushmatch = xml.pushmatch +local xmlpopmatch = xml.popmatch +local xmlstring = xml.string +local xmlserializetotext = xml.serializetotext + +local variables = interfaces and interfaces.variables or { } + +local settings_to_hash = utilities.parsers.settings_to_hash +local settings_to_set = utilities.parsers.settings_to_set +local options_to_hash = utilities.parsers.options_to_hash +local options_to_array = utilities.parsers.options_to_array + +local insertbeforevalue = utilities.tables.insertbeforevalue +local insertaftervalue = utilities.tables.insertaftervalue + +local resolveprefix = resolvers.resolve + +local starttiming = statistics.starttiming +local stoptiming = statistics.stoptiming + +local trace_setups = false trackers.register("lxml.setups", function(v) trace_setups = v end) +local trace_loading = false trackers.register("lxml.loading", function(v) trace_loading = v end) +local trace_access = false trackers.register("lxml.access", function(v) trace_access = v end) +local trace_comments = false trackers.register("lxml.comments", function(v) trace_comments = v end) +local trace_entities = false trackers.register("xml.entities", function(v) trace_entities = v end) +local trace_selectors = false trackers.register("lxml.selectors",function(v) trace_selectors = v end) + +local report_lxml = logs.reporter("lxml","tex") +local report_xml = logs.reporter("xml","tex") + +local forceraw = false + +local p_texescape = patterns.texescape directives.enable("xml.path.keeplastmatch") -local variables = interfaces and interfaces.variables or { } - -local settings_to_hash = utilities.parsers.settings_to_hash -local settings_to_set = utilities.parsers.settings_to_set -local options_to_hash = utilities.parsers.options_to_hash -local options_to_array = utilities.parsers.options_to_array - -local insertbeforevalue = utilities.tables.insertbeforevalue -local insertaftervalue = utilities.tables.insertaftervalue - -local resolveprefix = resolvers.resolve - -local starttiming = statistics.starttiming -local stoptiming = statistics.stoptiming - -local trace_setups = false trackers.register("lxml.setups", function(v) trace_setups = v end) -local trace_loading = false trackers.register("lxml.loading", function(v) trace_loading = v end) -local trace_access = false trackers.register("lxml.access", function(v) trace_access = v end) -local trace_comments = false trackers.register("lxml.comments", function(v) trace_comments = v end) -local trace_entities = false trackers.register("xml.entities", function(v) trace_entities = v end) -local trace_selectors = false trackers.register("lxml.selectors",function(v) trace_selectors = v end) - -local report_lxml = logs.reporter("lxml","tex") -local report_xml = logs.reporter("xml","tex") - -local forceraw = false - -local p_texescape = patterns.texescape - -- tex entities lxml.entities = lxml.entities or { } @@ -2237,17 +2238,23 @@ end texfinalizers.upperall = xmlfinalizers.upperall texfinalizers.lowerall = xmlfinalizers.lowerall -function lxml.tobuffer(id,pattern,name,unescaped) +function lxml.tobuffer(id,pattern,name,unescaped,contentonly) local collected = xmlapplylpath(getid(id),pattern) if collected then + local collected = collected[1] if unescaped == true then - collected = xmlcontent(collected[1]) -- expanded entities ! + -- expanded entities ! + if contentonly then + collected = xmlserializetotext(collected.dt) + else + collected = xmlcontent(collected) + end elseif unescaped == false then local t = { } - xmlstring(collected[1],function(s) t[#t+1] = s end) + xmlstring(collected,function(s) t[#t+1] = s end) collected = concat(t) else - collected = tostring(collected[1]) + collected = tostring(collected) end buffers.assign(name,collected) else @@ -2255,6 +2262,7 @@ function lxml.tobuffer(id,pattern,name,unescaped) end end + -- relatively new: local permitted = nil diff --git a/tex/context/base/mkiv/lxml-xml.lua b/tex/context/base/mkiv/lxml-xml.lua index 6ec353310..62564337c 100644 --- a/tex/context/base/mkiv/lxml-xml.lua +++ b/tex/context/base/mkiv/lxml-xml.lua @@ -162,6 +162,10 @@ local function xmltotext(root) end end +function xml.serializetotext(root) + return root and xmlserialize(root,xmltexthandler) or "" +end + -- local function text(collected) -- hybrid diff --git a/tex/context/base/mkiv/publ-imp-aps.mkvi b/tex/context/base/mkiv/publ-imp-aps.mkvi index 4b810672e..90d418ca0 100644 --- a/tex/context/base/mkiv/publ-imp-aps.mkvi +++ b/tex/context/base/mkiv/publ-imp-aps.mkvi @@ -1036,20 +1036,14 @@ \texdefinition{btx:aps:author} \texdefinition{btx:aps:title} \btxdoif {organization} { - \btxspace - \btxflush{organization} - \btxcomma + \doifnot {\btxfoundname{author}} {organization} { + \btxspace + \btxflush{organization} + \btxcomma + } } - \btxdoifelse {howpublished} { + \btxdoif {howpublished} { \texdefinition{btx:aps:doi-url} {\btxspace\btxflush{howpublished}} - } { - \btxdoifelse {doi} { - \texdefinition{btx:aps:doi-url} {\btxspace\btxflush{doi}} - } { - \btxdoif {url} { - \texdefinition{btx:aps:doi-url} {\btxspace\btxflush{url}} - } - } } \btxleftparenthesis \texdefinition{btx:aps:year} diff --git a/tex/context/base/mkiv/publ-imp-cite.mkvi b/tex/context/base/mkiv/publ-imp-cite.mkvi index be23326b8..a9b681d33 100644 --- a/tex/context/base/mkiv/publ-imp-cite.mkvi +++ b/tex/context/base/mkiv/publ-imp-cite.mkvi @@ -62,23 +62,25 @@ \stopsetups \startsetups btx:cite:lefttext - \ifx\currentbtxlefttext\empty - \else - \setbtxparameterset{\s!cite}{lefttext} - \btxparameter\c!left - \currentbtxlefttext - \btxparameter\c!right + \ifx\currentbtxlefttext\empty \else + \startbtxrunningstyleandcolor + \setbtxparameterset{\s!cite}{lefttext} + \btxparameter\c!left + \currentbtxlefttext + \btxparameter\c!right + \stopbtxrunningstyleandcolor \fi \stopsetups \startsetups btx:cite:righttext - \ifx\currentbtxrighttext\empty - \else - \setbtxparameterset{\s!cite}{righttext} - \btxparameter\c!left - \currentbtxrighttext - \btxparameter\c!right - \fi + \ifx\currentbtxrighttext\empty \else + \startbtxrunningstyleandcolor + \setbtxparameterset{\s!cite}{righttext} + \btxparameter\c!left + \currentbtxrighttext + \btxparameter\c!right + \stopbtxrunningstyleandcolor + \fi \stopsetups \startsetups btx:cite:invalid @@ -93,37 +95,8 @@ % when we have an author-year combination, the first and seconds is not % fields data but something more complex (that itself calls for a setup) -% \startsetups btx:cite:normal -% \texdefinition{\s!btx:\s!cite:concat} -% \currentbtxlefttext -% \ifx\currentbtxfirst\empty -% \fastsetup{\s!btx:\s!cite:\s!empty} -% \else -% \texdefinition {\s!btx:\s!cite:inject} { -% \btxcitereference -% \btxusecommand [\currentbtxspecification:cite:\currentbtxcitealternative] { -% \currentbtxfirst -% } -% } -% \ifx\currentbtxsecond\empty -% \btxflushsuffix -% \else -% \btxparameter\c!inbetween -% \texdefinition {\s!btx:\s!cite:inject} { -% \btxusecommand [\currentbtxspecification:cite:\currentbtxcitealternative] { -% \currentbtxsecond -% } -% } -% % quite likely an error -% \btxflushsuffix -% \fi -% \fi -% \currentbtxrighttext -% \stopsetups - \startsetups btx:cite:normal \texdefinition{\s!btx:\s!cite:concat} - %\currentbtxlefttext \fastsetup{\s!btx:\s!cite:lefttext} \ifx\currentbtxfirst\empty \fastsetup{\s!btx:\s!cite:\s!empty} @@ -136,21 +109,6 @@ } } \else - % \texdefinition {\s!btx:\s!cite:inject} { - % \btxcitereference - % \btxusecommand [\currentbtxspecification:cite:\currentbtxcitealternative] { - % \currentbtxfirst - % } - % } - % \btxparameter\c!inbetween - % \texdefinition {\s!btx:\s!cite:inject} { - % \btxusecommand [\currentbtxspecification:cite:\currentbtxcitealternative] { - % \currentbtxsecond - % } - % } - % \btxflushsuffix - % - % probably better: \texdefinition {\s!btx:\s!cite:inject} { \btxcitereference \btxusecommand [\currentbtxspecification:cite:\currentbtxcitealternative] { @@ -161,13 +119,11 @@ } } \fi\fi - %\currentbtxrighttext \fastsetup{\s!btx:\s!cite:righttext} \stopsetups \startsetups btx:cite:range \texdefinition{\s!btx:\s!cite:concat} - %\currentbtxlefttext \fastsetup{\s!btx:\s!cite:lefttext} \ifx\currentbtxfirst\empty \fastsetup{\s!btx:\s!cite:\s!empty} @@ -184,7 +140,6 @@ } } \fi - %\currentbtxrighttext \fastsetup{\s!btx:\s!cite:righttext} \stopsetups @@ -192,7 +147,6 @@ \startsetups btx:cite:listelement \texdefinition{\s!btx:\s!cite:concat} - %\currentbtxlefttext \fastsetup{\s!btx:\s!cite:lefttext} \ifx\currentbtxfirst\empty \fastsetup{\s!btx:\s!cite:\s!empty} @@ -202,16 +156,13 @@ \currentbtxfirst } \fi - %\currentbtxrighttext \fastsetup{\s!btx:\s!cite:righttext} \stopsetups \startsetups \s!btx:\s!cite:entry \texdefinition{\s!btx:\s!cite:concat} - %\currentbtxlefttext \fastsetup{\s!btx:\s!cite:lefttext} \btxhandleciteentry - %\currentbtxrighttext \fastsetup{\s!btx:\s!cite:righttext} \stopsetups diff --git a/tex/context/base/mkiv/publ-ini.lua b/tex/context/base/mkiv/publ-ini.lua index 57aaa2bbf..3c0b1678c 100644 --- a/tex/context/base/mkiv/publ-ini.lua +++ b/tex/context/base/mkiv/publ-ini.lua @@ -121,10 +121,6 @@ local ctx_btxsetnumber = context.btxsetnumber local ctx_btxsetlanguage = context.btxsetlanguage local ctx_btxsetcombis = context.btxsetcombis local ctx_btxsetcategory = context.btxsetcategory -local ctx_btxcitesetup = context.btxcitesetup -local ctx_btxsubcitesetup = context.btxsubcitesetup -local ctx_btxnumberingsetup = context.btxnumberingsetup -local ctx_btxpagesetup = context.btxpagesetup local ctx_btxsetfirst = context.btxsetfirst local ctx_btxsetsecond = context.btxsetsecond local ctx_btxsetsuffix = context.btxsetsuffix @@ -134,12 +130,30 @@ local ctx_btxsetrighttext = context.btxsetrighttext local ctx_btxsetbefore = context.btxsetbefore local ctx_btxsetafter = context.btxsetafter local ctx_btxsetbacklink = context.btxsetbacklink -local ctx_btxsetcount = context.btxsetcount -local ctx_btxsetconcat = context.btxsetconcat -local ctx_btxsetfirstpage = context.btxsetfirstpage -local ctx_btxsetlastpage = context.btxsetlastpage local ctx_btxsetfirstinternal = context.btxsetfirstinternal local ctx_btxsetlastinternal = context.btxsetlastinternal + +-- local ctx_btxsetdataset = function(s) setmacro("currentbtxdataset", s) end -- context.btxsetdataset +-- local ctx_btxsettag = function(s) setmacro("currentbtxtag", s) end -- context.btxsettag +-- local ctx_btxsetnumber = function(s) setmacro("currentbtxnumber", s) end -- context.btxsetnumber +-- local ctx_btxsetlanguage = function(s) setmacro("currentbtxlanguage", s) end -- context.btxsetlanguage +-- local ctx_btxsetcombis = function(s) setmacro("currentbtxcombis", s) end -- context.btxsetcombis +-- local ctx_btxsetcategory = function(s) setmacro("currentbtxcategory", s) end -- context.btxsetcategory +-- local ctx_btxsetfirst = function(s) setmacro("currentbtxfirst", s) end -- context.btxsetfirst +-- local ctx_btxsetsecond = function(s) setmacro("currentbtxsecond", s) end -- context.btxsetsecond +-- local ctx_btxsetsuffix = function(s) setmacro("currentbtxsuffix", s) end -- context.btxsetsuffix +-- local ctx_btxsetinternal = function(s) setmacro("currentbtxinternal", s) end -- context.btxsetinternal +-- local ctx_btxsetlefttext = function(s) setmacro("currentbtxlefttext", s) end -- context.btxsetlefttext +-- local ctx_btxsetrighttext = function(s) setmacro("currentbtxrighttext", s) end -- context.btxsetrighttext +-- local ctx_btxsetbefore = function(s) setmacro("currentbtxbefore", s) end -- context.btxsetbefore +-- local ctx_btxsetafter = function(s) setmacro("currentbtxafter", s) end -- context.btxsetafter +-- local ctx_btxsetbacklink = function(s) setmacro("currentbtxbacklink", s) end -- context.btxsetbacklink +-- local ctx_btxsetfirstinternal = function(s) setmacro("currentbtxfirstinternal", s) end -- context.btxsetfirstinternal +-- local ctx_btxsetlastinternal = function(s) setmacro("currentbtxlastinternal", s) end -- context.btxsetlastinternal + +local ctx_btxsetfirstpage = context.btxsetfirstpage +local ctx_btxsetlastpage = context.btxsetlastpage + local ctx_btxstartcite = context.btxstartcite local ctx_btxstopcite = context.btxstopcite local ctx_btxstartciteauthor = context.btxstartciteauthor @@ -150,12 +164,22 @@ local ctx_btxstartlistentry = context.btxstartlistentry local ctx_btxstoplistentry = context.btxstoplistentry local ctx_btxstartcombientry = context.btxstartcombientry local ctx_btxstopcombientry = context.btxstopcombientry -local ctx_btxlistsetup = context.btxlistsetup + local ctx_btxflushauthor = context.btxflushauthor + local ctx_btxsetnoflistentries = context.btxsetnoflistentries local ctx_btxsetcurrentlistentry = context.btxsetcurrentlistentry local ctx_btxsetcurrentlistindex = context.btxsetcurrentlistindex +local ctx_btxsetcount = context.btxsetcount +local ctx_btxsetconcat = context.btxsetconcat + +local ctx_btxcitesetup = context.btxcitesetup +local ctx_btxsubcitesetup = context.btxsubcitesetup +local ctx_btxnumberingsetup = context.btxnumberingsetup +local ctx_btxpagesetup = context.btxpagesetup +local ctx_btxlistsetup = context.btxlistsetup + local trialtypesetting = context.trialtypesetting languages.data = languages.data or { } @@ -2453,7 +2477,7 @@ do for i=1,#source do local entry = source[i] local current = entry.sortkey -- so we need a sortkey ! - if type(sortkey) == "number" then + if type(current) == "number" then if entry.suffix then if not first then first, last, firstr, lastr = current, current, entry, entry @@ -3099,8 +3123,6 @@ do local partialinteractive = false local function authorgetter(first,last,key,specification) -- only first - -- ctx_btxsetfirst(first.author) -- unformatted - -- ctx_btxsetfirst(currentbtxciteauthor) -- formatter (much slower) if first.type == "author" then ctx_btxsetfirst(currentbtxciteauthor) -- formatter (much slower) else diff --git a/tex/context/base/mkiv/publ-ini.mkiv b/tex/context/base/mkiv/publ-ini.mkiv index a1c76464a..5e467177b 100644 --- a/tex/context/base/mkiv/publ-ini.mkiv +++ b/tex/context/base/mkiv/publ-ini.mkiv @@ -428,13 +428,15 @@ \let\currentbtxlanguage \empty \unexpanded\def\btxsetlanguage {\def\currentbtxlanguage} \let\currentbtxtag \empty \unexpanded\def\btxsettag {\def\currentbtxtag} \let\currentbtxnumber \empty \unexpanded\def\btxsetnumber {\def\currentbtxnumber} -\let\currentbtxauthorvariant\v!normal \unexpanded\def\btxsetauthorvariant{\def\currentbtxauthorvariant} +\let\currentbtxfirstinternal\empty \unexpanded\def\btxsetfirstinternal{\def\currentbtxfirstinternal} +\let\currentbtxlastinternal \empty \unexpanded\def\btxsetlastinternal {\def\currentbtxlastinternal} -\let\currentbtxfirstnames \empty \unexpanded\def\btxsetfirstnames{\let\currentbtxfirstnames\currentbtxfirstnames_indeed} -\let\currentbtxinitials \empty \unexpanded\def\btxsetinitials {\let\currentbtxinitials \currentbtxinitials_indeed } -\let\currentbtxjuniors \empty \unexpanded\def\btxsetjuniors {\let\currentbtxjuniors \currentbtxjuniors_indeed } -\let\currentbtxsurnames \empty \unexpanded\def\btxsetsurnames {\let\currentbtxsurnames \currentbtxsurnames_indeed } -\let\currentbtxvons \empty \unexpanded\def\btxsetvons {\let\currentbtxvons \currentbtxvons_indeed } +\let\currentbtxauthorvariant\v!normal \unexpanded\def\btxsetauthorvariant{\def\currentbtxauthorvariant} +\let\currentbtxfirstnames \empty \unexpanded\def\btxsetfirstnames {\let\currentbtxfirstnames\currentbtxfirstnames_indeed} +\let\currentbtxinitials \empty \unexpanded\def\btxsetinitials {\let\currentbtxinitials \currentbtxinitials_indeed } +\let\currentbtxjuniors \empty \unexpanded\def\btxsetjuniors {\let\currentbtxjuniors \currentbtxjuniors_indeed } +\let\currentbtxsurnames \empty \unexpanded\def\btxsetsurnames {\let\currentbtxsurnames \currentbtxsurnames_indeed } +\let\currentbtxvons \empty \unexpanded\def\btxsetvons {\let\currentbtxvons \currentbtxvons_indeed } \newconstant\currentbtxoverflow \unexpanded\def\btxsetoverflow #1{\currentbtxoverflow #1\relax} \newconstant\currentbtxconcat \unexpanded\def\btxsetconcat #1{\currentbtxconcat #1\relax} @@ -449,10 +451,8 @@ \unexpanded\def\currentbtxsurnames_indeed {\clf_btxcurrentsurnames \numexpr\currentbtxauthorindex\relax} \unexpanded\def\currentbtxvons_indeed {\clf_btxcurrentvons \numexpr\currentbtxauthorindex\relax} -\let\currentbtxfirstpage \empty \unexpanded\def\btxsetfirstpage #1{\def\currentbtxfirstpage{\btx_page_number{#1}}} -\let\currentbtxlastpage \empty \unexpanded\def\btxsetlastpage #1{\def\currentbtxlastpage {\btx_page_number{#1}}} -\let\currentbtxfirstinternal\empty \unexpanded\def\btxsetfirstinternal {\def\currentbtxfirstinternal} -\let\currentbtxlastinternal \empty \unexpanded\def\btxsetlastinternal {\def\currentbtxlastinternal} +\let\currentbtxfirstpage \empty \unexpanded\def\btxsetfirstpage#1{\def\currentbtxfirstpage{\btx_page_number{#1}}} +\let\currentbtxlastpage \empty \unexpanded\def\btxsetlastpage #1{\def\currentbtxlastpage {\btx_page_number{#1}}} \def\currentbtxauthorvariant{normal} @@ -917,7 +917,7 @@ \unexpanded\def\btx_reference_indeed {\begingroup - % redundantm will go away: + % redundant will go away: \setbtxparameterset{\c!list:\s!numbering}\currentbtxnumbering % \ifx\currentbtxnumbering\empty @@ -1336,6 +1336,7 @@ \def\publ_cite_handle_variant_indeed[#1]% {\letbtxparameter\c!alternative\currentbtxcitealternative \edef\currentbtxreference{#1}% + \saverunningstyleandcolor \usebtxstyleandcolor\c!style\c!color \uselanguageparameter\btxdatasetparameter % new \btxparameter\c!left @@ -1557,6 +1558,7 @@ \unexpanded\def\btxstartsubcite#1% {\begingroup \btx_reset_cite % todo: limited set + % \saverunningstyleandcolor % let's see when Alan needs it \def\currentbtxcitealternative{#1}% \setbtxparameterset\s!cite\currentbtxcitealternative \usebtxstyleandcolor\c!style\c!color @@ -1789,6 +1791,14 @@ \unexpanded\def\btxusecommand[#1]#2% using #2 permits space after [] {\namedbtxparameter{#1}\c!command{#2}} +\unexpanded\def\startbtxrunningstyleandcolor + {\dontleavehmode + \begingroup + \restorerunningstyleandcolor} + +\unexpanded\def\stopbtxrunningstyleandcolor + {\endgroup} + %D Defaults: \setupbtxrendering diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index e820737c7..078a735e5 100644 Binary files a/tex/context/base/mkiv/status-files.pdf and b/tex/context/base/mkiv/status-files.pdf differ diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf index 76ebe0c1b..8477f929b 100644 Binary files a/tex/context/base/mkiv/status-lua.pdf and b/tex/context/base/mkiv/status-lua.pdf differ diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf index 29141d1e3..d79bbd007 100644 Binary files a/tex/context/interface/mkiv/i-context.pdf and b/tex/context/interface/mkiv/i-context.pdf differ diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf index 7e708175d..280221fb9 100644 Binary files a/tex/context/interface/mkiv/i-readme.pdf and b/tex/context/interface/mkiv/i-readme.pdf differ diff --git a/tex/context/modules/mkiv/s-fnt-20.mkiv b/tex/context/modules/mkiv/s-fnt-20.mkiv index df507a912..6fc1edb22 100644 --- a/tex/context/modules/mkiv/s-fnt-20.mkiv +++ b/tex/context/modules/mkiv/s-fnt-20.mkiv @@ -44,6 +44,7 @@ [analyze=yes,mode=node, language=dflt,script=arab, init=yes,medi=yes,fina=yes, + spacekern=yes, calt=yes, rlig=yes, ccmp=yes, diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 8b25160bf..5258875ba 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 : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 08/09/17 15:35:46 +-- merge date : 08/10/17 10:46:27 do -- begin closure to overcome local limits and interference @@ -25911,10 +25911,11 @@ registerotffeature { } otf.handlers=handlers local setspacekerns=nodes.injections.setspacekerns if not setspacekerns then os.exit() end +local tag="kern" if fontfeatures then function handlers.trigger_space_kerns(head,dataset,sequence,initialrl,font,attr) local features=fontfeatures[font] - local enabled=features and features.spacekern and features.kern + local enabled=features and features.spacekern and features[tag] if enabled then setspacekerns(font,sequence) end @@ -25924,7 +25925,7 @@ else function handlers.trigger_space_kerns(head,dataset,sequence,initialrl,font,attr) local shared=fontdata[font].shared local features=shared and shared.features - local enabled=features and features.spacekern and features.kern + local enabled=features and features.spacekern and features[tag] if enabled then setspacekerns(font,sequence) end @@ -25932,20 +25933,55 @@ else end end local function hasspacekerns(data) - local sequences=data.resources.sequences - for i=1,#sequences do - local sequence=sequences[i] - local steps=sequence.steps - if steps and sequence.features.kern then - for i=1,#steps do - local coverage=steps[i].coverage - if not coverage then - elseif coverage[32] then - return true - else - for k,v in next,coverage do - if v[32] then - return true + local resources=data.resources + local sequences=resources.sequences + local validgpos=resources.features.gpos + if validgpos and sequences then + for i=1,#sequences do + local sequence=sequences[i] + local steps=sequence.steps + if steps and sequence.features[tag] then + local kind=sequence.type + if kind=="gpos_pair" or kind=="gpos_single" then + for i=1,#steps do + local step=steps[i] + local coverage=step.coverage + local rules=step.rules + if rules then + elseif not coverage then + elseif kind=="gpos_single" then + elseif kind=="gpos_pair" then + local format=step.format + if format=="move" or format=="kern" then + local kerns=coverage[32] + if kerns then + return true + end + for k,v in next,coverage do + if v[32] then + return true + end + end + elseif format=="pair" then + local kerns=coverage[32] + if kerns then + for k,v in next,kerns do + local one=v[1] + if one and one~=true then + return true + end + end + end + for k,v in next,coverage do + local kern=v[32] + if kern then + local one=kern[1] + if one and one~=true then + return true + end + end + end + end end end end @@ -25963,104 +25999,110 @@ otf.readers.registerextender { local function spaceinitializer(tfmdata,value) local resources=tfmdata.resources local spacekerns=resources and resources.spacekerns - local properties=tfmdata.properties if value and spacekerns==nil then + local rawdata=tfmdata.shared and tfmdata.shared.rawdata + local properties=rawdata.properties if properties and properties.hasspacekerns then local sequences=resources.sequences - local left={} - local right={} - local last=0 - local feat=nil - for i=1,#sequences do - local sequence=sequences[i] - local steps=sequence.steps - if steps then - local kern=sequence.features.kern - if kern then - if feat then - for script,languages in next,kern do - local f=feat[script] - if f then - for l in next,languages do - f[l]=true - end - else - feat[script]=languages - end - end - else - feat=kern - end - for i=1,#steps do - local step=steps[i] - local coverage=step.coverage - local rules=step.rules - local format=step.format - if rules then - elseif coverage then - local single=format=="gpos_single" - local kerns=coverage[32] - if kerns then - for k,v in next,kerns do - if type(v)~="table" then - right[k]=v - elseif single then - right[k]=v[3] - else - local one=v[1] - if one and one~=true then - right[k]=one[3] + local validgpos=resources.features.gpos + if validgpos and sequences then + local left={} + local right={} + local last=0 + local feat=nil + for i=1,#sequences do + local sequence=sequences[i] + local steps=sequence.steps + if steps then + local kern=sequence.features[tag] + if kern then + local kind=sequence.type + if kind=="gpos_pair" or kind=="gpos_single" then + if feat then + for script,languages in next,kern do + local f=feat[script] + if f then + for l in next,languages do + f[l]=true end + else + feat[script]=languages end end + else + feat=kern end - for k,v in next,coverage do - local kern=v[32] - if kern then - if type(kern)~="table" then - left[k]=kern - elseif single then - left[k]=kern[3] - else - local one=kern[1] - if one and one~=true then - left[k]=one[3] + for i=1,#steps do + local step=steps[i] + local coverage=step.coverage + local rules=step.rules + if rules then + elseif not coverage then + elseif kind=="gpos_single" then + elseif kind=="gpos_pair" then + local format=step.format + if format=="move" or format=="kern" then + local kerns=coverage[32] + if kerns then + for k,v in next,kerns do + right[k]=v + end + end + for k,v in next,coverage do + local kern=v[32] + if kern then + left[k]=kern + end + end + elseif format=="pair" then + local kerns=coverage[32] + if kerns then + for k,v in next,kerns do + local one=v[1] + if one and one~=true then + right[k]=one[3] + end + end + end + for k,v in next,coverage do + local kern=v[32] + if kern then + local one=kern[1] + if one and one~=true then + left[k]=one[3] + end + end end end end end - else + last=i end + else end - last=i end - else end - end - left=next(left) and left or false - right=next(right) and right or false - if left or right then - spacekerns={ - left=left, - right=right, - } - if last>0 then - local triggersequence={ - features={ kern=feat or { dflt={ dflt=true,} } }, - flags=noflags, - name="trigger_space_kerns", - order={ "kern" }, - type="trigger_space_kerns", + left=next(left) and left or false + right=next(right) and right or false + if left or right then + spacekerns={ left=left, right=right, } - insert(sequences,last,triggersequence) + if last>0 then + local triggersequence={ + features={ [tag]=feat or { dflt={ dflt=true,} } }, + flags=noflags, + name="trigger_space_kerns", + order={ tag }, + type="trigger_space_kerns", + left=left, + right=right, + } + insert(sequences,last,triggersequence) + end end - else - spacekerns=false end - else - spacekerns=false end resources.spacekerns=spacekerns end -- cgit v1.2.3