summaryrefslogtreecommitdiff
path: root/macros/unicodetex/latex/emotion/emotion.lua
diff options
context:
space:
mode:
Diffstat (limited to 'macros/unicodetex/latex/emotion/emotion.lua')
-rw-r--r--macros/unicodetex/latex/emotion/emotion.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/macros/unicodetex/latex/emotion/emotion.lua b/macros/unicodetex/latex/emotion/emotion.lua
new file mode 100644
index 0000000000..bde272c2b5
--- /dev/null
+++ b/macros/unicodetex/latex/emotion/emotion.lua
@@ -0,0 +1,21 @@
+function unicodes(chs)
+ local text = ""
+ for _, c in utf8.codes(chs) do
+ text = text .. unicode(c)
+ end
+ print(text)
+end
+
+function unicode(codepoint)
+ local value = NULL
+ if codepoint > 0xFFFF then
+ value = string.format("^^^^^^%06x", codepoint)
+ elseif codepoint > 0xFF then
+ value = string.format("^^^^%04x", codepoint)
+ else
+ value = string.format("^^%02x", codepoint)
+ end
+ return value
+end
+
+unicodes("🀁♀") \ No newline at end of file