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

sile-typesetter / sile / 11645827362

02 Nov 2024 09:08PM UTC coverage: 54.19% (-15.2%) from 69.34%
11645827362

push

github

web-flow
Merge pull request #2151 from Omikhleia/math-more-fixes-and-features

Math more fixes and features

103 of 208 new or added lines in 4 files covered. (49.52%)

2652 existing lines in 91 files now uncovered.

9816 of 18114 relevant lines covered (54.19%)

671.83 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