From deb5a01766c2d947ed5fbc0797f3030b64491ab5 Mon Sep 17 00:00:00 2001 From: Omikhleia Date: Tue, 19 Nov 2024 23:49:25 +0100 Subject: [PATCH] fix(math): Add math.font.features setting, defaulting to +ssty for Libertinus Math --- packages/math/base-elements.lua | 1 + packages/math/init.lua | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/packages/math/base-elements.lua b/packages/math/base-elements.lua index 174f3e564..870c8894a 100644 --- a/packages/math/base-elements.lua +++ b/packages/math/base-elements.lua @@ -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 diff --git a/packages/math/init.lua b/packages/math/init.lua index 79edba25e..62aca3620 100644 --- a/packages/math/init.lua +++ b/packages/math/init.lua @@ -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", @@ -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.