summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2024-02-08 22:55:12 +0000
committerKarl Berry <karl@freefriends.org>2024-02-08 22:55:12 +0000
commit5cb543e1eca64fe43c71c01cfa510c62ca305538 (patch)
tree6d96679b2d19f55d118eb486b1b054f3cb775e81 /Master/texmf-dist/tex/latex
parent0e1742ab9d121e26fce1bc52a5a3d669a6cce37e (diff)
emotion (8feb24)
git-svn-id: svn://tug.org/texlive/trunk@69752 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r--Master/texmf-dist/tex/latex/emotion/emotion.def14
-rw-r--r--Master/texmf-dist/tex/latex/emotion/emotion.lua21
-rw-r--r--Master/texmf-dist/tex/latex/emotion/emotion.sty41
3 files changed, 76 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/emotion/emotion.def b/Master/texmf-dist/tex/latex/emotion/emotion.def
new file mode 100644
index 00000000000..4e6387e6274
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/emotion/emotion.def
@@ -0,0 +1,14 @@
+\ProvidesExplFile{emotion.def}
+ {2024/02/06}{0.1}{LaTeX emoji}
+
+\tl_const:cn{l__emotion_ 🇦}{^^^^^^01f1e6}
+\tl_const:cn{l__emotion_ 🇧}{^^^^^^01f1e7}
+\tl_const:cn{l__emotion_ 🇨}{^^^^^^01f1e8}
+
+\tl_const:cn{l__emotion_ 🈂}{^^^^^^01f202}
+\tl_const:cn{l__emotion_ 🈚}{^^^^^^01f21a}
+\tl_const:cn{l__emotion_ 🈯}{^^^^^^01f22f}
+\tl_const:cn{l__emotion_ 🈲}{^^^^^^01f232}
+
+
+\tl_const:cn{l__emotion_ emotion}{^^^^^^01f21a} \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/emotion/emotion.lua b/Master/texmf-dist/tex/latex/emotion/emotion.lua
new file mode 100644
index 00000000000..bde272c2b58
--- /dev/null
+++ b/Master/texmf-dist/tex/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
diff --git a/Master/texmf-dist/tex/latex/emotion/emotion.sty b/Master/texmf-dist/tex/latex/emotion/emotion.sty
new file mode 100644
index 00000000000..34b02f82edb
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/emotion/emotion.sty
@@ -0,0 +1,41 @@
+\RequirePackage{expl3}
+\ProvidesExplPackage{emotion}{2024/02/06}{0.1}{LaTeX emoji}
+
+\RequirePackage { fontspec }
+
+\ExplSyntaxOn
+
+% add emotion command
+\newfontface \emotionfont: { Apple~Color~Emoji } [ Renderer = Harfbuzz ]
+
+% enable update emoji font
+\newcommand{\emotionsetup}[1]{
+\renewfontface \emotionfont: {#1} [ Renderer = HarfBuzz]
+}
+
+% define emoji with unicode
+% 1: id
+% 2: unicode value
+\newcommand{\emotiondef}[2]{
+ \tl_const:cn{l__emotion_ #1}{#2}
+}
+
+% import pre-defined emotion
+\file_input:n { emotion.def }
+
+\tl_set:Nn \l__emotion_tmp_tl {❓}
+
+\newcommand{\emotion}[1]{
+\group_begin:
+\tl_set:Nn \l__emotion_tmp_tl {#1}
+\ifcsname l__emotion_#1\endcsname
+ {\emotionfont:{\tl_use:c {l__emotion_ #1}}}
+\else
+ {\emotionfont:{\tl_use:N \l__emotion_tmp_tl}}
+\fi
+\group_end:
+}
+
+\ExplSyntaxOff
+
+\endinput \ No newline at end of file