summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/unicode-alphabets/specimen.tex
blob: 4912283f5c98d69e62bc5b454b291c04ffd5e691 (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
% !TEX TS-program = lualatex
\documentclass{book}
\usepackage[
	a4paper,
	margin=1in,
	landscape
]{geometry}

\usepackage{csvsimple}
\usepackage{xltabular}
\usepackage{booktabs}
\usepackage{pgfkeys}
\usepackage{stringstrings}
\usepackage[
	hidelinks,
]{hyperref}

\include{csvsimple.tmp.patch}

\title{Unicode Alphabets for \LaTeX\\\bigskip\large Specimen}
\author{Mikkel Eide Eriksen}

\usepackage{fontspec}
\newfontfamily\mufifont{Palemonas MUFI}
\newfontfamily\silfont{Doulos SIL}
\newfontfamily\titusfont{TITUS Cyberbit Basic}
\newfontfamily\unzfont{LUC.EnsisheimU1A}

\usepackage[
%	CYFI,
	MUFI,
	SIL,
	TITUS,
	UNZ,
%	disable entity macros,
	fonts={
%		CYFI=\titusfont,
		MUFI=\mufifont,
		SIL=\silfont,
		TITUS=\titusfont,
		UNZ=\unzfont,
	},
]{unicode-alphabets}

\makeatletter
\newcommand\specset[1]{\pgfkeys{/specimen/.cd,#1}}

\newcommand\spec@showfont[1]{%
	{%
		#1%
		\edef\currentfontname{\f@family}\currentfontname
	}%
}

\newif\ifspec@has@entity
\specset{
	character set/.code={
		\csedef{spec@charset}{#1}%
		\caselower[q]{\spec@charset}%
		\csedef{spec@code}{\thestring}%
		\csedef{spec@csvfile}{unicode-alphabets.\spec@code.csv}%
		\csedef{spec@font}{\csname\spec@code font\endcsname}%
	},
	font url/.store in=\spec@font@url,
	has entity/.is if=spec@has@entity,
}

\newcommand\specimen[1]{%
	\specset{has entity=false,#1}%
	\chapter*{\spec@charset}
	\addcontentsline{toc}{chapter}{\spec@charset}

	Using the font \spec@showfont{\spec@font} from \url{\spec@font@url}.

	\begingroup
	\def\mytablerow{\texttt{\csvcoli} & \csuse{\csuse{spec@code}}{\csvcoli} & \ifspec@has@entity\csvcolii &\fi \csvcoliii}
	\ifspec@has@entity
		\def\spec@columns{r @{ } c @{ } l @{ } X}
	\else
		\def\spec@columns{r @{ } c @{ } X}
	\fi
	\expanded{\unexpanded{\begin{xltabular}{\linewidth}}{\spec@columns}}
	\toprule
	& Code & \ifspec@has@entity&\fi \hfill \spec@charset\\
	Glyph & Point & \ifspec@has@entity Entity Name &\fi Unicode Name\\
	\midrule
	\endhead
	\bottomrule
	\endfoot
	\csvloop{
		file={\spec@csvfile},
		late after line=\\,
		head to column names prefix=spec@,
		command=\mytablerow,
	}
	\end{xltabular}
	\endgroup
}

\makeatother

\begin{document}

\maketitle
\tableofcontents

\specimen{
	character set=MUFI,
	font url=http://mufi.info/,
	has entity=true,
}

\specimen{
	character set=SIL,
	font url=https://software.sil.org/charis/download/,
}

\specimen{
	character set=TITUS,
	font url=http://titus.fkidg1.uni-frankfurt.de/unicode/tituut.asp,
}

\begingroup
\catcode`\_=12 % unz entities have underscores
\specimen{
	character set=UNZ,
	font url=http://www.ligafaktur.de/,
	has entity=true,
}
\catcode`\_=8
\endgroup

\end{document}