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

sile-typesetter / sile / 7232859119

16 Dec 2023 03:49PM UTC coverage: 66.878% (-7.7%) from 74.62%
7232859119

push

github

web-flow
Merge 05d75c2a3 into 8686730e4

0 of 4 new or added lines in 1 file covered. (0.0%)

1201 existing lines in 56 files now uncovered.

10550 of 15775 relevant lines covered (66.88%)

3347.52 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 ()
×
7

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

24
end
25

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

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

35
\begin[type=autodoc:codeblock]{raw}
36
\unichar{U+263A}
37
\end{raw}
38

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

41
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.
42
Otherwise it is assumed to be a decimal codepoint.
43
\end{document}
UNCOV
44
]]
×
45

UNCOV
46
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