diff options
author | Hans Hagen <pragma@wxs.nl> | 2017-05-13 00:46:22 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2017-05-13 00:46:22 +0200 |
commit | aceba29d651766f5621b9812d4c40e28029bc4ea (patch) | |
tree | c758ab7390365921595c52d4c99f80fb75636c79 | |
parent | fdc4bdf67540ac0b5194641a552903faf9aef3a9 (diff) | |
download | context-aceba29d651766f5621b9812d4c40e28029bc4ea.tar.gz |
2017-05-12 22:46:00
25 files changed, 393 insertions, 171 deletions
diff --git a/doc/context/documents/general/qrcs/setup-cs.pdf b/doc/context/documents/general/qrcs/setup-cs.pdf Binary files differindex 36acb37d9..6d5775ddb 100644 --- a/doc/context/documents/general/qrcs/setup-cs.pdf +++ b/doc/context/documents/general/qrcs/setup-cs.pdf diff --git a/doc/context/documents/general/qrcs/setup-de.pdf b/doc/context/documents/general/qrcs/setup-de.pdf Binary files differindex 9424a661d..721e31d5b 100644 --- a/doc/context/documents/general/qrcs/setup-de.pdf +++ b/doc/context/documents/general/qrcs/setup-de.pdf diff --git a/doc/context/documents/general/qrcs/setup-en.pdf b/doc/context/documents/general/qrcs/setup-en.pdf Binary files differindex b32bd0a85..304cdbe33 100644 --- a/doc/context/documents/general/qrcs/setup-en.pdf +++ b/doc/context/documents/general/qrcs/setup-en.pdf diff --git a/doc/context/documents/general/qrcs/setup-fr.pdf b/doc/context/documents/general/qrcs/setup-fr.pdf Binary files differindex ae7c1d274..e28ca467e 100644 --- a/doc/context/documents/general/qrcs/setup-fr.pdf +++ b/doc/context/documents/general/qrcs/setup-fr.pdf diff --git a/doc/context/documents/general/qrcs/setup-it.pdf b/doc/context/documents/general/qrcs/setup-it.pdf Binary files differindex 17160c278..e54aa9fe6 100644 --- a/doc/context/documents/general/qrcs/setup-it.pdf +++ b/doc/context/documents/general/qrcs/setup-it.pdf diff --git a/doc/context/documents/general/qrcs/setup-nl.pdf b/doc/context/documents/general/qrcs/setup-nl.pdf Binary files differindex 0598ce45e..84dbf2b1c 100644 --- a/doc/context/documents/general/qrcs/setup-nl.pdf +++ b/doc/context/documents/general/qrcs/setup-nl.pdf diff --git a/doc/context/documents/general/qrcs/setup-ro.pdf b/doc/context/documents/general/qrcs/setup-ro.pdf Binary files differindex 50cf44626..b248bfb77 100644 --- a/doc/context/documents/general/qrcs/setup-ro.pdf +++ b/doc/context/documents/general/qrcs/setup-ro.pdf diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 8d3267e35..847856cb9 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.05.10 10:41} +\newcontextversion{2017.05.12 22:40} %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 0386cce0c..725f87c00 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.05.10 10:41} +\edef\contextversion{2017.05.12 22:40} %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 f673a6a86..8fe852b58 100644 --- a/tex/context/base/mkiv/char-ini.lua +++ b/tex/context/base/mkiv/char-ini.lua @@ -553,15 +553,34 @@ setmetatableindex(otfscripts,function(t,unicode) return "dflt" end) -local splitter = lpeg.splitat(S(":-")) +local splitter1 = lpeg.splitat(S(":-")) +local splitter2 = lpeg.splitat(S(" +-"),true) -function characters.getrange(name) -- used in font fallback definitions (name or range) - local range = blocks[name] +function characters.getrange(name,expression) -- used in font fallback definitions (name or range) + local range = rawget(blocks,lower(gsub(name,"[^a-zA-Z0-9]",""))) if range then return range.first, range.last, range.description, range.gaps end name = gsub(name,'"',"0x") -- goodie: tex hex notation - local start, stop = lpegmatch(splitter,name) + 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 + start = range.first + stop = range.last + local s = loadstring("return 0 " .. rest) + if type(s) == "function" then + local d = s() + if type(d) == "number" then + start = start + d + stop = stop + d + return start, stop, nil + end + end + end + end + start, stop = lpegmatch(splitter1,name) if start and stop then start, stop = tonumber(start,16) or tonumber(start), tonumber(stop,16) or tonumber(stop) if start and stop then @@ -572,6 +591,9 @@ function characters.getrange(name) -- used in font fallback definitions (name or return slot, slot, nil end +-- print(characters.getrange("lowercaseitalic + 123",true)) +-- print(characters.getrange("lowercaseitalic + 124",true)) + local categorytags = allocate { lu = "Letter Uppercase", ll = "Letter Lowercase", diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index e05965282..3aacc978c 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.05.10 10:41} +\newcontextversion{2017.05.12 22:40} %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 61c837076..6d946e0bc 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -39,7 +39,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2017.05.10 10:41} +\edef\contextversion{2017.05.12 22:40} \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 3698960b8..bce16fae7 100644 --- a/tex/context/base/mkiv/font-col.lua +++ b/tex/context/base/mkiv/font-col.lua @@ -104,7 +104,7 @@ function collections.define(name,font,ranges,details) details = settings_to_hash(details) -- todo, combine per font start/stop as arrays for s in gmatch(ranges,"[^, ]+") do - local start, stop, description, gaps = characters.getrange(s) + local start, stop, description, gaps = characters.getrange(s,true) if start and stop then if trace_collecting then if description then @@ -119,7 +119,7 @@ function collections.define(name,font,ranges,details) end local offset = details.offset if type(offset) == "string" then - local start = characters.getrange(offset) + local start = characters.getrange(offset,true) offset = start or false else offset = tonumber(offset) or false diff --git a/tex/context/base/mkiv/font-col.mkvi b/tex/context/base/mkiv/font-col.mkvi index bd1109e5c..88a3ff941 100644 --- a/tex/context/base/mkiv/font-col.mkvi +++ b/tex/context/base/mkiv/font-col.mkvi @@ -102,8 +102,8 @@ {\definedfont[#2*#3\space at #4\scaledpoint]}% \ctxlua{mathematics.registerfallbackid(#1,\fontid\font)}} -\def\font_fallbacks_finish_math - {\ctxlua{mathematics.finishfallbacks()}} +% \def\font_fallbacks_finish_math +% {\ctxlua{mathematics.finishfallbacks()}} % check : only replace when present in replacement font (default: no) % force : force replacent even when basefont has glyph (default: yes) diff --git a/tex/context/base/mkiv/font-ctx.lua b/tex/context/base/mkiv/font-ctx.lua index b86ab59fb..578babc75 100644 --- a/tex/context/base/mkiv/font-ctx.lua +++ b/tex/context/base/mkiv/font-ctx.lua @@ -1118,6 +1118,187 @@ do -- else too many locals -- function commands.definefont_two(global,cs,str,size,inheritancemode,classfeatures,fontfeatures,classfallbacks,fontfallbacks, -- mathsize,textsize,relativeid,classgoodies,goodies,classdesignsize,fontdesignsize,scaledfontmode) +-- scanners.definefont_two = function() + +-- local global = scanboolean() -- \ifx\fontclass\empty\s!false\else\s!true\fi +-- local cs = scanstring () -- {#csname}% +-- local str = scanstring () -- \somefontfile +-- local size = scaninteger() -- \d_font_scaled_font_size +-- local inheritancemode = scaninteger() -- \c_font_feature_inheritance_mode +-- local classfeatures = scanstring () -- \m_font_class_features +-- local fontfeatures = scanstring () -- \m_font_features +-- local classfallbacks = scanstring () -- \m_font_class_fallbacks +-- local fontfallbacks = scanstring () -- \m_font_fallbacks +-- local mathsize = scaninteger() -- \fontface +-- local textsize = scaninteger() -- \d_font_scaled_text_face +-- local relativeid = scaninteger() -- \relativefontid +-- local classgoodies = scanstring () -- \m_font_class_goodies +-- local goodies = scanstring () -- \m_font_goodies +-- local classdesignsize = scanstring () -- \m_font_class_designsize +-- local fontdesignsize = scanstring () -- \m_font_designsize +-- local scaledfontmode = scaninteger() -- \scaledfontmode + +-- if trace_defining then +-- report_defining("start stage two: %s, size %s, features %a & %a",str,size,classfeatures,fontfeatures) +-- end +-- -- name is now resolved and size is scaled cf sa/mo +-- local lookup, name, sub, method, detail = getspecification(str or "") +-- -- new (todo: inheritancemode) +-- local designsize = fontdesignsize ~= "" and fontdesignsize or classdesignsize or "" +-- local designname = designsizefilename(name,designsize,size) +-- if designname and designname ~= "" then +-- if trace_defining or trace_designsize then +-- report_defining("remapping name %a, specification %a, size %a, designsize %a",name,designsize,size,designname) +-- end +-- -- we don't catch detail here +-- local o_lookup, o_name, o_sub, o_method, o_detail = getspecification(designname) +-- if o_lookup and o_lookup ~= "" then lookup = o_lookup end +-- if o_method and o_method ~= "" then method = o_method end +-- if o_detail and o_detail ~= "" then detail = o_detail end +-- name = o_name +-- sub = o_sub +-- end +-- -- so far +-- -- some settings can have been overloaded +-- if lookup and lookup ~= "" then +-- specification.lookup = lookup +-- end +-- if relativeid and relativeid ~= "" then -- experimental hook +-- local id = tonumber(relativeid) or 0 +-- specification.relativeid = id > 0 and id +-- end +-- -- +-- specification.name = name +-- specification.size = size +-- specification.sub = (sub and sub ~= "" and sub) or specification.sub +-- specification.mathsize = mathsize +-- specification.textsize = textsize +-- specification.goodies = goodies +-- specification.cs = cs +-- specification.global = global +-- specification.scalemode = scaledfontmode -- context specific +-- if detail and detail ~= "" then +-- specification.method = method or "*" +-- specification.detail = detail +-- elseif specification.detail and specification.detail ~= "" then +-- -- already set +-- elseif inheritancemode == 0 then +-- -- nothing +-- elseif inheritancemode == 1 then +-- -- fontonly +-- if fontfeatures and fontfeatures ~= "" then +-- specification.method = "*" +-- specification.detail = fontfeatures +-- end +-- if fontfallbacks and fontfallbacks ~= "" then +-- specification.fallbacks = fontfallbacks +-- end +-- elseif inheritancemode == 2 then +-- -- classonly +-- if classfeatures and classfeatures ~= "" then +-- specification.method = "*" +-- specification.detail = classfeatures +-- end +-- if classfallbacks and classfallbacks ~= "" then +-- specification.fallbacks = classfallbacks +-- end +-- elseif inheritancemode == 3 then +-- -- fontfirst +-- if fontfeatures and fontfeatures ~= "" then +-- specification.method = "*" +-- specification.detail = fontfeatures +-- elseif classfeatures and classfeatures ~= "" then +-- specification.method = "*" +-- specification.detail = classfeatures +-- end +-- if fontfallbacks and fontfallbacks ~= "" then +-- specification.fallbacks = fontfallbacks +-- elseif classfallbacks and classfallbacks ~= "" then +-- specification.fallbacks = classfallbacks +-- end +-- elseif inheritancemode == 4 then +-- -- classfirst +-- if classfeatures and classfeatures ~= "" then +-- specification.method = "*" +-- specification.detail = classfeatures +-- elseif fontfeatures and fontfeatures ~= "" then +-- specification.method = "*" +-- specification.detail = fontfeatures +-- end +-- if classfallbacks and classfallbacks ~= "" then +-- specification.fallbacks = classfallbacks +-- elseif fontfallbacks and fontfallbacks ~= "" then +-- specification.fallbacks = fontfallbacks +-- end +-- end +-- local tfmdata = definers.read(specification,size) -- id not yet known (size in spec?) +-- -- +-- local lastfontid = 0 +-- if not tfmdata then +-- report_defining("unable to define %a as %a",name,nice_cs(cs)) +-- lastfontid = -1 +-- texsetcount("scaledfontsize",0) +-- -- ctx_letvaluerelax(cs) -- otherwise the current definition takes the previous one +-- elseif type(tfmdata) == "number" then +-- if trace_defining then +-- report_defining("reusing %s, id %a, target %a, features %a / %a, fallbacks %a / %a, goodies %a / %a, designsize %a / %a", +-- name,tfmdata,nice_cs(cs),classfeatures,fontfeatures,classfallbacks,fontfallbacks,classgoodies,goodies,classdesignsize,fontdesignsize) +-- end +-- csnames[tfmdata] = specification.cs +-- texdefinefont(global,cs,tfmdata) +-- -- resolved (when designsize is used): +-- local size = fontdata[tfmdata].parameters.size or 0 +-- -- ctx_setsomefontsize(size .. "sp") +-- setmacro("somefontsize",size.."sp") +-- texsetcount("scaledfontsize",size) +-- lastfontid = tfmdata +-- else +-- -- setting the extra characters will move elsewhere +-- local characters = tfmdata.characters +-- local parameters = tfmdata.parameters +-- -- we use char0 as signal; cf the spec pdf can handle this (no char in slot) +-- characters[0] = nil +-- -- characters[0x00A0] = { width = parameters.space } +-- -- characters[0x2007] = { width = characters[0x0030] and characters[0x0030].width or parameters.space } -- figure +-- -- characters[0x2008] = { width = characters[0x002E] and characters[0x002E].width or parameters.space } -- period +-- -- +-- constructors.checkvirtualids(tfmdata) -- experiment, will become obsolete when slots can selfreference +-- local id = definefont(tfmdata) +-- csnames[id] = specification.cs +-- tfmdata.properties.id = id +-- definers.register(tfmdata,id) -- to be sure, normally already done +-- texdefinefont(global,cs,id) +-- constructors.cleanuptable(tfmdata) +-- constructors.finalize(tfmdata) +-- if trace_defining then +-- report_defining("defining %a, id %a, target %a, features %a / %a, fallbacks %a / %a", +-- name,id,nice_cs(cs),classfeatures,fontfeatures,classfallbacks,fontfallbacks) +-- end +-- -- resolved (when designsize is used): +-- local size = tfmdata.parameters.size or 655360 +-- setmacro("somefontsize",size.."sp") +-- -- ctx_setsomefontsize(size .. "sp") +-- texsetcount("scaledfontsize",size) +-- lastfontid = id +-- end +-- if trace_defining then +-- report_defining("memory usage after: %s",statistics.memused()) +-- report_defining("stop stage two") +-- end +-- -- +-- texsetcount("global","lastfontid",lastfontid) +-- specifiers[lastfontid] = { str, size } +-- if not mathsize then +-- -- forget about it +-- elseif mathsize == 0 then +-- lastmathids[1] = lastfontid +-- else +-- lastmathids[mathsize] = lastfontid +-- end +-- -- +-- stoptiming(fonts) +-- end + scanners.definefont_two = function() local global = scanboolean() -- \ifx\fontclass\empty\s!false\else\s!true\fi @@ -1234,25 +1415,8 @@ do -- else too many locals local tfmdata = definers.read(specification,size) -- id not yet known (size in spec?) -- local lastfontid = 0 - if not tfmdata then - report_defining("unable to define %a as %a",name,nice_cs(cs)) - lastfontid = -1 - texsetcount("scaledfontsize",0) - -- ctx_letvaluerelax(cs) -- otherwise the current definition takes the previous one - elseif type(tfmdata) == "number" then - if trace_defining then - report_defining("reusing %s, id %a, target %a, features %a / %a, fallbacks %a / %a, goodies %a / %a, designsize %a / %a", - name,tfmdata,nice_cs(cs),classfeatures,fontfeatures,classfallbacks,fontfallbacks,classgoodies,goodies,classdesignsize,fontdesignsize) - end - csnames[tfmdata] = specification.cs - texdefinefont(global,cs,tfmdata) - -- resolved (when designsize is used): - local size = fontdata[tfmdata].parameters.size or 0 - -- ctx_setsomefontsize(size .. "sp") - setmacro("somefontsize",size.."sp") - texsetcount("scaledfontsize",size) - lastfontid = tfmdata - else + local tfmtype = type(tfmdata) + if tfmtype == "table" then -- setting the extra characters will move elsewhere local characters = tfmdata.characters local parameters = tfmdata.parameters @@ -1263,23 +1427,83 @@ do -- else too many locals -- characters[0x2008] = { width = characters[0x002E] and characters[0x002E].width or parameters.space } -- period -- constructors.checkvirtualids(tfmdata) -- experiment, will become obsolete when slots can selfreference - local id = definefont(tfmdata) - csnames[id] = specification.cs - tfmdata.properties.id = id - definers.register(tfmdata,id) -- to be sure, normally already done - texdefinefont(global,cs,id) - constructors.cleanuptable(tfmdata) - constructors.finalize(tfmdata) + local fallbacks = specification.fallbacks + if fallbacks and fallbacks ~= "" and tfmdata.properties.hasmath then + -- We need this ugly hack in order to resolve fontnames (at the \TEX end). Originally + -- math was done in Lua after loading (plugged into aftercopying). + -- + -- After tl 2017 I'll also do text falbacks this way (although backups there are done + -- in a completely different way. + mathematics.resolvefallbacks(tfmdata,specification,fallbacks) + context(function() + mathematics.finishfallbacks(tfmdata,specification,fallbacks) + local id = definefont(tfmdata) + csnames[id] = specification.cs + tfmdata.properties.id = id + definers.register(tfmdata,id) -- to be sure, normally already done + texdefinefont(global,cs,id) + constructors.cleanuptable(tfmdata) + constructors.finalize(tfmdata) + if trace_defining then + report_defining("defining %a, id %a, target %a, features %a / %a, fallbacks %a / %a", + name,id,nice_cs(cs),classfeatures,fontfeatures,classfallbacks,fontfallbacks) + end + -- resolved (when designsize is used): + local size = tfmdata.parameters.size or 655360 + setmacro("somefontsize",size.."sp") + -- ctx_setsomefontsize(size .. "sp") + texsetcount("scaledfontsize",size) + lastfontid = id + -- + texsetcount("global","lastfontid",lastfontid) + specifiers[lastfontid] = { str, size } + if not mathsize then + -- forget about it + elseif mathsize == 0 then + lastmathids[1] = lastfontid + else + lastmathids[mathsize] = lastfontid + end + stoptiming(fonts) + end) + return + else + local id = definefont(tfmdata) + csnames[id] = specification.cs + tfmdata.properties.id = id + definers.register(tfmdata,id) -- to be sure, normally already done + texdefinefont(global,cs,id) + constructors.cleanuptable(tfmdata) + constructors.finalize(tfmdata) + if trace_defining then + report_defining("defining %a, id %a, target %a, features %a / %a, fallbacks %a / %a", + name,id,nice_cs(cs),classfeatures,fontfeatures,classfallbacks,fontfallbacks) + end + -- resolved (when designsize is used): + local size = tfmdata.parameters.size or 655360 + setmacro("somefontsize",size.."sp") + -- ctx_setsomefontsize(size .. "sp") + texsetcount("scaledfontsize",size) + lastfontid = id + end + elseif tfmtype == "number" then if trace_defining then - report_defining("defining %a, id %a, target %a, features %a / %a, fallbacks %a / %a", - name,id,nice_cs(cs),classfeatures,fontfeatures,classfallbacks,fontfallbacks) + report_defining("reusing %s, id %a, target %a, features %a / %a, fallbacks %a / %a, goodies %a / %a, designsize %a / %a", + name,tfmdata,nice_cs(cs),classfeatures,fontfeatures,classfallbacks,fontfallbacks,classgoodies,goodies,classdesignsize,fontdesignsize) end + csnames[tfmdata] = specification.cs + texdefinefont(global,cs,tfmdata) -- resolved (when designsize is used): - local size = tfmdata.parameters.size or 655360 - setmacro("somefontsize",size.."sp") + local size = fontdata[tfmdata].parameters.size or 0 -- ctx_setsomefontsize(size .. "sp") + setmacro("somefontsize",size.."sp") texsetcount("scaledfontsize",size) - lastfontid = id + lastfontid = tfmdata + else + report_defining("unable to define %a as %a",name,nice_cs(cs)) + lastfontid = -1 + texsetcount("scaledfontsize",0) + -- ctx_letvaluerelax(cs) -- otherwise the current definition takes the previous one end if trace_defining then report_defining("memory usage after: %s",statistics.memused()) diff --git a/tex/context/base/mkiv/font-mat.mkvi b/tex/context/base/mkiv/font-mat.mkvi index fb14f1114..cbc78aca8 100644 --- a/tex/context/base/mkiv/font-mat.mkvi +++ b/tex/context/base/mkiv/font-mat.mkvi @@ -133,9 +133,9 @@ {\let\savedfontbody\fontbody \let\fontfamily#family% % the order is important as we depend on known id's when completing fonts - \let\mathsizesuffix\mathtextsuffix \let\fontface\!!plusthree\font_helpers_set_math_family_a\scriptscriptfont#mrtag\font + \let\mathsizesuffix\mathscriptscriptsuffix\let\fontface\!!plusthree\font_helpers_set_math_family_a\scriptscriptfont#mrtag\font \let\mathsizesuffix\mathscriptsuffix \let\fontface\!!plustwo \font_helpers_set_math_family_a\scriptfont #mrtag\font - \let\mathsizesuffix\mathscriptscriptsuffix\let\fontface\!!plusone \font_helpers_set_math_family_a\textfont #mrtag\font + \let\mathsizesuffix\mathtextsuffix \let\fontface\!!plusone \font_helpers_set_math_family_a\textfont #mrtag\font \let\mathsizesuffix\empty \let\fontface\!!zerocount \let\fontbody\savedfontbody \setfalse\c_font_auto_size} @@ -161,9 +161,9 @@ \let\defaultfontclass\fontclass % else truefontname falls back on the wrong one \let\savedfontbody\fontbody \let\fontfamily#familytag% - \let\mathsizesuffix\mathtextsuffix \let\fontface\!!plusthree\font_helpers_set_math_family_bold_a\scriptscriptfont#mbfam#mrfam% + \let\mathsizesuffix\mathscriptscriptsuffix\let\fontface\!!plusthree\font_helpers_set_math_family_bold_a\scriptscriptfont#mbfam#mrfam% \let\mathsizesuffix\mathscriptsuffix \let\fontface\!!plustwo \font_helpers_set_math_family_bold_a\scriptfont #mbfam#mrfam% - \let\mathsizesuffix\mathscriptscriptsuffix\let\fontface\!!plusone \font_helpers_set_math_family_bold_a\textfont #mbfam#mrfam% + \let\mathsizesuffix\mathtextsuffix \let\fontface\!!plusone \font_helpers_set_math_family_bold_a\textfont #mbfam#mrfam% \let\mathsizesuffix\empty \let\fontface\!!zerocount \let\fontbody\savedfontbody \let\defaultfontclass\savedfontclass diff --git a/tex/context/base/mkiv/math-act.lua b/tex/context/base/mkiv/math-act.lua index ead26bd4f..4fcac17d8 100644 --- a/tex/context/base/mkiv/math-act.lua +++ b/tex/context/base/mkiv/math-act.lua @@ -632,7 +632,7 @@ blocks["uppercasedoublestruck"].gaps = { -- fonts[index] = { id = id, size = size } -- local chars = fontchars[id] -- local function remap(unic,unicode,gap) --- local unic = unicode + offset - start +-- -- local unic = unicode + offset - start -- if check and not chars[unicode] then -- -- not in font -- elseif force or (not done[unic] and not characters[unic]) then @@ -659,143 +659,100 @@ blocks["uppercasedoublestruck"].gaps = { -- end -- end -- end +-- +-- sequencers.appendaction("aftercopyingcharacters", "system","mathematics.finishfallbacks") local stack = { } function mathematics.registerfallbackid(n,id) - local top = stack[#stack] - if top then - top.list[n] = id - else - report_math("stack underrun in math fallbacks") - end + stack[#stack][n] = id end -function mathematics.injectfallbacks(target,original) - if #stack > 0 then - -- for now - if trace_collecting then - report_math("stack overflow in math fallbacks") - end - return - end - local properties = original.properties - if properties and properties.hasmath then - local specification = target.specification - if specification then - local fallbacks = specification.fallbacks - if fallbacks then - local definitions = fonts.collections.definitions[fallbacks] - if definitions then - insert(stack, { - target = target, - original = original, - list = { }, - }) - if trace_collecting then - report_math("adding fallback characters to font %a",specification.hash) - end - local size = specification.size -- target.size - context.pushcatcodes("prt") -- context.unprotect() - for i=1,#definitions do - local definition = definitions[i] - local name = definition.font - local features = definition.features or "" - local size = size * (definition.rscale or 1) - context.font_fallbacks_register_math(i,name,features,size) - end - context.font_fallbacks_finish_math() - context.popcatcodes() - end +function mathematics.resolvefallbacks(target,specification,fallbacks) + local definitions = fonts.collections.definitions[fallbacks] + if definitions then + local size = specification.size -- target.size + local list = { } + insert(stack,list) + context.pushcatcodes("prt") -- context.unprotect() + for i=1,#definitions do + local definition = definitions[i] + local name = definition.font + local features = definition.features or "" + local size = size * (definition.rscale or 1) + context.font_fallbacks_register_math(i,name,features,size) + if trace_collecting then + report_math("registering fallback font %i, name %a, size %a, features %a",i,name,size,features) end end + context.popcatcodes() end end -function mathematics.finishfallbacks() - local top = remove(stack) - if not top then - report_math("finish error in math fallbacks") - return - end - local target = top.target - local original = top.original - local list = top.list - local properties = original.properties - if properties and properties.hasmath then - local specification = target.specification - if specification then - local fallbacks = specification.fallbacks - if fallbacks then - local definitions = fonts.collections.definitions[fallbacks] - if definitions and #definitions > 0 then - if trace_collecting then - report_math("adding fallback characters to font %a",specification.hash) - end - local definedfont = fonts.definers.internal - local copiedglyph = fonts.handlers.vf.math.copy_glyph - local fonts = target.fonts - local size = specification.size -- target.size - local characters = target.characters - if not fonts then - fonts = { } - target.fonts = fonts - target.type = "virtual" - target.properties.virtualized = true +function mathematics.finishfallbacks(target,specification,fallbacks) + local list = remove(stack) + if list and #list > 0 then + local definitions = fonts.collections.definitions[fallbacks] + if definitions and #definitions > 0 then + if trace_collecting then + report_math("adding fallback characters to font %a",specification.hash) + end + local definedfont = fonts.definers.internal + local copiedglyph = fonts.handlers.vf.math.copy_glyph + local fonts = target.fonts + local size = specification.size -- target.size + local characters = target.characters + if not fonts then + fonts = { } + target.fonts = fonts + end + target.type = "virtual" + target.properties.virtualized = true + if #fonts == 0 then + fonts[1] = { id = 0, size = size } -- self, will be resolved later + end + local done = { } + for i=1,#definitions do + local definition = definitions[i] + local name = definition.font + local start = definition.start + local stop = definition.stop + local gaps = definition.gaps + local check = definition.check + local force = definition.force + local rscale = definition.rscale or 1 + local offset = definition.offset or start + local id = list[i] + if id then + local index = #fonts + 1 + fonts[index] = { id = id, size = size } + local chars = fontchars[id] + local function remap(unic,unicode,gap) + if check and not chars[unicode] then + return + end + if force or (not done[unic] and not characters[unic]) then + if trace_collecting then + report_math("replacing math character %C by %C using vector %a and font %a named %a%s%s", + unic,unicode,fallbacks,id,name,check and ", checked",gap and ", gap plugged") + end + characters[unic] = copiedglyph(target,characters,chars,unicode,index) + done[unic] = true + end end - if #fonts == 0 then - fonts[1] = { id = 0, size = size } -- sel, will be resolved later + for unicode = start, stop do + local unic = unicode + offset - start + remap(unic,unicode,false) end - local done = { } - for i=1,#definitions do - local definition = definitions[i] - local name = definition.font - local start = definition.start - local stop = definition.stop - local gaps = definition.gaps - local check = definition.check - local force = definition.force - local rscale = definition.rscale or 1 - local offset = definition.offset or start - local id = list[i] - if id then - local index = #fonts + 1 - fonts[index] = { id = id, size = size } - local chars = fontchars[id] - local function remap(unic,unicode,gap) - local unic = unicode + offset - start - if check and not chars[unicode] then - -- not in font - elseif force or (not done[unic] and not characters[unic]) then - if trace_collecting then - report_math("remapping math character, vector %a, font %a, character %C%s%s", - fallbacks,name,unic,check and ", checked",gap and ", gap plugged") - end - characters[unic] = copiedglyph(target,characters,chars,unicode,index) - done[unic] = true - else - end - end - for unicode = start, stop do - local unic = unicode + offset - start - remap(unic,unicode,false) - end - if gaps then - for unic, unicode in next, gaps do - remap(unic,unicode,true) - end - end + if gaps then + for unic, unicode in next, gaps do + remap(unic,unicode,true) end end - xlist = nil - xtarget = nil - xoriginal = nil - elseif trace_collecting then - report_math("no fallback characters added to font %a",specification.hash) end end + elseif trace_collecting then + report_math("no fallback characters added to font %a",specification.hash) end end end - -sequencers.appendaction("aftercopyingcharacters", "system","mathematics.injectfallbacks") diff --git a/tex/context/base/mkiv/math-noa.lua b/tex/context/base/mkiv/math-noa.lua index 4db35c2d6..f9e8c9f70 100644 --- a/tex/context/base/mkiv/math-noa.lua +++ b/tex/context/base/mkiv/math-noa.lua @@ -585,9 +585,10 @@ do end local newchar = remapalphabets(char,a,g) if newchar then - if characters[newchar] then + local newchardata = characters[newchar] + if newchardata then if trace_remapping then - report_remap("char",font,char,newchar) + report_remap("char",font,char,newchar,newchardata.commands and " (virtual)" or "") end if trace_analyzing then setnodecolor(pointer,"font:isol") @@ -618,6 +619,11 @@ do report_remap("char",font,char,newchar," fails (no fallback style)") end end + elseif trace_remapping then + local chardata = characters[char] + if chardata and chardata.commands then + report_remap("char",font,char,char," (virtual)") + end end end if not characters[char] then diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 4948cc2fb..ac5183783 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 16575aea7..7e492a7e7 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex b32bd0a85..304cdbe33 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 e0cfaf5b3..9c05491bc 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf diff --git a/tex/context/sample/common/samples.tex b/tex/context/sample/common/samples.tex index 0201ab318..8d1477e1c 100644 --- a/tex/context/sample/common/samples.tex +++ b/tex/context/sample/common/samples.tex @@ -48,6 +48,8 @@ used in testing bibliographic references and citations. \NC waltham.tex \NC David Waltham \NC Lucky Planet, why earth is exceptional and what that means for life in the universe, Icon Books Ltd, London, 2014, p. 168 \NC \NR +\NC sapolsky.tex \NC Robert M. Sapolsky \NC Why Zebras Don't Have Ulsters, means for life in the universe, + St Martin's Press, 2004 \NC \NR \stoptabulate % Tufte: This quote will always produce hyphenated text, apart from the content, diff --git a/tex/context/sample/common/sapolsky.tex b/tex/context/sample/common/sapolsky.tex new file mode 100644 index 000000000..37c3ae4f3 --- /dev/null +++ b/tex/context/sample/common/sapolsky.tex @@ -0,0 +1,11 @@ +Agriculture is a fairly recent human invention, and in many ways it was one of +the great stupid moves of all time. Hunter|-|gatherers have thousands of wild +sources of food to subsist on. Agriculture changed that all, generating an +overwhelming reliance on a few dozen domesticated food sources, making you +extremely vulnerable to the next famine, the next locust infestation, the next +potato blight. Agriculture allowed for stockpiling of surplus resources and thus, +inevitably, the unequal stockpiling of them --- stratification of society and +the invention of classes. Thus, it allowed for the invention of poverty. I think +that the punch line of the primate|-|human difference is that when humans +invented poverty, they came up with a way of subjugating the low|-|ranking like +nothing ever seen before in the primate world. diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 953d2bf00..cc8c27bcf 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 : 05/10/17 10:41:46 +-- merge date : 05/12/17 22:40:43 do -- begin closure to overcome local limits and interference |