Skip to content

Commit

Permalink
fix(languages): French punctuation spacing must honor current font op…
Browse files Browse the repository at this point in the history
…tions
  • Loading branch information
Omikhleia authored and Didier Willis committed Apr 13, 2022
1 parent b584be5 commit 724daf4
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions languages/fr.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,24 @@ SILE.settings.declare({
help = "If switched to true, uses large spaces instead of the regular punctuation ones"
})

local getSpaceGlue = function(parameter)
local getSpaceGlue = function(options, parameter)
local sg
if SILE.settings.get("languages.fr.debugspace") then
return SILE.nodefactory.kern("5spc")
sg = SILE.nodefactory.kern("5spc")
else
sg = SILE.settings.get(parameter)
end
return SILE.settings.get(parameter)
-- Return the absolute (kern) length of the specified spacing parameter
-- with a particular set of font options.
-- As for SILE.shapers.base.measureSpace(), which has the same type of
-- logic, caching this doesn't seem to have any significant speedup.
SILE.settings.temporarily(function ()
SILE.settings.set("font.size", options.size)
SILE.settings.set("font.family", options.family)
SILE.settings.set("font.filename", options.filename)
sg = sg:absolute()
end)
return sg
end

SILE.nodeMakers.fr = pl.class({
Expand Down Expand Up @@ -117,7 +130,7 @@ SILE.nodeMakers.fr = pl.class({
makeUnbreakableSpace = function (self, parameter)
self:makeToken()
self.lastnode = "glue"
coroutine.yield(getSpaceGlue(parameter))
coroutine.yield(getSpaceGlue(self.options, parameter))
end,

handleSpaceBefore = function (self, item)
Expand Down

0 comments on commit 724daf4

Please sign in to comment.