summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/optex/pkg/emoji.opm
blob: e14579135f1c94341a44584e1c7162708951a5c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
% This is the macro package used by OpTeX, see http://petr.olsak.net/optex

% emoji.opm, Petr Olšák <petr@olsak.net>, 2021

% Emoji allows us to use colored emoticons as characters from the font.
% The \emoji{<name>} command is available, see texdoc emoji (from
% corresponding LaTeX package).

\_namespace{emoji}

\_codedecl \.emoji {Emotikons from the TwemojiMozilla.ttf font}

   \_doc -----------------------------
   Font TwemojiMozilla.ttf is loaded. The font feature +colr is needed.
   The `\emojifont` is implemented using `\_resizethefont` as size-dependent.
   \_cod -----------------------------

\_initunifonts
\_font\.tenemoji=[TwemojiMozilla]:+colr
\_def\.emojifont{\.tenemoji\_resizethefont}
\_def\.emoji#1{{\.emojifont\_trycs{_emoji_:#1}{\_opwarning{uknown emoji "#1"}}}}

   \_doc -----------------------------
   The mapping from names or aliases to the codes are declared in the
   `emoji-table.def` file from the \LaTeX/ package emoji.
   \_cod -----------------------------

\_bgroup
   \_def\__emoji_def #1 #2#3#4#5#6{% #1=n, #2=data, #3=name, #4=aliases, #5=descr, #6=versi
      \_sxdef{_emoji_:#3}{#2}%
      \_ifx^#4^\_else \_foreach #4, \_do ##1, {\_global\_slet{_emoji_:##1}{_emoji_:#3}}\_fi
   }
   \_def\ProvidesExplFile#1#2#3#4{}
   \_def\__emoji_group#1 #2{}
   \_def\__emoji_subgroup#1 #2{}
   \_catcode`\#=12
   \_input {emoji-table.def}% defining emoji names
\_egroup

\_nspublic \emoji \emojifont ;

\_endnamespace

\_endcode

\begtt % ----------------------- Testing file ---------------------------
\load[emoji]
We can use \emoji{grinning} or directly: {\emojifont 😀} too.
\bye
\endtt % ----------------------------------------------------------------

More than 3000 emoticons are available.

If you want black-and-white pictograms, see another font:
\url{http://petr.olsak.net/optex/optex-tricks.html\#fawesome}