summaryrefslogtreecommitdiff
path: root/tex/context/base/math-act.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/math-act.lua')
-rw-r--r--tex/context/base/math-act.lua136
1 files changed, 40 insertions, 96 deletions
diff --git a/tex/context/base/math-act.lua b/tex/context/base/math-act.lua
index 879480dce..d0ea78990 100644
--- a/tex/context/base/math-act.lua
+++ b/tex/context/base/math-act.lua
@@ -90,6 +90,8 @@ end
sequencers.appendaction("mathparameters","system","mathematics.scaleparameters")
+-- AccentBaseHeight vs FlattenedAccentBaseHeight
+
function mathematics.checkaccentbaseheight(target,original)
local mathparameters = target.mathparameters
if mathparameters and mathparameters.AccentBaseHeight == 0 then
@@ -103,15 +105,23 @@ function mathematics.checkprivateparameters(target,original)
local mathparameters = target.mathparameters
if mathparameters then
local parameters = target.parameters
+ local properties = target.properties
if parameters then
- if not mathparameters.FractionDelimiterSize then
- mathparameters.FractionDelimiterSize = 1.01 * parameters.size
- end
- if not mathparameters.FractionDelimiterDisplayStyleSize then
- mathparameters.FractionDelimiterDisplayStyleSize = 2.40 * parameters.size
+ local size = parameters.size
+ if size then
+ if not mathparameters.FractionDelimiterSize then
+ mathparameters.FractionDelimiterSize = 1.01 * size
+ end
+ if not mathparameters.FractionDelimiterDisplayStyleSize then
+ mathparameters.FractionDelimiterDisplayStyleSize = 2.40 * size
+ end
+ elseif properties then
+ report_math("invalid parameters in font %a",properties.fullname or "?")
+ else
+ report_math("invalid parameters in font")
end
- elseif target.properties then
- report_math("no parameters in font %a",target.properties.fullname or "?")
+ elseif properties then
+ report_math("no parameters in font %a",properties.fullname or "?")
else
report_math("no parameters and properties in font")
end
@@ -465,21 +475,17 @@ setmetatableindex(extensibles,function(extensibles,font)
return codes
end)
-function mathematics.extensiblecode(family,unicode)
+local function extensiblecode(family,unicode)
return extensibles[family_font(family or 0)][unicode][1]
end
-function commands.extensiblecode(family,unicode)
- context(extensibles[family_font(family or 0)][unicode][1])
-end
-
-- left : [head] ...
-- right : ... [head]
-- horizontal : [head] ... [head]
--
-- abs(right["start"] - right["end"]) | right.advance | characters[right.glyph].width
-function commands.horizontalcode(family,unicode)
+local function horizontalcode(family,unicode)
local font = family_font(family or 0)
local data = extensibles[font][unicode]
local kind = data[1]
@@ -503,13 +509,30 @@ function commands.horizontalcode(family,unicode)
loffset = abs((left ["start"] or 0) - (left ["end"] or 0))
roffset = abs((right["start"] or 0) - (right["end"] or 0))
end
- else
end
- texsetdimen("scratchleftoffset",loffset)
- texsetdimen("scratchrightoffset",roffset)
- context(kind)
+ return kind, loffset, roffset
end
+mathematics.extensiblecode = extensiblecode
+mathematics.horizontalcode = horizontalcode
+
+interfaces.implement {
+ name = "extensiblecode",
+ arguments = { "integer", "integer" },
+ actions = { extensiblecode, context }
+}
+
+interfaces.implement {
+ name = "horizontalcode",
+ arguments = { "integer", "integer" },
+ actions = function(family,unicode)
+ local kind, loffset, roffset = horizontalcode(family,unicode)
+ texsetdimen("scratchleftoffset", loffset)
+ texsetdimen("scratchrightoffset",roffset)
+ context(kind)
+ end
+}
+
-- experiment
-- check: when true, only set when present in font
@@ -517,85 +540,6 @@ end
local blocks = characters.blocks -- this will move to char-ini
-blocks["uppercasenormal"] = { first = 0x00041, last = 0x0005A }
-blocks["uppercasebold"] = { first = 0x1D400, last = 0x1D419 }
-blocks["uppercaseitalic"] = { first = 0x1D434, last = 0x1D44D }
-blocks["uppercasebolditalic"] = { first = 0x1D468, last = 0x1D481 }
-blocks["uppercasescript"] = { first = 0x1D49C, last = 0x1D4B5 }
-blocks["uppercaseboldscript"] = { first = 0x1D4D0, last = 0x1D4E9 }
-blocks["uppercasefraktur"] = { first = 0x1D504, last = 0x1D51D }
-blocks["uppercasedoublestruck"] = { first = 0x1D538, last = 0x1D551 }
-blocks["uppercaseboldfraktur"] = { first = 0x1D56C, last = 0x1D585 }
-blocks["uppercasesansserifnormal"] = { first = 0x1D5A0, last = 0x1D5B9 }
-blocks["uppercasesansserifbold"] = { first = 0x1D5D4, last = 0x1D5ED }
-blocks["uppercasesansserifitalic"] = { first = 0x1D608, last = 0x1D621 }
-blocks["uppercasesansserifbolditalic"] = { first = 0x1D63C, last = 0x1D655 }
-blocks["uppercasemonospace"] = { first = 0x1D670, last = 0x1D689 }
-blocks["uppercasegreeknormal"] = { first = 0x00391, last = 0x003AA }
-blocks["uppercasegreekbold"] = { first = 0x1D6A8, last = 0x1D6C1 }
-blocks["uppercasegreekitalic"] = { first = 0x1D6E2, last = 0x1D6FB }
-blocks["uppercasegreekbolditalic"] = { first = 0x1D71C, last = 0x1D735 }
-blocks["uppercasegreeksansserifbold"] = { first = 0x1D756, last = 0x1D76F }
-blocks["uppercasegreeksansserifbolditalic"] = { first = 0x1D790, last = 0x1D7A9 }
-
-blocks["lowercasenormal"] = { first = 0x00061, last = 0x0007A }
-blocks["lowercasebold"] = { first = 0x1D41A, last = 0x1D433 }
-blocks["lowercaseitalic"] = { first = 0x1D44E, last = 0x1D467 }
-blocks["lowercasebolditalic"] = { first = 0x1D482, last = 0x1D49B }
-blocks["lowercasescript"] = { first = 0x1D4B6, last = 0x1D4CF }
-blocks["lowercaseboldscript"] = { first = 0x1D4EA, last = 0x1D503 }
-blocks["lowercasefraktur"] = { first = 0x1D51E, last = 0x1D537 }
-blocks["lowercasedoublestruck"] = { first = 0x1D552, last = 0x1D56B }
-blocks["lowercaseboldfraktur"] = { first = 0x1D586, last = 0x1D59F }
-blocks["lowercasesansserifnormal"] = { first = 0x1D5BA, last = 0x1D5D3 }
-blocks["lowercasesansserifbold"] = { first = 0x1D5EE, last = 0x1D607 }
-blocks["lowercasesansserifitalic"] = { first = 0x1D622, last = 0x1D63B }
-blocks["lowercasesansserifbolditalic"] = { first = 0x1D656, last = 0x1D66F }
-blocks["lowercasemonospace"] = { first = 0x1D68A, last = 0x1D6A3 }
-blocks["lowercasegreeknormal"] = { first = 0x003B1, last = 0x003CA }
-blocks["lowercasegreekbold"] = { first = 0x1D6C2, last = 0x1D6DB }
-blocks["lowercasegreekitalic"] = { first = 0x1D6FC, last = 0x1D715 }
-blocks["lowercasegreekbolditalic"] = { first = 0x1D736, last = 0x1D74F }
-blocks["lowercasegreeksansserifbold"] = { first = 0x1D770, last = 0x1D789 }
-blocks["lowercasegreeksansserifbolditalic"] = { first = 0x1D7AA, last = 0x1D7C3 }
-
-blocks["digitsnormal"] = { first = 0x00030, last = 0x00039 }
-blocks["digitsbold"] = { first = 0x1D7CE, last = 0x1D7D8 }
-blocks["digitsdoublestruck"] = { first = 0x1D7D8, last = 0x1D7E2 }
-blocks["digitssansserifnormal"] = { first = 0x1D7E2, last = 0x1D7EC }
-blocks["digitssansserifbold"] = { first = 0x1D7EC, last = 0x1D805 }
-blocks["digitsmonospace"] = { first = 0x1D7F6, last = 0x1D80F }
-
-blocks["mathematicaloperators"] = { first = 0x02200, last = 0x022FF }
-blocks["miscellaneousmathematicalsymbolsa"] = { first = 0x027C0, last = 0x027EF }
-blocks["miscellaneousmathematicalsymbolsb"] = { first = 0x02980, last = 0x029FF }
-blocks["supplementalmathematicaloperators"] = { first = 0x02A00, last = 0x02AFF }
-blocks["letterlikesymbols"] = { first = 0x02100, last = 0x0214F }
-blocks["miscellaneoustechnical"] = { first = 0x02308, last = 0x0230B }
-blocks["geometricshapes"] = { first = 0x025A0, last = 0x025FF }
-blocks["miscellaneoussymbolsandarrows"] = { first = 0x02B30, last = 0x02B4C }
-blocks["mathematicalalphanumericsymbols"] = { first = 0x00400, last = 0x1D7FF }
-
-blocks["digitslatin"] = { first = 0x00030, last = 0x00039 }
-blocks["digitsarabicindic"] = { first = 0x00660, last = 0x00669 }
-blocks["digitsextendedarabicindic"] = { first = 0x006F0, last = 0x006F9 }
-------["digitsdevanagari"] = { first = 0x00966, last = 0x0096F }
-------["digitsbengali"] = { first = 0x009E6, last = 0x009EF }
-------["digitsgurmukhi"] = { first = 0x00A66, last = 0x00A6F }
-------["digitsgujarati"] = { first = 0x00AE6, last = 0x00AEF }
-------["digitsoriya"] = { first = 0x00B66, last = 0x00B6F }
-------["digitstamil"] = { first = 0x00030, last = 0x00039 } -- no zero
-------["digitstelugu"] = { first = 0x00C66, last = 0x00C6F }
-------["digitskannada"] = { first = 0x00CE6, last = 0x00CEF }
-------["digitsmalayalam"] = { first = 0x00D66, last = 0x00D6F }
-------["digitsthai"] = { first = 0x00E50, last = 0x00E59 }
-------["digitslao"] = { first = 0x00ED0, last = 0x00ED9 }
-------["digitstibetan"] = { first = 0x00F20, last = 0x00F29 }
-------["digitsmyanmar"] = { first = 0x01040, last = 0x01049 }
-------["digitsethiopic"] = { first = 0x01369, last = 0x01371 }
-------["digitskhmer"] = { first = 0x017E0, last = 0x017E9 }
-------["digitsmongolian"] = { first = 0x01810, last = 0x01809 }
-
-- operators : 0x02200
-- symbolsa : 0x02701
-- symbolsb : 0x02901