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

sile-typesetter / sile / 11135083927

01 Oct 2024 11:26PM UTC coverage: 62.071% (-7.3%) from 69.333%
11135083927

push

github

alerque
style: Reformat Lua with stylua

0 of 9 new or added lines in 2 files covered. (0.0%)

1678 existing lines in 57 files now uncovered.

11071 of 17836 relevant lines covered (62.07%)

5220.48 hits per line

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

0.0
/packages/unichar/init.lua
UNCOV
1
local base = require("packages.base")
×
2

UNCOV
3
local package = pl.class(base)
×
UNCOV
4
package._name = "unichar"
×
5

UNCOV
6
function package:registerCommands ()
×
UNCOV
7
   self:registerCommand("unichar", function (_, content)
×
UNCOV
8
      local cp = content[1]
×
UNCOV
9
      if type(cp) ~= "string" then
×
10
         SU.error("Bad argument to \\unicode")
×
11
      end
UNCOV
12
      local hlist = SILE.typesetter.state.nodes
×
UNCOV
13
      local char = SU.utf8charfromcodepoint(cp)
×
14
      if
UNCOV
15
         #hlist > 1
×
UNCOV
16
         and hlist[#hlist].is_unshaped
×
UNCOV
17
         and pl.tablex.deepcompare(hlist[#hlist].options, SILE.font.loadDefaults({}))
×
18
      then
19
         -- Stack character with a preceding unshaped node if its font is the
20
         -- same as the current one, so that combining characters (e.g. diacritics)
21
         -- and kerning works with \unichar'ed code points too.
UNCOV
22
         hlist[#hlist].text = hlist[#hlist].text .. char
×
23
      else
UNCOV
24
         SILE.typesetter:typeset(char)
×
25
      end
26
   end)
27
end
28

29
package.documentation = [[
30
\begin{document}
31
\use[module=packages.unichar]
32
SILE is Unicode compatible, and expects its input files to be in the UTF-8 encoding.
33
(The actual range of Unicode characters supported will depend on the supported ranges of the fonts that SILE is using to typeset.)
34
Some Unicode characters are hard to locate on a standard keyboard, and so are difficult to enter into SILE documents.
35

36
The \autodoc:package{unichar} package helps with this problem by providing the \autodoc:command{\unichar} command to enter Unicode codepoints.
37

38
\begin[type=autodoc:codeblock]{raw}
39
\unichar{U+263A}
40
\end{raw}
41

42
This produces: \font[family=Symbola]{\unichar{U+263A}}
43

44
If the argument to \autodoc:command{\unichar} begins with \code{U+}, \code{u+}, \code{0x}, or \code{0X}, then it is assumed to be a hexadecimal value.
45
Otherwise it is assumed to be a decimal codepoint.
46
\end{document}
UNCOV
47
]]
×
48

UNCOV
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