diff options
Diffstat (limited to 'tex')
-rw-r--r-- | tex/context/base/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/context-version.pdf | bin | 4211 -> 4198 bytes | |||
-rw-r--r-- | tex/context/base/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/font-fea.mkvi | 10 | ||||
-rw-r--r-- | tex/context/base/font-gds.lua | 9 | ||||
-rw-r--r-- | tex/context/base/font-otb.lua | 10 | ||||
-rw-r--r-- | tex/context/base/font-otc.lua | 77 | ||||
-rw-r--r-- | tex/context/base/font-otf.lua | 65 | ||||
-rw-r--r-- | tex/context/base/font-oth.lua | 44 | ||||
-rw-r--r-- | tex/context/base/font-otl.lua | 131 | ||||
-rw-r--r-- | tex/context/base/font-otn.lua | 1 | ||||
-rw-r--r-- | tex/context/base/font-pre.mkiv | 4 | ||||
-rw-r--r-- | tex/context/base/math-ini.mkiv | 21 | ||||
-rw-r--r-- | tex/context/base/math-noa.lua | 90 | ||||
-rw-r--r-- | tex/context/base/mult-low.lua | 2 | ||||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 24346 -> 24376 bytes | |||
-rw-r--r-- | tex/context/base/status-lua.pdf | bin | 254399 -> 254430 bytes | |||
-rw-r--r-- | tex/context/base/tabl-tsp.mkiv | 22 | ||||
-rw-r--r-- | tex/context/base/type-imp-texgyre.mkiv | 8 | ||||
-rw-r--r-- | tex/context/fonts/texgyre.lfg | 5 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 61 |
21 files changed, 428 insertions, 136 deletions
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 5409438c1..d8017a271 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2015.07.09 15:23} +\newcontextversion{2015.07.10 00:05} %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/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex dc5468cab..45307850a 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 769e6b993..9587f0464 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -39,7 +39,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2015.07.09 15:23} +\edef\contextversion{2015.07.10 00:05} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/font-fea.mkvi b/tex/context/base/font-fea.mkvi index 5f6f1b5d5..512b59506 100644 --- a/tex/context/base/font-fea.mkvi +++ b/tex/context/base/font-fea.mkvi @@ -340,4 +340,14 @@ \font_feature_add \fi} +% let's put this here: + +\unexpanded\def\slashedzero + {\dontleavehmode + \begingroup + %\addff{zero} + \font_feature_add_nop{zero}% + 0% + \endgroup} + \protect \endinput diff --git a/tex/context/base/font-gds.lua b/tex/context/base/font-gds.lua index 7dfbee5a7..4daafd154 100644 --- a/tex/context/base/font-gds.lua +++ b/tex/context/base/font-gds.lua @@ -91,6 +91,9 @@ local function loadgoodies(filename) -- maybe a merge is better end goodies.name = goodies.name or "no name" for name, fnc in next, list do + if trace_goodies then + report_goodies("handling goodie %a",name) + end fnc(goodies) end goodies.initialized = true @@ -833,13 +836,15 @@ end implement { name = "loadfontgoodies", actions = fontgoodies.load, - arguments = "string" + arguments = "string", + overload = true, -- for now, permits new font loader } implement { name = "enablefontcolorschemes", onlyonce = true, - actions = colorschemes.enable + actions = colorschemes.enable, + overload = true, -- for now, permits new font loader } -- weird place ... depends on math diff --git a/tex/context/base/font-otb.lua b/tex/context/base/font-otb.lua index 4e955a197..c9f5d4aca 100644 --- a/tex/context/base/font-otb.lua +++ b/tex/context/base/font-otb.lua @@ -321,14 +321,14 @@ local function preparesubstitutions(tfmdata,feature,value,validlookups,lookuplis for unicode, character in next, characters do local description = descriptions[unicode] - local lookups = description.slookups + local lookups = description.slookups if lookups then for l=1,#lookuplist do local lookupname = lookuplist[l] local lookupdata = lookups[lookupname] if lookupdata then local lookuptype = lookuptypes[lookupname] - local action = actions[lookuptype] + local action = actions[lookuptype] if action then action(lookupdata,lookuptags,lookupname,description,unicode) end @@ -342,7 +342,7 @@ local function preparesubstitutions(tfmdata,feature,value,validlookups,lookuplis local lookuplist = lookups[lookupname] if lookuplist then local lookuptype = lookuptypes[lookupname] - local action = actions[lookuptype] + local action = actions[lookuptype] if action then for i=1,#lookuplist do action(lookuplist[i],lookuptags,lookupname,description,unicode) @@ -614,8 +614,8 @@ local function featuresinitializer(tfmdata,value) local collectlookups = otf.collectlookups local rawdata = tfmdata.shared.rawdata local properties = tfmdata.properties - local script = properties.script - local language = properties.language + local script = properties.script -- or "dflt" -- can be nil + local language = properties.language -- or "dflt" -- can be nil local basesubstitutions = rawdata.resources.features.gsub local basepositionings = rawdata.resources.features.gpos -- diff --git a/tex/context/base/font-otc.lua b/tex/context/base/font-otc.lua index cc3a6a122..c2ccf42b0 100644 --- a/tex/context/base/font-otc.lua +++ b/tex/context/base/font-otc.lua @@ -33,6 +33,7 @@ local normalized = { ligature = "ligature", alternate = "alternate", multiple = "multiple", + kern = "kern", } local types = { @@ -41,6 +42,7 @@ local types = { ligature = "gsub_ligature", alternate = "gsub_alternate", multiple = "gsub_multiple", + kern = "gpos_pair", } setmetatableindex(types, function(t,k) t[k] = k return k end) -- "key" @@ -106,8 +108,28 @@ local function addfeature(data,feature,specifications) local list = askedsteps[i] local coverage = { } local cover = coveractions[featuretype] + local format = nil if not cover then -- unknown + elseif featuretype == "substitution" then + for code, replacement in next, list do + local unicode = tounicode(code) + local description = descriptions[unicode] + if description then + if type(replacement) == "table" then + replacement = replacement[1] + end + replacement = tounicode(replacement) + if replacement and descriptions[replacement] then + cover(coverage,unicode,replacement) + done = done + 1 + else + skip = skip + 1 + end + else + skip = skip + 1 + end + end elseif featuretype == "ligature" then for code, ligature in next, list do local unicode = tounicode(code) @@ -137,25 +159,6 @@ local function addfeature(data,feature,specifications) skip = skip + 1 end end - elseif featuretype == "substitution" then - for code, replacement in next, list do - local unicode = tounicode(code) - local description = descriptions[unicode] - if description then - if type(replacement) == "table" then - replacement = replacement[1] - end - replacement = tounicode(replacement) - if replacement and descriptions[replacement] then - cover(coverage,unicode,replacement) - done = done + 1 - else - skip = skip + 1 - end - else - skip = skip + 1 - end - end elseif featuretype == "alternate" then for code, replacement in next, list do local unicode = tounicode(code) @@ -211,11 +214,34 @@ local function addfeature(data,feature,specifications) end end end + elseif featuretype == "kern" then + for code, replacement in next, list do + local unicode = tounicode(code) + local description = descriptions[unicode] + if description and type(replacement) == "table" then + local r = { } + for k, v in next, replacement do + local u = tounicode(k) + if u then + r[u] = v + end + end + if next(r) then + cover(coverage,unicode,r) + done = done + 1 + else + skip = skip + 1 + end + else + skip = skip + 1 + end + end + format = "kern" end if next(coverage) then added = true nofsteps = nofsteps + 1 - steps[nofsteps] = register(coverage,descriptions,resources,feature,featuretype,nofsteps) + steps[nofsteps] = register(coverage,featuretype,format,feature,nofsteps,descriptions,resources) end end if added then @@ -491,7 +517,14 @@ registerotffeature { -- name = "ltest", -- type = "ligature", -- data = { --- a = { "X", "Y" }, --- b = { "P", "Q" }, +-- X = { "a", "b" }, +-- Y = { "d", "a" }, +-- } +-- } +-- fonts.handlers.otf.addfeature { +-- name = "ktest", +-- type = "kern", +-- data = { +-- a = { b = -500 }, -- } -- } diff --git a/tex/context/base/font-otf.lua b/tex/context/base/font-otf.lua index 423035fff..204357ab5 100644 --- a/tex/context/base/font-otf.lua +++ b/tex/context/base/font-otf.lua @@ -2912,10 +2912,15 @@ otf.coverup = { alternate = justset, multiple = justset, ligature = justset, + kern = justset, }, - register = function(coverage,descriptions,resources,feature,lookuptype,n) + register = function(coverage,lookuptype,format,feature,n,descriptions,resources) local name = formatters["ctx_%s_%s"](feature,n) - resources.lookuptypes[name] = lookuptype + if lookuptype == "kern" then + resources.lookuptypes[name] = "position" + else + resources.lookuptypes[name] = lookuptype + end for u, c in next, coverage do local description = descriptions[u] local slookups = description.slookups @@ -2924,7 +2929,63 @@ otf.coverup = { else description.slookups = { [name] = c } end +-- inspect(feature,description) end return name end } + +-- moved from font-oth.lua + +local function getgsub(tfmdata,k,kind) + local description = tfmdata.descriptions[k] + if description then + local slookups = description.slookups -- we assume only slookups (we can always extend) + if slookups then + local shared = tfmdata.shared + local rawdata = shared and shared.rawdata + if rawdata then + local lookuptypes = rawdata.resources.lookuptypes + if lookuptypes then + local properties = tfmdata.properties + -- we could cache these + local validlookups, lookuplist = otf.collectlookups(rawdata,kind,properties.script,properties.language) + if validlookups then + for l=1,#lookuplist do + local lookup = lookuplist[l] + local found = slookups[lookup] + if found then + return found, lookuptypes[lookup] + end + end + end + end + end + end + end +end + +otf.getgsub = getgsub -- returns value, gsub_kind + +function otf.getsubstitution(tfmdata,k,kind,value) + local found, kind = getgsub(tfmdata,k,kind) + if not found then + -- + elseif kind == "substitution" then + return found + elseif kind == "alternate" then + local choice = tonumber(value) or 1 -- no random here (yet) + return found[choice] or found[1] or k + end + return k +end + +otf.getalternate = otf.getsubstitution + +function otf.getmultiple(tfmdata,k,kind) + local found, kind = getgsub(tfmdata,k,kind) + if found and kind == "multiple" then + return found + end + return { k } +end diff --git a/tex/context/base/font-oth.lua b/tex/context/base/font-oth.lua index 59dca31d9..28c543494 100644 --- a/tex/context/base/font-oth.lua +++ b/tex/context/base/font-oth.lua @@ -6,46 +6,4 @@ if not modules then modules = { } end modules ['font-oth'] = { license = "see context related readme files" } -local fonts = fonts -local otf = fonts.handlers.otf - --- todo: use nodemode data is available - -function otf.getalternate(tfmdata,k,kind,value) -- just initialize nodemode and use that (larger mem print) - if value then - local description = tfmdata.descriptions[k] - if description then - local slookups = description.slookups -- we assume only slookups (we can always extend) - if slookups then - local shared = tfmdata.shared - local rawdata = shared and shared.rawdata - if rawdata then - local lookuptypes = rawdata.resources.lookuptypes - if lookuptypes then - local properties = tfmdata.properties - -- we could cache these - local validlookups, lookuplist = otf.collectlookups(rawdata,kind,properties.script,properties.language) - if validlookups then - local choice = tonumber(value) or 1 -- no random here (yet) - for l=1,#lookuplist do - local lookup = lookuplist[l] - local found = slookups[lookup] - if found then - local lookuptype = lookuptypes[lookup] - if lookuptype == "substitution" then - return found - elseif lookuptype == "alternate" then - return found[choice] or found[#found] - else - -- ignore - end - end - end - end - end - end - end - end - end - return k -end +-- otf.getalternate is moved elsewhere (for now) but move back here some day diff --git a/tex/context/base/font-otl.lua b/tex/context/base/font-otl.lua index bd76fced6..4dd95a7d1 100644 --- a/tex/context/base/font-otl.lua +++ b/tex/context/base/font-otl.lua @@ -24,7 +24,7 @@ if not modules then modules = { } end modules ['font-otl'] = { -- todo: less tounicodes local gmatch, find, match, lower, strip = string.gmatch, string.find, string.match, string.lower, string.strip -local type, next, tonumber, tostring = type, next, tonumber, tostring +local type, next, tonumber, tostring, unpack = type, next, tonumber, tostring, unpack local abs = math.abs local ioflush = io.flush local derivetable = table.derive @@ -603,35 +603,125 @@ registerotffeature { -- readers function otf.collectlookups(rawdata,kind,script,language) - local sequences = rawdata.resources.sequences - if sequences then + if not kind then + return + end + if not script then + script = default + end + if not language then + language = default + end + local lookupcache = rawdata.lookupcache + if not lookupcache then + lookupcache = { } + rawdata.lookupcache = lookupcache + end + local kindlookup = lookupcache[kind] + if not kindlookup then + kindlookup = { } + lookupcache[kind] = kindlookup + end + local scriptlookup = kindlookup[script] + if not scriptlookup then + scriptlookup = { } + kindlookup[script] = scriptlookup + end + local languagelookup = scriptlookup[language] + if not languagelookup then + local sequences = rawdata.resources.sequences local featuremap = { } local featurelist = { } - for s=1,#sequences do - local sequence = sequences[s] - local features = sequence.features - if features then - features = features[kind] + if sequences then + for s=1,#sequences do + local sequence = sequences[s] + local features = sequence.features if features then - features = features[script] or features[default] or features[wildcard] + features = features[kind] if features then - features = features[language] or features[default] or features[wildcard] + -- features = features[script] or features[default] or features[wildcard] + features = features[script] or features[wildcard] if features then - if not featuremap[sequence] then - featuremap[sequence] = true - featurelist[#featurelist+1] = sequence + -- features = features[language] or features[default] or features[wildcard] + features = features[language] or features[wildcard] + if features then + if not featuremap[sequence] then + featuremap[sequence] = true + featurelist[#featurelist+1] = sequence + end end end end end end + if #featurelist == 0 then + featuremap, featurelist = false, false + end + else + featuremap, featurelist = false, false end - if #featurelist > 0 then - return featuremap, featurelist + languagelookup = { featuremap, featurelist } + scriptlookup[language] = languagelookup + end + return unpack(languagelookup) +end + +-- moved from font-oth.lua + +local function getgsub(tfmdata,k,kind,value) + local shared = tfmdata.shared + local rawdata = shared and shared.rawdata + if rawdata then + local sequences = rawdata.resources.sequences + if sequences then + local properties = tfmdata.properties + local validlookups, lookuplist = otf.collectlookups(rawdata,kind,properties.script,properties.language) + if validlookups then + local choice = tonumber(value) or 1 -- no random here (yet) + for i=1,#lookuplist do + local lookup = lookuplist[i] + local steps = lookup.steps + local nofsteps = lookup.nofsteps + for i=1,nofsteps do + local coverage = steps[i].coverage + if coverage then + local found = coverage[k] + if found then + return found, lookup.type + end + end + end + end + end end end end +otf.getgsub = getgsub -- returns value, gsub_kind + +function otf.getsubstitution(tfmdata,k,kind,value) + local found, kind = getgsub(tfmdata,k,kind) + if not found then + -- + elseif kind == "gsub_single" then + return found + elseif kind == "gsub_alternate" then + local choice = tonumber(value) or 1 -- no random here (yet) + return found[choice] or found[1] or k + end + return k +end + +otf.getalternate = otf.getsubstitution + +function otf.getmultiple(tfmdata,k,kind) + local found, kind = getgsub(tfmdata,k,kind) + if found and kind == "gsub_multiple" then + return found + end + return { k } +end + local function check_otf(forced,specification,suffix) local name = specification.name if forced then @@ -681,7 +771,9 @@ otf.coverup = { substitution = justset, alternate = justset, multiple = justset, - ligature = function (coverage,unicode,ligature) + kern = justset, + pair = justset, + ligature = function(coverage,unicode,ligature) local first = ligature[1] local tree = coverage[first] if not tree then @@ -700,7 +792,10 @@ otf.coverup = { tree.ligature = unicode end, }, - register = function(coverage) - return { coverage = coverage } + register = function(coverage,featuretype,format) + return { + format = format, + coverage = coverage, + } end } diff --git a/tex/context/base/font-otn.lua b/tex/context/base/font-otn.lua index 73ee8ecef..3b169143e 100644 --- a/tex/context/base/font-otn.lua +++ b/tex/context/base/font-otn.lua @@ -3426,6 +3426,7 @@ local action = { position = generic, ligature = ligature, pair = pair, + kern = pair, } local function prepare_lookups(tfmdata) diff --git a/tex/context/base/font-pre.mkiv b/tex/context/base/font-pre.mkiv index 157b4585a..98498b6aa 100644 --- a/tex/context/base/font-pre.mkiv +++ b/tex/context/base/font-pre.mkiv @@ -66,6 +66,10 @@ [oldstylenumbers] [onum=yes] +\definefontfeature + [zero] + [zero=yes] + % \definefontfeature % [newstyle] % [onum=no] diff --git a/tex/context/base/math-ini.mkiv b/tex/context/base/math-ini.mkiv index 9627b153f..c431cd383 100644 --- a/tex/context/base/math-ini.mkiv +++ b/tex/context/base/math-ini.mkiv @@ -343,7 +343,24 @@ \getparameters[\??mathstylealternate][#1]% \fi} -\unexpanded\def\mathaltcal{\math_set_font_alternate{cal}\cal} % ss01 in xits +% if there were many features we could have a feature pass over math nodes but it makes no +% sense now so we have commands to deal with it + +\unexpanded\def\mathaltcal {\math_set_font_alternate{cal}\cal} % set via goody file +%unexpanded\def\mathslashedzero {\math_set_font_alternate{zero}0} % set via goody file or automatic +\unexpanded\def\mathdotless {\math_set_font_alternate{dotless}} % set via goody file or automatic +\unexpanded\def\mathdotlessi {\mathdotless i} +\unexpanded\def\mathdotlessj {\mathdotless j} + +%let\textslashedzero\slashedzero \unexpanded\def\autoslashedzero{\mathortext\mathslashedzero\textslashedzero} +\let\textdotlessi \dotlessi \unexpanded\def\autodotlessi {\mathortext\mathdotlessi \textdotlessi} +\let\textdotlessj \dotlessj \unexpanded\def\autodotlessj {\mathortext\mathdotlessj \textdotlessj} + +\appendtoks + %let\slashedzero\autoslashedzero + \let\dotlessi \autodotlessi + \let\dotlessj \autodotlessj +\to \everymathematics \let\setmathattribute \math_set_attribute \let\setmathalphabet \math_set_alphabet @@ -351,7 +368,7 @@ \let\setmathfontalternate \math_set_font_alternate \let\setmathfontstylealternate\math_set_font_style_alternate -\let\mathalternate \math_set_font_alternate % obsolete +\let\mathalternate \math_set_font_alternate \unexpanded\def\mathupright {\math_set_attribute\s!regular\s!tf\math_set_font_style_alternate\s!tf} \unexpanded\def\mathdefault {\math_set_attribute\s!regular\s!it\math_set_font_style_alternate\s!it} diff --git a/tex/context/base/math-noa.lua b/tex/context/base/math-noa.lua index cdbbe36c3..a1b3bc855 100644 --- a/tex/context/base/math-noa.lua +++ b/tex/context/base/math-noa.lua @@ -20,6 +20,7 @@ if not modules then modules = { } end modules ['math-noa'] = { local utfchar, utfbyte = utf.char, utf.byte local formatters = string.formatters +local sortedhash = table.sortedhash local div = math.div local fonts, nodes, node, mathematics = fonts, nodes, node, mathematics @@ -663,7 +664,7 @@ end local function collected(list) if list and next(list) then local n, t = 0, { } - for k, v in table.sortedpairs(list) do + for k, v in sortedhash(list) do n = n + v t[#t+1] = formatters["%C"](k) end @@ -683,32 +684,57 @@ end) -- math alternates: (in lucidanova lgf: $ABC \mathalternate{italic} ABC$) -- todo: set alternate for specific symbols +-- todo: no need to do this when already loaded + +local defaults = { + dotless = { feature = 'dtls', value = 1, comment = "Mathematical Dotless Forms" }, + -- zero = { feature = 'zero', value = 1, comment = "Slashed or Dotted Zero" }, -- in no math font (yet) +} local function initializemathalternates(tfmdata) - local goodies = tfmdata.goodies + local goodies = tfmdata.goodies + local autolist = table.copy(defaults) + + local function setthem(alternates) + local resources = tfmdata.resources -- was tfmdata.shared + local lastattribute = 0 + local attributes = { } + for k, v in sortedhash(alternates) do + lastattribute = lastattribute + 1 + v.attribute = lastattribute + attributes[lastattribute] = v + end + resources.mathalternates = alternates -- to be checked if shared is ok here + resources.mathalternatesattributes = attributes -- to be checked if shared is ok here + end + if goodies then - local shared = tfmdata.shared + local done = { } for i=1,#goodies do -- first one counts -- we can consider sharing the attributes ... todo (only once scan) local mathgoodies = goodies[i].mathematics - local alternates = mathgoodies and mathgoodies.alternates + local alternates = mathgoodies and mathgoodies.alternates if alternates then if trace_goodies then report_goodies("loading alternates for font %a",tfmdata.properties.name) end - local lastattribute, attributes = 0, { } - for k, v in next, alternates do - lastattribute = lastattribute + 1 - v.attribute = lastattribute - attributes[lastattribute] = v + for k, v in next, autolist do + if not alternates[k] then + alternates[k] = v + end end - shared.mathalternates = alternates -- to be checked if shared is ok here - shared.mathalternatesattributes = attributes -- to be checked if shared is ok here + setthem(alternates) return end end end + + if trace_goodies then + report_goodies("loading default alternates for font %a",tfmdata.properties.name) + end + setthem(autolist) + end registerotffeature { @@ -720,19 +746,24 @@ registerotffeature { } } -local getalternate = otf.getalternate +-- local getalternate = otf.getalternate (runtime new method so ...) + +-- todo: not shared but copies ... one never knows local a_mathalternate = privateattribute("mathalternate") local alternate = { } -- processors.alternate = alternate function mathematics.setalternate(fam,tag) - local id = font_of_family(fam) - local tfmdata = fontdata[id] - local mathalternates = tfmdata.shared and tfmdata.shared.mathalternates - if mathalternates then - local m = mathalternates[tag] - texsetattribute(a_mathalternate,m and m.attribute or unsetvalue) + local id = font_of_family(fam) + local tfmdata = fontdata[id] + local resources = tfmdata.resources -- was tfmdata.shared + if resources then + local mathalternates = resources.mathalternates + if mathalternates then + local m = mathalternates[tag] + texsetattribute(a_mathalternate,m and m.attribute or unsetvalue) + end end end @@ -740,17 +771,20 @@ alternate[math_char] = function(pointer) local a = getattr(pointer,a_mathalternate) if a and a > 0 then setattr(pointer,a_mathalternate,0) - local tfmdata = fontdata[font_of_family(getfield(pointer,"fam"))] -- we can also have a famdata - local mathalternatesattributes = tfmdata.shared.mathalternatesattributes - if mathalternatesattributes then - local what = mathalternatesattributes[a] - local alt = getalternate(tfmdata,getchar(pointer),what.feature,what.value) - if alt then - if trace_alternates then - report_alternates("alternate %a, value %a, replacing glyph %U by glyph %U", - tostring(what.feature),tostring(what.value),getchar(pointer),alt) + local tfmdata = fontdata[font_of_family(getfield(pointer,"fam"))] -- we can also have a famdata + local resources = tfmdata.resources -- was tfmdata.shared + if resources then + local mathalternatesattributes = resources.mathalternatesattributes + if mathalternatesattributes then + local what = mathalternatesattributes[a] + local alt = otf.getalternate(tfmdata,getchar(pointer),what.feature,what.value) + if alt then + if trace_alternates then + report_alternates("alternate %a, value %a, replacing glyph %U by glyph %U", + tostring(what.feature),tostring(what.value),getchar(pointer),alt) + end + setfield(pointer,"char",alt) end - setfield(pointer,"char",alt) end end end diff --git a/tex/context/base/mult-low.lua b/tex/context/base/mult-low.lua index 5396ec723..6d299ec08 100644 --- a/tex/context/base/mult-low.lua +++ b/tex/context/base/mult-low.lua @@ -176,6 +176,8 @@ return { -- "inlineordisplaymath","indisplaymath","forcedisplaymath","startforceddisplaymath","stopforceddisplaymath","reqno", -- + "mathortext", + -- "htdp", "unvoidbox", "hfilll", "vfilll", diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 86821739d..9e26a6d32 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex b22b8d62b..ff04d11ba 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/tabl-tsp.mkiv b/tex/context/base/tabl-tsp.mkiv index 64ab94a67..eb50eb401 100644 --- a/tex/context/base/tabl-tsp.mkiv +++ b/tex/context/base/tabl-tsp.mkiv @@ -257,6 +257,8 @@ \global\setfalse\usesamefloatnumber % new, prevent next increment \global\setfalse\splitfloatfirstdone} % we can use this one for tests +\newconditional\tabl_split_forced_page + \def\tabl_split_loop_body {\ifinsidecolumns % brrr, assumes empty columns @@ -303,8 +305,22 @@ \splittopskip\zeropoint \doloop % inner loop {\setbox\scratchbox\vsplit\tsplitcontent to \onepoint % \lineheight - \setbox\scratchbox\vbox{\unvbox\scratchbox}% - \ifdim\dimexpr\d_tabl_split_available-\htdp\scratchbox-\htdp\tsplitresult\relax>\zeropoint + \setbox\scratchbox\vbox + {\unvbox\scratchbox + \setbox\scratchbox\vbox + {\splitdiscards + \ifnum\lastpenalty>-\plustenthousand\else + % so that \bTR[before=\page] works + \global\settrue\tabl_split_forced_page + \fi}}% + \ifconditional\tabl_split_forced_page + \global\setfalse\tabl_split_forced_page + \setbox\tsplitresult\vbox + {\unvbox\tsplitresult + \tsplitinbetween + \unvbox\scratchbox}% + \exitloop + \else\ifdim\dimexpr\d_tabl_split_available-\htdp\scratchbox-\htdp\tsplitresult\relax>\zeropoint \setbox\tsplitresult\vbox {\unvbox\tsplitresult \tsplitinbetween @@ -328,7 +344,7 @@ \tsplitinbetween \ifvoid\tsplitcontent\else\unvbox\tsplitcontent\fi}% \exitloop - \fi\fi\fi + \fi\fi\fi\fi \setfalse\c_tabl_split_head \setfalse\c_tabl_split_full}% \postprocesstsplit diff --git a/tex/context/base/type-imp-texgyre.mkiv b/tex/context/base/type-imp-texgyre.mkiv index 247b4ef21..ca5d456e5 100644 --- a/tex/context/base/type-imp-texgyre.mkiv +++ b/tex/context/base/type-imp-texgyre.mkiv @@ -235,7 +235,7 @@ \starttypescript [\s!math][times,termes][\s!all] \loadfontgoodies[texgyre] - \definefontsynonym[\s!MathRoman][file:texgyre-termes-math-regular.otf][\s!features=\s!math\mathsizesuffix] + \definefontsynonym[\s!MathRoman][file:texgyre-termes-math-regular.otf][\s!features=\s!math\mathsizesuffix,\s!goodies=texgyre] \stoptypescript \stoptypescriptcollection @@ -262,7 +262,7 @@ \starttypescript [\s!math][palatino,pagella][\s!all] \loadfontgoodies[texgyre] - \definefontsynonym[\s!MathRoman][file:texgyre-pagella-math-regular.otf][\s!features=\s!math\mathsizesuffix] + \definefontsynonym[\s!MathRoman][file:texgyre-pagella-math-regular.otf][\s!features=\s!math\mathsizesuffix,\s!goodies=texgyre] \stoptypescript \stoptypescriptcollection @@ -273,7 +273,7 @@ \starttypescript [\s!math][bookman,bonum][\s!all] \loadfontgoodies[texgyre] - \definefontsynonym[\s!MathRoman][file:texgyre-bonum-math-regular.otf][\s!features=\s!math\mathsizesuffix] + \definefontsynonym[\s!MathRoman][file:texgyre-bonum-math-regular.otf][\s!features=\s!math\mathsizesuffix,\s!goodies=texgyre] \stoptypescript \stoptypescriptcollection @@ -282,7 +282,7 @@ \starttypescript [\s!math][schoolbook,schola][\s!all] \loadfontgoodies[texgyre] - \definefontsynonym[\s!MathRoman][file:texgyre-schola-math-regular.otf][\s!features=\s!math\mathsizesuffix] + \definefontsynonym[\s!MathRoman][file:texgyre-schola-math-regular.otf][\s!features=\s!math\mathsizesuffix,\s!goodies=texgyre] \stoptypescript \stoptypescriptcollection diff --git a/tex/context/fonts/texgyre.lfg b/tex/context/fonts/texgyre.lfg index 785982037..bcbc2ad86 100644 --- a/tex/context/fonts/texgyre.lfg +++ b/tex/context/fonts/texgyre.lfg @@ -33,4 +33,9 @@ return { "tgschola-math.otf", }, }, + mathematics = { + alternates = { + dotless = { feature = 'dtls', value = 1, comment = "Mathematical Dotless Forms" }, + }, + }, } diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 7ead58247..bf337eff7 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 : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 07/09/15 15:23:36 +-- merge date : 07/10/15 00:05:49 do -- begin closure to overcome local limits and interference @@ -9412,10 +9412,15 @@ otf.coverup={ alternate=justset, multiple=justset, ligature=justset, + kern=justset, }, - register=function(coverage,descriptions,resources,feature,lookuptype,n) + register=function(coverage,lookuptype,format,feature,n,descriptions,resources) local name=formatters["ctx_%s_%s"](feature,n) - resources.lookuptypes[name]=lookuptype + if lookuptype=="kern" then + resources.lookuptypes[name]="position" + else + resources.lookuptypes[name]=lookuptype + end for u,c in next,coverage do local description=descriptions[u] local slookups=description.slookups @@ -9428,6 +9433,52 @@ otf.coverup={ return name end } +local function getgsub(tfmdata,k,kind) + local description=tfmdata.descriptions[k] + if description then + local slookups=description.slookups + if slookups then + local shared=tfmdata.shared + local rawdata=shared and shared.rawdata + if rawdata then + local lookuptypes=rawdata.resources.lookuptypes + if lookuptypes then + local properties=tfmdata.properties + local validlookups,lookuplist=otf.collectlookups(rawdata,kind,properties.script,properties.language) + if validlookups then + for l=1,#lookuplist do + local lookup=lookuplist[l] + local found=slookups[lookup] + if found then + return found,lookuptypes[lookup] + end + end + end + end + end + end + end +end +otf.getgsub=getgsub +function otf.getsubstitution(tfmdata,k,kind,value) + local found,kind=getgsub(tfmdata,k,kind) + if not found then + elseif kind=="substitution" then + return found + elseif kind=="alternate" then + local choice=tonumber(value) or 1 + return found[choice] or found[1] or k + end + return k +end +otf.getalternate=otf.getsubstitution +function otf.getmultiple(tfmdata,k,kind) + local found,kind=getgsub(tfmdata,k,kind) + if found and kind=="multiple" then + return found + end + return { k } +end end -- closure @@ -9958,8 +10009,8 @@ local function featuresinitializer(tfmdata,value) local collectlookups=otf.collectlookups local rawdata=tfmdata.shared.rawdata local properties=tfmdata.properties - local script=properties.script - local language=properties.language + local script=properties.script + local language=properties.language local basesubstitutions=rawdata.resources.features.gsub local basepositionings=rawdata.resources.features.gpos if basesubstitutions or basepositionings then |