Skip to content

Commit 59f4bfd

Browse files
Omikhleiaalerque
authored andcommitted
feat(core): Add px unit as 0.75pt as per CSS3
We long did without it, but MathML examples may contain lengths in px. And we'll be happy too with other uses cases such as Markdown etc. This might break some code as SILE.types.length can ignore the unknown unit and the raw number value would thus be regarded as being in pt. But that's rather a parsing bug anyway, and SILE.types.measurement spits an error, so let's not care.
1 parent f4c513a commit 59f4bfd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

types/unit.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ unittypes["pc"] = {
7676
definition = "0.166666667in",
7777
}
7878

79+
-- Pixel, by convention 1px = 1/96in = 0.75pt
80+
-- (CSS Values and Units Module Level 3, §5.2)
81+
-- Used in MathML, etc.
82+
unittypes["px"] = {
83+
definition = "0.75pt",
84+
}
85+
7986
local checkPaperDefined = function ()
8087
if not SILE.documentState or not SILE.documentState.orgPaperSize then
8188
SU.error("A measurement tried to measure the paper size before the paper was defined", true)

0 commit comments

Comments
 (0)