From 753dd0cbafc567d4960c5fc4888ccb4e2302c64d Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Wed, 3 Oct 2018 16:44:19 +0200 Subject: 2018-10-03 16:11:00 --- tex/context/base/mkii/cont-new.mkii | 2 +- tex/context/base/mkii/context.mkii | 2 +- tex/context/base/mkiv/char-ini.lua | 21 +++-- tex/context/base/mkiv/cldf-bas.lua | 20 ++-- tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/font-col.lua | 103 +++++++++++++++++---- tex/context/base/mkiv/font-col.mkvi | 5 + tex/context/base/mkiv/l-lpeg.lua | 20 +++- tex/context/base/mkiv/pack-com.mkiv | 2 +- tex/context/base/mkiv/status-files.pdf | Bin 26120 -> 26068 bytes tex/context/base/mkiv/status-lua.pdf | Bin 268553 -> 269399 bytes tex/context/base/mkiv/tabl-xtb.mkvi | 56 +++++++---- tex/context/interface/mkiv/context-en.xml | 8 ++ tex/context/interface/mkiv/i-context.pdf | Bin 857249 -> 857465 bytes tex/context/interface/mkiv/i-fonts.xml | 8 ++ tex/context/interface/mkiv/i-readme.pdf | Bin 60771 -> 60771 bytes tex/generic/context/luatex/luatex-fonts-merged.lua | 14 ++- 18 files changed, 207 insertions(+), 58 deletions(-) (limited to 'tex') diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index e309eca7b..269f053f9 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{2018.10.02 23:17} +\newcontextversion{2018.10.03 16:02} %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 76f4f8d69..5fa5ed7d2 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{2018.10.02 23:17} +\edef\contextversion{2018.10.03 16:02} %D For those who want to use this: diff --git a/tex/context/base/mkiv/char-ini.lua b/tex/context/base/mkiv/char-ini.lua index ea9aa330f..1c53d924f 100644 --- a/tex/context/base/mkiv/char-ini.lua +++ b/tex/context/base/mkiv/char-ini.lua @@ -642,14 +642,19 @@ function characters.getrange(name,expression) -- used in font fallback definitio name = gsub(name,'"',"0x") -- goodie: tex hex notation local start, stop if expression then - local first, rest = lpegmatch(splitter2,name) - local range = rawget(blocks,lower(gsub(first,"[^a-zA-Z0-9]",""))) - if range then - local s = loadstring("return 0 " .. rest) - if type(s) == "function" then - local d = s() - if type(d) == "number" then - return range.first + d, range.last + d, nil + local n = tonumber(name) + if n then + return n, n, nil + else + local first, rest = lpegmatch(splitter2,name) + local range = rawget(blocks,lower(gsub(first,"[^a-zA-Z0-9]",""))) + if range then + local s = loadstring("return 0 " .. rest) + if type(s) == "function" then + local d = s() + if type(d) == "number" then + return range.first + d, range.last + d, nil + end end end end diff --git a/tex/context/base/mkiv/cldf-bas.lua b/tex/context/base/mkiv/cldf-bas.lua index b2c4b2623..27bb4f343 100644 --- a/tex/context/base/mkiv/cldf-bas.lua +++ b/tex/context/base/mkiv/cldf-bas.lua @@ -150,13 +150,21 @@ function ctxcore.flushboxregister(n) context(type(n) == "number" and [[\box%s ]] or [[\box\%s]],n) end -function ctxcore.beginhbox() context([[\hbox{]]) end -function ctxcore.beginvbox() context([[\vbox{]]) end -function ctxcore.beginvtop() context([[\vtop{]]) end +-- function ctxcore.beginhbox() context([[\hbox\bgroup]]) end +-- function ctxcore.beginvbox() context([[\vbox\bgroup]]) end +-- function ctxcore.beginvtop() context([[\vtop\bgroup]]) end -ctxcore.endhbox = ctx_egroup -ctxcore.endvbox = ctx_egroup -ctxcore.endvtop = ctx_egroup +local ctx_hbox = context.cs.hbox +local ctx_vbox = context.cs.vbox +local ctx_vtop = context.cs.vtop + +function ctxcore.beginhbox() ctx_hbox() ctx_bgroup() end +function ctxcore.beginvbox() ctx_vbox() ctx_bgroup() end +function ctxcore.beginvtop() ctx_vtop() ctx_bgroup() end + +ctxcore.endhbox = ctx_egroup -- \egroup +ctxcore.endvbox = ctx_egroup -- \egroup +ctxcore.endvtop = ctx_egroup -- \egroup local function allocate(name,what,cmd) local a = format("c_syst_last_allocated_%s",what) diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 733561e8c..3e3ab3bde 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{2018.10.02 23:17} +\newcontextversion{2018.10.03 16:02} %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 23a0825ce..5a944df23 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{2018.10.02 23:17} +\edef\contextversion{2018.10.03 16:02} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/font-col.lua b/tex/context/base/mkiv/font-col.lua index 0af6f3188..ae6399525 100644 --- a/tex/context/base/mkiv/font-col.lua +++ b/tex/context/base/mkiv/font-col.lua @@ -124,11 +124,16 @@ function collections.define(name,font,ranges,details) -- todo, combine per font start/stop as arrays local offset = details.offset if type(offset) == "string" then - local start = characters.getrange(offset,true) - offset = start or false + offset = characters.getrange(offset,true) or false else offset = tonumber(offset) or false end + local target = details.target + if type(target) == "string" then + target = characters.getrange(target,true) or false + else + target = tonumber(target) or false + end local rscale = tonumber (details.rscale) or 1 local force = toboolean(details.force,true) local check = toboolean(details.check,true) @@ -154,9 +159,11 @@ function collections.define(name,font,ranges,details) stop = stop, gaps = gaps, offset = offset, + target = target, rscale = rscale, force = force, check = check, + method = details.method, factor = factor, features = features, } @@ -177,6 +184,32 @@ end -- check: when true, only set when present in font -- force: when false, then not set when already set +local uccodes = characters.uccodes +local lccodes = characters.lccodes + +local methods = { + lowercase = function(oldchars,newchars,vector,start,stop,cloneid) + for k, v in next, oldchars do + if k >= start and k <= stop then + local lccode = lccodes[k] + if k ~= lccode and newchars[lccode] then + vector[k] = { cloneid, lccode } + end + end + end + end, + uppercase = function(oldchars,newchars,vector,start,stop,cloneid) + for k, v in next, oldchars do + if k >= start and k <= stop then + local uccode = uccodes[k] + if k ~= uccode and newchars[uccode] then + vector[k] = { cloneid, uccode } + end + end + end + end, +} + function collections.clonevector(name) statistics.starttiming(fonts) if trace_collecting then @@ -193,7 +226,9 @@ function collections.clonevector(name) local check = definition.check local force = definition.force local offset = definition.offset or start - local remap = definition.remap + local remap = definition.remap -- not used + local target = definition.target + local method = definition.method local cloneid = list[i] local oldchars = fontdata[current].characters local newchars = fontdata[cloneid].characters @@ -202,28 +237,60 @@ function collections.clonevector(name) vector.factor = factor end if trace_collecting then - report_fonts("remapping font %a to %a for range %U - %U",current,cloneid,start,stop) + if target then + report_fonts("remapping font %a to %a for range %U - %U, offset %X, target %U",current,cloneid,start,stop,offset,target) + else + report_fonts("remapping font %a to %a for range %U - %U, offset %X",current,cloneid,start,stop,offset) + end end - if check then - for unicode = start, stop do - local unic = unicode + offset - start - if not newchars[unicode] then - -- not in font - elseif force or (not vector[unic] and not oldchars[unic]) then - if remap then - vector[unic] = { cloneid, remap[unicode] } - else + if method then + method = methods[method] + end + if method then + method(oldchars,newchars,vector,start,stop,cloneid) + elseif check then + if target then + for unicode = start, stop do + local unic = unicode + offset - start + if not newchars[target] then + -- not in font + elseif force or (not vector[unic] and not oldchars[unic]) then + vector[unic] = { cloneid, target } + end + target = target + 1 + end + elseif remap then + -- not used + else + for unicode = start, stop do + local unic = unicode + offset - start + if not newchars[unicode] then + -- not in font + elseif force or (not vector[unic] and not oldchars[unic]) then vector[unic] = cloneid end end end else - for unicode = start, stop do - local unic = unicode + offset - start - if force or (not vector[unic] and not oldchars[unic]) then - if remap then + if target then + for unicode = start, stop do + local unic = unicode + offset - start + if force or (not vector[unic] and not oldchars[unic]) then + vector[unic] = { cloneid, target } + end + target = target + 1 + end + elseif remap then + for unicode = start, stop do + local unic = unicode + offset - start + if force or (not vector[unic] and not oldchars[unic]) then vector[unic] = { cloneid, remap[unicode] } - else + end + end + else + for unicode = start, stop do + local unic = unicode + offset - start + if force or (not vector[unic] and not oldchars[unic]) then vector[unic] = cloneid end end diff --git a/tex/context/base/mkiv/font-col.mkvi b/tex/context/base/mkiv/font-col.mkvi index a9c461e44..7ba92b526 100644 --- a/tex/context/base/mkiv/font-col.mkvi +++ b/tex/context/base/mkiv/font-col.mkvi @@ -23,6 +23,11 @@ % \definefontfallback [whatever] [Slanted] [0x0060-0x007F] [force=yes] % \definefontfallback [whatever] [Bold] [0x0080-0x00FF,0x00A0-0x00AF] [rscale=1.2] % \definefontfallback [whatever] [BoldSlanted] [0x00C0-0x00C7] [check=yes,force=yes] +% +% \definefontfeature [emboldened] [effect={width=0.1,delta=0.4,factor=0.3}] +% \definefontsynonym [SansEmboldened] [Sans] [features=emboldened] +% \definefontfallback[FakeSansCaps] [SansEmboldened] [0x0000-0xFFFF] [rscale=.8,method=uppercase] +% \definefontsynonym [SansCaps] [file:MyriadPro-Regular.otf] [fallbacks=FakeSansCaps] \writestatus{loading}{ConTeXt Font Macros / Collections} diff --git a/tex/context/base/mkiv/l-lpeg.lua b/tex/context/base/mkiv/l-lpeg.lua index 750d5e698..589fa2b0b 100644 --- a/tex/context/base/mkiv/l-lpeg.lua +++ b/tex/context/base/mkiv/l-lpeg.lua @@ -308,12 +308,28 @@ function lpeg.instringchecker(p) end end +-- function lpeg.splitter(pattern, action) +-- return (((1-P(pattern))^1)/action+1)^0 +-- end + +-- function lpeg.tsplitter(pattern, action) +-- return Ct((((1-P(pattern))^1)/action+1)^0) +-- end + function lpeg.splitter(pattern, action) - return (((1-P(pattern))^1)/action+1)^0 + if action then + return (((1-P(pattern))^1)/action+1)^0 + else + return (Cs((1-P(pattern))^1)+1)^0 + end end function lpeg.tsplitter(pattern, action) - return Ct((((1-P(pattern))^1)/action+1)^0) + if action then + return Ct((((1-P(pattern))^1)/action+1)^0) + else + return Ct((Cs((1-P(pattern))^1)+1)^0) + end end -- probleem: separator can be lpeg and that does not hash too well, but diff --git a/tex/context/base/mkiv/pack-com.mkiv b/tex/context/base/mkiv/pack-com.mkiv index c7e613368..b69f812e5 100644 --- a/tex/context/base/mkiv/pack-com.mkiv +++ b/tex/context/base/mkiv/pack-com.mkiv @@ -290,7 +290,7 @@ \alignmark\alignmark \m_pack_combinations_rightfiller \aligntab - \tabskip\zeropoint \s!plus 1fill + \tabskip\zeropoint \s!plus 1fill % \fillskip \alignmark\alignmark \cr \pack_combinations_pickup} diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index 8e33d0576..7d9a44566 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 7ce0ed38d..5a886244b 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/base/mkiv/tabl-xtb.mkvi b/tex/context/base/mkiv/tabl-xtb.mkvi index ec0e9c25b..148304331 100644 --- a/tex/context/base/mkiv/tabl-xtb.mkvi +++ b/tex/context/base/mkiv/tabl-xtb.mkvi @@ -912,7 +912,7 @@ % \tabl_x_stop_cell} \def\tabl_x_flush_swapped - {\dorecurse\c_tabl_x_swapped + {\dorecurse\c_tabl_x_swapped_max {\expandafter \startxrow \the\csname\??xtableswap##1\endcsname\relax @@ -922,31 +922,55 @@ {\expandafter\newtoks\csname\??xtableswap\number\c_tabl_x_swapped\endcsname \expandafter\let\expandafter\t_tabl_x_swapped\csname\??xtableswap\number\c_tabl_x_swapped\endcsname} -\unexpanded\def\tabl_x_collect_cell_start#content\stopxcell - {\global\advance\c_tabl_x_swapped\plusone - \ifnum\c_tabl_x_swapped>\c_tabl_x_swapped_max - \global\c_tabl_x_swapped_max\c_tabl_x_swapped - \fi - \expandafter\let\expandafter\t_tabl_x_swapped\csname\??xtableswap\number\c_tabl_x_swapped\endcsname - \ifx\t_tabl_x_swapped\relax - \tabl_x_collect_allocate - \fi - \ifx\m_tabl_x_swapped_settings\empty - \gtoksapp\t_tabl_x_swapped{\tabl_x_c_cell_start{}#content\tabl_x_c_cell_stop} - \else - \gtoksapp\t_tabl_x_swapped\expandafter{\expandafter\tabl_x_c_cell_start\expandafter{\m_tabl_x_swapped_settings}#content\tabl_x_c_cell_stop}% - \fi} +\def\tabl_x_collect_advance + {\global\advance\c_tabl_x_swapped\plusone + \ifnum\c_tabl_x_swapped>\c_tabl_x_swapped_max + \global\c_tabl_x_swapped_max\c_tabl_x_swapped + \fi + \expandafter\let\expandafter\t_tabl_x_swapped\csname\??xtableswap\number\c_tabl_x_swapped\endcsname + \ifx\t_tabl_x_swapped\relax + \tabl_x_collect_allocate + \fi} + +\unexpanded\def\tabl_x_collect_cell_start + {\doifelsenextoptionalcs + \tabl_x_collect_cell_start_yes + \tabl_x_collect_cell_start_nop} + +\def\tabl_x_collect_cell_start_nop#content\stopxcell + {\tabl_x_collect_advance + \ifx\m_tabl_x_swapped_settings\empty + \gtoksapp\t_tabl_x_swapped{\tabl_x_c_cell_start{}#content\tabl_x_c_cell_stop}% + \else + \gtoksapp\t_tabl_x_swapped\expandafter{\expandafter\tabl_x_c_cell_start\expandafter{\m_tabl_x_swapped_settings}#content\tabl_x_c_cell_stop}% + \fi} + +\def\tabl_x_collect_cell_start_yes[#settings]#content\stopxcell + {\tabl_x_collect_advance + \ifx\m_tabl_x_swapped_settings\empty + \gtoksapp\t_tabl_x_swapped{\tabl_x_c_cell_start{}[#settings]#content\tabl_x_c_cell_stop}% + \else + \gtoksapp\t_tabl_x_swapped\expandafter{\expandafter\tabl_x_c_cell_start\expandafter{\m_tabl_x_swapped_settings}[#settings]#content\tabl_x_c_cell_stop}% + \fi + \getdummyparameters[\c!ny=1,#settings]% + \scratchcounter\numexpr\dummyparameter\c!ny-\plusone\relax + \ifcase\scratchcounter\else + \dorecurse\scratchcounter\tabl_x_collect_advance + \fi} \unexpanded\def\startxcolumn % todo: arguments {\begingroup \global\c_tabl_x_swapped\zerocount \let\startxcell\tabl_x_collect_cell_start \let\stopxcell \relax - \doifelsenextoptionalcs\tabl_x_start_column_yes\relax} + \doifelsenextoptionalcs\tabl_x_start_column_yes\tabl_x_start_column_nop} \def\tabl_x_start_column_yes[#1]% {\xdef\m_tabl_x_swapped_settings{#1}} +\def\tabl_x_start_column_nop + {\glet\m_tabl_x_swapped_settings\empty} + \unexpanded\def\stopxcolumn {\endgroup} diff --git a/tex/context/interface/mkiv/context-en.xml b/tex/context/interface/mkiv/context-en.xml index 9b1cbd0c2..508e2fc7c 100644 --- a/tex/context/interface/mkiv/context-en.xml +++ b/tex/context/interface/mkiv/context-en.xml @@ -11379,12 +11379,20 @@ + + + + + + + + diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf index 7137482f0..f373195d9 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-fonts.xml b/tex/context/interface/mkiv/i-fonts.xml index 9735f8935..03bdb2a7e 100644 --- a/tex/context/interface/mkiv/i-fonts.xml +++ b/tex/context/interface/mkiv/i-fonts.xml @@ -31,12 +31,20 @@ + + + + + + + + diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf index 4b64b52c2..3dcf09ed4 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/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index ccf6d3a7c..adc2c6202 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 : 10/02/18 23:17:57 +-- merge date : 10/03/18 16:02:19 do -- begin closure to overcome local limits and interference @@ -306,10 +306,18 @@ function lpeg.instringchecker(p) end end function lpeg.splitter(pattern,action) - return (((1-P(pattern))^1)/action+1)^0 + if action then + return (((1-P(pattern))^1)/action+1)^0 + else + return (Cs((1-P(pattern))^1)+1)^0 + end end function lpeg.tsplitter(pattern,action) - return Ct((((1-P(pattern))^1)/action+1)^0) + if action then + return Ct((((1-P(pattern))^1)/action+1)^0) + else + return Ct((Cs((1-P(pattern))^1)+1)^0) + end end local splitters_s,splitters_m,splitters_t={},{},{} local function splitat(separator,single) -- cgit v1.2.3