diff options
author | Hans Hagen <pragma@wxs.nl> | 2017-08-02 19:40:52 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2017-08-02 19:40:52 +0200 |
commit | ee627840c85edc7b073d0582632dcc4da82a1e83 (patch) | |
tree | ff490354230b8ea3a1d75bbb879aae1823895725 /tex | |
parent | 391b705af1c22eaa6027d18a146e8d3fafc8832f (diff) | |
download | context-ee627840c85edc7b073d0582632dcc4da82a1e83.tar.gz |
2017-08-02 19:04:00
Diffstat (limited to 'tex')
29 files changed, 393 insertions, 128 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 9acd3d260..ad39ff810 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.01 18:10} +\newcontextversion{2017.08.02 18:59} %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 630a19c49..5bb3e1b31 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.01 18:10} +\edef\contextversion{2017.08.02 18:59} %D For those who want to use this: diff --git a/tex/context/base/mkiv/attr-col.lua b/tex/context/base/mkiv/attr-col.lua index 48f2f2ac6..28e63b177 100644 --- a/tex/context/base/mkiv/attr-col.lua +++ b/tex/context/base/mkiv/attr-col.lua @@ -358,7 +358,7 @@ local function reviver(data,n) else local model = colors.forcedmodel(v[1]) if model == 2 then - local gray= graycolor(v[2]) + local gray = graycolor(v[2]) d = { gray, gray, gray, gray } elseif model == 3 then local gray, rgb, cmyk = graycolor(v[2]), rgbcolor(v[3],v[4],v[5]), cmykcolor(v[6],v[7],v[8],v[9]) diff --git a/tex/context/base/mkiv/buff-ver.lua b/tex/context/base/mkiv/buff-ver.lua index ed0e327a1..6af56b327 100644 --- a/tex/context/base/mkiv/buff-ver.lua +++ b/tex/context/base/mkiv/buff-ver.lua @@ -44,6 +44,8 @@ local v_yes = variables.yes local v_last = variables.last local v_all = variables.all local v_absolute = variables.absolute +local v_inline = variables.inline +local v_display = variables.display -- beware, all macros have an argument: @@ -66,7 +68,7 @@ local ctx_verbatimspace = context.doverbatimspace local CargOne = Carg(1) local function f_emptyline(s,settings) - if settings and settings.nature == "inline" then + if settings and settings.nature == v_inline then ctx_inlineverbatimemptyline() else ctx_displayverbatimemptyline() @@ -74,7 +76,7 @@ local function f_emptyline(s,settings) end local function f_beginline(s,settings) - if settings and settings.nature == "inline" then + if settings and settings.nature == v_inline then ctx_inlineverbatimbeginline() else ctx_displayverbatimbeginline() @@ -82,7 +84,7 @@ local function f_beginline(s,settings) end local function f_newline(s,settings) - if settings and settings.nature == "inline" then + if settings and settings.nature == v_inline then ctx_inlineverbatimnewline() else ctx_displayverbatimnewline() @@ -90,7 +92,7 @@ local function f_newline(s,settings) end local function f_start(s,settings) - if settings and settings.nature == "inline" then + if settings and settings.nature == v_inline then ctx_inlineverbatimstart() else ctx_displayverbatimstart() @@ -98,7 +100,7 @@ local function f_start(s,settings) end local function f_stop(s,settings) - if settings and settings.nature == "inline" then + if settings and settings.nature == v_inline then ctx_inlineverbatimstop() else ctx_displayverbatimstop() @@ -500,7 +502,7 @@ local function visualize(content,settings) -- maybe also method in settings else m = specifications[method] or specifications.default end - local nature = settings.nature or "display" + local nature = settings.nature or v_display local n = m and m[nature] if n then if trace_visualize then @@ -534,15 +536,15 @@ local function checkedsettings(settings,nature) end function visualizers.visualizestring(content,settings) - visualize(content,checkedsettings(settings,"inline")) + visualize(content,checkedsettings(settings,v_inline)) end function visualizers.visualizefile(name,settings) - visualize(resolvers.loadtexfile(name),checkedsettings(settings,"display")) + visualize(resolvers.loadtexfile(name),checkedsettings(settings,v_display)) end function visualizers.visualizebuffer(name,settings) - visualize(buffers.getcontent(name),checkedsettings(settings,"display")) + visualize(buffers.getcontent(name),checkedsettings(settings,v_display)) end -- -- @@ -739,7 +741,7 @@ local function filter(lines,settings) -- todo: inline or display in settings first, last = getstrip(lines,first,last) end -- \r is \endlinechar but \n would is more generic so this choice is debatable - local content = concat(lines,(settings.nature == "inline" and " ") or "\n",first,last) + local content = concat(lines,(settings.nature == v_inline and " ") or "\n",first,last) return content, m end @@ -755,7 +757,7 @@ local function typebuffer(settings) if content and content ~= "" then -- content = decodecomment(content) content = dotabs(content,settings) - visualize(content,checkedsettings(settings,"display")) + visualize(content,checkedsettings(settings,v_display)) end end end @@ -804,7 +806,7 @@ local function typestring(settings) end -- content = decodecomment(content) -- content = dotabs(content,settings) - visualize(content,checkedsettings(settings,"inline")) + visualize(content,checkedsettings(settings,v_inline)) end end @@ -824,7 +826,7 @@ local function typefile(settings) local content, m = filter(lines,settings) if content and content ~= "" then content = dotabs(content,settings) - visualize(content,checkedsettings(settings,"display")) + visualize(content,checkedsettings(settings,v_display)) end end end diff --git a/tex/context/base/mkiv/buff-ver.mkiv b/tex/context/base/mkiv/buff-ver.mkiv index ba0591012..8e76ff139 100644 --- a/tex/context/base/mkiv/buff-ver.mkiv +++ b/tex/context/base/mkiv/buff-ver.mkiv @@ -342,7 +342,7 @@ method {\p_buff_option}% compact {\typeparameter\c!compact}% % none | all | last (all needed in tabulate etc for manuals) escape {\typeparameter\c!escape}% % new but rather useless imo (escaping in general is not used much) - % nature {inline}% is default + % nature {\v!inline}% is default \relax \dostoptagged \buff_verbatim_right_of_type @@ -356,7 +356,7 @@ tab {\typeparameter\c!tab}% method {\p_buff_option}% % extra visualizer (maybe: nested,\typeparameter\c!option) escape {\typeparameter\c!escape}% % new but rather useless imo (escaping in general is not used much) - % nature {inline}% is default + % nature {\v!inline}% is default method {nested}% \relax \dostoptagged @@ -799,21 +799,6 @@ \setuevalue{\e!type\currenttyping\v!buffer}{\buff_verbatim_type_buffer_class{\currenttyping}}% \to \everydefinetyping -% \unexpanded\def\buff_verbatim_type_buffer[#1][#2]% -% {\begingroup -% \ifsecondargument -% \setuptyping[\v!buffer][#2]% -% \processcommalist[#1]{\buff_verbatim_type_buffer_indeed\v!buffer}% [name] [settings] -% \else\iffirstargument -% \doifelseassignment{#1} -% {\setuptyping[\v!buffer][#1]% -% \buff_verbatim_type_buffer_indeed\v!buffer\empty}% [settings] -% {\processcommalist[#1]{\buff_verbatim_type_buffer_indeed\v!buffer}}% [name] -% \else -% \buff_verbatim_type_buffer_indeed\v!buffer\empty% [] -% \fi\fi -% \endgroup} - \unexpanded\def\buff_verbatim_type_buffer[#1][#2]% {\ifsecondargument \setupcurrenttyping[#2]% @@ -867,6 +852,27 @@ \stoppacked \typingparameter\c!after} +\unexpanded\def\typeinlinebuffer + {\dontleavehmode + \begingroup + \let\buff_verbatim_type_buffer_indeed\buff_verbatim_type_buffer_indeed_inline + \let\setupcurrenttyping\setupcurrenttype % a terrible hack but it saves code + \let\currenttype\v!buffer + \dodoubleempty\buff_verbatim_type_buffer} + +\unexpanded\def\buff_verbatim_type_buffer_indeed_inline#1#2% category name + {\doifsomething{#1}{\edef\currenttype{#1}}% probably this line can go + \buff_verbatim_initialize_type_one + \dostarttaggedchained\t!verbatim\currenttype\??type + \clf_typebuffer + name {#2}% + strip {\v!yes}% + regime {\currentregime}% + method {\p_buff_option}% + nature {\v!inline}% + \relax + \dostoptagged} + % get : before/after of buffer % typing : before/after of typing % process : no before/after (special case anyway) diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 9db1f59ae..d5ae4be08 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.01 18:10} +\newcontextversion{2017.08.02 18:59} %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 79d035edf..6c8b58ee3 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.01 18:10} +\edef\contextversion{2017.08.02 18:59} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/font-mis.lua b/tex/context/base/mkiv/font-mis.lua index 401abbffa..f0afb35de 100644 --- a/tex/context/base/mkiv/font-mis.lua +++ b/tex/context/base/mkiv/font-mis.lua @@ -21,7 +21,7 @@ local readers = otf.readers if readers then - otf.version = otf.version or 3.100 + otf.version = otf.version or 3.101 otf.cache = otf.cache or containers.define("fonts", "otl", otf.version, true) function fonts.helpers.getfeatures(name,save) diff --git a/tex/context/base/mkiv/font-osd.lua b/tex/context/base/mkiv/font-osd.lua index 2ee8a2286..9adc8bff2 100644 --- a/tex/context/base/mkiv/font-osd.lua +++ b/tex/context/base/mkiv/font-osd.lua @@ -1586,7 +1586,7 @@ local function dev2_reorder(head,start,stop,font,attr,nbspaces) -- maybe do a pa next = getnext(current) local tmp = getnext(next) local changestop = next == stop - setnext(next,nil) + setnext(next) setprop(current,a_state,s_pref) current = processcharacters(current,font) setprop(current,a_state,s_blwf) diff --git a/tex/context/base/mkiv/font-otj.lua b/tex/context/base/mkiv/font-otj.lua index 5ab9dd12b..8d95e115b 100644 --- a/tex/context/base/mkiv/font-otj.lua +++ b/tex/context/base/mkiv/font-otj.lua @@ -93,7 +93,17 @@ local insert_node_after = nuts.insert_after local properties = nodes.properties.data -local fontkern = nuts.pool and nuts.pool.fontkern -- context +local fontkern = nuts.pool and nuts.pool.fontkern -- context +local italickern = nuts.pool and nuts.pool.italickern -- context + +local useitalickerns = false + +directives.register("fonts.injections.useitalics", function(v) + if v then + report_injections("using italics for space kerns (tracing only)") + end + useitalickerns = v +end) do if not fontkern then -- generic @@ -107,6 +117,16 @@ do if not fontkern then -- generic return n end + local thekern = nuts.new("kern",3) -- italiccorrection + local setkern = nuts.setkern + local copy_node = nuts.copy_node + + italickern = function(k) + local n = copy_node(thekern) + setkern(n,k) + return n + end + end end function injections.installnewkern() end -- obsolete @@ -1560,6 +1580,7 @@ local function injectspaces(head) local threshold = 0 local leftkern = false local rightkern = false + local nuthead = tonut(head) local function updatefont(font,trig) leftkerns = trig.left @@ -1569,8 +1590,7 @@ local function injectspaces(head) factor = getthreshold(font) end - -- for n in traverse_id(glue_code,tonut(head)) do - for n in traverse_char(tonut(head)) do + for n in traverse_id(glue_code,nuthead) do local prev, next = getspaceboth(n) local prevchar = prev and ischar(prev) local nextchar = next and ischar(next) @@ -1602,18 +1622,38 @@ local function injectspaces(head) local old = getwidth(n) if old > threshold then if rightkern then - local new = old + (leftkern + rightkern) * factor - if trace_spaces then - report_spaces("%C [%p -> %p] %C",prevchar,old,new,nextchar) + if useitalickerns then + local new = old + (leftkern + rightkern) * factor + if trace_spaces then + report_spaces("%C [%p -> %p] %C",prevchar,old,new,nextchar) + end + setwidth(n,new) + else + local new = (leftkern + rightkern) * factor + if trace_spaces then + report_spaces("%C [%p + %p] %C",prevchar,old,new,nextchar) + end + local h = insert_node_before(nuthead,n,italickern(new)) + if h == nuthead then + head = tonode(h) + nuthead = h + end end - setwidth(n,new) - leftkern = false + leftkern = false else - local new = old + leftkern * factor - if trace_spaces then - report_spaces("%C [%p -> %p]",prevchar,old,new) + if useitalickerns then + local new = leftkern * factor + if trace_spaces then + report_spaces("%C [%p + %p]",prevchar,old,new) + end + insert_node_after(nuthead,n,italickern(new)) -- tricky with traverse but ok + else + local new = old + leftkern * factor + if trace_spaces then + report_spaces("%C [%p -> %p]",prevchar,old,new) + end + setwidth(n,new) end - setwidth(n,new) end end leftkern = false diff --git a/tex/context/base/mkiv/font-otl.lua b/tex/context/base/mkiv/font-otl.lua index 210611989..f6d99dbe0 100644 --- a/tex/context/base/mkiv/font-otl.lua +++ b/tex/context/base/mkiv/font-otl.lua @@ -52,7 +52,7 @@ local report_otf = logs.reporter("fonts","otf loading") local fonts = fonts local otf = fonts.handlers.otf -otf.version = 3.100 -- beware: also sync font-mis.lua and in mtx-fonts +otf.version = 3.101 -- beware: also sync font-mis.lua and in mtx-fonts otf.cache = containers.define("fonts", "otl", otf.version, true) otf.svgcache = containers.define("fonts", "svg", otf.version, true) otf.sbixcache = containers.define("fonts", "sbix", otf.version, true) diff --git a/tex/context/base/mkiv/font-ots.lua b/tex/context/base/mkiv/font-ots.lua index 00fd3dc26..98a9184ae 100644 --- a/tex/context/base/mkiv/font-ots.lua +++ b/tex/context/base/mkiv/font-ots.lua @@ -864,14 +864,24 @@ function handlers.gpos_pair(head,start,dataset,sequence,kerns,rlmode,step,i,inje while snext do local nextchar = ischar(snext,currentfont) if nextchar then - local krn = kerns[nextchar] - if not krn and marks[nextchar] then - -- hm, needs checking i guess - prev = snext + -- local krn = kerns[nextchar] + -- if not krn and marks[nextchar] then + -- prev = snext + -- snext = getnext(snext) + -- elseif not krn then + -- break + -- else + if marks[nextchar] and sequence.flags[1] then + prev = snext snext = getnext(snext) - elseif not krn then - break +-- elseif sequence.markclass and sequence.markclass[nextchar] then +-- prev = snext +-- snext = getnext(snext) else + local krn = kerns[nextchar] + if not krn then + break + end local format = step.format if format == "pair" then local a, b = krn[1], krn[2] @@ -1089,8 +1099,8 @@ function handlers.gpos_cursive(head,start,dataset,sequence,exitanchors,rlmode,st local nextchar = ischar(nxt,currentfont) if not nextchar then break - elseif marks[nextchar] then - nxt = getnext(nxt) + elseif marks[nextchar] then -- always sequence.flags[1] + nxt = getnext(nxt) else local exit = exitanchors[3] if exit then @@ -1469,13 +1479,24 @@ function chainprocs.gpos_pair(head,start,stop,dataset,sequence,currentlookup,rlm if not nextchar then break end - local krn = kerns[nextchar] - if not krn and marks[nextchar] then - prev = snext + -- local krn = kerns[nextchar] + -- if not krn and marks[nextchar] then + -- prev = snext + -- snext = getnext(snext) + -- elseif not krn then + -- break + -- else + if marks[nextchar] and sequence.flags[1] then + prev = snext snext = getnext(snext) - elseif not krn then - break +-- elseif sequence.markclass and sequence.markclass[nextchar] then +-- prev = snext +-- snext = getnext(snext) else + local krn = kerns[nextchar] + if not krn then + break + end local format = step.format if format == "pair" then local a, b = krn[1], krn[2] @@ -4089,7 +4110,7 @@ local function k_run_multiple(sub,injection,last,font,attr,steps,nofsteps,datase local lookupcache = step.coverage local lookupmatch = lookupcache[char] if lookupmatch then - local h, d, ok = handler(head,n,dataset,sequence,lookupmatch,rlmode,step,i,injection) + local h, d, ok = handler(sub,n,dataset,sequence,lookupmatch,rlmode,step,i,injection) -- sub was head if ok then return true end diff --git a/tex/context/base/mkiv/font-oup.lua b/tex/context/base/mkiv/font-oup.lua index 5cc6a17dc..ce1dca724 100644 --- a/tex/context/base/mkiv/font-oup.lua +++ b/tex/context/base/mkiv/font-oup.lua @@ -2145,7 +2145,6 @@ local function mergesteps_1(lookup,strict) return nofsteps - 1 end - local function mergesteps_2(lookup,strict) -- pairs local steps = lookup.steps local nofsteps = lookup.nofsteps @@ -2165,9 +2164,9 @@ local function mergesteps_2(lookup,strict) -- pairs for k, v in next, steps[i].coverage do local tk = target[k] if tk then - for k, v in next, v do - if not tk[k] then - tk[k] = v + for kk, vv in next, v do + if tk[kk] == nil then + tk[kk] = vv end end else @@ -2176,7 +2175,8 @@ local function mergesteps_2(lookup,strict) -- pairs end end lookup.nofsteps = 1 - lookup.steps = { first } + lookup.merged = true + lookup.steps = { first } return nofsteps - 1 end @@ -2216,6 +2216,7 @@ local function mergesteps_3(lookup,strict) -- marks first.baseclasses = baseclasses first.coverage = coverage lookup.nofsteps = 1 + lookup.merged = true lookup.steps = { first } return nofsteps - 1 end @@ -2359,11 +2360,29 @@ local function checkpairs(lookup) return kerned end -local compact_pairs = true -local compact_singles = true - -directives.register("otf.compact.pairs", function(v) compact_pairs = v end) -directives.register("otf.compact.singles", function(v) compact_singles = v end) +local compact_pairs = true +local compact_singles = true + +local merge_pairs = true +local merge_singles = true +local merge_substitutions = true +local merge_alternates = true +local merge_multiples = true +local merge_ligatures = true +local merge_cursives = true +local merge_marks = true + +directives.register("otf.compact.pairs", function(v) compact_pairs = v end) +directives.register("otf.compact.singles", function(v) compact_singles = v end) + +directives.register("otf.merge.pairs", function(v) merge_pairs = v end) +directives.register("otf.merge.singles", function(v) merge_singles = v end) +directives.register("otf.merge.substitutions", function(v) merge_substitutions = v end) +directives.register("otf.merge.alternates", function(v) merge_alternates = v end) +directives.register("otf.merge.multiples", function(v) merge_multiples = v end) +directives.register("otf.merge.ligatures", function(v) merge_ligatures = v end) +directives.register("otf.merge.cursives", function(v) merge_cursives = v end) +directives.register("otf.merge.marks", function(v) merge_marks = v end) function readers.compact(data) if not data or data.compacted then @@ -2385,24 +2404,44 @@ function readers.compact(data) allsteps = allsteps + nofsteps if nofsteps > 1 then local merg = merged - if kind == "gsub_single" or kind == "gsub_alternate" or kind == "gsub_multiple" then - merged = merged + mergesteps_1(lookup) + if kind == "gsub_single" then + if merge_substitutions then + merged = merged + mergesteps_1(lookup) + end + elseif kind == "gsub_alternate" then + if merge_alternates then + merged = merged + mergesteps_1(lookup) + end + elseif kind == "gsub_multiple" then + if merge_multiples then + merged = merged + mergesteps_1(lookup) + end elseif kind == "gsub_ligature" then - merged = merged + mergesteps_4(lookup) + if merge_ligatures then + merged = merged + mergesteps_4(lookup) + end elseif kind == "gpos_single" then - merged = merged + mergesteps_1(lookup,true) + if merge_singles then + merged = merged + mergesteps_1(lookup,true) + end if compact_singles then kerned = kerned + checkkerns(lookup) end elseif kind == "gpos_pair" then - merged = merged + mergesteps_2(lookup,true) + if merge_pairs then + merged = merged + mergesteps_2(lookup,true) + end if compact_pairs then kerned = kerned + checkpairs(lookup) end elseif kind == "gpos_cursive" then - merged = merged + mergesteps_2(lookup) + if merge_cursives then + merged = merged + mergesteps_2(lookup) + end elseif kind == "gpos_mark2mark" or kind == "gpos_mark2base" or kind == "gpos_mark2ligature" then - merged = merged + mergesteps_3(lookup) + if merge_marks then + merged = merged + mergesteps_3(lookup) + end end if merg ~= merged then lookup.merged = true diff --git a/tex/context/base/mkiv/lang-lab.mkiv b/tex/context/base/mkiv/lang-lab.mkiv index 40845be4a..b4875dd59 100644 --- a/tex/context/base/mkiv/lang-lab.mkiv +++ b/tex/context/base/mkiv/lang-lab.mkiv @@ -83,6 +83,8 @@ % hm, not interfaced +\let\thetextprefix\empty + \unexpanded\def\lang_labels_define_class_indeed#1#2#3#4#5#6#7#8#9% {\setuvalue{setup#1text}{\protecttextprefixes#2\def\currenttextprefixclass{#1}\dodoubleempty\lang_labels_text_prefix_setup}% \setuvalue{preset#1text}{\protecttextprefixes1\def\currenttextprefixclass{#1}\dodoubleempty\lang_labels_text_prefix_setup}% diff --git a/tex/context/base/mkiv/lang-mis.mkiv b/tex/context/base/mkiv/lang-mis.mkiv index ada8f81ea..e8609ec04 100644 --- a/tex/context/base/mkiv/lang-mis.mkiv +++ b/tex/context/base/mkiv/lang-mis.mkiv @@ -266,6 +266,9 @@ \futurelet\nextnext\next}% \next} +\let\discretionarytoken \relax +\let\textmodediscretionary\relax + \unexpanded\def\activedododotextmodediscretionary#1#2% {\edef\discretionarytoken{\detokenize{#2}}% \def\textmodediscretionary{\handletextmodediscretionary{#1}}% diff --git a/tex/context/base/mkiv/lxml-ini.mkiv b/tex/context/base/mkiv/lxml-ini.mkiv index f97857fbe..d4616edca 100644 --- a/tex/context/base/mkiv/lxml-ini.mkiv +++ b/tex/context/base/mkiv/lxml-ini.mkiv @@ -147,6 +147,21 @@ {\xmltobuffertextonly{#1}{.}{\xmltempbuffername}% \prettyprintbuffer\xmltempbuffername{#2}} +\unexpanded\def\inlineprettyprintbuffer#1#2% only used here + {\ifdefined\sciteinlinebuffer + \sciteinlinebuffer[#2][#1]% + \else + \typeinlinebuffer[#1][\c!option=#2]% + \fi} + +\unexpanded\def\xmlinlineprettyprint#1#2% + {\xmltobufferverbose{#1}{.}{\xmltempbuffername}% + \inlineprettyprintbuffer\xmltempbuffername{#2}} + +\unexpanded\def\xmlinlineprettyprinttext#1#2% + {\xmltobuffertextonly{#1}{.}{\xmltempbuffername}% + \inlineprettyprintbuffer\xmltempbuffername{#2}} + % kind of special: \let\xmlstartraw\clf_xmlstartraw diff --git a/tex/context/base/mkiv/page-box.mkvi b/tex/context/base/mkiv/page-box.mkvi index fa85aef68..083a94390 100644 --- a/tex/context/base/mkiv/page-box.mkvi +++ b/tex/context/base/mkiv/page-box.mkvi @@ -133,6 +133,10 @@ \page_boxes_apply_negate#box% \fi\fi} +\let\p_page_layouts_scale\relax +\let\p_page_layouts_sx \relax +\let\p_page_layouts_sy \relax + \def\page_boxes_apply_scale#box% {\edef\p_page_layouts_scale{\layoutparameter\c!scale}% \ifdim\p_page_layouts_scale\points=\onepoint diff --git a/tex/context/base/mkiv/page-flt.mkiv b/tex/context/base/mkiv/page-flt.mkiv index c514496df..aafa15287 100644 --- a/tex/context/base/mkiv/page-flt.mkiv +++ b/tex/context/base/mkiv/page-flt.mkiv @@ -264,6 +264,8 @@ \doifnotinset\v!low\floatspecification\vfill}% \page_otr_fill_and_eject_page} +\let\m_page_otf_checked_page_float\relax + \unexpanded\def\page_floats_flush_page_floats % used in postpone {\edef\m_page_otf_checked_page_float{\clf_checkedpagefloat}% \ifx\m_page_otf_checked_page_float\empty diff --git a/tex/context/base/mkiv/page-txt.mkvi b/tex/context/base/mkiv/page-txt.mkvi index b67e3aa74..92d6d288b 100644 --- a/tex/context/base/mkiv/page-txt.mkvi +++ b/tex/context/base/mkiv/page-txt.mkvi @@ -482,6 +482,8 @@ \c!rightstyle\c!rightcolor\c!rightwidth{#one}}% \fi\fi\fi} +\let\currentlayoutelement\relax + \unexpanded\def\resettextcontent {\dotripleempty\page_layouts_reset_text_content} @@ -502,6 +504,8 @@ %D The placement of a whole line is handled by the next two macros. These are hooked %D into the general purpose token list registers mentioned before. +\let\currentlayouttextline\relax + \def\page_layouts_place_text_line_indeed#vertical#height% {\let\currentlayouttextline#vertical% \ifdim#height>\zeropoint\relax % prevents pagenumbers when zero height diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 2a9b3c599..c210fae43 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 b06dabfea..cebe52549 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/syst-aux.mkiv b/tex/context/base/mkiv/syst-aux.mkiv index 956cfa9f3..5fd515da9 100644 --- a/tex/context/base/mkiv/syst-aux.mkiv +++ b/tex/context/base/mkiv/syst-aux.mkiv @@ -282,6 +282,15 @@ %D {\localnext} because we don't want clashes with \type %D {\next}. +\let\next \relax +\let\nextnext \relax +\let\nextnextnext \relax +\let\nexttoken \relax +\let\charactertoken\relax + +\let\m_syst_action_yes\relax +\let\m_syst_action_nop\relax + \unexpanded\def\doifelsenextchar#1#2#3% #1 should not be {} ! {\let\charactertoken=#1% = needed here \def\m_syst_action_yes{#2}% diff --git a/tex/context/interface/mkiv/context-en.xml b/tex/context/interface/mkiv/context-en.xml index 341011255..2f03a27fd 100644 --- a/tex/context/interface/mkiv/context-en.xml +++ b/tex/context/interface/mkiv/context-en.xml @@ -3016,6 +3016,16 @@ </cd:assignments> </cd:arguments> </cd:command> + <cd:command file="buff-ver.mkiv" level="document" name="typeinlinebuffer"> + <cd:arguments> + <cd:keywords list="yes" optional="yes"> + <cd:constant type="cd:buffer"/> + </cd:keywords> + <cd:assignments list="yes" optional="yes"> + <cd:inherit name="setuptype"/> + </cd:assignments> + </cd:arguments> + </cd:command> <cd:command file="buff-ver.mkiv" generated="yes" level="document" name="typebuffer" variant="instance"> <cd:sequence> <cd:string value="type"/> diff --git a/tex/context/interface/mkiv/i-buffer.xml b/tex/context/interface/mkiv/i-buffer.xml index b99d2886b..cc8686494 100644 --- a/tex/context/interface/mkiv/i-buffer.xml +++ b/tex/context/interface/mkiv/i-buffer.xml @@ -164,7 +164,7 @@ </cd:arguments> </cd:command> - <cd:command name="getbufferdata" file="buff-ini.mkiv"> + <cd:command name="getbufferdata" file="buff-ini.mkiv"> <cd:arguments> <cd:resolve name="keyword-buffer-optional"/> </cd:arguments> @@ -179,6 +179,15 @@ </cd:arguments> </cd:command> + <cd:command name="typeinlinebuffer" level="document" file="buff-ver.mkiv"> + <cd:arguments> + <cd:resolve name="keyword-buffer-list-optional"/> + <cd:assignments list="yes" optional="yes"> + <cd:inherit name="setuptype"/> + </cd:assignments> + </cd:arguments> + </cd:command> + <cd:command name="typebuffer" generated="yes" variant="instance" level="document" file="buff-ver.mkiv"> <cd:sequence> <cd:string value="type"/> diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex 1ebc5d003..23591e183 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 2c67171b8..e3e3d744e 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf diff --git a/tex/context/modules/mkiv/m-scite.mkiv b/tex/context/modules/mkiv/m-scite.mkiv index a7d9f8b5c..516f3ce54 100644 --- a/tex/context/modules/mkiv/m-scite.mkiv +++ b/tex/context/modules/mkiv/m-scite.mkiv @@ -254,7 +254,7 @@ end {\dosingleargument\module_scite_file} \unexpanded\def\module_scite_file[#1]% - {\start + {\begingroup \ctxlua{buffers.scite.lexfile("#1")}% \installscitecommands \tt @@ -265,13 +265,13 @@ end \getbuffer[lex] \stoplines \stopcontextcode - \stop} + \endgroup} \unexpanded\def\scitebuffer {\dodoubleargument\module_scite_buffer} \unexpanded\def\module_scite_buffer[#1][#2]% - {\start + {\begingroup \ifsecondargument \ctxlua{buffers.scite.lexbuffer("#2","#1")}% \else @@ -285,7 +285,25 @@ end \startlines \getbuffer[lex]% \stoplines - \stop} + \endgroup} + +\unexpanded\def\sciteinlinebuffer + {\dodoubleargument\module_scite_buffer_inline} + +\unexpanded\def\module_scite_buffer[#1][#2]% + {\dontleavehmode + \begingroup + \ifsecondargument + \ctxlua{buffers.scite.lexbuffer("#2","#1")}% + \else + \ctxlua{buffers.scite.lexbuffer("#1","tex")}% + \fi + \installscitecommands + \tt + \dontcomplain + \setcatcodetable\ctxcatcodes % needed in xml + \getbuffer[lex]% + \endgroup} \protect diff --git a/tex/context/modules/mkiv/s-fnt-20.mkiv b/tex/context/modules/mkiv/s-fnt-20.mkiv index 5d6ac75ef..486c8ad7f 100644 --- a/tex/context/modules/mkiv/s-fnt-20.mkiv +++ b/tex/context/modules/mkiv/s-fnt-20.mkiv @@ -123,19 +123,23 @@ \setupcolors [state=start] +\startsetups otftracker-steps + \doifsomething {\getvariable{otftracker}{figure}} { + \startlinecorrection + \externalfigure[\getvariable{otftracker}{figure}][maxwidth=\hsize,frame=on] + \stoplinecorrection + } + \showotfcomposition + {\getvariable{otftracker}{font}*\getvariable{otftracker}{features} at \getvariable{otftracker}{size}} + {\getvariable{otftracker}{direction}} + {\getvariable{otftracker}{sample}} +\stopsetups + \startsetups otftracker \setupbodyfont[tt,10pt] \starttext \normalexpanded{\startchapter[title={\getvariable{otftracker}{title}}]} - \doifsomething {\getvariable{otftracker}{figure}} { - \startlinecorrection - \externalfigure[\getvariable{otftracker}{figure}][maxwidth=\hsize,frame=on] - \stoplinecorrection - } - \showotfcomposition - {\getvariable{otftracker}{font}*\getvariable{otftracker}{features} at \getvariable{otftracker}{size}} - {\getvariable{otftracker}{direction}} - {\getvariable{otftracker}{sample}} + \directsetup{otftracker-steps} \directsetup{otftracker-extra} \stopchapter \stoptext diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index c713a5ca9..73f68128e 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/01/17 18:10:43 +-- merge date : 08/02/17 18:59:29 do -- begin closure to overcome local limits and interference @@ -19179,9 +19179,9 @@ local function mergesteps_2(lookup,strict) for k,v in next,steps[i].coverage do local tk=target[k] if tk then - for k,v in next,v do - if not tk[k] then - tk[k]=v + for kk,vv in next,v do + if tk[kk]==nil then + tk[kk]=vv end end else @@ -19190,6 +19190,7 @@ local function mergesteps_2(lookup,strict) end end lookup.nofsteps=1 + lookup.merged=true lookup.steps={ first } return nofsteps-1 end @@ -19224,6 +19225,7 @@ local function mergesteps_3(lookup,strict) first.baseclasses=baseclasses first.coverage=coverage lookup.nofsteps=1 + lookup.merged=true lookup.steps={ first } return nofsteps-1 end @@ -19343,8 +19345,24 @@ local function checkpairs(lookup) end local compact_pairs=true local compact_singles=true +local merge_pairs=true +local merge_singles=true +local merge_substitutions=true +local merge_alternates=true +local merge_multiples=true +local merge_ligatures=true +local merge_cursives=true +local merge_marks=true directives.register("otf.compact.pairs",function(v) compact_pairs=v end) directives.register("otf.compact.singles",function(v) compact_singles=v end) +directives.register("otf.merge.pairs",function(v) merge_pairs=v end) +directives.register("otf.merge.singles",function(v) merge_singles=v end) +directives.register("otf.merge.substitutions",function(v) merge_substitutions=v end) +directives.register("otf.merge.alternates",function(v) merge_alternates=v end) +directives.register("otf.merge.multiples",function(v) merge_multiples=v end) +directives.register("otf.merge.ligatures",function(v) merge_ligatures=v end) +directives.register("otf.merge.cursives",function(v) merge_cursives=v end) +directives.register("otf.merge.marks",function(v) merge_marks=v end) function readers.compact(data) if not data or data.compacted then return @@ -19365,24 +19383,44 @@ function readers.compact(data) allsteps=allsteps+nofsteps if nofsteps>1 then local merg=merged - if kind=="gsub_single" or kind=="gsub_alternate" or kind=="gsub_multiple" then - merged=merged+mergesteps_1(lookup) + if kind=="gsub_single" then + if merge_substitutions then + merged=merged+mergesteps_1(lookup) + end + elseif kind=="gsub_alternate" then + if merge_alternates then + merged=merged+mergesteps_1(lookup) + end + elseif kind=="gsub_multiple" then + if merge_multiples then + merged=merged+mergesteps_1(lookup) + end elseif kind=="gsub_ligature" then - merged=merged+mergesteps_4(lookup) + if merge_ligatures then + merged=merged+mergesteps_4(lookup) + end elseif kind=="gpos_single" then - merged=merged+mergesteps_1(lookup,true) + if merge_singles then + merged=merged+mergesteps_1(lookup,true) + end if compact_singles then kerned=kerned+checkkerns(lookup) end elseif kind=="gpos_pair" then - merged=merged+mergesteps_2(lookup,true) + if merge_pairs then + merged=merged+mergesteps_2(lookup,true) + end if compact_pairs then kerned=kerned+checkpairs(lookup) end elseif kind=="gpos_cursive" then - merged=merged+mergesteps_2(lookup) + if merge_cursives then + merged=merged+mergesteps_2(lookup) + end elseif kind=="gpos_mark2mark" or kind=="gpos_mark2base" or kind=="gpos_mark2ligature" then - merged=merged+mergesteps_3(lookup) + if merge_marks then + merged=merged+mergesteps_3(lookup) + end end if merg~=merged then lookup.merged=true @@ -19627,7 +19665,7 @@ local trace_defining=false registertracker("fonts.defining",function(v) trace_de local report_otf=logs.reporter("fonts","otf loading") local fonts=fonts local otf=fonts.handlers.otf -otf.version=3.100 +otf.version=3.101 otf.cache=containers.define("fonts","otl",otf.version,true) otf.svgcache=containers.define("fonts","svg",otf.version,true) otf.sbixcache=containers.define("fonts","sbix",otf.version,true) @@ -20756,7 +20794,15 @@ local traverse_char=nuts.traverse_char local insert_node_before=nuts.insert_before local insert_node_after=nuts.insert_after local properties=nodes.properties.data -local fontkern=nuts.pool and nuts.pool.fontkern +local fontkern=nuts.pool and nuts.pool.fontkern +local italickern=nuts.pool and nuts.pool.italickern +local useitalickerns=false +directives.register("fonts.injections.useitalics",function(v) + if v then + report_injections("using italics for space kerns (tracing only)") + end + useitalickerns=v +end) do if not fontkern then local thekern=nuts.new("kern",0) local setkern=nuts.setkern @@ -20766,6 +20812,14 @@ do if not fontkern then setkern(n,k) return n end + local thekern=nuts.new("kern",3) + local setkern=nuts.setkern + local copy_node=nuts.copy_node + italickern=function(k) + local n=copy_node(thekern) + setkern(n,k) + return n + end end end function injections.installnewkern() end local nofregisteredkerns=0 @@ -22019,6 +22073,7 @@ local function injectspaces(head) local threshold=0 local leftkern=false local rightkern=false + local nuthead=tonut(head) local function updatefont(font,trig) leftkerns=trig.left rightkerns=trig.right @@ -22026,7 +22081,7 @@ local function injectspaces(head) threshold, factor=getthreshold(font) end - for n in traverse_char(tonut(head)) do + for n in traverse_id(glue_code,nuthead) do local prev,next=getspaceboth(n) local prevchar=prev and ischar(prev) local nextchar=next and ischar(next) @@ -22058,18 +22113,38 @@ local function injectspaces(head) local old=getwidth(n) if old>threshold then if rightkern then - local new=old+(leftkern+rightkern)*factor - if trace_spaces then - report_spaces("%C [%p -> %p] %C",prevchar,old,new,nextchar) + if useitalickerns then + local new=old+(leftkern+rightkern)*factor + if trace_spaces then + report_spaces("%C [%p -> %p] %C",prevchar,old,new,nextchar) + end + setwidth(n,new) + else + local new=(leftkern+rightkern)*factor + if trace_spaces then + report_spaces("%C [%p + %p] %C",prevchar,old,new,nextchar) + end + local h=insert_node_before(nuthead,n,italickern(new)) + if h==nuthead then + head=tonode(h) + nuthead=h + end end - setwidth(n,new) leftkern=false else - local new=old+leftkern*factor - if trace_spaces then - report_spaces("%C [%p -> %p]",prevchar,old,new) + if useitalickerns then + local new=leftkern*factor + if trace_spaces then + report_spaces("%C [%p + %p]",prevchar,old,new) + end + insert_node_after(nuthead,n,italickern(new)) + else + local new=old+leftkern*factor + if trace_spaces then + report_spaces("%C [%p -> %p]",prevchar,old,new) + end + setwidth(n,new) end - setwidth(n,new) end end leftkern=false @@ -23139,13 +23214,14 @@ function handlers.gpos_pair(head,start,dataset,sequence,kerns,rlmode,step,i,inje while snext do local nextchar=ischar(snext,currentfont) if nextchar then - local krn=kerns[nextchar] - if not krn and marks[nextchar] then + if marks[nextchar] and sequence.flags[1] then prev=snext snext=getnext(snext) - elseif not krn then - break else + local krn=kerns[nextchar] + if not krn then + break + end local format=step.format if format=="pair" then local a,b=krn[1],krn[2] @@ -23350,7 +23426,7 @@ function handlers.gpos_cursive(head,start,dataset,sequence,exitanchors,rlmode,st local nextchar=ischar(nxt,currentfont) if not nextchar then break - elseif marks[nextchar] then + elseif marks[nextchar] then nxt=getnext(nxt) else local exit=exitanchors[3] @@ -23644,13 +23720,14 @@ function chainprocs.gpos_pair(head,start,stop,dataset,sequence,currentlookup,rlm if not nextchar then break end - local krn=kerns[nextchar] - if not krn and marks[nextchar] then + if marks[nextchar] and sequence.flags[1] then prev=snext snext=getnext(snext) - elseif not krn then - break else + local krn=kerns[nextchar] + if not krn then + break + end local format=step.format if format=="pair" then local a,b=krn[1],krn[2] @@ -25941,7 +26018,7 @@ local function k_run_multiple(sub,injection,last,font,attr,steps,nofsteps,datase local lookupcache=step.coverage local lookupmatch=lookupcache[char] if lookupmatch then - local h,d,ok=handler(head,n,dataset,sequence,lookupmatch,rlmode,step,i,injection) + local h,d,ok=handler(sub,n,dataset,sequence,lookupmatch,rlmode,step,i,injection) if ok then return true end @@ -27728,7 +27805,7 @@ local function dev2_reorder(head,start,stop,font,attr,nbspaces) next=getnext(current) local tmp=getnext(next) local changestop=next==stop - setnext(next,nil) + setnext(next) setprop(current,a_state,s_pref) current=processcharacters(current,font) setprop(current,a_state,s_blwf) |