diff options
author | Hans Hagen <pragma@wxs.nl> | 2017-07-14 21:22:10 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2017-07-14 21:22:10 +0200 |
commit | 23b495f46b4d2e9264d54095f43774ef47d3a656 (patch) | |
tree | 1b0131b93d92d4aa7e15b55c50ad1dfa3573a7e1 /tex/context/base/mkiv/font-oto.lua | |
parent | 6ae40572e7643edcc29f8d5b071221dd1e04bdf3 (diff) | |
download | context-23b495f46b4d2e9264d54095f43774ef47d3a656.tar.gz |
2017-07-14 19:41:00
Diffstat (limited to 'tex/context/base/mkiv/font-oto.lua')
-rw-r--r-- | tex/context/base/mkiv/font-oto.lua | 53 |
1 files changed, 51 insertions, 2 deletions
diff --git a/tex/context/base/mkiv/font-oto.lua b/tex/context/base/mkiv/font-oto.lua index 22bb1d74e..0009d7f5f 100644 --- a/tex/context/base/mkiv/font-oto.lua +++ b/tex/context/base/mkiv/font-oto.lua @@ -368,9 +368,13 @@ local function preparepositionings(tfmdata,feature,value,validlookups,lookuplist local character = characters[unicode] local kerns = character.kerns for otherunicode, kern in next, data do - if not kern[2] and not (kerns and kerns[otherunicode]) then + -- kern[2] is true (all zero) or a table + local other = kern[2] + if other == true or (not other and not (kerns and kerns[otherunicode])) then local kern = kern[1] - if kern[1] ~= 0 or kern[2] ~= 0 or kern[4] ~= 0 then + if kern == true then + -- all zero + elseif kern[1] ~= 0 or kern[2] ~= 0 or kern[4] ~= 0 then -- a complex pair not suitable for basemode else kern = kern[3] @@ -400,6 +404,43 @@ local function initializehashes(tfmdata) -- already done end +local function checkmathreplacements(tfmdata,fullname) + if tfmdata.mathparameters then + local characters = tfmdata.characters + local changed = tfmdata.changed + if next(changed) then + if trace_preparing or trace_baseinit then + report_prepare("checking math replacements for %a",fullname) + end + for unicode, replacement in next, changed do + local u = characters[unicode] + local r = characters[replacement] + local n = u.next + local v = u.vert_variants + local h = u.horiz_variants + if n and not r.next then + if trace_preparing then + report_prepare("forcing %s for %C substituted by %U","incremental step",unicode,replacement) + end + r.next = n + end + if v and not r.vert_variants then + if trace_preparing then + report_prepare("forcing %s for %C substituted by %U","vertical variants",unicode,replacement) + end + r.vert_variants = v + end + if h and not r.horiz_variants then + if trace_preparing then + report_prepare("forcing %s for %C substituted by %U","horizontal variants",unicode,replacement) + end + r.horiz_variants = h + end + end + end + end +end + local function featuresinitializer(tfmdata,value) if true then -- value then local starttime = trace_preparing and os.clock() @@ -416,6 +457,8 @@ local function featuresinitializer(tfmdata,value) local rawfeatures = rawresources and rawresources.features local basesubstitutions = rawfeatures and rawfeatures.gsub local basepositionings = rawfeatures and rawfeatures.gpos + local substitutionsdone = false + local positioningsdone = false -- if basesubstitutions or basepositionings then local sequences = tfmdata.resources.sequences @@ -438,12 +481,14 @@ local function featuresinitializer(tfmdata,value) end preparesubstitutions(tfmdata,feature,value,validlookups,lookuplist) registerbasefeature(feature,value) + substitutionsdone = true elseif basepositionings and basepositionings[feature] then if trace_preparing then report_prepare("filtering base %a feature %a for %a with value %a","pos",feature,fullname,value) end preparepositionings(tfmdata,feature,value,validlookups,lookuplist) registerbasefeature(feature,value) + positioningsdone = true end end end @@ -452,6 +497,10 @@ local function featuresinitializer(tfmdata,value) end end -- + if substitutionsdone then + checkmathreplacements(tfmdata,fullname) + end + -- registerbasehash(tfmdata) end if trace_preparing then |