diff options
Diffstat (limited to 'tex')
24 files changed, 221 insertions, 127 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index d3e4c17e9..dd19543a1 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{2019.01.25 20:06} +\newcontextversion{2019.01.28 12:25} %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 df4b07429..7b8813e3b 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{2019.01.25 20:06} +\edef\contextversion{2019.01.28 12:25} %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 2aa91bfcd..677fc757a 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{2019.01.25 20:06} +\newcontextversion{2019.01.28 12:25} %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 824690bd1..60e8c1bc4 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -42,7 +42,7 @@ %D has to match \type {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2019.01.25 20:06} +\edef\contextversion{2019.01.28 12:25} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/core-con.lua b/tex/context/base/mkiv/core-con.lua index a17c57208..3829efc9c 100644 --- a/tex/context/base/mkiv/core-con.lua +++ b/tex/context/base/mkiv/core-con.lua @@ -16,7 +16,7 @@ slower but look nicer this way.</p> <p>Some code may move to a module in the language namespace.</p> --ldx]]-- -local floor, date, time, concat = math.floor, os.date, os.time, table.concat +local floor, osdate, ostime, concat = math.floor, os.date, os.time, table.concat local lower, upper, rep, match, gsub = string.lower, string.upper, string.rep, string.match, string.gsub local utfchar, utfbyte = utf.char, utf.byte local tonumber, tostring, type, rawset = tonumber, tostring, type, rawset @@ -308,14 +308,14 @@ local function leapyear(year) end local function textime() - return tonumber(date("%H")) * 60 + tonumber(date("%M")) + return tonumber(osdate("%H")) * 60 + tonumber(osdate("%M")) end -function converters.year () return date("%Y") end -function converters.month () return date("%m") end -function converters.hour () return date("%H") end -function converters.minute() return date("%M") end -function converters.second() return date("%S") end +function converters.year () return osdate("%Y") end +function converters.month () return osdate("%m") end +function converters.hour () return osdate("%H") end +function converters.minute() return osdate("%M") end +function converters.second() return osdate("%S") end converters.weekday = weekday converters.isleapyear = isleapyear @@ -327,11 +327,11 @@ implement { name = "weekday", actions = { weekday, context }, arguments = { "i implement { name = "leapyear", actions = { leapyear, context }, arguments = { "integer" } } implement { name = "nofdays", actions = { nofdays, context }, arguments = { "integer", "integer" } } -implement { name = "year", actions = { date, context }, arguments = "'%Y'" } -implement { name = "month", actions = { date, context }, arguments = "'%m'" } -implement { name = "hour", actions = { date, context }, arguments = "'%H'" } -implement { name = "minute", actions = { date, context }, arguments = "'%M'" } -implement { name = "second", actions = { date, context }, arguments = "'%S'" } +implement { name = "year", actions = { osdate, context }, arguments = "'%Y'" } +implement { name = "month", actions = { osdate, context }, arguments = "'%m'" } +implement { name = "hour", actions = { osdate, context }, arguments = "'%H'" } +implement { name = "minute", actions = { osdate, context }, arguments = "'%M'" } +implement { name = "second", actions = { osdate, context }, arguments = "'%S'" } implement { name = "textime", actions = { textime, context } } implement { @@ -1268,32 +1268,65 @@ do arguments = { "integer" } } - local f_month = formatters["\\month{%s}"] + local f_monthlong = formatters["\\monthlong{%s}"] local f_monthshort = formatters["\\monthshort{%s}"] local f_weekday = formatters["\\weekday{%s}"] local f_dayoftheweek = formatters["\\dayoftheweek{%s}{%s}{%s}"] - local function tomonth(m) - return f_month(tonumber(m) or 1) - end - - local function tomonthshort(m) - return f_monthshort(tonumber(m) or 1) - end - - local function toweekday(d) - return f_weekday(tonumber(d) or 1) - end + local function tomonthlong (m) return f_monthlong (tonumber(m) or 1) end + local function tomonthshort(m) return f_monthshort(tonumber(m) or 1) end + local function toweekday (d) return f_weekday (tonumber(d) or 1) end local function todayoftheweek(d,m,y) return f_dayoftheweek(tonumber(d) or 1,tonumber(m) or 1,tonumber(y) or 2000) end - addformatter(formatters,"month", [[tomonth(%s)]], { tomonth = tomonth }) + addformatter(formatters,"monthlong", [[tomonthlong(%s)]], { tomonthlong = tomonthlong }) addformatter(formatters,"monthshort", [[tomonthshort(%s)]], { tomonthshort = tomonthshort }) addformatter(formatters,"weekday", [[toweekday(%s)]], { toweekday = toweekday }) addformatter(formatters,"dayoftheweek",[[todayoftheweek(%s,%s,%s)]],{ todayoftheweek = todayoftheweek }) + -- using %t is slower, even with caching as we seldom use > 3 items per epoch + + local function toeyear (e) return osdate("%Y",tonumber(e)) end + local function toemonth (e) return osdate("%m",tonumber(e)) end + local function toeday (e) return osdate("%d",tonumber(e)) end + local function toeminute(e) return osdate("%M",tonumber(e)) end + local function toesecond(e) return osdate("%S",tonumber(e)) end + + local function toemonthlong(e) + return f_monthlong(tonumber(osdate("%m",tonumber(e)))) + end + + local function toemonthshort(e) + return f_monthshort(tonumber(osdate("%m",tonumber(e)))) + end + + local function toeweek(e) -- we run from 1-7 not 0-6 + return tostring(tonumber(osdate("%w",tonumber(e)))+1) + end + + local function toeweekday(e) + return f_weekday(tonumber(osdate("%w",tonumber(e)))+1) + end + + local function toedate(format,e) + return osdate(format,tonumber(e)) + end + + addformatter(formatters,"eyear", [[toeyear(%s)]], { toeyear = toeyear }) + addformatter(formatters,"emonth", [[toemonth(%s)]], { toemonth = toemonth }) + addformatter(formatters,"eday", [[toeday(%s)]], { toeday = toeday }) + addformatter(formatters,"eweek", [[toeweek(%s)]], { toeweek = toeweek }) + addformatter(formatters,"eminute", [[toeminute(%s)]], { toeminute = toeminute }) + addformatter(formatters,"esecond", [[toesecond(%s)]], { toesecond = toesecond }) + + addformatter(formatters,"emonthlong", [[toemonthlong(%s)]], { toemonthlong = toemonthlong }) + addformatter(formatters,"emonthshort", [[toemonthshort(%s)]], { toemonthshort = toemonthshort }) + addformatter(formatters,"eweekday", [[toeweekday(%s)]], { toeweekday = toeweekday }) + + addformatter(formatters,"edate", [[toedate(%s,%s)]], { toedate = toedate }) + end -- a prelude to a function that we can use at the lua end diff --git a/tex/context/base/mkiv/core-con.mkiv b/tex/context/base/mkiv/core-con.mkiv index 85b988c88..5ccc5ed35 100644 --- a/tex/context/base/mkiv/core-con.mkiv +++ b/tex/context/base/mkiv/core-con.mkiv @@ -416,9 +416,9 @@ \newtoks \everycurrentdate \def\syst_converters_check_date - {\edef\temp{\systemparameter\c!y}\scratchcounterone \ifx\temp\empty\normalyear \else\temp\fi + {\edef\temp{\systemparameter\c!d}\scratchcounterone \ifx\temp\empty\normalday \else\temp\fi \edef\temp{\systemparameter\c!m}\scratchcountertwo \ifx\temp\empty\normalmonth\else\temp\fi - \edef\temp{\systemparameter\c!d}\scratchcounterthree\ifx\temp\empty\normalday \else\temp\fi} + \edef\temp{\systemparameter\c!y}\scratchcounterthree\ifx\temp\empty\normalyear \else\temp\fi} \unexpanded\def\currentdate {\dosingleempty\syst_converters_current_date} diff --git a/tex/context/base/mkiv/font-def.lua b/tex/context/base/mkiv/font-def.lua index 2deb04744..f3d0f8187 100644 --- a/tex/context/base/mkiv/font-def.lua +++ b/tex/context/base/mkiv/font-def.lua @@ -340,7 +340,7 @@ local function checkfeatures(tfmdata) for script, languages in next, scripts do if languages["*"] then -- ok - elseif not languages[usedlanguage] then + elseif context and not languages[usedlanguage] then report_defining("font %!font:name!, feature %a, script %a, no language %a", tfmdata,feature,script,usedlanguage) end @@ -360,7 +360,7 @@ local function checkfeatures(tfmdata) if not languages["*"] then for i=1,#foundlanguages do local language = foundlanguages[i] - if not languages[language] then + if context and not languages[language] then report_defining("font %!font:name!, feature %a, script %a, no language %a", tfmdata,feature,script,language) end diff --git a/tex/context/base/mkiv/font-otj.lua b/tex/context/base/mkiv/font-otj.lua index 8d1b540be..df9756f4e 100644 --- a/tex/context/base/mkiv/font-otj.lua +++ b/tex/context/base/mkiv/font-otj.lua @@ -469,15 +469,18 @@ function injections.setmark(start,base,factor,rlmode,ba,ma,tfmbase,mkmk,checkmar if i.markmark then -- out of order mkmk: yes or no or option else - if dx ~= 0 then - i.markx = dx - end - if y ~= 0 then - i.marky = dy - end - if rlmode then - i.markdir = rlmode - end + -- if dx ~= 0 then + -- i.markx = dx + -- end + -- if y ~= 0 then + -- i.marky = dy + -- end + -- if rlmode then + -- i.markdir = rlmode + -- end + i.markx = dx + i.marky = dy + i.markdir = rlmode or 0 i.markbase = nofregisteredmarks i.markbasenode = base i.markmark = mkmk @@ -690,7 +693,8 @@ local function inject_kerns_only(head,where) -- glyph|disc|glyph (special case) local leftkern = i.leftkern if leftkern and leftkern ~= 0 then - setfield(prev,"replace",fontkern(leftkern)) -- maybe also leftkern + replace = fontkern(leftkern) + done = true end end end @@ -831,7 +835,9 @@ local function inject_positions_only(head,where) if replace then -- error, we expect an empty one else - setfield(next,"replace",fontkern(rightkern)) -- maybe also leftkern +--KE setfield(next,"replace",fontkern(rightkern)) -- maybe also leftkern + replace = fontkern(rightkern) -- maybe also leftkern --KE + done = true --KE end end end @@ -864,7 +870,8 @@ local function inject_positions_only(head,where) -- new .. okay? local leftkern = i.leftkern if leftkern and leftkern ~= 0 then - setfield(prev,"replace",fontkern(leftkern)) -- maybe also leftkern + replace = fontkern(leftkern) + done = true end end end @@ -1280,7 +1287,8 @@ local function inject_everything(head,where) if replace then -- error, we expect an empty one else - setfield(next,"replace",fontkern(rightkern)) -- maybe also leftkern + replace = fontkern(rightkern) + done = true end end end @@ -1313,7 +1321,8 @@ local function inject_everything(head,where) if i then local leftkern = i.leftkern if leftkern and leftkern ~= 0 then - setfield(prev,"replace",fontkern(leftkern)) -- maybe also leftkern + replace = fontkern(leftkern) + done = true end end end diff --git a/tex/context/base/mkiv/font-ots.lua b/tex/context/base/mkiv/font-ots.lua index 1c6c30f81..4d011a934 100644 --- a/tex/context/base/mkiv/font-ots.lua +++ b/tex/context/base/mkiv/font-ots.lua @@ -844,7 +844,7 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skip local tail = getprev(stop) local copy = copy_node_list(start) local liat = find_node_tail(copy) - if pre and replace then + if pre then setlink(liat,pre) end if replace then @@ -2655,7 +2655,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s end end else - notmatchreplace[prev] = true -- new, for Kai to check + -- notmatchreplace[prev] = true -- not according to Kai end end prev = getprev(prev) @@ -2784,7 +2784,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s end end else - notmatchreplace[current] = true -- new, for Kai to check + -- notmatchreplace[current] = true -- not according to Kai end current = getnext(current) elseif id == glue_code then @@ -3192,7 +3192,7 @@ local function testrun(disc,t_run,c_run,...) local d = d_replace > d_post and d_replace or d_post local head = getnext(disc) -- is: next local tail = head - for i=1,d do + for i=2,d do -- must start at 2 according to Kai local nx = getnext(tail) local id = getid(nx) if id == disc_code then diff --git a/tex/context/base/mkiv/lpdf-fmt.lua b/tex/context/base/mkiv/lpdf-fmt.lua index e0ba612c4..25a72fa49 100644 --- a/tex/context/base/mkiv/lpdf-fmt.lua +++ b/tex/context/base/mkiv/lpdf-fmt.lua @@ -116,6 +116,7 @@ local formats = utilities.storage.allocate { jbig2_compression = true, -- todo: block at lua level jpeg2000_compression = true, -- todo: block at lua level include_cidsets = true, + include_charsets = true, inject_metadata = function() -- nothing end @@ -131,6 +132,7 @@ local formats = utilities.storage.allocate { spot_colors = true, internal_icc_profiles = true, include_cidsets = true, + include_charsets = true, inject_metadata = function() addtoinfo("GTS_PDFXVersion","PDF/X-1a:2001") injectxmpinfo("xml://rdf:RDF","<rdf:Description rdf:about='' xmlns:pdfxid='http://www.npes.org/pdfx/ns/id/'><pdfxid:GTS_PDFXVersion>PDF/X-1a:2001</pdfxid:GTS_PDFXVersion></rdf:Description>",false) @@ -146,6 +148,7 @@ local formats = utilities.storage.allocate { spot_colors = true, internal_icc_profiles = true, include_cidsets = true, + include_charsets = true, inject_metadata = function() addtoinfo("GTS_PDFXVersion","PDF/X-1a:2003") injectxmpinfo("xml://rdf:RDF","<rdf:Description rdf:about='' xmlns:pdfxid='http://www.npes.org/pdfx/ns/id/'><pdfxid:GTS_PDFXVersion>PDF/X-1a:2003</pdfxid:GTS_PDFXVersion></rdf:Description>",false) @@ -165,6 +168,7 @@ local formats = utilities.storage.allocate { internal_icc_profiles = true, include_intents = true, include_cidsets = true, + include_charsets = true, inject_metadata = function() addtoinfo("GTS_PDFXVersion","PDF/X-3:2002") end @@ -184,6 +188,7 @@ local formats = utilities.storage.allocate { include_intents = true, jbig2_compression = true, include_cidsets = true, + include_charsets = true, inject_metadata = function() addtoinfo("GTS_PDFXVersion","PDF/X-3:2003") end @@ -207,6 +212,7 @@ local formats = utilities.storage.allocate { jpeg2000_compression = true, object_compression = true, include_cidsets = true, + include_charsets = true, inject_metadata = function() injectxmpinfo("xml://rdf:RDF","<rdf:Description rdf:about='' xmlns:pdfxid='http://www.npes.org/pdfx/ns/id/'><pdfxid:GTS_PDFXVersion>PDF/X-4</pdfxid:GTS_PDFXVersion></rdf:Description>",false) insertxmpinfo("xml://rdf:Description/xmpMM:InstanceID","<xmpMM:VersionID>1</xmpMM:VersionID>",false) @@ -233,6 +239,7 @@ local formats = utilities.storage.allocate { jpeg2000_compression = true, object_compression = true, include_cidsets = true, + include_charsets = true, inject_metadata = function() injectxmpinfo("xml://rdf:RDF","<rdf:Description rdf:about='' xmlns:pdfxid='http://www.npes.org/pdfx/ns/id/'><pdfxid:GTS_PDFXVersion>PDF/X-4p</pdfxid:GTS_PDFXVersion></rdf:Description>",false) insertxmpinfo("xml://rdf:Description/xmpMM:InstanceID","<xmpMM:VersionID>1</xmpMM:VersionID>",false) @@ -259,6 +266,7 @@ local formats = utilities.storage.allocate { jpeg2000_compression = true, object_compression = true, include_cidsets = true, + include_charsets = true, inject_metadata = function() -- todo end @@ -284,6 +292,7 @@ local formats = utilities.storage.allocate { jpeg2000_compression = true, object_compression = true, include_cidsets = true, + include_charsets = true, inject_metadata = function() -- todo end @@ -308,6 +317,7 @@ local formats = utilities.storage.allocate { nchannel_colorspace = true, object_compression = true, include_cidsets = true, + include_charsets = true, inject_metadata = function() -- todo end @@ -328,6 +338,7 @@ local formats = utilities.storage.allocate { tagging = true, -- NEW; the only difference to PDF/A-1b internal_icc_profiles = true, include_cidsets = true, + include_charsets = true, inject_metadata = function() injectxmpinfo("xml://rdf:RDF","<rdf:Description rdf:about='' xmlns:pdfaid='http://www.aiim.org/pdfa/ns/id/'><pdfaid:part>1</pdfaid:part><pdfaid:conformance>A</pdfaid:conformance></rdf:Description>",false) end @@ -347,6 +358,7 @@ local formats = utilities.storage.allocate { forms = true, internal_icc_profiles = true, include_cidsets = true, + include_charsets = true, inject_metadata = function() injectxmpinfo("xml://rdf:RDF","<rdf:Description rdf:about='' xmlns:pdfaid='http://www.aiim.org/pdfa/ns/id/'><pdfaid:part>1</pdfaid:part><pdfaid:conformance>B</pdfaid:conformance></rdf:Description>",false) end @@ -371,6 +383,7 @@ local formats = utilities.storage.allocate { jpeg2000_compression = true, -- NEW object_compression = true, include_cidsets = false, + include_charsets = false, inject_metadata = function() injectxmpinfo("xml://rdf:RDF","<rdf:Description rdf:about='' xmlns:pdfaid='http://www.aiim.org/pdfa/ns/id/'><pdfaid:part>2</pdfaid:part><pdfaid:conformance>A</pdfaid:conformance></rdf:Description>",false) end @@ -395,6 +408,7 @@ local formats = utilities.storage.allocate { jpeg2000_compression = true, object_compression = true, include_cidsets = false, + include_charsets = false, inject_metadata = function() injectxmpinfo("xml://rdf:RDF","<rdf:Description rdf:about='' xmlns:pdfaid='http://www.aiim.org/pdfa/ns/id/'><pdfaid:part>3</pdfaid:part><pdfaid:conformance>A</pdfaid:conformance></rdf:Description>",false) end @@ -418,6 +432,7 @@ local formats = utilities.storage.allocate { jpeg2000_compression = true, object_compression = true, include_cidsets = true, + include_charsets = true, --- really ? inject_metadata = function() injectxmpinfo("xml://rdf:RDF","<rdf:Description rdf:about='' xmlns:pdfaid='http://www.aiim.org/pdfa/ns/id/'><pdfaid:part>3</pdfaid:part><pdfaid:conformance>A</pdfaid:conformance></rdf:Description>",false) injectxmpinfo("xml://rdf:RDF","<rdf:Description rdf:about='' xmlns:pdfuaid='http://www.aiim.org/pdfua/ns/id/'><pdfuaid:part>1</pdfuaid:part></rdf:Description>",false) @@ -756,7 +771,8 @@ function codeinjections.setformat(s) -- cid sets can always omitted now, but those validators still complain so let's -- for a while keep it (for luigi): -- - lpdf.setomitcidset(formatspecification.include_cidsets == false and 1 or 0) + lpdf.setomitcidset (formatspecification.include_cidsets == false and 1 or 0) + lpdf.setomitcharset(formatspecification.include_charsets == false and 1 or 0) -- -- context.setupcolors { -- not this way -- cmyk = spec.cmyk_colors and variables.yes or variables.no, diff --git a/tex/context/base/mkiv/lpdf-ini.lua b/tex/context/base/mkiv/lpdf-ini.lua index 37427cde0..055356a4b 100644 --- a/tex/context/base/mkiv/lpdf-ini.lua +++ b/tex/context/base/mkiv/lpdf-ini.lua @@ -89,6 +89,7 @@ local getobjectcompresslevel = pdf.getobjcompresslevel local setsuppressoptionalinfo = pdf.setsuppressoptionalinfo local setomitcidset = pdf.setomitcidset +local setomitcharset = pdf.setomitcharset or function() end local function pdfdisablecommand(command) pdf[command] = function() @@ -102,6 +103,7 @@ pdfdisablecommand("setnames") pdfdisablecommand("settrailer") pdfdisablecommand("settrailerid") pdfdisablecommand("setomitcidset") +pdfdisablecommand("setomitcharset") pdfdisablecommand("setpageresources") pdfdisablecommand("setpageattributes") pdfdisablecommand("setpagesattributes") @@ -145,6 +147,7 @@ updaters.register("backend.update.lpdf",function() setsuppressoptionalinfo = pdf.setsuppressoptionalinfo setomitcidset = pdf.setomitcidset + setomitcharset = pdf.setomitcharset pdfdisablecommand("setinfo") pdfdisablecommand("setcatalog") @@ -236,6 +239,10 @@ function lpdf.setomitcidset(v) return setomitcidset(v) end +function lpdf.setomitcharset(v) + return setomitcharset(v) +end + local jobpositions = job.positions local getpos = jobpositions.getpos diff --git a/tex/context/base/mkiv/node-pro.lua b/tex/context/base/mkiv/node-pro.lua index 5bb396d86..b6b130588 100644 --- a/tex/context/base/mkiv/node-pro.lua +++ b/tex/context/base/mkiv/node-pro.lua @@ -76,16 +76,16 @@ do local tracer = processors.tracer - local function pre_linebreak_filter(head,groupcode) -- ,size,packtype,direction + local function pre_linebreak_filter(head,groupcode) local found = force_processors or has_glyph(head) if found then if trace_callbacks then local before = count_nodes(head,true) - head = actions(head,groupcode) -- ,size,packtype,direction + head = actions(head,groupcode) local after = count_nodes(head,true) tracer("pre_linebreak",head,groupcode,before,after,true) else - head = actions(head,groupcode) -- ,size,packtype,direction + head = actions(head,groupcode) end elseif trace_callbacks then local n = count_nodes(head,false) diff --git a/tex/context/base/mkiv/page-mul.mkiv b/tex/context/base/mkiv/page-mul.mkiv index ad9f75871..957981703 100644 --- a/tex/context/base/mkiv/page-mul.mkiv +++ b/tex/context/base/mkiv/page-mul.mkiv @@ -890,6 +890,7 @@ \def\page_mul_routine_balance {\bgroup + % why no \forgetall here \page_mul_initialize_variables \widowpenalty\zerocount \setbox\b_page_mul_balance_content\vbox{\unvbox\normalpagebox}% diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 591118f62..72f45c039 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex e4ab24ae0..07cb7dd16 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/strc-flt.mkvi b/tex/context/base/mkiv/strc-flt.mkvi index 4ca7d3fbf..02f6fd753 100644 --- a/tex/context/base/mkiv/strc-flt.mkvi +++ b/tex/context/base/mkiv/strc-flt.mkvi @@ -2044,7 +2044,7 @@ \vpack to \onepoint{\box\b_strc_floats_caption}} \def\strc_floats_build_box_separate_split#1% - {\setbox\scratchbox\vbox{% + {\setbox\scratchbox\vbox\bgroup \setbox\scratchbox\vpack{#1}% \unvbox\scratchbox\relax \setbox\scratchbox\lastbox @@ -2055,13 +2055,20 @@ \unvbox\scratchbox \setbox\scratchbox\lastbox % \exitloop - % \fi}% + % \fi + %}% \splittopskip\zeropoint \global\setbox\b_strc_floats_separate_content\vsplit\scratchbox to \onepoint \global\setbox\b_strc_floats_separate_caption\vsplit\scratchbox to \onepoint - \global\setbox\b_strc_floats_separate_content\vpack{\unvbox\b_strc_floats_separate_content\setbox0\lastbox\unvbox0}% - \global\setbox\b_strc_floats_separate_caption\tpack{\unvbox\b_strc_floats_separate_caption\setbox0\lastbox\unvbox0}% - }} + \egroup + \global\setbox\b_strc_floats_separate_content\vpack + {\unvbox\b_strc_floats_separate_content + \setbox\scratchbox\lastbox + \unvbox\scratchbox}% + \global\setbox\b_strc_floats_separate_caption\tpack + {\unvbox\b_strc_floats_separate_caption + \setbox\scratchbox\lastbox + \unvbox\scratchbox}} % \def\strc_floats_build_box_step#1% % {\doifdefined{\??floatbuilder#1}{\def\floatcaptionarrangement{#1}\quitcommalist}} diff --git a/tex/context/base/mkiv/typo-brk.lua b/tex/context/base/mkiv/typo-brk.lua index 34d4071aa..76e50ce18 100644 --- a/tex/context/base/mkiv/typo-brk.lua +++ b/tex/context/base/mkiv/typo-brk.lua @@ -75,14 +75,14 @@ local new_wordboundary = nodepool.wordboundary local nodecodes = nodes.nodecodes local kerncodes = nodes.kerncodes -local glyph_code = nodecodes.glyph local kern_code = nodecodes.kern local math_code = nodecodes.math local fontkern_code = kerncodes.fontkern ------ userkern_code = kerncodes.userkern local italickern_code = kerncodes.italiccorrection +local is_letter = characters.is_letter + local typesetters = typesetters typesetters.breakpoints = typesetters.breakpoints or {} @@ -321,17 +321,21 @@ function breakpoints.handler(head) local stop = data[2] local cmap = data[3] local smap = data[4] --- local lang = getlang(start) -- -- we do a sanity check for language +-- local lang = getlang(start) -- local smap = lang and lang >= 0 and lang < 0x7FFF and (cmap[numbers[lang]] or cmap[""]) -- if smap then local nleft = smap.nleft local cleft = 0 local prev = getprev(start) - local kern = nil + local kern = nil while prev and nleft ~= cleft do - local id = getid(prev) - if id == glyph_code then + local char, id = isglyph(prev) + if char then + if not is_letter[char] then + cleft = -1 + break + end cleft = cleft + 1 prev = getprev(prev) elseif id == kern_code then @@ -357,6 +361,10 @@ function breakpoints.handler(head) while next and nright ~= cright do local char, id = isglyph(next) if char then + if not is_letter[char] then + cright = -1 + break + end if cright == 1 and cmap[char] then -- let's not make it too messy break diff --git a/tex/context/base/mkiv/typo-dir.lua b/tex/context/base/mkiv/typo-dir.lua index 78b95117f..88c84bd02 100644 --- a/tex/context/base/mkiv/typo-dir.lua +++ b/tex/context/base/mkiv/typo-dir.lua @@ -166,7 +166,7 @@ local stoptiming = statistics.stoptiming -- -- \enabledirectives[typesetters.directions.onetoo] -function directions.handler(head,_,_,_,direction) +function directions.handler(head,where,_,_,direction) local only_one = not getnext(head) if only_one and not one_too then return head @@ -181,7 +181,7 @@ function directions.handler(head,_,_,_,direction) return head end starttiming(directions) - head = handler(head,direction,only_one) + head = handler(head,direction,only_one,where) stoptiming(directions) return head end diff --git a/tex/context/base/mkiv/typo-dua.lua b/tex/context/base/mkiv/typo-dua.lua index c4b359745..095d66eae 100644 --- a/tex/context/base/mkiv/typo-dua.lua +++ b/tex/context/base/mkiv/typo-dua.lua @@ -419,7 +419,7 @@ local function resolve_explicit(list,size,baselevel) end -- X7 elseif direction == "pdf" then - if nofstack < maximum_stack then + if noifstack > 0 then local stacktop = stack[nofstack] nofstack = nofstack - 1 level = stacktop[1] @@ -428,7 +428,7 @@ local function resolve_explicit(list,size,baselevel) entry.direction = "bn" entry.remove = true elseif trace_directions then - report_directions("stack overflow at position %a with direction %a",i,direction) + report_directions("stack underflow at position %a with direction %a",i,direction) end -- X6 else diff --git a/tex/context/base/mkiv/typo-dub.lua b/tex/context/base/mkiv/typo-dub.lua index 1a9a91ae6..fde31ca93 100644 --- a/tex/context/base/mkiv/typo-dub.lua +++ b/tex/context/base/mkiv/typo-dub.lua @@ -490,7 +490,7 @@ local function resolve_explicit(list,size,baselevel) end -- X7 elseif direction == "pdf" then - if nofstack < maximum_stack then + if nofstack > 0 then local stacktop = stack[nofstack] nofstack = nofstack - 1 level = stacktop[1] @@ -499,7 +499,7 @@ local function resolve_explicit(list,size,baselevel) entry.direction = "bn" entry.remove = true elseif trace_directions then - report_directions("stack overflow at position %a with direction %a",i,direction) + report_directions("stack underflow at position %a with direction %a",i,direction) end -- X6 else diff --git a/tex/context/base/mkiv/typo-duc.lua b/tex/context/base/mkiv/typo-duc.lua index 597042b37..c1338d0d1 100644 --- a/tex/context/base/mkiv/typo-duc.lua +++ b/tex/context/base/mkiv/typo-duc.lua @@ -66,6 +66,7 @@ local getchar = nuts.getchar local getattr = nuts.getattr local getprop = nuts.getprop local getdirection = nuts.getdirection +local isglyph = nuts.isglyph local setprop = nuts.setprop local setchar = nuts.setchar @@ -247,16 +248,16 @@ end -- tracking what direction is used and skipping tests is not faster (extra kind of -- compensates gain) -local mt_space = { __index = { char = 0x0020, direction = "ws", original = "ws", level = 0 } } -local mt_lre = { __index = { char = 0x202A, direction = "lre", original = "lre", level = 0 } } -local mt_rle = { __index = { char = 0x202B, direction = "rle", original = "rle", level = 0 } } -local mt_pdf = { __index = { char = 0x202C, direction = "pdf", original = "pdf", level = 0 } } -local mt_object = { __index = { char = 0xFFFC, direction = "on", original = "on", level = 0 } } +local mt_space = { __index = { char = 0x0020, direction = "ws", original = "ws", level = 0, skip = 0 } } +local mt_lre = { __index = { char = 0x202A, direction = "lre", original = "lre", level = 0, skip = 0 } } +local mt_rle = { __index = { char = 0x202B, direction = "rle", original = "rle", level = 0, skip = 0 } } +local mt_pdf = { __index = { char = 0x202C, direction = "pdf", original = "pdf", level = 0, skip = 0 } } +local mt_object = { __index = { char = 0xFFFC, direction = "on", original = "on", level = 0, skip = 0 } } local stack = table.setmetatableindex("table") -- shared local list = { } -- shared -local function build_list(head) -- todo: store node pointer ... saves loop +local function build_list(head,where) -- todo: store node pointer ... saves loop -- P1 local current = head local size = 0 @@ -265,6 +266,7 @@ local function build_list(head) -- todo: store node pointer ... saves loop local id = getid(current) local p = properties[current] if p and p.directions then + -- tricky as dirs can be injected in between local skip = 0 local last = id current = getnext(current) @@ -287,6 +289,7 @@ local function build_list(head) -- todo: store node pointer ... saves loop elseif id == glyph_code then local chr = getchar(current) local dir = directiondata[chr] + -- could also be a metatable list[size] = { char = chr, direction = dir, original = dir, level = 0 } current = getnext(current) -- if not list[dir] then list[dir] = true end -- not faster when we check for usage @@ -296,9 +299,9 @@ local function build_list(head) -- todo: store node pointer ... saves loop elseif id == dir_code then local dir, pop = getdirection(current) if dir == lefttoright_code then - list[size] = setmetatable({ },swap and mt_pdf or mt_lre) + list[size] = setmetatable({ },pop and mt_pdf or mt_lre) elseif dir == righttoleft_code then - list[size] = setmetatable({ },swap and mt_pdf or mt_rle) + list[size] = setmetatable({ },pop and mt_pdf or mt_rle) else list[size] = setmetatable({ id = id },mt_object) end @@ -353,6 +356,7 @@ end local function resolve_fences(list,size,start,limit) -- N0: funny effects, not always better, so it's an option + local stack = { } local nofstack = 0 for i=start,limit do local entry = list[i] @@ -368,7 +372,6 @@ local function resolve_fences(list,size,start,limit) local stacktop = stack[nofstack] stacktop[1] = mirror stacktop[2] = i - stacktop[3] = false -- not used elseif nofstack == 0 then -- skip elseif class == "close" then @@ -411,15 +414,15 @@ local function get_baselevel(head,list,size,direction) return direction, true elseif getid(head) == localpar_code and getsubtype(head) == 0 then direction = getdirection(head) - if direction == righttoleft_code or direction == lefttoright_code then + if direction == lefttoright_code or direction == righttoleft_code then return direction, true end end -- for old times sake we we handle strings too if direction == "TLT" then - return righttoleft_code, true - elseif direction == "TRT" then return lefttoright_code, true + elseif direction == "TRT" then + return righttoleft_code, true end -- P2, P3: for i=1,size do @@ -505,7 +508,7 @@ local function resolve_explicit(list,size,baselevel) end -- X7 elseif direction == "pdf" then - if nofstack < maximum_stack then + if nofstack > 0 then local stacktop = stack[nofstack] level = stacktop[1] override = stacktop[2] @@ -514,7 +517,11 @@ local function resolve_explicit(list,size,baselevel) entry.direction = "bn" entry.remove = true elseif trace_directions then - report_directions("stack overflow at position %a with direction %a",i,direction) + report_directions("stack underflow at position %a with direction %a", + i, direction) + else + report_directions("stack underflow at position %a with direction %a: %s", + i, direction, show_list(list,size)) end -- X6 else @@ -899,6 +906,10 @@ local function insert_dir_points(list,size) end end +-- We flag nodes that can be skipped when we see them again but because whatever +-- mechanism can injetc dir nodes that then are not flagged, we don't flag dir +-- nodes that we inject here. + local function apply_to_list(list,size,head,pardir) local index = 1 local current = head @@ -914,7 +925,12 @@ local function apply_to_list(list,size,head,pardir) local entry = list[index] local begindir = entry.begindir local enddir = entry.enddir - local p = properties[current] if p then p.directions = true else properties[current] = { directions = true } end + local p = properties[current] + if p then + p.directions = true + else + properties[current] = { directions = true } + end if id == glyph_code then local mirror = entry.mirror if mirror then @@ -939,40 +955,33 @@ local function apply_to_list(list,size,head,pardir) elseif id == glue_code then if enddir and getsubtype(current) == parfillskip_code then -- insert the last enddir before \parfillskip glue - local d = new_direction(enddir,true) - local p = properties[d] if p then p.directions = true else properties[d] = { directions = true } end - -- setattrlist(d,current) - head = insert_node_before(head,current,d) + head = insert_node_before(head,current,new_direction(enddir,true)) enddir = false end elseif begindir then if id == localpar_code and getsubtype(current) == 0 then -- localpar should always be the 1st node - local d = new_direction(begindir) - local p = properties[d] if p then p.directions = true else properties[d] = { directions = true } end - -- setattrlist(d,current) - head, current = insert_node_after(head,current,d) + head, current = insert_node_after(head,current,new_direction(begindir)) begindir = nil end end if begindir then - local d = new_direction(begindir) - local p = properties[d] if p then p.directions = true else properties[d] = { directions = true } end - -- setattrlist(d,current) - head = insert_node_before(head,current,d) + head = insert_node_before(head,current,new_direction(begindir)) end local skip = entry.skip if skip and skip > 0 then for i=1,skip do current = getnext(current) - local p = properties[current] if p then p.directions = true else properties[current] = { directions = true } end + local p = properties[current] + if p then + p.directions = true + else + properties[current] = { directions = true } + end end end if enddir then - local d = new_direction(enddir,true) - local p = properties[d] if p then p.directions = true else properties[d] = { directions = true } end - -- setattrlist(d,current) - head, current = insert_node_after(head,current,d) + head, current = insert_node_after(head,current,new_direction(enddir,true)) end if not entry.remove then current = getnext(current) @@ -996,12 +1005,19 @@ end -- have more than one node. Actually, we only enter this function when we -- do have a glyph! -local function process(head,direction,only_one) +local function process(head,direction,only_one,where) + +-- print("START") +-- for n in nodes.traverse(nodes.tonode(head)) do +-- print(" "..tostring(n)) +-- end +-- print("STOP") + -- for the moment a whole paragraph property local attr = getattr(head,a_directions) local analyze_fences = getfences(attr) -- - local list, size = build_list(head) + local list, size = build_list(head,where) local baselevel, dirfound = get_baselevel(head,list,size,direction) -- we always have an inline dir node in context if trace_details then report_directions("analyze: baselevel %a",baselevel == righttoleft_code and "r2l" or "l2r") diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex 6f7618b57..d22baf534 100644 --- a/tex/context/interface/mkiv/i-context.pdf +++ b/tex/context/interface/mkiv/i-context.pdf diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf Binary files differindex 859484617..f9549aebf 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 02f50d6e7..5c6661592 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 : 01/25/19 20:06:50 +-- merge date : 01/28/19 12:25:54 do -- begin closure to overcome local limits and interference @@ -23952,15 +23952,9 @@ function injections.setmark(start,base,factor,rlmode,ba,ma,tfmbase,mkmk,checkmar if i then if i.markmark then else - if dx~=0 then - i.markx=dx - end - if y~=0 then - i.marky=dy - end - if rlmode then - i.markdir=rlmode - end + i.markx=dx + i.marky=dy + i.markdir=rlmode or 0 i.markbase=nofregisteredmarks i.markbasenode=base i.markmark=mkmk @@ -24154,7 +24148,8 @@ local function inject_kerns_only(head,where) if i then local leftkern=i.leftkern if leftkern and leftkern~=0 then - setfield(prev,"replace",fontkern(leftkern)) + replace=fontkern(leftkern) + done=true end end end @@ -24282,7 +24277,8 @@ local function inject_positions_only(head,where) if next and getid(next)==disc_code then if replace then else - setfield(next,"replace",fontkern(rightkern)) + replace=fontkern(rightkern) + done=true end end end @@ -24314,7 +24310,8 @@ local function inject_positions_only(head,where) if i then local leftkern=i.leftkern if leftkern and leftkern~=0 then - setfield(prev,"replace",fontkern(leftkern)) + replace=fontkern(leftkern) + done=true end end end @@ -24634,7 +24631,8 @@ local function inject_everything(head,where) if next and getid(next)==disc_code then if replace then else - setfield(next,"replace",fontkern(rightkern)) + replace=fontkern(rightkern) + done=true end end end @@ -24667,7 +24665,8 @@ local function inject_everything(head,where) if i then local leftkern=i.leftkern if leftkern and leftkern~=0 then - setfield(prev,"replace",fontkern(leftkern)) + replace=fontkern(leftkern) + done=true end end end @@ -26014,7 +26013,7 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skip local tail=getprev(stop) local copy=copy_node_list(start) local liat=find_node_tail(copy) - if pre and replace then + if pre then setlink(liat,pre) end if replace then @@ -27563,7 +27562,6 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s end end else - notmatchreplace[prev]=true end end prev=getprev(prev) @@ -27683,7 +27681,6 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s end end else - notmatchreplace[current]=true end current=getnext(current) elseif id==glue_code then @@ -27999,7 +27996,7 @@ local function testrun(disc,t_run,c_run,...) local d=d_replace>d_post and d_replace or d_post local head=getnext(disc) local tail=head - for i=1,d do + for i=2,d do local nx=getnext(tail) local id=getid(nx) if id==disc_code then @@ -34206,7 +34203,7 @@ local function checkfeatures(tfmdata) else for script,languages in next,scripts do if languages["*"] then - elseif not languages[usedlanguage] then + elseif context and not languages[usedlanguage] then report_defining("font %!font:name!, feature %a, script %a, no language %a", tfmdata,feature,script,usedlanguage) end @@ -34226,7 +34223,7 @@ local function checkfeatures(tfmdata) if not languages["*"] then for i=1,#foundlanguages do local language=foundlanguages[i] - if not languages[language] then + if context and not languages[language] then report_defining("font %!font:name!, feature %a, script %a, no language %a", tfmdata,feature,script,language) end |