Debian Codegraph @

texmf-dist/tex/latex/utfsym/utfsym.sty

raw
1 \NeedsTeXFormat{LaTeX2e}[2015/09/07]
2 \ProvidesExplPackage{utfsym}{2022/04/17}{}{Use TikZ to support icons from Unicode blocks}
3 %% developed for use in package 'schule' 2016 by Daniel Spittank
4 %% modified to work with lualatex 2021 by Marei Peischl
5 %% this package is public domain, CC0
6
7 %% - needs ut8 as input encoding
8 %% - TikZ paths are extracted from Symbola.ttf public domain font by George Douros,
9 %% see: http://users.teilar.gr/~g1951d/
10 %% - supports direct use of unicode symbols
11 %% - supports textcolor
12 %% - supports fontsizes
13 %% - supported Blocks:
14 %% - Miscellaneous Symbols and Arrows (2600-26FF)
15 %% - Dingbats (2700-27BF)
16 %% - Mahjong Tiles (1F000-1F02F)
17 %% - Domino Tiles (1F030-1F09F)
18 %% - Playing Cards (1F0A0-1F0FF)
19 %% - Miscellaneous Symbols and Pictographs (1F300-1F5FF)
20 %% - Emoticons / Emoji (1F600-1F64F)
21 %% - Transport and Map Symbols (1F680-1F6FF)
22
23 \RequirePackage{l3keys2e}
24
25 \keys_define:nn {utfsym} {
26 create-chars .bool_gset:N = \g__utfsym_create_chars_bool,
27 create-chars .default:n = true,
28 create-chars .initial:n = true
29 }
30
31 \ProcessKeysOptions{ utfsym }
32
33 \ExplSyntaxOff
34 \RequirePackage{xcolor}
35 \RequirePackage{tikz}
36 \RequirePackage{graphicx}
37
38 %% command for symbol usage \usym{unicode number}
39 \newcommand{\usym}[1]{\resizebox{!}{\fontcharht\font`M}{\input{usym#1.tikz}}}
40
41 %% command for symbol usage as a picture, scaling by height
42 %% \usymH{unicode number}{height}
43 \newcommand{\usymH}[2]{\resizebox{!}{#2}{\input{usym#1.tikz}}}
44
45 %% command for symbol usage as a picture, scaling by width
46 %% \usymW{unicode number}{width}
47 \newcommand{\usymW}[2]{\resizebox{#2}{!}{\input{usym#1.tikz}}}
48
49 %% direct unicode support
50
51 \ExplSyntaxOn
52
53 \bool_if:NT \g__utfsym_create_chars_bool {
54 \cs_if_exist:NTF \DeclareUnicodeCharacter {
55 \cs_new:Nn \utfsym_create_char:n {
56 \exp_args:Nx \DeclareUnicodeCharacter{\int_to_Hex:n {#1}}{\usym{\int_to_Hex:n {#1}}}
57 }
58 }{
59 \RequirePackage{newunicodechar}
60 \cs_new:Nn \utfsym_create_char:n {
61 \exp_args:Nx \newunicodechar{\char_generate:nn {#1}{12}}{\usym{\int_to_Hex:n {#1}}}
62 }
63 }
64
65 \int_step_inline:nnn {126976} {127231} {
66 \utfsym_create_char:n {#1}
67 }
68
69 \int_step_inline:nnn {127744} {128767} {
70 \utfsym_create_char:n {#1}
71 }
72
73 \int_step_inline:nnn {9728} {10175} {
74 \utfsym_create_char:n {#1}
75 }
76 }
77 \endinput