Skip to content

Commit a6628b5

Browse files
committed
fix(shapers): Actually disable variablespaces if setting set to false
...even if a space node prototype is not set via document.spaceskip. Fall back to just using the width of an actual space and disabling stretch and shrink like the setting name suggests.
1 parent ce6c70d commit a6628b5

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

shapers/base.lua

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@ local function shapespace (spacewidth)
1111
spacewidth = SU.cast("measurement", spacewidth)
1212
-- In some scripts with word-level kerning, glue can be negative.
1313
-- Use absolute value to ensure stretch and shrink work as expected.
14-
local absoluteSpaceWidth = math.abs(spacewidth:tonumber())
15-
local length = spacewidth * SILE.settings:get("shaper.spaceenlargementfactor")
16-
local stretch = absoluteSpaceWidth * SILE.settings:get("shaper.spacestretchfactor")
17-
local shrink = absoluteSpaceWidth * SILE.settings:get("shaper.spaceshrinkfactor")
14+
local abs_length = math.abs(spacewidth:tonumber())
15+
local length, stretch, shrink = abs_length, 0, 0
16+
if SILE.settings:get("shaper.variablespaces") then
17+
length = spacewidth * SILE.settings:get("shaper.spaceenlargementfactor")
18+
stretch = abs_length * SILE.settings:get("shaper.spacestretchfactor")
19+
shrink = abs_length * SILE.settings:get("shaper.spaceshrinkfactor")
20+
end
1821
return SILE.types.length(length, stretch, shrink)
1922
end
2023

0 commit comments

Comments
 (0)