Skip to content

Commit

Permalink
fix(math): Add math.font.features setting, defaulting to +ssty for Li…
Browse files Browse the repository at this point in the history
…bertinus Math
  • Loading branch information
Omikhleia authored and Didier Willis committed Nov 19, 2024
1 parent 9a1425c commit deb5a01
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/math/base-elements.lua
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ function elements.mbox:_init ()
size = SILE.settings:get("math.font.size"),
style = SILE.settings:get("math.font.style"),
weight = SILE.settings:get("math.font.weight"),
features = SILE.settings:get("math.font.features"),
}
local filename = SILE.settings:get("math.font.filename")
if filename and filename ~= "" then
Expand Down
7 changes: 7 additions & 0 deletions packages/math/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ function package.declareSettings (_)
type = "integer",
default = 400,
})
SILE.settings:declare({
parameter = "math.font.features",
type = "string or nil",
default = "+ssty",
})
SILE.settings:declare({
parameter = "math.font.filename",
type = "string",
Expand Down Expand Up @@ -138,6 +143,8 @@ By default, this package uses Libertinus Math, so it will fail if Libertinus Mat
Another font may be specified via the setting \autodoc:setting{math.font.family}.
If required, you can set the font style and weight via \autodoc:setting{math.font.style} and \autodoc:setting{math.font.weight}.
The font size can be set via \autodoc:setting{math.font.size}.
The \autodoc:setting{math.font.features} setting can be used to specify OpenType features for the math font. It defaults to \code{+ssty} (script style), notably to ensure that some symbols such as the prime, double prime, etc. are displayed correctly.
The default setting applies to Libertinus Math, but other fonts may require different features (e.g. the STIX Two Math font requires \code{+ss04}).
\paragraph{MathML}
The first way to typeset math formulas is to enter them in the MathML format.
Expand Down

0 comments on commit deb5a01

Please sign in to comment.