diff options
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luaotfload/luaotfload-features.lua')
-rw-r--r-- | Master/texmf-dist/tex/luatex/luaotfload/luaotfload-features.lua | 167 |
1 files changed, 165 insertions, 2 deletions
diff --git a/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-features.lua b/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-features.lua index 59fe42da32d..2d83df10ffc 100644 --- a/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-features.lua +++ b/Master/texmf-dist/tex/luatex/luaotfload/luaotfload-features.lua @@ -5,8 +5,8 @@ local ProvidesLuaModule = { name = "luaotfload-features", - version = "3.14", --TAGVERSION - date = "2020-05-06", --TAGDATE + version = "3.15", --TAGVERSION + date = "2020-09-02", --TAGDATE description = "luaotfload submodule / features", license = "GPL v2.0", author = "Hans Hagen, Khaled Hosny, Elie Roux, Philipp Gesang, Marcel Krüger", @@ -429,6 +429,13 @@ local function handle_request (specification) --- investigated it any further (luatex-fonts-ext), so it will --- just stay here. features.normal = normalize (request.features) + if features.normal.instance then + if features.normal.axis then + report("term and log", 0, "features", "instance and axis provided, instance will be ignored") + else + specification.instance = features.normal.instance + end + end specification.sub = request.sub or specification.sub or false local forced_mode = request.features and request.features.mode @@ -451,6 +458,58 @@ if as_script == true then --- skip the remainder of the file return end +do + local helpers = fonts.handlers.otf.readers.helpers + local axistofactors = helpers.axistofactors + local cleanname = helpers.cleanname + local getaxisscale = helpers.getaxisscale + local function search(table, term, key_field, value_field) + if not table then return end + for i=1, #table do + local entry = table[i] + if cleanname(entry[key_field]) == term then + return entry[value_field] + end + end + end + function helpers.getfactors(tfmdata, instance) -- `instance` might refer to an `axis` value here + assert(instance == true or type(instance) == "string", "Fontloader changed interface of helpers.getfactors. This is a bug, please notify the luaotfload maintainers.") + local variabledata = tfmdata.variabledata + if not variabledata or instance == "" then return end + local instances = variabledata.instances + local axis = variabledata.axis + local designaxis = variabledata.designaxis + local segments = variabledata.segments + if not axis then return end + local factors = {} + if instance == true then + for i=1, #axis do + local cur = axis[i] + local default = cur.default + factors[i] = getaxisscale(segments, cur.minimum, default, cur.maximum, default) + end + return factors + end + local values = search(instances, instance, "subfamily", "values") + if values then + for i=1, #axis do + local cur = axis[i] + factors[i] = getaxisscale(segments, cur.minimum, cur.default, cur.maximum, values[i].value) + end + return factors + end + values = axistofactors(instance) + for i=1, #axis do + local cur = axis[i] + local default = cur.default + local value = cur.name and values[cur.name] or values[cur.tag] + value = tonumber(value) or (value and search(search(designaxis, cur.tag, "tag", "variants"), cleanname(value), "name", "value")) or default + factors[i] = getaxisscale(segments, cur.minimum, default, cur.maximum, value) + end + return factors + end +end + -- MK: Added function fonts.definers.analyze (spec_string, size) return handle_request { @@ -602,6 +661,110 @@ do } end +do + local function mathfontdimen(tfmdata, _, value) + if not next(tfmdata.mathparameters) then return end + local parameters = tfmdata.parameters + local mathparameters = tfmdata.mathparameters + if value == 'xetex' then + parameters[10] = mathparameters.ScriptPercentScaleDown + parameters[11] = mathparameters.ScriptScriptPercentScaleDown + parameters[12] = mathparameters.DelimitedSubFormulaMinHeight + parameters[13] = mathparameters.DisplayOperatorMinHeight + parameters[14] = mathparameters.MathLeading + parameters[15] = mathparameters.AxisHeight + parameters[16] = mathparameters.AccentBaseHeight + parameters[17] = mathparameters.FlattenedAccentBaseHeight + parameters[18] = mathparameters.SubscriptShiftDown + parameters[19] = mathparameters.SubscriptTopMax + parameters[20] = mathparameters.SubscriptBaselineDropMin + parameters[21] = mathparameters.SuperscriptShiftUp + parameters[22] = mathparameters.SuperscriptShiftUpCramped + parameters[23] = mathparameters.SuperscriptBottomMin + parameters[24] = mathparameters.SuperscriptBaselineDropMax + parameters[25] = mathparameters.SubSuperscriptGapMin + parameters[26] = mathparameters.SuperscriptBottomMaxWithSubscript + parameters[27] = mathparameters.SpaceAfterScript + parameters[28] = mathparameters.UpperLimitGapMin + parameters[29] = mathparameters.UpperLimitBaselineRiseMin + parameters[30] = mathparameters.LowerLimitGapMin + parameters[31] = mathparameters.LowerLimitBaselineDropMin + parameters[32] = mathparameters.StackTopShiftUp + parameters[33] = mathparameters.StackTopDisplayStyleShiftUp + parameters[34] = mathparameters.StackBottomShiftDown + parameters[35] = mathparameters.StackBottomDisplayStyleShiftDown + parameters[36] = mathparameters.StackGapMin + parameters[37] = mathparameters.StackDisplayStyleGapMin + parameters[38] = mathparameters.StretchStackTopShiftUp + parameters[39] = mathparameters.StretchStackBottomShiftDown + parameters[40] = mathparameters.StretchStackGapAboveMin + parameters[41] = mathparameters.StretchStackGapBelowMin + parameters[42] = mathparameters.FractionNumeratorShiftUp + parameters[43] = mathparameters.FractionNumeratorDisplayStyleShiftUp + parameters[44] = mathparameters.FractionDenominatorShiftDown + parameters[45] = mathparameters.FractionDenominatorDisplayStyleShiftDown + parameters[46] = mathparameters.FractionNumeratorGapMin + parameters[47] = mathparameters.FractionNumeratorDisplayStyleGapMin + parameters[48] = mathparameters.FractionRuleThickness + parameters[49] = mathparameters.FractionDenominatorGapMin + parameters[50] = mathparameters.FractionDenominatorDisplayStyleGapMin + parameters[51] = mathparameters.SkewedFractionHorizontalGap + parameters[52] = mathparameters.SkewedFractionVerticalGap + parameters[53] = mathparameters.OverbarVerticalGap + parameters[54] = mathparameters.OverbarRuleThickness + parameters[55] = mathparameters.OverbarExtraAscender + parameters[56] = mathparameters.UnderbarVerticalGap + parameters[57] = mathparameters.UnderbarRuleThickness + parameters[58] = mathparameters.UnderbarExtraDescender + parameters[59] = mathparameters.RadicalVerticalGap + parameters[60] = mathparameters.RadicalDisplayStyleVerticalGap + parameters[61] = mathparameters.RadicalRuleThickness + parameters[62] = mathparameters.RadicalExtraAscender + parameters[63] = mathparameters.RadicalKernBeforeDegree + parameters[64] = mathparameters.RadicalKernAfterDegree + parameters[65] = mathparameters.RadicalDegreeBottomRaisePercent + -- parameters[66] = mathparameters.MinConnectorOverlap + -- parameters[67] = mathparameters.SubscriptShiftDownWithSuperscript + -- parameters[68] = mathparameters.FractionDelimiterSize + -- parameters[69] = mathparameters.FractionDelimiterDisplayStyleSize + -- parameters[70] = mathparameters.NoLimitSubFactor + -- parameters[71] = mathparameters.NoLimitSupFactor + elseif value == 'tex2' then + parameters[8] = mathparameters.FractionNumeratorDisplayStyleShiftUp + parameters[9] = mathparameters.FractionNumeratorShiftUp + parameters[10] = mathparameters.StackTopShiftUp + parameters[11] = mathparameters.FractionDenominatorDisplayStyleShiftDown + parameters[12] = mathparameters.FractionDenominatorShiftDown + parameters[13] = mathparameters.SuperscriptShiftUp + parameters[14] = mathparameters.SuperscriptShiftUp + parameters[15] = mathparameters.SuperscriptShiftUpCramped + parameters[16] = mathparameters.SubscriptShiftDown + parameters[17] = mathparameters.SubscriptShiftDown + parameters[18] = mathparameters.SuperscriptBaselineDropMax + parameters[19] = mathparameters.SubscriptBaselineDropMin + parameters[20] = mathparameters.FractionDelimiterDisplayStyleSize + parameters[21] = mathparameters.FractionDelimiterSize + parameters[22] = mathparameters.AxisHeight + elseif value == 'tex3' then + parameters[8] = mathparameters.Defa + parameters[9] = mathparameters.UpperLimitGapMin + parameters[10] = mathparameters.LowerLimitGapMin + parameters[11] = mathparameters.UpperLimitBaselineRiseMin + parameters[12] = mathparameters.LowerLimitBaselineDropMin + parameters[13] = 0 + end + end + fonts.constructors.features.otf.register { + name = 'mathfontdimen', + description = 'Set fontdimen values for compatibility with other engines', + manipulators = { + base = mathfontdimen, + -- node = mathfontdimen, + -- plug = mathfontdimen, + }, + } +end + return function () if not fonts and fonts.handlers then report ("log", 0, "features", |