Skip to content

Commit

Permalink
Merge pull request #981 from sile-typesetter/fix-979
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque authored Jul 24, 2020
2 parents 94fc57f + b50fd91 commit 556b74c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/unichar.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
SILE.registerCommand("unichar", function(_, content)
local cp = content[1]
if type(cp) ~= "string" then SU.error("Bad argument to \\unicode") end
SILE.typesetter:typeset(SU.utf8charfromcodepoint(cp))
local hlist = SILE.typesetter.state.nodes
local char = SU.utf8charfromcodepoint(cp)
if #hlist > 1 and hlist[#hlist].is_unshaped then
hlist[#hlist].text = hlist[#hlist].text .. char
else
SILE.typesetter:typeset(char)
end
end)

return { documentation = [[\begin{document}
Expand Down
10 changes: 10 additions & 0 deletions tests/bug-979.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Set paper size 297.6377985 419.5275636
Begin page
Mx 14.8819
My 28.1492
Set font Symbola;10;400;;normal;;LTR
T 164 (â)
My 40.1492
T 164 (â)
End page
Finish
10 changes: 10 additions & 0 deletions tests/bug-979.sil
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
\begin[papersize=a6]{document}
\nofolios
\noindent
\script[src=packages/unichar]
\font[family=Symbola]
\raggedright{
â\break
a\unichar{0x302}
}
\end{document}

0 comments on commit 556b74c

Please sign in to comment.