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

sile-typesetter / sile / 9428435077

08 Jun 2024 11:35AM UTC coverage: 64.56% (-9.9%) from 74.46%
9428435077

push

github

web-flow
Merge pull request #2047 from alerque/end-pars

23 of 46 new or added lines in 5 files covered. (50.0%)

1684 existing lines in 60 files now uncovered.

11145 of 17263 relevant lines covered (64.56%)

4562.45 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 preceeding 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

© 2025 Coveralls, Inc