• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

sile-typesetter / sile / 9304049654

30 May 2024 02:12PM UTC coverage: 60.021% (-14.7%) from 74.707%
9304049654

push

github

web-flow
Merge 1a26b4f22 into a1fd105f8

6743 of 12900 new or added lines in 186 files covered. (52.27%)

347 existing lines in 49 files now uncovered.

10311 of 17179 relevant lines covered (60.02%)

3307.34 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/packages/complex-spaces/init.lua
1
local base = require("packages.base")
×
2

3
local package = pl.class(base)
×
4
package._name = "complex-spaces"
×
5

6
function package:_init ()
×
NEW
7
   base._init(self)
×
NEW
8
   if not SILE.languageSupport.languages["x-spaces-are-nodes"] then
×
NEW
9
      local xsan = pl.class(SILE.nodeMakers.unicode)
×
NEW
10
      function xsan.makeGlue (node, item)
×
NEW
11
         node:addToken(" ", item)
×
NEW
12
         node:makeToken()
×
13
      end
NEW
14
      SILE.nodeMakers["x-spaces-are-nodes"] = xsan
×
NEW
15
      SILE.languageSupport.languages["x-spaces-are-nodes"] = true
×
16
   end
NEW
17
   if SILE.shaper and not SILE.shaper.noncomplex_SpaceNode then
×
NEW
18
      SILE.shaper.noncomplex_SpaceNode = SILE.shaper.makeSpaceNode
×
NEW
19
      SILE.shaper.makeSpaceNode = function (_, options, item)
×
NEW
20
         if SILE.settings:get("shaper.complexspaces") then
×
NEW
21
            local myoptions = pl.tablex.deepcopy(options)
×
NEW
22
            myoptions.language = "x-spaces-are-nodes"
×
NEW
23
            local nnodes = SILE.shaper:createNnodes(" ", myoptions)
×
NEW
24
            return SILE.types.node.discretionary({ replacement = nnodes })
×
25
         end
NEW
26
         return SILE.shaper.noncomplex_SpaceNode(_, options, item)
×
27
      end
28
   end
29
end
30

31
function package.declareSettings (_)
×
NEW
32
   SILE.settings:declare({
×
33
      parameter = "shaper.complexspaces",
34
      default = true,
35
      type = "boolean",
36
      help = "Whether the font's space glyph should be emitted, rather than a glue",
37
   })
38
end
39

40
package.documentation = [[
41
\begin{document}
42
SILE normally assumes that the "space" character in a font is empty, and that it can be replaced with a stretchable and shrinkable space.
43
In some fonts (particularly color fonts), this is not a reliable assumption, and the space character may actually contain ink.
44
Loading this package will allow such space glyphs to be correctly rendered.
45
(At some point in the future, SILE will detect fonts with complex spaces and load this package automatically, but for now it needs to be manually loaded.)
46
\end{document}
47
]]
×
48

49
return package
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc