| 1 |
%%%%% \iffalse meta-comment |
| 2 |
% |
| 3 |
%% File: unicodefonttable.dtx (C) Copyright 2019-2024 Frank Mittelbach |
| 4 |
% |
| 5 |
% It may be distributed and/or modified under the conditions of the |
| 6 |
% LaTeX Project Public License (LPPL), either version 1.3c of this |
| 7 |
% license or (at your option) any later version. The latest version |
| 8 |
% of this license is in the file |
| 9 |
% |
| 10 |
% https://www.latex-project.org/lppl.txt |
| 11 |
% |
| 12 |
% |
| 13 |
% The development version of the bundle can be found below |
| 14 |
% |
| 15 |
% https://github.com/FrankMittelbach/fmitex/ |
| 16 |
% |
| 17 |
% for those people who are interested or want to report an issue. |
| 18 |
% |
| 19 |
|
| 20 |
\def\unicodefonttabledate {2025/07/11} |
| 21 |
\def\unicodefonttableversion{1.0k} |
| 22 |
|
| 23 |
|
| 24 |
%<*driver> |
| 25 |
\documentclass{l3doc-TUB2024} |
| 26 |
|
| 27 |
% some fixes local to this documentation |
| 28 |
|
| 29 |
\ExplSyntaxOn |
| 30 |
\cs_new:Npn\IfImplementationShownTF |
| 31 |
{\bool_if:NTF \g__codedoc_typeset_implementation_bool} |
| 32 |
\ExplSyntaxOff |
| 33 |
|
| 34 |
\makeatletter |
| 35 |
\def\meta@font@select{\normalfont\itshape} |
| 36 |
|
| 37 |
\IndexPrologue{% |
| 38 |
\IfImplementationShownTF{\section*{Index}% |
| 39 |
Numbers written in italic refer to the page |
| 40 |
where the corresponding entry is described |
| 41 |
or mentioned. Numbers underlined refer to the |
| 42 |
code line of the |
| 43 |
definition; numbers in Roman refer to the |
| 44 |
code lines where the entry is used.}% |
| 45 |
{\section{Index}% |
| 46 |
Numbers written in italic refer to the page |
| 47 |
where the corresponding entry is described |
| 48 |
or mentioned.}} |
| 49 |
|
| 50 |
\makeatother |
| 51 |
|
| 52 |
|
| 53 |
\usepackage{graphicx,unicodefonttable} |
| 54 |
|
| 55 |
\EnableCrossrefs |
| 56 |
\CodelineIndex |
| 57 |
\begin{document} |
| 58 |
\DocInput{unicodefonttable.dtx} |
| 59 |
\advance\signaturewidth by 40pt |
| 60 |
\makesignature |
| 61 |
\end{document} |
| 62 |
%</driver> |
| 63 |
% |
| 64 |
% \fi |
| 65 |
% |
| 66 |
% \tracinglostchars=3 |
| 67 |
% |
| 68 |
% \newcommand\key [1]{\texttt{#1}} |
| 69 |
% \newcommand\kval[1]{\texttt{#1}} |
| 70 |
% |
| 71 |
% \newcommand\keysetup[1]{\noindent\marginpar{\raggedleft Key setup: #1}\ignorespaces} |
| 72 |
% \renewcommand\keysetup[1]{\paragraph*{\hspace*{-8pc}Key setup (#1)}} |
| 73 |
% |
| 74 |
% |
| 75 |
% \title{The \texttt{unicodefonttable} package\thanks{This is |
| 76 |
% version \unicodefonttableversion\ of the package, dated |
| 77 |
% \unicodefonttabledate; the license is LPPL.}} |
| 78 |
% \author{Frank Mittelbach} |
| 79 |
% \address{Mainz, Germany} |
| 80 |
% \netaddress{https://www.latex-project.org} |
| 81 |
% \personalURL{https://ctan.org/pkg/unicodefonttable} |
| 82 |
% \raggedbottom |
| 83 |
% |
| 84 |
% \maketitle |
| 85 |
% |
| 86 |
% |
| 87 |
% \begin{abstract} |
| 88 |
% A package for typesetting font tables for larger fonts, e.g., |
| 89 |
% TrueType or OpenType Unicode fonts. |
| 90 |
% To produce a one-off table, a standalone version is available as well. |
| 91 |
% \end{abstract} |
| 92 |
% |
| 93 |
% \vspace*{\medskipamount} |
| 94 |
% |
| 95 |
% \tableofcontents |
| 96 |
% |
| 97 |
% \vspace*{\bigskipamount} |
| 98 |
% |
| 99 |
% \section{Introduction} |
| 100 |
% |
| 101 |
% When I started to write a new chapter for the third edition of |
| 102 |
% \emph{The \LaTeX{} Companion} on modern fonts available for |
| 103 |
% different \LaTeX{} engines, I was a bit surprised that I couldn't |
| 104 |
% find a way to easily typeset tables showing the glyphs available in |
| 105 |
% TrueType or OpenType fonts. The \pkg{nfssfont} package available |
| 106 |
% with \LaTeX{} only supports fonts from the 8-bit world, but |
| 107 |
% modern fonts that can be used with \XeTeX{} or \LuaTeX{} can |
| 108 |
% contain thousands of glyphs and having a method to display what |
| 109 |
% is available in them was important for me. |
| 110 |
% |
| 111 |
% I therefore set out to write my own little package and what |
| 112 |
% started as an afternoon exercise ended up being this package, |
| 113 |
% offering plenty of bells and whistles for typesetting such |
| 114 |
% font tables. |
| 115 |
% |
| 116 |
% As there can be many glyphs in such fonts a tabular |
| 117 |
% representation of them might run for several pages, so the |
| 118 |
% package internally uses the \pkg{longtable} package to handle |
| 119 |
% that. |
| 120 |
% |
| 121 |
% In most cases the glyphs inside the fonts are indexed by their |
| 122 |
% Unicode numbers so it is natural to display them sorted by their |
| 123 |
% position in the Unicode character set. |
| 124 |
% |
| 125 |
% Unicode is organized in named blocks such as ``Basic Latin'', |
| 126 |
% ``Latin-1~Supplement'', etc., typically consisting of 265 |
| 127 |
% characters each.\footnote{Some blocks are smaller, while those |
| 128 |
% containing the Asian ideographs are much larger.} It is therefore |
| 129 |
% helpful to use these block names as subtitles within the table, |
| 130 |
% to more easily find the information one is looking for. |
| 131 |
% |
| 132 |
% A common way to represent the number of a single Unicode |
| 133 |
% character is \texttt{U+} followed by four (or more) |
| 134 |
% hexadecimal digits. For example, \texttt{U+0041} represents the letter |
| 135 |
% ``A'' and \texttt{U+20AC} the Euro currency symbol ``\texteuro''. |
| 136 |
% We use this convention by showing a Unicode range of sixteen |
| 137 |
% characters at the left of each table row, |
| 138 |
% e.g., \texttt{U+0040 - |
| 139 |
% 004F}, followed by the sixteen glyphs in the range. Thus that |
| 140 |
% ^^A \IfImplementationShownTF{}{\pagebreak}\ignorespaces |
| 141 |
% particular table row from the ``Basic Latin'' block would show |
| 142 |
% something like |
| 143 |
% |
| 144 |
% \displayfonttable*[noheader,range-start=0040, range-end=004F, |
| 145 |
% color=black!50]{Latin Modern Sans} |
| 146 |
% |
| 147 |
% If a Unicode character has no glyph representation in a given |
| 148 |
% font then this is indicated by a special symbol (by default a |
| 149 |
% colored hyphen). By default some color is used, but we've grayscaled |
| 150 |
% the output for \TUB. |
| 151 |
% |
| 152 |
% In order to easily locate any Unicode character the table shows by |
| 153 |
% default sixteen hex digits as a column heading. For example, to find |
| 154 |
% Euro currency symbol (\texttt{U+20AC}) one first finds the |
| 155 |
% right row, which is the range \texttt{U+20A0 - 20AF}, and then |
| 156 |
% the \texttt{C} column in that row, and the glyph is there (or an |
| 157 |
% indication that the font is missing that glyph; |
| 158 |
% the line shows that for some of the other slots). |
| 159 |
% |
| 160 |
% \displayfonttable*[noheader,range-start=20A0, range-end=20AF, |
| 161 |
% color=black!50]{Latin Modern Sans} |
| 162 |
% |
| 163 |
% It can be useful to compare two fonts with each other by |
| 164 |
% filling the table with glyphs from a secondary font if the |
| 165 |
% primary font is missing them. For example, the next display shows |
| 166 |
% two rows of Latin Modern Math (black glyphs) and instead of showing |
| 167 |
% a missing glyph symbol in most slots, we use the glyphs from New |
| 168 |
% Computer Modern Math, which has a much larger glyph set |
| 169 |
% (normally red glyphs with gray background but again, grayscaled for |
| 170 |
% \TUB). |
| 171 |
% |
| 172 |
% |
| 173 |
% \displayfonttable[noheader,nostatistics,display-block=none, |
| 174 |
% compare-with=NewCMMath-Regular.otf,range-start=2A00,range-end=2A1F, |
| 175 |
% color=black!50,compare-color=none] |
| 176 |
% {latinmodern-math.otf} |
| 177 |
% |
| 178 |
% |
| 179 |
% \section{The user interface} |
| 180 |
% |
| 181 |
% The package offers one command to typeset a font table. The |
| 182 |
% appearance of the table can be customized by specifying key/value |
| 183 |
% pairs. |
| 184 |
% |
| 185 |
% \begin{function}{\displayfonttable} |
| 186 |
% \begin{syntax} |
| 187 |
% \cs{displayfonttable} \texttt{*} \oarg{key/value-list} \Arg{font-name} \oarg{font-features} |
| 188 |
% \end{syntax} |
| 189 |
% The \meta{font-name} is the font to be displayed. This and the |
| 190 |
% \meta{font-features} argument are passed to \pkg{fontspec}, thus they |
| 191 |
% should follow the conventions of that package for specifying a |
| 192 |
% font. The \meta{key/value-list} offers customization |
| 193 |
% possibilities discussed below. |
| 194 |
% |
| 195 |
% The \cs{displayfonttable*} is a variant of the command, intended |
| 196 |
% for use with 8-bit legacy fonts. It presets some keys, but |
| 197 |
% otherwise behaves identically. The preset values are: |
| 198 |
%\begin{verbatim} |
| 199 |
% nostatistics, display-block=none, hex-digits=head, range-end=FF |
| 200 |
%\end{verbatim} |
| 201 |
% For details see the next section. |
| 202 |
% \end{function} |
| 203 |
% |
| 204 |
% |
| 205 |
% |
| 206 |
% \begin{function}{\fonttablesetup} |
| 207 |
% \begin{syntax} |
| 208 |
% \cs{fonttablesetup} \Arg{key/value-list} |
| 209 |
% \end{syntax} |
| 210 |
% Instead of or in addition to specifying key/values to |
| 211 |
% \cs{displayfonttable} it is possible to set them up as |
| 212 |
% defaults. Inside \cs{displayfonttable} the defaults are applied first, |
| 213 |
% so one can still overwrite their values for an individual table. |
| 214 |
% \end{function} |
| 215 |
% |
| 216 |
% |
| 217 |
% \begin{function}{\fonttableglyphcount} |
| 218 |
% \begin{syntax} |
| 219 |
% \cs{fonttableglyphcount} |
| 220 |
% \end{syntax} |
| 221 |
% While typesetting a font table the package keeps track of the |
| 222 |
% number of glyphs it finds in the font. After the table has finished, |
| 223 |
% this value is available in \cs{fonttableglyphcount} and it is, for |
| 224 |
% example, used when statistics are produced. At the start of the |
| 225 |
% next table it is reset to zero. |
| 226 |
% \end{function} |
| 227 |
% |
| 228 |
% |
| 229 |
% |
| 230 |
% |
| 231 |
% \subsection{Keys and their values} |
| 232 |
% |
| 233 |
% Several of the available keys are booleans accepting \texttt{true} |
| 234 |
% or \texttt{false}. They usually exist in pairs so that one can |
| 235 |
% specify the desired behavior without needing to provide a value, |
| 236 |
% e.g., specifying \key{header} is equivalent to specifying |
| 237 |
% \key{header}\texttt{=true} or \key{noheader}\texttt{=false}, etc. |
| 238 |
% In the lists below the default settings are indicated by an |
| 239 |
% underline. |
| 240 |
% |
| 241 |
% \begin{variable}{header,noheader,title-format,title-format-cont} |
| 242 |
% The first set of keys is concerned with the overall look and |
| 243 |
% feel of the generated table. |
| 244 |
% \begin{description} |
| 245 |
% \item[\underline{\key{header}}, \key{noheader}] |
| 246 |
% These keys determine whether a header to the table is |
| 247 |
% produced. |
| 248 |
% |
| 249 |
% \item[\key{title-format}, \key{title-format-cont}] |
| 250 |
% These keys define what is provided as a header title or |
| 251 |
% continuation title if the table consists of several pages. |
| 252 |
% They expect code as their value. This code can contain \verb=#1= |
| 253 |
% and \verb=#2= to denote the \meta{font-name} and |
| 254 |
% \meta{font-features} arguments, respectively. |
| 255 |
% |
| 256 |
% By default a title using the \cs{caption} command is produced; on |
| 257 |
% continuation titles, the \meta{font-features} are not shown. |
| 258 |
% This is typeset as a \env{longtable} header row, so you either need to use |
| 259 |
% \cs{multicolumn} or a \cs{caption} command\Dash otherwise everything |
| 260 |
% ends up in the first column. |
| 261 |
% |
| 262 |
% \end{description} |
| 263 |
% |
| 264 |
% \end{variable} |
| 265 |
% |
| 266 |
% |
| 267 |
% \begin{variable}{display-block,hex-digits, hex-digits-font,hex-digits-row-format,color} |
| 268 |
% These keys handle the inner parts of the table. |
| 269 |
% |
| 270 |
% \begin{description} |
| 271 |
% \item[\key{display-block}] |
| 272 |
% The Unicode dataset is organized in named blocks that are typically 128 or |
| 273 |
% 256 characters, though some are noticeably larger and a few are |
| 274 |
% smaller. With the \key{display-block} key it is |
| 275 |
% possible to specify if and how such blocks should be made visible. |
| 276 |
% The following values are supported: |
| 277 |
% \begin{description} |
| 278 |
% \item[\underline{\kval{titles}}] |
| 279 |
% Above each display block that contains glyphs the Unicode title |
| 280 |
% of the block is displayed. |
| 281 |
% |
| 282 |
% \item[\kval{rules}] |
| 283 |
% Display blocks are indicated only by a \cs{midrule}. |
| 284 |
% |
| 285 |
% \item[\kval{none}] |
| 286 |
% Display blocks are not indicated at all. |
| 287 |
% \end{description} |
| 288 |
% |
| 289 |
% \item[\key{hex-digits}] |
| 290 |
% To ease reading the table, rows of hex digits are added to |
| 291 |
% it. Where or if this happens is controlled by this key. Allowed |
| 292 |
% values for it are the following: |
| 293 |
% \begin{description} |
| 294 |
% \item[\kval{block}] |
| 295 |
% A row of hex digits is placed at the beginning of each Unicode |
| 296 |
% block containing glyphs in the displayed font. |
| 297 |
% |
| 298 |
% \item[\kval{foot}] |
| 299 |
% A row is added to the foot of each table page. |
| 300 |
% |
| 301 |
% \item[\underline{\kval{head}}] |
| 302 |
% A row is added to the top of each table page. |
| 303 |
% |
| 304 |
% \item[\kval{head+foot}] |
| 305 |
% A row is added to the top and the foot of each table page. |
| 306 |
% |
| 307 |
% \item[\kval{none}] |
| 308 |
% All hex digit rows are suppressed. |
| 309 |
% \end{description}% |
| 310 |
% |
| 311 |
% \item[\key{hex-digits-font}] |
| 312 |
% The font to use for the hex digits, by default |
| 313 |
% \underline{\cs{ttfamily}\cs{scriptsize}}.{\hfuzz=2.7pt\par} |
| 314 |
% |
| 315 |
% \item[\key{hex-digits-row-format}] |
| 316 |
% This key defines the format for the hex digits shown on the left |
| 317 |
% of each row. It accepts one argument hold the hex values for the |
| 318 |
% row except for the last digit, e.g, \texttt{0A3} for the values |
| 319 |
% from \texttt{0A30} to \texttt{0A3F}. The default formatting is |
| 320 |
% \underline{\ttfamily U+\#10\cs{,}-\cs{,}\#1F} and without further |
| 321 |
% adjustments it is automaticaly set |
| 322 |
% in \cs{ttfamily}\cs{footnotesize} and in the color |
| 323 |
% specified by the \key{color} key. |
| 324 |
% A suitable value that takes up less space would be \texttt{U+\#1x}. |
| 325 |
% |
| 326 |
% |
| 327 |
% |
| 328 |
% \item[\key{color}] |
| 329 |
% This key determines the color for parts of the table (hex digits |
| 330 |
% and Unicode ranges). It can be either \kval{none} or a color |
| 331 |
% specification as understood by the \cs{color} command. |
| 332 |
% The default is \underline{\texttt{blue}}. |
| 333 |
% |
| 334 |
% \end{description} |
| 335 |
% |
| 336 |
% \end{variable} |
| 337 |
% |
| 338 |
% |
| 339 |
% \begin{variable}{statistics, nostatistics,statistics-font,statistics-format} |
| 340 |
% The next set of keys allows altering the statistics that are produced. |
| 341 |
% \begin{description} |
| 342 |
% |
| 343 |
% \item[\underline{\key{statistics}}, \key{nostatistics}] |
| 344 |
% These keys determine whether some statistics are listed at |
| 345 |
% the end of the table. |
| 346 |
% |
| 347 |
% \item[\key{statistics-font}] |
| 348 |
% The font used to typeset the statistics; the default is\\ |
| 349 |
% \underline{\cs{normalfont}\cs{small}}. |
| 350 |
% |
| 351 |
% |
| 352 |
% \item[\key{statistics-format}] |
| 353 |
% Code (text) to specify what should be typeset in the |
| 354 |
% statistics. One can use \verb=#1= for the \meta{font-name} and |
| 355 |
% \verb=#2= for the glyph count. |
| 356 |
% The material is typeset on a single line at the end of the |
| 357 |
% table. If several lines are needed you need to use \cs{parbox} |
| 358 |
% or a similar construct. |
| 359 |
% \end{description} |
| 360 |
% \end{variable} |
| 361 |
% |
| 362 |
% |
| 363 |
% |
| 364 |
% \begin{variable}{glyph-width,missing-glyph, missing-glyph-font, missing-glyph-color} |
| 365 |
% Another set of keys deals with customization on the glyph level. |
| 366 |
% \begin{description} |
| 367 |
% \item[\key{glyph-width}] |
| 368 |
% All glyphs are typeset in a box with the same width, the default |
| 369 |
% value is \underline{\texttt{6pt}} which is suitable for most 10pt |
| 370 |
% fonts |
| 371 |
% and make the table fit comfortably into the text width of |
| 372 |
% a typical document. |
| 373 |
% |
| 374 |
% \item[\key{missing-glyph}] |
| 375 |
% If a slot in a row doesn't have a glyph in the font you may still |
| 376 |
% want display something to indicate this state. By giving the key |
| 377 |
% a value any arbitrary glyph or material can be typeset. The |
| 378 |
% default is to typeset a \kval{-} (hyphen) in a special color. |
| 379 |
% |
| 380 |
% Rows that contain no glyph whatsoever are not displayed at |
| 381 |
% all. Instead a small vertical space is added to indicate the one |
| 382 |
% or more rows are omitted. |
| 383 |
% |
| 384 |
% \item[\key{missing-glyph-font}] |
| 385 |
% |
| 386 |
% The font used for the missing glyphs (the default value is |
| 387 |
% \underline{\cs{ttfamily}\cs{scriptsize}}). |
| 388 |
% |
| 389 |
% \item[\key{missing-glyph-color}] |
| 390 |
% If not specified it uses the value specified with the \key{color} |
| 391 |
% key. If you want a different color, e.g., \texttt{red}, you can |
| 392 |
% use a color value or you can specify \kval{none} to use no coloring. |
| 393 |
% |
| 394 |
% \end{description} |
| 395 |
% |
| 396 |
% \end{variable} |
| 397 |
% |
| 398 |
% |
| 399 |
% \begin{variable}{compare-with,compare-color, compare-bgcolor,statistics-compare-format} |
| 400 |
% |
| 401 |
% You can make comparisons between two fonts, which is useful, for |
| 402 |
% example when dealing with incomplete math fonts and you need to |
| 403 |
% see how well the symbols from one font blend with the supplementary |
| 404 |
% symbols from another font. |
| 405 |
% |
| 406 |
% \begin{description} |
| 407 |
% \item[\key{compare-with}] |
| 408 |
% |
| 409 |
% If given, the value is a \meta{comparison-font-name} that is used |
| 410 |
% to supply missing glyphs. This means that if the \meta{font-name} |
| 411 |
% to be displayed is missing a glyph in a slot, then the |
| 412 |
% \meta{comparison-font-name} is checked, and if that font has the |
| 413 |
% glyph in question, it will be displayed instead of showing a |
| 414 |
% missing glyph indicator. |
| 415 |
% |
| 416 |
% \item[\key{compare-color}, \key{compare-bgcolor}] |
| 417 |
% |
| 418 |
% To distinguish real glyphs from missing but substituted glyphs, |
| 419 |
% they can be colored specially (default \underline{\texttt{red}}) |
| 420 |
% and/or you can have their background colored (default is |
| 421 |
% \underline{\texttt{black!10}}, i.e., a light gray). |
| 422 |
% |
| 423 |
% \item[\key{statistics-compare-format}] |
| 424 |
% |
| 425 |
% Code (text) to specify what should be typeset in the statistics |
| 426 |
% when comparing two fonts. One can use \verb=#1= for the |
| 427 |
% \meta{font-name} and \verb=#2= for its glyph count, \verb=#3= is |
| 428 |
% the name of the comparison font, \verb=#4= its glyph count, |
| 429 |
% \verb=#5= for the number of glyphs missing in this font and |
| 430 |
% \verb=#6= the number of extra glyphs in it. This code is used |
| 431 |
% instead of \key{statistics-format} when comparisons are made. |
| 432 |
% |
| 433 |
% The material is typeset on a single line at the end of the |
| 434 |
% table. If several lines are needed you need to use \cs{parbox} |
| 435 |
% or a similar construct. |
| 436 |
% |
| 437 |
% \end{description} |
| 438 |
% \end{variable} |
| 439 |
% |
| 440 |
% |
| 441 |
% \begin{variable}{range-start, range-end} |
| 442 |
% Finally there are two keys for restricting the display range. |
| 443 |
% \begin{description} |
| 444 |
% \item[\key{range-start}, \key{range-end}] |
| 445 |
% The full Unicode set of characters is huge and checking every |
| 446 |
% slot to see if the current font contains a glyph in the slot |
| 447 |
% takes a long time. If you know that font contains only a |
| 448 |
% certain subset then you can speed up the table generation |
| 449 |
% considerably by limiting the search (and consequently the output |
| 450 |
% generation). |
| 451 |
% The \key{range-start} specifies where to start with the search |
| 452 |
% (default \underline{\texttt{0000}}) and \key{range-end} gives |
| 453 |
% the last slot that is tested (default |
| 454 |
% \underline{\texttt{FFFF}}). |
| 455 |
% |
| 456 |
% Thus, by default we restrict the display to slots below |
| 457 |
% \texttt{10000}, because text fonts seldom contain glyphs in the |
| 458 |
% higher planes. But if you want to see everything of the font (as |
| 459 |
% far as supported by this package) and are prepared to wait for |
| 460 |
% the higher |
| 461 |
% planes to be scanned, you can go up to a value of \texttt{FFFFF}. |
| 462 |
% |
| 463 |
% However, please note that the \LuaTeX{} fontloader uses the |
| 464 |
% \enquote{Supplementary Private Use Area-A}, which starts at |
| 465 |
% \texttt{F0000}, as its own playground and places remapping into |
| 466 |
% it, so by default you see random data instead of font data there. You |
| 467 |
% either have to use the \XeTeX{} engine or load the font with |
| 468 |
% \texttt{Renderer=HarfBuzz} in \LuaTeX{}. |
| 469 |
% |
| 470 |
% These keys are also quite useful in combination with the previous |
| 471 |
% \key{compare-with} key, to display only, for example, the Greek |
| 472 |
% letters and see how glyphs from two fonts blend with each other. |
| 473 |
|
| 474 |
% \end{description} |
| 475 |
% \end{variable} |
| 476 |
% |
| 477 |
% |
| 478 |
% |
| 479 |
% \subsection{A standalone interactive version} |
| 480 |
% |
| 481 |
% If you want to quickly display a single font, you can run |
| 482 |
% \texttt{unicodefont.tex} through \LaTeX{} using \LuaTeX{} (or \XeTeX{}) |
| 483 |
% as the engine. Similar to |
| 484 |
% \texttt{nfssfont.tex} (which is for 8-bit fonts with \pdfTeX) it |
| 485 |
% asks you a few questions and then generates the font table for |
| 486 |
% you. There are fewer configuration options available, |
| 487 |
% but this workflow saves you writing a document to get a |
| 488 |
% one-off table. |
| 489 |
% |
| 490 |
% Most font tables need several runs due to the use of |
| 491 |
% \pkg{longtable}, which has to find the right width for the columns |
| 492 |
% across several pages. The \texttt{unicodefont} file therefore |
| 493 |
% remembers your selection from the previous run and asks you if |
| 494 |
% you want to reapply it to speed up the process. |
| 495 |
% |
| 496 |
% |
| 497 |
% |
| 498 |
% \section{Notes on the table data} |
| 499 |
% |
| 500 |
% If you look at some parts of a Unicode font table you see a number of slots that |
| 501 |
% do not show a \enquote{missing glyph} sign, but nonetheless appear |
| 502 |
% to be empty. For example: |
| 503 |
% |
| 504 |
% \displayfonttable[noheader,nostatistics,display-block=none, |
| 505 |
% range-start=0020,range-end=00BF, |
| 506 |
% color=black!50] |
| 507 |
% {TeX Gyre Pagella} |
| 508 |
% |
| 509 |
% |
| 510 |
% The reason is that Unicode contains a lot of special |
| 511 |
% spaces or otherwise invisible characters, e.g., \texttt{U+0020} |
| 512 |
% is the normal space, \texttt{U+00A0} is a non-breaking space, |
| 513 |
% \texttt{U+00AD} is a soft-hyphen (what \LaTeX{} users would |
| 514 |
% indicate with \cs{-}), and so forth. Especially the row |
| 515 |
% \texttt{U+2000-200F} in Table~6 looks strange as it appears to be totally |
| 516 |
% empty, but in fact most of its slots contain spaces of different |
| 517 |
% width. |
| 518 |
% |
| 519 |
%\displayfonttable[noheader,nostatistics,hex-digits=foot, |
| 520 |
% range-start=2000,range-end=202F, |
| 521 |
% color=black!50] |
| 522 |
% {latinmodern-math.otf} |
| 523 |
% |
| 524 |
% |
| 525 |
% Another somewhat surprising area is the \enquote{Mathematical |
| 526 |
% Alphanumeric Symbols} block in math fonts, starting at \texttt{U+1D400}. |
| 527 |
% There you see a number of missing characters, the first two being |
| 528 |
% \texttt{U+1D455} (math italic small h) and \texttt{U+1D49D} (math |
| 529 |
% script B). |
| 530 |
% |
| 531 |
% \displayfonttable[noheader,nostatistics,hex-digits=foot, |
| 532 |
% range-start=1D400,range-end=1D4AF, |
| 533 |
% color=black!50] |
| 534 |
% {latinmodern-math.otf} |
| 535 |
% |
| 536 |
% In this case the reason is \emph{not} that the font |
| 537 |
% fails to implement the characters, but that these characters have |
| 538 |
% already been defined in earlier revisions of the Unicode standard in the |
| 539 |
% lower Unicode plane. For example, the \enquote{h} is the |
| 540 |
% Planck constant \texttt{U+210E} and \texttt{U+212C} is |
| 541 |
% the script capital B, etc. The Unicode Consortium decided not |
| 542 |
% to encode the \emph{same} character twice, hence the apparent |
| 543 |
% holes. |
| 544 |
% |
| 545 |
% |
| 546 |
% \IfImplementationShownTF{} |
| 547 |
% {\appendix |
| 548 |
% \def\theHsection{Appendix.\thesection} |
| 549 |
% \addtocontents{toc}{\smallskip} |
| 550 |
% \setlength\IndexMin{200pt} |
| 551 |
% \PrintIndex |
| 552 |
% } |
| 553 |
% |
| 554 |
% |
| 555 |
% \section{Examples} |
| 556 |
% |
| 557 |
% In this section we show the results of a few calls to |
| 558 |
% \cs{displayfonttable}. |
| 559 |
% The tables are a bit easier to navigate if they use color in some |
| 560 |
% places, but for \TUB{} this is not practical, so we |
| 561 |
% use black and gray. |
| 562 |
% |
| 563 |
% Please note that this documentation was produced with |
| 564 |
% \LuaTeX{}. If you reuse the examples with \XeTeX{}, you may have |
| 565 |
% to specify the font names differently (i.e., following to the |
| 566 |
% \pkg{fontspec} documentation for this engine). |
| 567 |
% |
| 568 |
% |
| 569 |
% |
| 570 |
% \subsection{Computer Modern Sans --- 7-bit font} |
| 571 |
% |
| 572 |
% Our first example is the original Computer Modern Sans, with |
| 573 |
% character codes $\le 127$. |
| 574 |
% |
| 575 |
% Command used: \begin{verbatim} |
| 576 |
% \displayfonttable*[color=none, range-end=7F]{cmss10} |
| 577 |
% \end{verbatim} |
| 578 |
% |
| 579 |
% \displayfonttable*[color=none, range-end=7F]{cmss10} |
| 580 |
% |
| 581 |
% |
| 582 |
% \iftrue |
| 583 |
% |
| 584 |
%\subsection{\TeX\ Gyre Heros --- 8-bit font} |
| 585 |
% |
| 586 |
% This example shows the \TeX\ Gyre Heros 8-bit font, |
| 587 |
% in the T1 encoding, with character codes $\le 255$. |
| 588 |
% We used \key{hex-digits-row-format} to shorten the row titles on |
| 589 |
% the left: |
| 590 |
%\begin{verbatim} |
| 591 |
% \displayfonttable*[color=none,hex-digits-row-format=U+#1]{ec-qhvr} |
| 592 |
%\end{verbatim} |
| 593 |
% |
| 594 |
%\displayfonttable*[color=none,hex-digits-row-format=U+#1]{ec-qhvr} |
| 595 |
% |
| 596 |
% \fi |
| 597 |
% |
| 598 |
% |
| 599 |
% \iftrue |
| 600 |
%\subsection{Latin Modern Math --- 8-bit fonts} |
| 601 |
% |
| 602 |
% The traditional Latin Modern Math Italic, Symbol and Extension fonts. |
| 603 |
% The symbol font (\texttt{lmsy10}) has two characters added to the |
| 604 |
% Computer Modern symbol repertoire, seen in the last row of the table. |
| 605 |
% Commands used: |
| 606 |
% |
| 607 |
%\begin{verbatim} |
| 608 |
% \displayfonttable*[color=none]{lmmi10} |
| 609 |
% \displayfonttable*[color=none]{lmsy10} |
| 610 |
% \displayfonttable*[color=none]{lmex10} |
| 611 |
%\end{verbatim} |
| 612 |
% |
| 613 |
%\displayfonttable*[color=none]{lmmi10} |
| 614 |
%\displayfonttable*[color=none]{lmsy10} |
| 615 |
%\displayfonttable*[color=none]{lmex10} |
| 616 |
% |
| 617 |
% \fi |
| 618 |
% |
| 619 |
% |
| 620 |
% \iffalse % 5pp |
| 621 |
% |
| 622 |
%\subsection{\TeX{} Gyre Pagella (Palatino) oldstyle figures --- OTF font} |
| 623 |
% |
| 624 |
% This example shows Pagella with oldstyle numerals. |
| 625 |
% Command used: |
| 626 |
%\begin{verbatim} |
| 627 |
%\displayfonttable{TeX Gyre Pagella}[Numbers=OldStyle] |
| 628 |
%\end{verbatim} |
| 629 |
% |
| 630 |
%\displayfonttable{TeX Gyre Pagella}[Numbers=OldStyle] |
| 631 |
% |
| 632 |
% \fi |
| 633 |
% |
| 634 |
% |
| 635 |
% ^^A \IfImplementationShownTF{}{\newpage} |
| 636 |
% |
| 637 |
% \subsection{Latin Modern Math compared to New Computer Modern Math} |
| 638 |
% |
| 639 |
% This example shows the extra symbols available in New Computer |
| 640 |
% Modern Math in comparison to Latin Modern Math as the base font. |
| 641 |
% We use the following setup (including settings for the |
| 642 |
% grayscaled \TUB\ output, as an example of color overrides): |
| 643 |
%\begin{verbatim} |
| 644 |
% \displayfonttable[hex-digits=head+foot, range-end=1FFFF, |
| 645 |
% compare-with=New Computer Modern Math, |
| 646 |
% title-format=\caption{Latin Modern Math compared to |
| 647 |
% New Computer Modern Math}, |
| 648 |
% title-format-cont=\caption{LM Math vs.\ NewCM Math, |
| 649 |
% \emph{cont.}}, |
| 650 |
% compare-color=black, compare-bgcolor=black!5, |
| 651 |
% missing-glyph-color=black!50, color=black!75] |
| 652 |
% {Latin Modern Math} |
| 653 |
%\end{verbatim} |
| 654 |
% That is, glyphs only in \texttt{NewCM} are shown with a light gray |
| 655 |
% background. |
| 656 |
% |
| 657 |
% We also extended the range to cover \texttt{U+10000} to |
| 658 |
% \texttt{U+1FFFF} in order to include the Unicode Math alphabets. |
| 659 |
% |
| 660 |
% \displayfonttable[hex-digits=head+foot, range-end=1FFFF, |
| 661 |
% compare-with=New Computer Modern Math, |
| 662 |
% title-format=\caption{Latin Modern Math compared to |
| 663 |
% New Computer Modern Math}, |
| 664 |
% title-format-cont=\caption{LM Math vs.\ NewCM Math, |
| 665 |
% \emph{cont.}}, |
| 666 |
% compare-color=black, compare-bgcolor=black!5, |
| 667 |
% missing-glyph-color=black!50, color=black!75] |
| 668 |
% {Latin Modern Math} |
| 669 |
% |
| 670 |
% |
| 671 |
%\subsection{Garamond Libre's Byzantine Musical Symbols} |
| 672 |
% |
| 673 |
% As a final example we exhibit the Byzantine Musical Symbols as provided by |
| 674 |
% Garamond Libre. |
| 675 |
% Command used: |
| 676 |
%\begin{verbatim} |
| 677 |
% \displayfonttable[range-start=1D000, range-end=1D0FF, |
| 678 |
% hex-digits=block, |
| 679 |
% missing-glyph-color=black!50, color=black!75, |
| 680 |
% statistics-format=Total number of glyphs in |
| 681 |
% this block of #1 is #2] |
| 682 |
% {Garamond Libre} |
| 683 |
%\end{verbatim} |
| 684 |
% |
| 685 |
% Note that we have altered the text produced by the statistics, |
| 686 |
% because the default is somewhat misleading if only a portion of |
| 687 |
% the font is displayed. This produces the following table: |
| 688 |
% |
| 689 |
% \displayfonttable[range-start=1D000, range-end=1D0FF, |
| 690 |
% hex-digits=foot, |
| 691 |
% missing-glyph-color=black!50, color=black!75, |
| 692 |
% statistics-format=Total number of glyphs in |
| 693 |
% this block of #1 is #2] |
| 694 |
% {Garamond Libre} |
| 695 |
% |
| 696 |
% |
| 697 |
% |
| 698 |
% \IfImplementationShownTF |
| 699 |
% {\StopEventually{\setlength\IndexMin{200pt} \PrintIndex }} |
| 700 |
% {\StopEventually{}} |
| 701 |
% |
| 702 |
% |
| 703 |
% |
| 704 |
% \section{The package implementation} |
| 705 |
% |
| 706 |
% \hfuzz=10pt ^^A lots of slightly overfull tt lines |
| 707 |
% |
| 708 |
% \begin{macrocode} |
| 709 |
%<*package> |
| 710 |
% \end{macrocode} |
| 711 |
% |
| 712 |
% By default the package uses coloring to improve the table |
| 713 |
% appearance and therefore requires a color package. |
| 714 |
% \begin{macrocode} |
| 715 |
\RequirePackage{xcolor} |
| 716 |
% \end{macrocode} |
| 717 |
% |
| 718 |
|
| 719 |
% \begin{macrocode} |
| 720 |
%<@@=fmuft> |
| 721 |
% \end{macrocode} |
| 722 |
% |
| 723 |
% We need the package \pkg{xparse} for specifying the document-level |
| 724 |
% interface commands and \pkg{l3keys2e} to use the \pkg{expl3} key |
| 725 |
% value methods within \LaTeXe{}. These packages automatically |
| 726 |
% require \pkg{expl3} so there is no need to load that explicitly. |
| 727 |
% Actually, \pkg{expl3}, \pkg{l3keys2e} and the \pkg{xparse} |
| 728 |
% functionality is now all part of the \LaTeX{} kernel so the next |
| 729 |
% line is actually not needed at all with a current \LaTeX{} kernel, but |
| 730 |
% in order to support older installations we keep it for now. |
| 731 |
% |
| 732 |
% \begin{macrocode} |
| 733 |
\RequirePackage{xparse,l3keys2e} |
| 734 |
% \end{macrocode} |
| 735 |
% |
| 736 |
% Here we introduce the package and specify its version number: |
| 737 |
% \begin{macrocode} |
| 738 |
\ProvidesExplPackage{unicodefonttable} |
| 739 |
{\unicodefonttabledate} |
| 740 |
{\unicodefonttableversion} |
| 741 |
{Producing font tables for Unicode and other fonts} |
| 742 |
% \end{macrocode} |
| 743 |
% |
| 744 |
% |
| 745 |
% \newcommand\hex[1]{$\langle\textit{hex}_{#1}\rangle$} |
| 746 |
% |
| 747 |
% |
| 748 |
% |
| 749 |
% |
| 750 |
% |
| 751 |
% \subsection{User interface commands} |
| 752 |
% |
| 753 |
% |
| 754 |
% Throughout the implementation we will define a number of keys (and |
| 755 |
% their allowed values). We introduce them at the point where they are |
| 756 |
% used, so they are sprinkled throughout the code.\footnote{This fits |
| 757 |
% with the way this package was developed. I first implemented a |
| 758 |
% single rigid table layout without configuration possibilities and |
| 759 |
% then thought about which parts I wanted to have flexible. I then |
| 760 |
% replaced the rigid code with code that is affected by setting |
| 761 |
% key/value pairs.} |
| 762 |
|
| 763 |
% \begin{macro}{\fonttablesetup} |
| 764 |
% To set up user defaults for the keys we provide a standard |
| 765 |
% interface. The command \cs{unicodefonttabletablesetup} expects a |
| 766 |
% key/value list and can be called as often as necessary. |
| 767 |
% \begin{macrocode} |
| 768 |
\NewDocumentCommand \fonttablesetup { m } |
| 769 |
{ \keys_set:nn {@@} {#1} \ignorespaces } |
| 770 |
% \end{macrocode} |
| 771 |
% \end{macro} |
| 772 |
% |
| 773 |
% |
| 774 |
% |
| 775 |
% \begin{macro}{\displayfonttable} |
| 776 |
% The document-level command for generating a font table. |
| 777 |
% \begin{macrocode} |
| 778 |
\NewDocumentCommand\displayfonttable {s O{} m o}{% |
| 779 |
\IfBooleanTF #1 |
| 780 |
{ |
| 781 |
% \end{macrocode} |
| 782 |
% For the starred form we preset a number of keys with values |
| 783 |
% suitable when displaying 8-bit legacy fonts. |
| 784 |
% With such fonts Unicode block headers make little |
| 785 |
% sense (as the fonts do not conform to the Unicode layout and |
| 786 |
% since they have at most 265 glyphs). It is therefore also unnecessary to |
| 787 |
% loop over the whole Unicode range of the first plane. |
| 788 |
% If necessary all of them can still be overwritten in the optional |
| 789 |
% argument. |
| 790 |
% |
| 791 |
% Some font names contain special character, e.g., \verb=_= or |
| 792 |
% \verb=&=. We therefore turn the font name into a string before |
| 793 |
% passing it on but we allow for the possibility that the font name |
| 794 |
% was given in a macro, so we do this with \cs{tl_to_str:o} (tough |
| 795 |
% if the font name starts out with a special character then |
| 796 |
% you have to use \cs{string} or something to prevent the special |
| 797 |
% character from causing issues). |
| 798 |
% \changes{v1.0k}{2025/07/11}{Allow special chars in font names but |
| 799 |
% not as the first character (gh/12)} |
| 800 |
% \begin{macrocode} |
| 801 |
\exp_args:Nne |
| 802 |
\@@_display_fonttable:nnn |
| 803 |
{nostatistics,display-block=none,hex-digits=head,range-end=FF,#2} |
| 804 |
{ \tl_to_str:o {#3} } {#4} |
| 805 |
} |
| 806 |
{ |
| 807 |
\exp_args:Nne |
| 808 |
\@@_display_fonttable:nnn {#2}{ \tl_to_str:o {#3} }{#4} |
| 809 |
} |
| 810 |
} |
| 811 |
% \end{macrocode} |
| 812 |
% \end{macro} |
| 813 |
% |
| 814 |
% |
| 815 |
% \begin{macro}{\@@_display_fonttable:nnn} |
| 816 |
% This command is the main workhorse of the |
| 817 |
% package. It produces a \texttt{longtable} containing all font |
| 818 |
% glyphs with 16 glyphs per row. The first optional argument is |
| 819 |
% used to configure the table through key/value pairs, the |
| 820 |
% mandatory argument is the font name to display (in |
| 821 |
% \texttt{fontspec} conventions) and the final optional argument is |
| 822 |
% the font feature list if any. If the latter is not provided it |
| 823 |
% will get a special value (\texttt{--NoValue--}) assigned by |
| 824 |
% \texttt{xparse}, which is something that can be tested for. |
| 825 |
% \begin{macrocode} |
| 826 |
\cs_new:Npn \@@_display_fonttable:nnn #1#2#3 { |
| 827 |
\group_begin: |
| 828 |
% \end{macrocode} |
| 829 |
% First initialize the font that should be displayed (perhaps with a |
| 830 |
% feature list) and then update the key/value list using \verb=#1=. |
| 831 |
% \begin{macrocode} |
| 832 |
\fontspec{#2}[#3] |
| 833 |
\keys_set:nn{@@}{#1} |
| 834 |
% \end{macrocode} |
| 835 |
% If the \LuaTeX{} engine is used without HarfBuzz and the display |
| 836 |
% range includes code points above \texttt{U+EFFFF} the output shows |
| 837 |
% remappings and not what is in the font, so we issue a warning. |
| 838 |
% \changes{v1.0g}{2022/11/12}{Test for luatex without harfbuzz and |
| 839 |
% private area A and warn (gh/8)} |
| 840 |
% \begin{macrocode} |
| 841 |
\bool_lazy_and:nnT |
| 842 |
{ \sys_if_engine_luatex_p: } |
| 843 |
{ \int_compare_p:nNn { "EFFFF } < { "\l_@@_range_end_tl } } |
| 844 |
{ |
| 845 |
\directlua{token.put_next(token.create(font.getfont(font.current()).hb~ |
| 846 |
and~ 'use_none:n'~ or~ 'use:n'))} |
| 847 |
{ \msg_warning:nn {unicodefonttable}{noharfbuzz} } |
| 848 |
} |
| 849 |
% \end{macrocode} |
| 850 |
% If the user has asked for a comparsion to some other font we need to set this up: |
| 851 |
% \begin{macrocode} |
| 852 |
\tl_if_empty:NTF \l_@@_compare_with_tl |
| 853 |
{ \tl_clear:N \l_@@_compare_font_tl } |
| 854 |
{ |
| 855 |
\setfontface \l_@@_compare_font_tl {\l_@@_compare_with_tl}[] |
| 856 |
\cs_set_eq:NN \@@_handle_missing_glyph:n |
| 857 |
\@@_handle_missing_glyph_compare:n |
| 858 |
} |
| 859 |
% \end{macrocode} |
| 860 |
% Typesetting the font tables in twocolumn mode makes little sense |
| 861 |
% due to their width, and if \env{longtable} is used it will |
| 862 |
% complain. However there is one case where it should work: in a |
| 863 |
% page-wide float. To make this happen we claim that we are not in |
| 864 |
% twocolumn mode if the display is inside a vertical box. |
| 865 |
% \changes{v1.0g}{2022/11/12}{Support use in twocolumn mode if inside |
| 866 |
% a table* float (gh/7)} |
| 867 |
% \begin{macrocode} |
| 868 |
\if_mode_vertical: \if_mode_inner: \@twocolumnfalse \fi: \fi: |
| 869 |
% \end{macrocode} |
| 870 |
% Then we start the table with 17 columns. We use \texttt{longtable} |
| 871 |
% if we produce a caption and \texttt{longtable*} if not (so that |
| 872 |
% the table number is not increased, which would look odd if you |
| 873 |
% have other tables in your document). |
| 874 |
% \begin{macrocode} |
| 875 |
\begin{longtable\bool_if:NF\l_@@_display_header_bool{*}} |
| 876 |
{@{}r@{\quad}*{16}{c}@{}} |
| 877 |
% \end{macrocode} |
| 878 |
% Special headers and footers are set up first: |
| 879 |
% \begin{macrocode} |
| 880 |
\@@_setup_header_footer:nn{#2}{#3} |
| 881 |
% \end{macrocode} |
| 882 |
% Then we produce all table rows with the glyphs. |
| 883 |
% \begin{macrocode} |
| 884 |
\@@_produce_table_rows: |
| 885 |
% \end{macrocode} |
| 886 |
% At the very end we may typeset some statistics. This can't be |
| 887 |
% done in the table footer, because the data is dynamic (e.g., |
| 888 |
% number of glyphs processed) and the table footers are static and |
| 889 |
% do not change based on the table content. |
| 890 |
% \begin{macrocode} |
| 891 |
\@@_handle_table_ending:n {#2} |
| 892 |
\end{longtable\bool_if:NF\l_@@_display_header_bool{*}} |
| 893 |
\group_end: |
| 894 |
} |
| 895 |
% \end{macrocode} |
| 896 |
% \end{macro} |
| 897 |
% |
| 898 |
% |
| 899 |
% \begin{macrocode} |
| 900 |
\msg_new:nnn {unicodefonttable}{noharfbuzz} |
| 901 |
{ You~ asked~ for~ displaying~ glyphs~ with~ code \iow_newline: |
| 902 |
points~ above~ U+EFFFF~ \msg_line_context: ,~ i.e.,~ from~ the~ |
| 903 |
'Supplementary~ Private~ Use~ Area-A'\iow_newline: |
| 904 |
without~ specifying~ '[Renderer=Harfbuzz]'~ when~ |
| 905 |
loading~ the~ font. |
| 906 |
\iow_newline:\iow_newline: |
| 907 |
With~ LuaLaTeX,~ this~ Unicode~ region~ is~ used~ |
| 908 |
for~ remappings~ (if~ the~ HarfBuzz~ engine~ is~ not~ used).~ |
| 909 |
Thus,~ the~ results~ shown~ do~ not~ reflect~ what~ |
| 910 |
is~ in~ the~ font! |
| 911 |
} |
| 912 |
% \end{macrocode} |
| 913 |
% |
| 914 |
% |
| 915 |
% |
| 916 |
% \begin{macro}{\fonttableglyphcount} |
| 917 |
% \begin{macro}{\g_@@_glyph_int,\g_@@_glyph_only_B_int,\g_@@_glyph_also_B_int} |
| 918 |
% While generating the font table we count the number of glyphs we |
| 919 |
% see (and typeset). The total is available in the command |
| 920 |
% \cs{fonttableglyphcount} after the table got finished and will be reset to |
| 921 |
% zero when the next table starts. |
| 922 |
% \begin{macrocode} |
| 923 |
\DeclareDocumentCommand \fonttableglyphcount {} |
| 924 |
{ \int_use:N \g_@@_glyph_int } |
| 925 |
% \end{macrocode} |
| 926 |
% |
| 927 |
% \begin{macrocode} |
| 928 |
\int_new:N \g_@@_glyph_int |
| 929 |
% \end{macrocode} |
| 930 |
% When comparing fonts we also record data for the second font: the |
| 931 |
% number of glyphs in both and the number of glyphs only in the |
| 932 |
% second one. |
| 933 |
% \begin{macrocode} |
| 934 |
\int_new:N \g_@@_glyph_only_B_int |
| 935 |
\int_new:N \g_@@_glyph_also_B_int |
| 936 |
% \end{macrocode} |
| 937 |
% \end{macro} |
| 938 |
% \end{macro} |
| 939 |
|
| 940 |
|
| 941 |
|
| 942 |
|
| 943 |
% \subsection{The overall table layout} |
| 944 |
% |
| 945 |
% |
| 946 |
% \begin{macro}{\@@_setup_header_footer:nn} |
| 947 |
% Setting up header and footer lines of the table. |
| 948 |
% This macro receives the \textit{font name} and the \textit{font |
| 949 |
% features} specified by the user as its arguments. |
| 950 |
% \begin{macrocode} |
| 951 |
\cs_new:Npn \@@_setup_header_footer:nn #1#2{ |
| 952 |
% \end{macrocode} |
| 953 |
% On the first page of the table the header may show a caption or |
| 954 |
% some other sort of title based on the value of |
| 955 |
% \cs{l_@@_display_header_bool}. The formatting is handled by |
| 956 |
% \cs{@@_format_table_title:nn} which can be customized through the |
| 957 |
% key \key{title-format}. |
| 958 |
% \begin{macrocode} |
| 959 |
\bool_if:NT \l_@@_display_header_bool |
| 960 |
{ \@@_format_table_title:nn{#1}{#2} \@@_debug_nl:n{T}\\*[6pt] } |
| 961 |
% \end{macrocode} |
| 962 |
% We may also want to display a line of hex digits. This is |
| 963 |
% controlled through the key \key{hex-digits} that accepts different |
| 964 |
% values: \kval{head}, \kval{foot}, \kval{head+foo}, \kval{block} |
| 965 |
% (after a block title) or \kval{none}. |
| 966 |
% \begin{macrocode} |
| 967 |
\bool_if:NT \l_@@_header_hex_digits_bool |
| 968 |
{ \@@_display_row_of_hex_digits: \@@_debug_nl:n{H}\\* } |
| 969 |
\endfirsthead |
| 970 |
% \end{macrocode} |
| 971 |
% Headers for later table pages have a continuation title and |
| 972 |
% maybe a row of hex digits. |
| 973 |
% \begin{macrocode} |
| 974 |
\bool_if:NT \l_@@_display_header_bool |
| 975 |
{ \@@_format_table_cont:nn{#1}{#2} \@@_debug_nl:n{T}\\*[6pt] } |
| 976 |
\bool_if:NT \l_@@_header_hex_digits_bool |
| 977 |
{ \@@_display_row_of_hex_digits: \@@_debug_nl:n{H}\\* } |
| 978 |
\endhead |
| 979 |
% \end{macrocode} |
| 980 |
% Footers of the table are either empty or show a row of hex digits. |
| 981 |
% \begin{macrocode} |
| 982 |
\bool_if:NT \l_@@_footer_hex_digits_bool |
| 983 |
{ \@@_display_row_of_hex_digits: \@@_debug_nl:n{H}\\* } |
| 984 |
\endfoot |
| 985 |
% \end{macrocode} |
| 986 |
% The footer of the last page of the table will always be |
| 987 |
% empty. Any special row, such as a row of hex digits, will be |
| 988 |
% provided in the table body. The reason is that we may want to |
| 989 |
% display statistics at the very end of the table and those can't be |
| 990 |
% placed into a static footer. |
| 991 |
% \begin{macrocode} |
| 992 |
\endlastfoot |
| 993 |
} |
| 994 |
% \end{macrocode} |
| 995 |
% \end{macro} |
| 996 |
% |
| 997 |
% \begin{macro}{\l_@@_header_hex_digits_bool} |
| 998 |
% \begin{macro}{\l_@@_footer_hex_digits_bool} |
| 999 |
% \begin{macro}{\l_@@_blockwise_hex_digits_bool} |
| 1000 |
% Here are the booleans we use in the code. |
| 1001 |
% \begin{macrocode} |
| 1002 |
\bool_new:N \l_@@_header_hex_digits_bool |
| 1003 |
\bool_new:N \l_@@_footer_hex_digits_bool |
| 1004 |
\bool_new:N \l_@@_blockwise_hex_digits_bool |
| 1005 |
% \end{macrocode} |
| 1006 |
% \end{macro} |
| 1007 |
% \end{macro} |
| 1008 |
% \end{macro} |
| 1009 |
% |
| 1010 |
% |
| 1011 |
% \begin{macro}{\@@_display_row_of_hex_digits:} |
| 1012 |
% \begin{macro}{\@@_format_hex_digit:n} |
| 1013 |
% Producing a row of hex digits is simple. |
| 1014 |
% \begin{macrocode} |
| 1015 |
\cs_new:Npn \@@_display_row_of_hex_digits: { |
| 1016 |
& \@@_format_hex_digit:n{0} & \@@_format_hex_digit:n{1} |
| 1017 |
& \@@_format_hex_digit:n{2} & \@@_format_hex_digit:n{3} |
| 1018 |
& \@@_format_hex_digit:n{4} & \@@_format_hex_digit:n{5} |
| 1019 |
& \@@_format_hex_digit:n{6} & \@@_format_hex_digit:n{7} |
| 1020 |
& \@@_format_hex_digit:n{8} & \@@_format_hex_digit:n{9} |
| 1021 |
& \@@_format_hex_digit:n{A} & \@@_format_hex_digit:n{B} |
| 1022 |
& \@@_format_hex_digit:n{C} & \@@_format_hex_digit:n{D} |
| 1023 |
& \@@_format_hex_digit:n{E} & \@@_format_hex_digit:n{F} } |
| 1024 |
% \end{macrocode} |
| 1025 |
% Each digit is typeset in typewriter and in script size. We offer |
| 1026 |
% font and color |
| 1027 |
% customizations. Note that it is important to set an explicit |
| 1028 |
% family. Otherwise the hex digits are formatted using the current |
| 1029 |
% table font (which may or may not work at all). |
| 1030 |
% \begin{macrocode} |
| 1031 |
\cs_new:Npn \@@_format_hex_digit:n #1 { |
| 1032 |
\l_@@_hex_digits_font_tl \l_@@_color_tl #1 } |
| 1033 |
% \end{macrocode} |
| 1034 |
% \end{macro} |
| 1035 |
% \end{macro} |
| 1036 |
% |
| 1037 |
|
| 1038 |
% \begin{macro}{\l_@@_color_tl} |
| 1039 |
% The token list to hold definition if set up. |
| 1040 |
% \begin{macrocode} |
| 1041 |
\tl_new:N \l_@@_color_tl |
| 1042 |
% \end{macrocode} |
| 1043 |
% \end{macro} |
| 1044 |
% |
| 1045 |
% |
| 1046 |
% \keysetup{overall table} |
| 1047 |
% Here are the definitions for the keys used in the code above: |
| 1048 |
% \begin{macrocode} |
| 1049 |
\keys_define:nn {@@} { |
| 1050 |
% \end{macrocode} |
| 1051 |
% The \key{header} key is a boolean that determines if a header |
| 1052 |
% title should be produced (default) |
| 1053 |
% \begin{macrocode} |
| 1054 |
,header .bool_set:N = \l_@@_display_header_bool |
| 1055 |
,header .default:n = true |
| 1056 |
,header .initial:n = true |
| 1057 |
% \end{macrocode} |
| 1058 |
% To ease the setup we also support the key \key{noheader} which is |
| 1059 |
% a short form for \texttt{header=false}. |
| 1060 |
% \begin{macrocode} |
| 1061 |
,noheader .bool_set_inverse:N = \l_@@_display_header_bool |
| 1062 |
,noheader .default:n = true |
| 1063 |
% \end{macrocode} |
| 1064 |
% The default for the \key{title-format} key is to produce a |
| 1065 |
% \cs{caption} listing the font name and any features (if |
| 1066 |
% given). Note the \cs{IfValueTF} command (provided by |
| 1067 |
% \texttt{xparse}) that checks if the second argument got any value |
| 1068 |
% or has the special \texttt{--NoValue--} value. |
| 1069 |
% \begin{macrocode} |
| 1070 |
,title-format .cs_set:Np = \@@_format_table_title:nn #1#2 |
| 1071 |
,title-format .initial:n = |
| 1072 |
\IfValueTF{#2} { \caption{ #1~ (features:~ \texttt{\small#2}) } } |
| 1073 |
{ \caption{ #1 } } |
| 1074 |
% \end{macrocode} |
| 1075 |
% The default continuation title ignores the given features, so the |
| 1076 |
% formatting is somewhat simpler. It uses \verb=\caption[]{...}= to |
| 1077 |
% make a caption that doesn't alter the table number. |
| 1078 |
% \changes{v1.0f}{2021/10/29}{Make documentation and code match: |
| 1079 |
% it should be \texttt{title-format-cont}} |
| 1080 |
% \begin{macrocode} |
| 1081 |
,title-format-cont .cs_set:Np = \@@_format_table_cont:nn #1#2 |
| 1082 |
,title-format-cont .initial:n = \caption[]{#1~ \emph{cont.}} |
| 1083 |
% \end{macrocode} |
| 1084 |
% The key \key{hex-digits} is implemented as a choice, where each |
| 1085 |
% allowed value sets different booleans that are then used in the code. |
| 1086 |
% \begin{macrocode} |
| 1087 |
,hex-digits .choice: |
| 1088 |
,hex-digits / block .code:n = |
| 1089 |
\bool_set_true:N \l_@@_blockwise_hex_digits_bool |
| 1090 |
\bool_set_false:N \l_@@_header_hex_digits_bool |
| 1091 |
\bool_set_false:N \l_@@_footer_hex_digits_bool |
| 1092 |
,hex-digits / foot .code:n = |
| 1093 |
\bool_set_true:N \l_@@_footer_hex_digits_bool |
| 1094 |
\bool_set_false:N \l_@@_header_hex_digits_bool |
| 1095 |
\bool_set_false:N \l_@@_blockwise_hex_digits_bool |
| 1096 |
,hex-digits / head .code:n = |
| 1097 |
\bool_set_true:N \l_@@_header_hex_digits_bool |
| 1098 |
\bool_set_false:N \l_@@_footer_hex_digits_bool |
| 1099 |
\bool_set_false:N \l_@@_blockwise_hex_digits_bool |
| 1100 |
,hex-digits / head+foot .code:n = |
| 1101 |
\bool_set_true:N \l_@@_header_hex_digits_bool |
| 1102 |
\bool_set_true:N \l_@@_footer_hex_digits_bool |
| 1103 |
\bool_set_false:N \l_@@_blockwise_hex_digits_bool |
| 1104 |
,hex-digits / none .code:n = |
| 1105 |
\bool_set_false:N \l_@@_header_hex_digits_bool |
| 1106 |
\bool_set_false:N \l_@@_footer_hex_digits_bool |
| 1107 |
\bool_set_false:N \l_@@_blockwise_hex_digits_bool |
| 1108 |
,hex-digits .initial:n = head |
| 1109 |
% \end{macrocode} |
| 1110 |
% The font for hex digits are set with \key{hex-digits-font}. |
| 1111 |
% \begin{macrocode} |
| 1112 |
,hex-digits-font .tl_set:N = \l_@@_hex_digits_font_tl |
| 1113 |
,hex-digits-font .initial:n = \ttfamily \scriptsize |
| 1114 |
% \end{macrocode} |
| 1115 |
% Customizing the row header (on the left) can be done with this |
| 1116 |
% key. Defaults for font, fontsize, and color is set on the outside, but can, of |
| 1117 |
% course, be overwritten inside if that is desired. |
| 1118 |
% \changes{v1.0g}{2022/11/12}{Add key hex-digits-row-format to allow |
| 1119 |
% customizing the row title on the left (gh/3)} |
| 1120 |
% \begin{macrocode} |
| 1121 |
,hex-digits-row-format .cs_set:Np = \@@_format_row_hex_digits:n #1 |
| 1122 |
,hex-digits-row-format .initial:n = U+#1 0 \, - \, #1 F |
| 1123 |
% \end{macrocode} |
| 1124 |
% The \key{color} key is used in most places that get colored; some |
| 1125 |
% have their own key but default to the main color. |
| 1126 |
% \begin{macrocode} |
| 1127 |
,color .choice: |
| 1128 |
,color / none .code:n = \tl_clear:N \l_@@_color_tl |
| 1129 |
,color / unknown .code:n = \tl_set:Nn \l_@@_color_tl { \color {#1} } |
| 1130 |
,color .initial:n = blue |
| 1131 |
} |
| 1132 |
% \end{macrocode} |
| 1133 |
% |
| 1134 |
% |
| 1135 |
% |
| 1136 |
% |
| 1137 |
% \begin{macro}{\@@_handle_table_ending:n} |
| 1138 |
% At the end of the table we may want to display a final row of |
| 1139 |
% hex digits and perhaps some statistics, i.e., the number of |
| 1140 |
% typeset glyphs. |
| 1141 |
% \begin{macrocode} |
| 1142 |
\cs_new:Npn \@@_handle_table_ending:n #1 { |
| 1143 |
% \end{macrocode} |
| 1144 |
% |
| 1145 |
% \begin{macrocode} |
| 1146 |
\@@_debug_nl:n{H} \\* |
| 1147 |
\bool_if:NT \l_@@_footer_hex_digits_bool |
| 1148 |
{ \@@_display_row_of_hex_digits: \@@_debug_nl:n{H} \\* } |
| 1149 |
\bool_if:NT \l_@@_display_statistics_bool |
| 1150 |
{ \\*[2pt] |
| 1151 |
\multicolumn{17}{l}{ \l_@@_stats_font_tl |
| 1152 |
% \end{macrocode} |
| 1153 |
% If we do font comparison, we use a different command for |
| 1154 |
% displaying statistics and pass more data to it. |
| 1155 |
% \begin{macrocode} |
| 1156 |
\tl_if_empty:NTF \l_@@_compare_with_tl |
| 1157 |
{ |
| 1158 |
\@@_format_stats:nn{#1}{\fonttableglyphcount} |
| 1159 |
} |
| 1160 |
{ |
| 1161 |
\@@_format_compare_stats:nnnnnn{#1}{\fonttableglyphcount} |
| 1162 |
{ \l_@@_compare_with_tl } |
| 1163 |
% \end{macrocode} |
| 1164 |
% The extra arguments are total glyph number in second font, glyphs |
| 1165 |
% missing in second font and glyphs only in second font. |
| 1166 |
% \begin{macrocode} |
| 1167 |
{ \int_eval:n { \int_use:N\g_@@_glyph_also_B_int + |
| 1168 |
\int_use:N\g_@@_glyph_only_B_int } |
| 1169 |
} |
| 1170 |
{ \int_eval:n { \fonttableglyphcount - |
| 1171 |
\int_use:N\g_@@_glyph_also_B_int } |
| 1172 |
} |
| 1173 |
{ \int_use:N\g_@@_glyph_only_B_int } |
| 1174 |
} |
| 1175 |
% \end{macrocode} |
| 1176 |
% We don't know exactly how wide the table is (and nor does the |
| 1177 |
% user) but one may need to use \cs{parbox} when formatting |
| 1178 |
% the statistic line(s). So we back up a bit (rather random) which |
| 1179 |
% allows us to use \verb=\parbox{\linewidth}{...= in the key |
| 1180 |
% without thinking too much about it. |
| 1181 |
% \begin{macrocode} |
| 1182 |
\hspace*{-3cm} |
| 1183 |
} |
| 1184 |
} |
| 1185 |
} |
| 1186 |
% \end{macrocode} |
| 1187 |
% |
| 1188 |
% \keysetup{for statistics} |
| 1189 |
% Here are the keys used above. By default we produce statistics. |
| 1190 |
% \begin{macrocode} |
| 1191 |
\keys_define:nn {@@} { |
| 1192 |
,statistics .bool_set:N = \l_@@_display_statistics_bool |
| 1193 |
,statistics .default:n = true |
| 1194 |
,statistics .initial:n = true |
| 1195 |
% \end{macrocode} |
| 1196 |
% the key \key{nostatistics} is just short for \texttt{statistics=false}: |
| 1197 |
% \begin{macrocode} |
| 1198 |
,nostatistics .bool_set_inverse:N = \l_@@_display_statistics_bool |
| 1199 |
,nostatistics .default:n = true |
| 1200 |
% \end{macrocode} |
| 1201 |
% The default font we use is \cs{normalfont}. Again we need to |
| 1202 |
% supply a family to avoid getting the font used in the table body. |
| 1203 |
% \begin{macrocode} |
| 1204 |
,statistics-font .tl_set:N = \l_@@_stats_font_tl |
| 1205 |
,statistics-font .initial:n = \normalfont\small |
| 1206 |
% \end{macrocode} |
| 1207 |
% And here we have the default text. There is only space for a |
| 1208 |
% single line. If more text is needed one needs to provide some |
| 1209 |
% explicit \cs{parbox}. |
| 1210 |
% \changes{v1.0g}{2022/11/12}{Change default text so that it makes |
| 1211 |
% more sense if only a portion of the font is displayed (gh/4)} |
| 1212 |
% \begin{macrocode} |
| 1213 |
,statistics-format .cs_set:Np = \@@_format_stats:nn #1#2 |
| 1214 |
,statistics-format .initial:n = Total~ number~ of~ glyphs~ shown~ from~ #1:~#2 |
| 1215 |
} |
| 1216 |
% \end{macrocode} |
| 1217 |
% \end{macro} |
| 1218 |
% |
| 1219 |
% |
| 1220 |
% |
| 1221 |
% |
| 1222 |
% |
| 1223 |
% \begin{macro}{\@@_debug_nl:n} |
| 1224 |
% While developing the code I had a bit of trouble getting the line |
| 1225 |
% endings correct, so I added a little macro that made them visible |
| 1226 |
% (displaying its argument in the table margin when the key |
| 1227 |
% \key{debug} is used. By default it does nothing. |
| 1228 |
% \begin{macrocode} |
| 1229 |
\cs_new:Npn \@@_debug_nl:n #1 {} |
| 1230 |
% \end{macrocode} |
| 1231 |
% |
| 1232 |
% \keysetup{debugging} |
| 1233 |
% This key is really internal and is therefore not documented above |
| 1234 |
% (and its behavior may changes over time). |
| 1235 |
% \begin{macrocode} |
| 1236 |
\keys_define:nn {@@} { |
| 1237 |
debug .code:n = \cs_set:Npn \@@_debug_nl:n ##1 |
| 1238 |
{\rlap{\normalfont\scriptsize \qquad ##1}} } |
| 1239 |
% \end{macrocode} |
| 1240 |
% \end{macro} |
| 1241 |
% |
| 1242 |
% |
| 1243 |
% |
| 1244 |
% |
| 1245 |
% |
| 1246 |
% |
| 1247 |
% |
| 1248 |
% \subsection{The producing the table content} |
| 1249 |
% |
| 1250 |
% |
| 1251 |
% The body of the table consists of rows with sixteen glyphs each |
| 1252 |
% and to produce it we loop through all possible Unicode points |
| 1253 |
% starting at \texttt{U+0000} and ending with \texttt{U+FFFF}. |
| 1254 |
% |
| 1255 |
% This is implemented with a four-level nested loop that runs through the |
| 1256 |
% values \texttt{0}, \texttt{1}, \ldots, \texttt{F} with the |
| 1257 |
% current hex value in each of the four positions stored in some variable. |
| 1258 |
|
| 1259 |
|
| 1260 |
% \begin{macro}{\g_@@_hex_H_tl,\g_@@_hex_A_tl, |
| 1261 |
% \g_@@_hex_B_tl,\g_@@_hex_C_tl} |
| 1262 |
% \cs{g_@@_hex_H_tl} is a bit special because, it is initially not |
| 1263 |
% zero, but empty, so that slots in the lower plane are denoted by 4 |
| 1264 |
% hex digits. |
| 1265 |
% We really only need three further variables, as the value in the |
| 1266 |
% innermost loop can used directly. |
| 1267 |
% \begin{macrocode} |
| 1268 |
\tl_new:N \g_@@_hex_H_tl % higher plane |
| 1269 |
\tl_new:N \g_@@_hex_A_tl |
| 1270 |
\tl_new:N \g_@@_hex_B_tl |
| 1271 |
\tl_new:N \g_@@_hex_C_tl |
| 1272 |
% \end{macrocode} |
| 1273 |
% \end{macro} |
| 1274 |
% |
| 1275 |
% |
| 1276 |
% \begin{macro}{\c_@@_hex_digits_clist} |
| 1277 |
% Here is the sequence we loop through on each level, except the |
| 1278 |
% one for the outer level. |
| 1279 |
% \begin{macrocode} |
| 1280 |
\clist_const:Nn\c_@@_hex_digits_clist{0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F} |
| 1281 |
% \end{macrocode} |
| 1282 |
% \end{macro} |
| 1283 |
% |
| 1284 |
% |
| 1285 |
% |
| 1286 |
% \begin{macro}{\@@_produce_table_rows:,\@@_handle_hex_H:n, |
| 1287 |
% \@@_handle_hex_A:n,\@@_handle_hex_B:n, |
| 1288 |
% \@@_handle_hex_C:n,\@@_handle_hex_D:n} |
| 1289 |
% The overall code layout is then fairly simply: |
| 1290 |
% \begin{macrocode} |
| 1291 |
\cs_new:Npn \@@_produce_table_rows: { |
| 1292 |
% \end{macrocode} |
| 1293 |
% First to some general initialization |
| 1294 |
% \begin{macrocode} |
| 1295 |
\@@_initialize_table_rows: |
| 1296 |
% \end{macrocode} |
| 1297 |
% and then loop we start the loop. The outer level is a bit special |
| 1298 |
% as currently Unicode has only slots allocated in plane 0, 1, 2 |
| 1299 |
% and E (well, and F, but that is a private area) so we loop only |
| 1300 |
% over those and instead of \texttt{0} we use an empty value. |
| 1301 |
% Not covered is the whole of plane 16 which too is now a |
| 1302 |
% private area. |
| 1303 |
% |
| 1304 |
% \begin{macrocode} |
| 1305 |
\clist_map_function:nN { { } , 1, 2, E, F } \@@_handle_hex_H:n } |
| 1306 |
% \end{macrocode} |
| 1307 |
% |
| 1308 |
% Most fonts do not have glyphs in the higher planes, which is why |
| 1309 |
% by default we don't loop using a nonempty \cs{@@_handle_hex_H:n}. |
| 1310 |
% But if the user wants to scan and display the higher slots they |
| 1311 |
% can by setting \key{range-end} appropriatly. |
| 1312 |
% |
| 1313 |
% So after setting \cs{@@_handle_hex_H:n} we loop over |
| 1314 |
% \cs{c_@@_hex_digits_clist} for the next |
| 1315 |
% hex digit (which we call \enquote{A}). |
| 1316 |
% \begin{macrocode} |
| 1317 |
\cs_new:Npn \@@_handle_hex_H:n #1 { \tl_gset:Nn\g_@@_hex_H_tl{#1} |
| 1318 |
\clist_map_function:NN \c_@@_hex_digits_clist \@@_handle_hex_A:n } |
| 1319 |
% \end{macrocode} |
| 1320 |
% |
| 1321 |
% Handling \enquote{A} means storing its value for later use and |
| 1322 |
% then start a loop for setting the second (or third on higher planes) hex digits: |
| 1323 |
% \begin{macrocode} |
| 1324 |
\cs_new:Npn \@@_handle_hex_A:n #1 { \tl_gset:Nn\g_@@_hex_A_tl{#1} |
| 1325 |
\clist_map_function:NN \c_@@_hex_digits_clist \@@_handle_hex_B:n } |
| 1326 |
% \end{macrocode} |
| 1327 |
% |
| 1328 |
% Same game for \enquote{B} and \enquote{C}\footnote{Actually this |
| 1329 |
% is a white lie. In reality we do a lot of extra stuff when |
| 1330 |
% handling \enquote{C} so later one we give a second definition for |
| 1331 |
% \cs{@@_handle_hex_C:n} but for understanding the overall picture |
| 1332 |
% the simpler one shown here is better.}: |
| 1333 |
% \begin{macrocode} |
| 1334 |
\cs_new:Npn \@@_handle_hex_B:n #1 { \tl_gset:Nn\g_@@_hex_B_tl{#1} |
| 1335 |
\clist_map_function:NN \c_@@_hex_digits_clist \@@_handle_hex_C:n } |
| 1336 |
% \end{macrocode} |
| 1337 |
% |
| 1338 |
% \begin{macrocode} |
| 1339 |
\cs_new:Npn \@@_handle_hex_C:n #1 { \tl_gset:Nn\g_@@_hex_C_tl{#1} |
| 1340 |
\clist_map_function:NN \c_@@_hex_digits_clist \@@_handle_hex_D:n } |
| 1341 |
% \end{macrocode} |
| 1342 |
% In the innermost loop we now have the full Unicode number |
| 1343 |
% available, so there we have to decide what to do with it. This is |
| 1344 |
% done by \cs{@@_handle_hex_D:n} that receives the full number, |
| 1345 |
% e.g., \texttt{1A7C} or \texttt{1AD00}, as its argument. |
| 1346 |
% \begin{macrocode} |
| 1347 |
\cs_new:Npn \@@_handle_hex_D:n #1 { |
| 1348 |
\@@_handle_slot:x |
| 1349 |
{ " \g_@@_hex_H_tl \g_@@_hex_A_tl |
| 1350 |
\g_@@_hex_B_tl \g_@@_hex_C_tl #1 } |
| 1351 |
} |
| 1352 |
% \end{macrocode} |
| 1353 |
% \end{macro} |
| 1354 |
% |
| 1355 |
% \begin{macro}{\g_@@_row_tl} |
| 1356 |
% We first collect the glyphs for a whole row before deciding to |
| 1357 |
% typeset it, because if the row is entirely empty we want to omit |
| 1358 |
% it. The data for the row is collected slot by slot and the typesetting |
| 1359 |
% information (the glyph or the indication for a missing glyph is |
| 1360 |
% appended to \cs{g_@@_row_tl}. |
| 1361 |
% \begin{macrocode} |
| 1362 |
\tl_new:N \g_@@_row_tl |
| 1363 |
% \end{macrocode} |
| 1364 |
% \end{macro} |
| 1365 |
|
| 1366 |
|
| 1367 |
% \begin{macro}{\@@_handle_slot:n,\@@_handle_slot:x} |
| 1368 |
% If the current slot number under inspection contains a glyph in |
| 1369 |
% our font we want to typeset it. But we don't do this immediately, |
| 1370 |
% instead we build up the whole row and typeset it later. We |
| 1371 |
% therefore append a \verb=&= and the glyph (including the necessary |
| 1372 |
% formatting) to the token list \cs{g_@@_row_tl}. |
| 1373 |
% \begin{macrocode} |
| 1374 |
\cs_new:Npn \@@_handle_slot:n #1 { |
| 1375 |
\@@_if_uchar_exists:nTF { #1 } |
| 1376 |
{ \tl_gput_right:Nn \g_@@_row_tl |
| 1377 |
{ & \@@_format_glyph:n { \symbol{#1} } } |
| 1378 |
% \end{macrocode} |
| 1379 |
% We then increment the overall glyph count and record that we have |
| 1380 |
% seen at least one glyph in the current row. There is not much |
| 1381 |
% point in displaying rows that are completely empty; indeed, |
| 1382 |
% we'd end up with extremely large tables which are |
| 1383 |
% mostly empty. |
| 1384 |
% \begin{macrocode} |
| 1385 |
\int_gincr:N\g_@@_glyph_int |
| 1386 |
\bool_gset_true:N \g_@@_glyph_seen_bool |
| 1387 |
% \end{macrocode} |
| 1388 |
% If we do font comparison we also check if the glyph is in the |
| 1389 |
% second font and if so record that fact. |
| 1390 |
% \begin{macrocode} |
| 1391 |
\tl_if_empty:NF \l_@@_compare_font_tl |
| 1392 |
{ |
| 1393 |
\group_begin: |
| 1394 |
\l_@@_compare_font_tl |
| 1395 |
\@@_if_uchar_exists:nT { #1 } |
| 1396 |
{ \int_gincr:N \g_@@_glyph_also_B_int } |
| 1397 |
\group_end: |
| 1398 |
} |
| 1399 |
} |
| 1400 |
% \end{macrocode} |
| 1401 |
% If the current slot has no glyph in the font we also add a |
| 1402 |
% \verb=&= followed by something that indicates the glyph is |
| 1403 |
% missing. If we do font comparison, it may show the glyph from |
| 1404 |
% the other font (if it exists there) in some special way to indicate which glyph |
| 1405 |
% should be in this slot. |
| 1406 |
% \begin{macrocode} |
| 1407 |
{ \@@_handle_missing_glyph:n {#1} } |
| 1408 |
} |
| 1409 |
% \end{macrocode} |
| 1410 |
% |
| 1411 |
% \begin{macrocode} |
| 1412 |
\cs_generate_variant:Nn \@@_handle_slot:n {x} |
| 1413 |
% \end{macrocode} |
| 1414 |
% \end{macro} |
| 1415 |
% |
| 1416 |
|
| 1417 |
% \begin{macro}{\@@_handle_missing_glyph:n, |
| 1418 |
% \@@_handle_missing_glyph_std:n, |
| 1419 |
% \@@_handle_missing_glyph_compare:n} |
| 1420 |
% |
| 1421 |
% In the standard case we typeset a special symbol to indicate that the glyph is missing. |
| 1422 |
% For this case we provide some customization through keys: |
| 1423 |
% \cs{l_@@_missing_glyph_tl} holds the symbol for a missing glyph |
| 1424 |
% (default: a hyphen). It is typeset in a specific color and we allow for |
| 1425 |
% setting it in a special font. The actual symbol number in |
| 1426 |
% \verb=#1= is not needed in this scenario. |
| 1427 |
% \begin{macrocode} |
| 1428 |
\cs_new:Npn \@@_handle_missing_glyph_std:n #1 { |
| 1429 |
\tl_gput_right:Nn \g_@@_row_tl |
| 1430 |
{ & |
| 1431 |
\@@_format_glyph:n { |
| 1432 |
% \colorbox{black!30} % <--- povide interface |
| 1433 |
{\l_@@_missing_glyph_color_tl |
| 1434 |
\l_@@_missing_glyph_font_tl |
| 1435 |
\l_@@_missing_glyph_tl } |
| 1436 |
} |
| 1437 |
} |
| 1438 |
} |
| 1439 |
% \end{macrocode} |
| 1440 |
% |
| 1441 |
% \keysetup{missing glyphs} |
| 1442 |
% Here are the keys for customizing the missing glyph representation. |
| 1443 |
% \begin{macrocode} |
| 1444 |
\keys_define:nn {@@} { |
| 1445 |
missing-glyph-color .choice: |
| 1446 |
,missing-glyph-color / none .code:n = |
| 1447 |
\tl_clear:N \l_@@_missing_glyph_color_tl |
| 1448 |
,missing-glyph-color / unknown .code:n = |
| 1449 |
\tl_set:Nn \l_@@_missing_glyph_color_tl { \color {#1} } |
| 1450 |
% |
| 1451 |
,missing-glyph-font .tl_set:N = \l_@@_missing_glyph_font_tl |
| 1452 |
,missing-glyph-font .initial:n = \ttfamily \scriptsize |
| 1453 |
,missing-glyph .tl_set:N = \l_@@_missing_glyph_tl |
| 1454 |
,missing-glyph .initial:n = - } |
| 1455 |
% \end{macrocode} |
| 1456 |
% |
| 1457 |
% |
| 1458 |
% The default definition for the color is to use the same as the |
| 1459 |
% one specified by the \key{color} key. We therefore define the |
| 1460 |
% default outside of the \pkg{l3keys} method. |
| 1461 |
% \begin{macrocode} |
| 1462 |
\tl_new:N \l_@@_missing_glyph_color_tl |
| 1463 |
\tl_set:Nn \l_@@_missing_glyph_color_tl {\l_@@_color_tl} |
| 1464 |
% \end{macrocode} |
| 1465 |
% |
| 1466 |
% This is the version that handles a missing glyph by checking |
| 1467 |
% the \key{compare-with} font to see if that font contains the |
| 1468 |
% glyph. |
| 1469 |
% If yes, the substitute glyph will be typeset, otherwise the missing |
| 1470 |
% glyph symbol is shown by calling \cs{@@_handle_missing_glyph_std:n}. |
| 1471 |
% \begin{macrocode} |
| 1472 |
\cs_new:Npn \@@_handle_missing_glyph_compare:n #1 { |
| 1473 |
\group_begin: |
| 1474 |
% \end{macrocode} |
| 1475 |
% Locally switch to the other font, then check for the glyph: |
| 1476 |
% \begin{macrocode} |
| 1477 |
\l_@@_compare_font_tl |
| 1478 |
\@@_if_uchar_exists:nTF { #1 } |
| 1479 |
{ |
| 1480 |
% \end{macrocode} |
| 1481 |
% If available, format it (together with the \texttt{\&}) but use a |
| 1482 |
% special color and perhaps a background color. |
| 1483 |
% \begin{macrocode} |
| 1484 |
\tl_gput_right:Nn \g_@@_row_tl |
| 1485 |
{ & |
| 1486 |
\@@_format_glyph:n |
| 1487 |
{ \l_@@_compare_bgcolor_tl { \l_@@_compare_color_tl |
| 1488 |
\l_@@_compare_font_tl |
| 1489 |
\symbol {#1} } |
| 1490 |
} |
| 1491 |
} |
| 1492 |
% \end{macrocode} |
| 1493 |
% Having seen a glyph only in the second font we record this fact. |
| 1494 |
% \begin{macrocode} |
| 1495 |
\int_gincr:N \g_@@_glyph_only_B_int |
| 1496 |
% \end{macrocode} |
| 1497 |
% Also tell the algorithm that we have seen a glyph to typeset. If |
| 1498 |
% we don't do this then a row consisting of only substitute glyphs is not |
| 1499 |
% typeset. However, we don't update the glyph count, because this |
| 1500 |
% is not a glyph from the main font we display. |
| 1501 |
% \begin{macrocode} |
| 1502 |
\bool_gset_true:N \g_@@_glyph_seen_bool |
| 1503 |
} |
| 1504 |
% \end{macrocode} |
| 1505 |
% If the alternate font doesn't have the glyph either we |
| 1506 |
% typeset the missing glyph symbol. |
| 1507 |
% \begin{macrocode} |
| 1508 |
{ \@@_handle_missing_glyph_std:n {} } |
| 1509 |
\group_end: |
| 1510 |
} |
| 1511 |
% \end{macrocode} |
| 1512 |
% |
| 1513 |
% \keysetup{comparison} |
| 1514 |
% |
| 1515 |
% In order to display glyphs from a secondary font we need a |
| 1516 |
% secondary color for the glyph itself and possibly some background color. |
| 1517 |
% \begin{macrocode} |
| 1518 |
\tl_new:N \l_@@_compare_with_tl |
| 1519 |
\tl_new:N \l_@@_compare_color_tl |
| 1520 |
\tl_new:N \l_@@_compare_bgcolor_tl |
| 1521 |
% \end{macrocode} |
| 1522 |
% |
| 1523 |
% \begin{macrocode} |
| 1524 |
\keys_define:nn {@@} |
| 1525 |
{ |
| 1526 |
,compare-with .tl_set:N = \l_@@_compare_with_tl |
| 1527 |
,compare-with .initial:n = |
| 1528 |
,compare-color .choice: |
| 1529 |
,compare-color / none .code:n |
| 1530 |
= \tl_clear:N \l_@@_compare_color_tl |
| 1531 |
,compare-color / unknown .code:n |
| 1532 |
= \tl_set:Nn \l_@@_compare_color_tl { \color {#1} } |
| 1533 |
,compare-color .initial:n = red |
| 1534 |
,compare-bgcolor .choice: |
| 1535 |
,compare-bgcolor / none .code:n |
| 1536 |
= \tl_clear:N \l_@@_compare_bgcolor_tl |
| 1537 |
,compare-bgcolor / unknown .code:n |
| 1538 |
= \tl_set:Nn \l_@@_compare_bgcolor_tl { \colorbox {#1} } |
| 1539 |
,compare-bgcolor .initial:n = black!10 |
| 1540 |
% \end{macrocode} |
| 1541 |
% If we run a comparison we show different statistics that have |
| 1542 |
% their own key. |
| 1543 |
% \changes{v1.0g}{2022/11/12}{Change default text so that it makes |
| 1544 |
% more sense if only a portion of the font is displayed (gh/4)} |
| 1545 |
% \begin{macrocode} |
| 1546 |
,statistics-compare-format .cs_set:Np |
| 1547 |
= \@@_format_compare_stats:nnnnnn #1#2#3#4#5#6 |
| 1548 |
,statistics-compare-format .initial:n |
| 1549 |
= \parbox{\linewidth}{ |
| 1550 |
Total~ number~ of~ glyphs~ shown~ from~ \texttt{#1}:~#2\\ |
| 1551 |
Comparison~ font~ \texttt{#3}~ has~ #5~ missing~ and~ #6~ |
| 1552 |
extra~ glyphs} |
| 1553 |
} |
| 1554 |
% \end{macrocode} |
| 1555 |
% |
| 1556 |
% |
| 1557 |
% By default, i.e., if no font for comparison has been specified, we |
| 1558 |
% handle missing glyphs by displaying a missing glyph symbol. |
| 1559 |
% \begin{macrocode} |
| 1560 |
\cs_new_eq:NN \@@_handle_missing_glyph:n |
| 1561 |
\@@_handle_missing_glyph_std:n |
| 1562 |
% \end{macrocode} |
| 1563 |
% \end{macro} |
| 1564 |
% |
| 1565 |
|
| 1566 |
|
| 1567 |
% \begin{macro}{\@@_format_glyph:n} |
| 1568 |
% Every glyph is typeset in a box of equal width with the glyph |
| 1569 |
% centered and if necessary protruding on both sides. |
| 1570 |
% \begin{macrocode} |
| 1571 |
\cs_new:Npn \@@_format_glyph:n #1 { |
| 1572 |
\hbox_to_wd:nn {\l_@@_glyph_box_dim} { \hss #1 \hss } } |
| 1573 |
% \end{macrocode} |
| 1574 |
% |
| 1575 |
% \keysetup{glyph typesetting} |
| 1576 |
% The key to customize the width. The 6pt are fine for most cases. |
| 1577 |
% \begin{macrocode} |
| 1578 |
\dim_new:N\l_@@_glyph_box_dim |
| 1579 |
% \end{macrocode} |
| 1580 |
% |
| 1581 |
% \begin{macrocode} |
| 1582 |
\keys_define:nn {@@} { |
| 1583 |
glyph-width .dim_set:N = \l_@@_glyph_box_dim |
| 1584 |
,glyph-width .initial:n = 6pt |
| 1585 |
} |
| 1586 |
% \end{macrocode} |
| 1587 |
% \end{macro} |
| 1588 |
|
| 1589 |
|
| 1590 |
% \begin{macro}{\@@_if_uchar_exists:n} |
| 1591 |
% For testing whether or not a slot position contains a glyph we |
| 1592 |
% need to resort to low-level methods, because so far |
| 1593 |
% \texttt{expl3} doesn't offer an interface. |
| 1594 |
% \begin{macrocode} |
| 1595 |
\prg_set_conditional:Npnn \@@_if_uchar_exists:n #1 { TF , T } |
| 1596 |
{ \tex_iffontchar:D \tex_font:D #1 \scan_stop: |
| 1597 |
\prg_return_true: |
| 1598 |
\else: |
| 1599 |
\prg_return_false: |
| 1600 |
\fi: |
| 1601 |
} |
| 1602 |
% \end{macrocode} |
| 1603 |
% \end{macro} |
| 1604 |
% |
| 1605 |
% |
| 1606 |
% |
| 1607 |
% |
| 1608 |
% \subsection{Handling a single row} |
| 1609 |
% |
| 1610 |
% |
| 1611 |
% \begin{macro}{\@@_handle_hex_C:n} |
| 1612 |
% As promised here is the read definition for |
| 1613 |
% \cs{@@_handle_hex_C:n} in all its glory. |
| 1614 |
% \begin{macrocode} |
| 1615 |
\cs_set:Npn \@@_handle_hex_C:n #1 { |
| 1616 |
% \end{macrocode} |
| 1617 |
% We are now at the start of a new row (but with the last row not |
| 1618 |
% yet typeset) and this last row may need a Unicode block heading |
| 1619 |
% before it. This is the reason why we have to delay the |
| 1620 |
% typesetting, because in case the line doesn't contain any glyphs |
| 1621 |
% we want to typeset neither and that is only known after all |
| 1622 |
% slots in the row have been processed. |
| 1623 |
% \begin{macrocode} |
| 1624 |
\@@_maybe_typeset_a_row_and_display_a_block_title: |
| 1625 |
% \end{macrocode} |
| 1626 |
% We then store away the value for the third hex digit (denoted as |
| 1627 |
% C) in order to start with the next row. |
| 1628 |
% \begin{macrocode} |
| 1629 |
\tl_gset:Nn\g_@@_hex_C_tl{#1} |
| 1630 |
% \end{macrocode} |
| 1631 |
% Being at the start of a new row we might be at the start of a new |
| 1632 |
% Unicode block. If so we have to update the block title to add in |
| 1633 |
% front of the row when we typeset it (or in front of one of the |
| 1634 |
% next rows if the first rows in the is block have no glyphs). If |
| 1635 |
% we are still in the same block no update happens. |
| 1636 |
% \begin{macrocode} |
| 1637 |
\@@_update_block_title:n { \g_@@_hex_H_tl |
| 1638 |
\g_@@_hex_A_tl |
| 1639 |
\g_@@_hex_B_tl |
| 1640 |
\g_@@_hex_C_tl } |
| 1641 |
% \end{macrocode} |
| 1642 |
% We now check if this row is within the requested range, i.e., |
| 1643 |
% greater than or equal to \cs{l_@@_range_start_tl} and not greater than |
| 1644 |
% \cs{l_@@_range_end_tl}. |
| 1645 |
% \begin{macrocode} |
| 1646 |
\int_compare:nNnF |
| 1647 |
{ " \g_@@_hex_H_tl \g_@@_hex_A_tl |
| 1648 |
\g_@@_hex_B_tl \g_@@_hex_C_tl 0 } |
| 1649 |
< { "\l_@@_range_start_tl } |
| 1650 |
{ |
| 1651 |
\int_compare:nNnTF |
| 1652 |
{ " \g_@@_hex_H_tl \g_@@_hex_A_tl |
| 1653 |
\g_@@_hex_B_tl \g_@@_hex_C_tl 0 } |
| 1654 |
> { "\l_@@_range_end_tl } |
| 1655 |
% \end{macrocode} |
| 1656 |
% If we are past the \texttt{end-range} we break out the clist |
| 1657 |
% mapping, to avoind unnecessary repetition. This should be |
| 1658 |
% propagated back to the outer clists as well (not done). |
| 1659 |
% \begin{macrocode} |
| 1660 |
{ \clist_map_break: } |
| 1661 |
% \end{macrocode} |
| 1662 |
% If we are within range we process the slots in the row by first |
| 1663 |
% initializing \cs{g_@@_row_tl} with the row title (the info on the |
| 1664 |
% left) and then loop through all slots the row to append glyphs |
| 1665 |
% (or missing glyphs) to \cs{g_@@_row_tl} to build up everything we |
| 1666 |
% need to finally typeset it. |
| 1667 |
% \begin{macrocode} |
| 1668 |
{ |
| 1669 |
\tl_gset:Nx \g_@@_row_tl |
| 1670 |
{ |
| 1671 |
\exp_not:N \@@_format_row_title:n |
| 1672 |
{ \g_@@_hex_H_tl \g_@@_hex_A_tl |
| 1673 |
\g_@@_hex_B_tl \g_@@_hex_C_tl } |
| 1674 |
} |
| 1675 |
\clist_map_function:NN \c_@@_hex_digits_clist |
| 1676 |
\@@_handle_hex_D:n |
| 1677 |
} |
| 1678 |
} |
| 1679 |
} |
| 1680 |
% \end{macrocode} |
| 1681 |
% \end{macro} |
| 1682 |
% |
| 1683 |
% |
| 1684 |
% \begin{macro}{\@@_format_row_title:n} |
| 1685 |
% The function to format the row title on the left, as used above. |
| 1686 |
% \changes{v1.0g}{2022/11/12}{Add key hex-digits-row-format to allow |
| 1687 |
% customizing the row title on the left (gh/3)} |
| 1688 |
% \begin{macrocode} |
| 1689 |
\cs_new:Npn \@@_format_row_title:n #1 { |
| 1690 |
\texttt { \footnotesize \l_@@_color_tl \@@_format_row_hex_digits:n {#1} } |
| 1691 |
} |
| 1692 |
% \end{macrocode} |
| 1693 |
% \end{macro} |
| 1694 |
% |
| 1695 |
% |
| 1696 |
% |
| 1697 |
% \keysetup{ranges} |
| 1698 |
% |
| 1699 |
% For the range we have two keys, its start and the end. By default the |
| 1700 |
% whole range from 0 to FFFF is processed. |
| 1701 |
% |
| 1702 |
% \begin{macrocode} |
| 1703 |
\tl_new:N \l_@@_range_start_tl |
| 1704 |
\tl_new:N \l_@@_range_end_tl |
| 1705 |
% \end{macrocode} |
| 1706 |
% |
| 1707 |
% \begin{macrocode} |
| 1708 |
\keys_define:nn {@@} |
| 1709 |
{ |
| 1710 |
,range-start .tl_set:N = \l_@@_range_start_tl |
| 1711 |
,range-start .initial:n = 0000 |
| 1712 |
,range-end .tl_set:N = \l_@@_range_end_tl |
| 1713 |
,range-end .initial:n = FFFF |
| 1714 |
} |
| 1715 |
% \end{macrocode} |
| 1716 |
% |
| 1717 |
% |
| 1718 |
% |
| 1719 |
% |
| 1720 |
% |
| 1721 |
% \begin{macro}{\@@_maybe_typeset_a_row_and_display_a_block_title:} |
| 1722 |
% The function handles the just-finished row and, if the row does not |
| 1723 |
% consist only of missing glyphs, typesets it. If necessary it also typesets |
| 1724 |
% a Unicode block name first. |
| 1725 |
% \begin{macrocode} |
| 1726 |
\cs_new:Npn \@@_maybe_typeset_a_row_and_display_a_block_title: { |
| 1727 |
% \end{macrocode} |
| 1728 |
% We first check if the row had any real glyphs. |
| 1729 |
% \begin{macrocode} |
| 1730 |
\bool_if:NTF \g_@@_glyph_seen_bool |
| 1731 |
{ |
| 1732 |
% \end{macrocode} |
| 1733 |
% If the row needs typesetting the fun part starts. We first look |
| 1734 |
% at the content of \cs{g_@@_block_title_tl}. |
| 1735 |
% \begin{macrocode} |
| 1736 |
\tl_if_empty:NTF \g_@@_block_title_tl |
| 1737 |
{ |
| 1738 |
% \end{macrocode} |
| 1739 |
% It is empty we are in the middle of a block and we can ignore |
| 1740 |
% the Unicode title. However, we have to see if the previous row |
| 1741 |
% (or several) was missing (i.e., contained no glyphs). In that |
| 1742 |
% case we leave a little extra space, otherwise we just finish the |
| 1743 |
% previous row |
| 1744 |
% \begin{macrocode} |
| 1745 |
\bool_if:NTF \g_@@_row_missing_bool |
| 1746 |
{ \@@_debug_nl:n{A}\\[6pt] } |
| 1747 |
{ \@@_debug_nl:n{B}\\ } |
| 1748 |
} |
| 1749 |
{ |
| 1750 |
% \end{macrocode} |
| 1751 |
% Otherwise we first have to typeset the Unicode block title (or |
| 1752 |
% whatever should happen instead). |
| 1753 |
% \begin{macrocode} |
| 1754 |
\typeout{ Processing~ \tl_use:N \g_@@_block_title_tl } |
| 1755 |
\bool_if:NTF \l_@@_display_block_bool |
| 1756 |
{ |
| 1757 |
% \end{macrocode} |
| 1758 |
% If we are to typeset the title the action depends a bit on |
| 1759 |
% whether we are at the very first row or typesetting a later block. |
| 1760 |
% \begin{macrocode} |
| 1761 |
\bool_if:NTF \g_@@_first_row_bool |
| 1762 |
{ |
| 1763 |
\bool_gset_false:N \g_@@_first_row_bool |
| 1764 |
\@@_debug_nl:n{C}\\[-4pt] |
| 1765 |
} |
| 1766 |
{ |
| 1767 |
\@@_debug_nl:n{D}\\[8pt] |
| 1768 |
\noalign{\vskip 1pt plus 1pt} % space above block: customizable? |
| 1769 |
} |
| 1770 |
% \noalign{\smallskip} % space above block: customizable? |
| 1771 |
\multicolumn{17}{c}{\normalfont \bfseries |
| 1772 |
\tl_use:N \g_@@_block_title_tl} |
| 1773 |
% \end{macrocode} |
| 1774 |
% After the block title is typeset we may want to add a row of hex |
| 1775 |
% digits as well if that was requested, otherwise we only leave a |
| 1776 |
% bit of extra space. |
| 1777 |
% \begin{macrocode} |
| 1778 |
\bool_if:NTF \l_@@_blockwise_hex_digits_bool |
| 1779 |
{ \@@_debug_nl:n{E}\\* |
| 1780 |
\@@_display_row_of_hex_digits: |
| 1781 |
\@@_debug_nl:n{H}\\*[2pt] |
| 1782 |
} |
| 1783 |
{ \@@_debug_nl:n{F}\\*[2pt] } |
| 1784 |
} |
| 1785 |
{ |
| 1786 |
% \end{macrocode} |
| 1787 |
% If the Unicode block title is not typeset we may still have to do |
| 1788 |
% someting special and again it differs if we at the very beginning |
| 1789 |
% of the table (because there we do nothing except changing the |
| 1790 |
% state of \cs{g_@@_first_row_bool}). |
| 1791 |
% \begin{macrocode} |
| 1792 |
\bool_if:NTF \g_@@_first_row_bool |
| 1793 |
{ \bool_gset_false:N \g_@@_first_row_bool } |
| 1794 |
{ |
| 1795 |
\@@_debug_nl:n{G~ (new~ block)} |
| 1796 |
\l_@@_display_block_action_tl |
| 1797 |
} |
| 1798 |
} |
| 1799 |
% \end{macrocode} |
| 1800 |
% Once we are past the block title we clear it, so that it is not |
| 1801 |
% retypeset before the next row. |
| 1802 |
% \begin{macrocode} |
| 1803 |
\tl_gclear:N \g_@@_block_title_tl |
| 1804 |
} |
| 1805 |
% \end{macrocode} |
| 1806 |
% The final action is to typeset the row and reset the booleans (in |
| 1807 |
% case they were true; if they are false already then we do this |
| 1808 |
% unnecessarily, but that is probably faster than testing first). |
| 1809 |
% \begin{macrocode} |
| 1810 |
\bool_gset_false:N \g_@@_glyph_seen_bool |
| 1811 |
\bool_gset_false:N \g_@@_row_missing_bool |
| 1812 |
\tl_use:N \g_@@_row_tl |
| 1813 |
} |
| 1814 |
% \end{macrocode} |
| 1815 |
% Current row had no glyphs; remember that fact, and that is all we |
| 1816 |
% have to do in that case. |
| 1817 |
% \begin{macrocode} |
| 1818 |
{ |
| 1819 |
\bool_gset_true:N \g_@@_row_missing_bool |
| 1820 |
} |
| 1821 |
} |
| 1822 |
% \end{macrocode} |
| 1823 |
% \end{macro} |
| 1824 |
|
| 1825 |
% |
| 1826 |
% |
| 1827 |
% \subsection{Initialisation at the start of the table} |
| 1828 |
% |
| 1829 |
% |
| 1830 |
% \begin{macro}{\g_@@_first_row_bool,\g_@@_glyph_seen_bool,\g_@@_row_missing_bool} |
| 1831 |
% Declare the three booleans used in the code below. They will tell |
| 1832 |
% us answers to the following questions: |
| 1833 |
% \begin{itemize} |
| 1834 |
% \item Are we processing the first row? |
| 1835 |
% \item Have we seen any glyph so far (in the current row)? |
| 1836 |
% \item Did we have one or more missing rows recently? |
| 1837 |
% \end{itemize} |
| 1838 |
% \begin{macrocode} |
| 1839 |
\bool_new:N \g_@@_first_row_bool |
| 1840 |
\bool_new:N \g_@@_glyph_seen_bool |
| 1841 |
\bool_new:N \g_@@_row_missing_bool |
| 1842 |
% \end{macrocode} |
| 1843 |
% \end{macro} |
| 1844 |
|
| 1845 |
|
| 1846 |
|
| 1847 |
|
| 1848 |
|
| 1849 |
|
| 1850 |
% \begin{macro}{\@@_initialize_table_rows:} |
| 1851 |
% At the start of a table we are processing the first row |
| 1852 |
% and so we (obviously) haven't seen a glyph yet and there wasn't a |
| 1853 |
% missing row recently. |
| 1854 |
% \begin{macrocode} |
| 1855 |
\cs_new:Npn \@@_initialize_table_rows: { |
| 1856 |
\bool_gset_true:N \g_@@_first_row_bool |
| 1857 |
\bool_gset_false:N \g_@@_glyph_seen_bool |
| 1858 |
\bool_gset_false:N \g_@@_row_missing_bool |
| 1859 |
% \end{macrocode} |
| 1860 |
% And clearly the glyph count for the font(s) is zero. |
| 1861 |
% \begin{macrocode} |
| 1862 |
\int_gzero:N \g_@@_glyph_int |
| 1863 |
\int_gzero:N \g_@@_glyph_only_B_int |
| 1864 |
\int_gzero:N \g_@@_glyph_also_B_int |
| 1865 |
} |
| 1866 |
% \end{macrocode} |
| 1867 |
% \end{macro} |
| 1868 |
% |
| 1869 |
% |
| 1870 |
% |
| 1871 |
% |
| 1872 |
% \subsection{Handling block titles} |
| 1873 |
% |
| 1874 |
% \begin{macro}{g_@@_block_title_tl} |
| 1875 |
% We keep the current block title in this token list. |
| 1876 |
% \begin{macrocode} |
| 1877 |
\tl_new:N \g_@@_block_title_tl |
| 1878 |
% \end{macrocode} |
| 1879 |
% \end{macro} |
| 1880 |
|
| 1881 |
|
| 1882 |
% \begin{macro}{\@@_update_block_title:n} |
| 1883 |
% A block title is updated when the hex digits A,B,C have a certain |
| 1884 |
% value, so this is nothing more than a huge case switch. |
| 1885 |
% \begin{macrocode} |
| 1886 |
\cs_new:Npn \@@_update_block_title:n #1 { |
| 1887 |
\tl_gset:Nx \g_@@_block_title_tl { |
| 1888 |
\int_case:nnF{ "#1 } |
| 1889 |
{ |
| 1890 |
{ "000 }{ Basic~ Latin } |
| 1891 |
{ "008 }{ Latin-1~ Supplement } |
| 1892 |
{ "010 }{ Latin~ Extended-A } |
| 1893 |
{ "018 }{ Latin~ Extended-B } |
| 1894 |
{ "025 }{ IPA~ Extensions } |
| 1895 |
{ "02B }{ Spacing~ Modifier~ Letters } |
| 1896 |
{ "030 }{ Combining~ Diacritical~ Marks } |
| 1897 |
{ "037 }{ Greek~ and~ Coptic } |
| 1898 |
{ "040 }{ Cyrillic } |
| 1899 |
{ "053 }{ Armenian } |
| 1900 |
{ "059 }{ Hebrew } |
| 1901 |
{ "060 }{ Arabic } |
| 1902 |
{ "070 }{ Syriac } |
| 1903 |
{ "075 }{ Arabic~ Supplement } |
| 1904 |
{ "078 }{ Thaana } |
| 1905 |
{ "07C }{ NKo } |
| 1906 |
{ "090 }{ Devanagari } |
| 1907 |
{ "098 }{ Bengali } |
| 1908 |
{ "0A0 }{ Gurmukhi } |
| 1909 |
{ "0A8 }{ Gujarati } |
| 1910 |
{ "0B0 }{ Oriya } |
| 1911 |
{ "0B8 }{ Tamil } |
| 1912 |
{ "0C0 }{ Telugu } |
| 1913 |
{ "0C8 }{ Kannada } |
| 1914 |
{ "0D0 }{ Malayalam } |
| 1915 |
{ "0D8 }{ Sinhala } |
| 1916 |
{ "0E0 }{ Thai } |
| 1917 |
{ "0E8 }{ Lao } |
| 1918 |
{ "0F0 }{ Tibetan } |
| 1919 |
{ "100 }{ Myanmar } |
| 1920 |
{ "10A }{ Georgian } |
| 1921 |
{ "110 }{ Hangul~ Jamo } |
| 1922 |
{ "120 }{ Ethiopic } |
| 1923 |
{ "138 }{ Ethiopic~ Supplement } |
| 1924 |
{ "13A }{ Cherokee } |
| 1925 |
{ "140 }{ Unified~ Canadian~ Aboriginal~ Syllabics } |
| 1926 |
{ "168 }{ Ogham } |
| 1927 |
{ "16A }{ Runic } |
| 1928 |
{ "170 }{ Tagalog } |
| 1929 |
{ "172 }{ Hanunoo } |
| 1930 |
{ "174 }{ Buhid } |
| 1931 |
{ "176 }{ Tagbanwa } |
| 1932 |
{ "178 }{ Khmer } |
| 1933 |
{ "180 }{ Mongolian } |
| 1934 |
{ "190 }{ Limbu } |
| 1935 |
{ "195 }{ Tai~ Le } |
| 1936 |
{ "198 }{ New~ Tai~ Le } |
| 1937 |
{ "19E }{ Khmer~ Symbols } |
| 1938 |
{ "1A0 }{ Buginese } |
| 1939 |
{ "1B0 }{ Balinese } |
| 1940 |
{ "1D0 }{ Phonetic~ Extensions } |
| 1941 |
{ "1D8 }{ Phonetic~ Extensions~ Supplement } |
| 1942 |
{ "1DC }{ Combining~ Diacritical~ Marks~ Supplement } |
| 1943 |
{ "1E0 }{ Latin~ Extended~ Additional } |
| 1944 |
{ "1F0 }{ Greek~ Extended } |
| 1945 |
{ "200 }{ General~ Punctuation } |
| 1946 |
{ "207 }{ Superscripts~ and~ Subscripts } |
| 1947 |
{ "20A }{ Currency~ Symbols } |
| 1948 |
{ "20D }{ Combining~ Diacritical~ Marks~ for~ Symbols } |
| 1949 |
{ "210 }{ Letterlike~ Symbols } |
| 1950 |
{ "215 }{ Number~ Forms } |
| 1951 |
{ "219 }{ Arrows } |
| 1952 |
{ "220 }{ Mathematical~ Operators } |
| 1953 |
{ "230 }{ Miscellaneous~ Technical } |
| 1954 |
{ "240 }{ Control~ Pictures } |
| 1955 |
{ "244 }{ Optical~ Character~ Recognition } |
| 1956 |
{ "246 }{ Enclosed~ Alphanumerics } |
| 1957 |
{ "250 }{ Box~ Drawing } |
| 1958 |
{ "258 }{ Block~ Elements } |
| 1959 |
{ "25A }{ Geometric~ Shapes } |
| 1960 |
{ "260 }{ Miscellaneous~ Shapes } |
| 1961 |
{ "270 }{ Dingbats } |
| 1962 |
{ "27C }{ Miscellaneous~ Mathematical~ Symbols-A } |
| 1963 |
{ "27F }{ Supplemental~ Arrows-A } |
| 1964 |
{ "280 }{ Braille~ Patterns } |
| 1965 |
{ "290 }{ Supplemental~ Arrows-B } |
| 1966 |
{ "298 }{ Miscellaneous~ Mathematical~ Symbols-B } |
| 1967 |
{ "2A0 }{ Supplemental~ Mathematical~ Operators } |
| 1968 |
{ "2B0 }{ Miscellaneous~ Symbols~ and~ Arrows } |
| 1969 |
{ "2C0 }{ Glagolitic } |
| 1970 |
{ "2C6 }{ Latin~ Extended-C } |
| 1971 |
{ "2C8 }{ Coptic } |
| 1972 |
{ "2D0 }{ Georgian~ Supplement } |
| 1973 |
{ "2D3 }{ Tifinagh } |
| 1974 |
{ "2D8 }{ Ethiopic~ Extended } |
| 1975 |
{ "2E0 }{ Supplemental~ Punctuation } |
| 1976 |
{ "2E8 }{ CJK~ Radicals~ Supplement } |
| 1977 |
{ "2F0 }{ Kangxi~ Radicals } |
| 1978 |
{ "2FF }{ Ideographic~ Description~ Characters } |
| 1979 |
{ "300 }{ CJK~ Symbols~ and~ Punctuation } |
| 1980 |
{ "304 }{ Hiragana } |
| 1981 |
{ "30A }{ Katakana } |
| 1982 |
{ "310 }{ Bopomofo } |
| 1983 |
{ "313 }{ Hangul~ Compatibility~ Jamo } |
| 1984 |
{ "319 }{ Kanbun } |
| 1985 |
{ "31A }{ Bopomofo~ Extended } |
| 1986 |
{ "31C }{ CJK~ Strokes } |
| 1987 |
{ "31F }{ Katakana~ Phonetic~ Extensions } |
| 1988 |
{ "320 }{ Enclosed~ CJK~ Letters~ and~ Months } |
| 1989 |
{ "330 }{ CJK~ Compatibility } |
| 1990 |
{ "4DC }{ Yijing~ Hexagram~ Symbols } |
| 1991 |
{ "A00 }{ Yi~ Syllables } |
| 1992 |
{ "A49 }{ Yi~ Radicals } |
| 1993 |
{ "A70 }{ Modifier~ Tone~ Letters } |
| 1994 |
{ "A72 }{ Latin~ Extended-D } |
| 1995 |
{ "A80 }{ Syloti~ Nagri } |
| 1996 |
{ "A84 }{ Phags-pa } |
| 1997 |
{ "A88 }{ Saurashtra } |
| 1998 |
{ "A8E }{ Devanagari Extended } |
| 1999 |
{ "A90 }{ Kayah Li } |
| 2000 |
{ "A93 }{ Rejang } |
| 2001 |
{ "A96 }{ Hangul Jamo Extended-A } |
| 2002 |
{ "A98 }{ Javanese } |
| 2003 |
{ "A9E }{ Myanmar Extended-B } |
| 2004 |
{ "AA0 }{ Cham } |
| 2005 |
{ "AA6 }{ Myanmar Extended-A } |
| 2006 |
{ "AA8 }{ Tai Viet } |
| 2007 |
{ "AAE }{ Meetei Mayek Extensions } |
| 2008 |
{ "AB0 }{ Ethiopic Extended-A } |
| 2009 |
{ "AB3 }{ Latin Extended-E } |
| 2010 |
{ "AB7 }{ Cherokee Supplement } |
| 2011 |
{ "ABC }{ Meetei Mayek } |
| 2012 |
{ "AC0 }{ Hangul Syllables } |
| 2013 |
{ "D7B }{ Hangul Jamo Extended-B } |
| 2014 |
{ "D80 }{ High Surrogates } |
| 2015 |
{ "DB8 }{ High Private Use Surrogates } |
| 2016 |
{ "DC0 }{ Low Surrogates } |
| 2017 |
{ "E00 }{ Private~ Use~ Area } |
| 2018 |
{ "F90 }{ CJK~ Compatibility~ Ideographs } |
| 2019 |
{ "FB0 }{ Alphabetic~ Presentation~ Forms } |
| 2020 |
{ "FB5 }{ Arabic~ Presentation~ Forms-A } |
| 2021 |
{ "FE0 }{ Variation~ Selectors } |
| 2022 |
{ "FE1 }{ Vertical~ Forms } |
| 2023 |
{ "FE2 }{ Combining~ Half~ Marks } |
| 2024 |
{ "FE3 }{ CJK~ Compatibility~ Forms } |
| 2025 |
{ "FE5 }{ Small~ Form~ Variants } |
| 2026 |
{ "FE7 }{ Arabic~ Presentation~ Forms-B } |
| 2027 |
{ "FF0 }{ Halfwidth~ and Fullwidth~ Forms } |
| 2028 |
{ "FFF }{ Specials~ ... } |
| 2029 |
%% ... Plane 1 ... |
| 2030 |
{ "1000 }{ Linear~ B~ Syllabary } |
| 2031 |
{ "1008 }{ Linear~ B~ Ideograms } |
| 2032 |
{ "1010 }{ Aegean~ Numbers } |
| 2033 |
{ "1014 }{ Ancient~ Greek~ Numbers } |
| 2034 |
{ "1019 }{ Ancient~ Symbols } |
| 2035 |
{ "101D }{ Phaistos~ Disc } |
| 2036 |
{ "1028 }{ Lycian } |
| 2037 |
{ "102A }{ Carian } |
| 2038 |
{ "102E }{ Coptic~ Epact~ Numbers } |
| 2039 |
{ "1030 }{ Old~ Italic } |
| 2040 |
{ "1033 }{ Gothic } |
| 2041 |
{ "1035 }{ Old~ Permic } |
| 2042 |
{ "1038 }{ Ugaritic } |
| 2043 |
{ "103A }{ Old~ Persian } |
| 2044 |
{ "1040 }{ Deseret } |
| 2045 |
{ "1045 }{ Shavian } |
| 2046 |
{ "1048 }{ Osmanya } |
| 2047 |
{ "104B }{ Osage } |
| 2048 |
{ "1050 }{ Elbasan } |
| 2049 |
{ "1053 }{ Caucasian~ Albanian } |
| 2050 |
{ "1060 }{ Linear~ A } |
| 2051 |
{ "1080 }{ Cypriot~ Syllabary } |
| 2052 |
{ "1084 }{ Imperial~ Aramaic } |
| 2053 |
{ "1086 }{ Palmyrene } |
| 2054 |
{ "1088 }{ Nabataean } |
| 2055 |
{ "108E }{ Hatran } |
| 2056 |
{ "1090 }{ Phoenician } |
| 2057 |
{ "1092 }{ Lydian } |
| 2058 |
{ "1098 }{ Meroitic~ Hieroglyphs } |
| 2059 |
{ "109A }{ Meroitic~ Cursive } |
| 2060 |
{ "10A0 }{ Kharoshthi } |
| 2061 |
{ "10A6 }{ Old~ South~ Arabian } |
| 2062 |
{ "10A8 }{ Old~ North~ Arabian } |
| 2063 |
{ "10AC }{ Manichaean } |
| 2064 |
{ "10B0 }{ Avestan } |
| 2065 |
{ "10B4 }{ Inscriptional~ Parthian } |
| 2066 |
{ "10B6 }{ Inscriptional~ Pahlavi } |
| 2067 |
{ "10B8 }{ Psalter~ Pahlavi } |
| 2068 |
{ "10C0 }{ Old~ Turkic } |
| 2069 |
{ "10C8 }{ Old~ Hungarian } |
| 2070 |
{ "10E6 }{ Rumi~ Numeral~ Symbols } |
| 2071 |
{ "1100 }{ Brahmi } |
| 2072 |
{ "1108 }{ Kaithi } |
| 2073 |
{ "110D }{ Sora~ Sompeng } |
| 2074 |
{ "1110 }{ Chakma } |
| 2075 |
{ "1115 }{ Mahajani } |
| 2076 |
{ "1118 }{ Sharada } |
| 2077 |
{ "111E }{ Sinhala~ Archaic~ Numbers } |
| 2078 |
{ "1120 }{ Khojki } |
| 2079 |
{ "1128 }{ Multani } |
| 2080 |
{ "112B }{ Khudawadi } |
| 2081 |
{ "1130 }{ Grantha } |
| 2082 |
{ "1140 }{ Newa } |
| 2083 |
{ "1148 }{ Tirhuta } |
| 2084 |
{ "1158 }{ Siddham } |
| 2085 |
{ "1160 }{ Modi } |
| 2086 |
{ "1166 }{ Mongolian~ Supplement } |
| 2087 |
{ "1168 }{ Takri } |
| 2088 |
{ "1170 }{ Ahom } |
| 2089 |
{ "118A }{ Warang~ Citi } |
| 2090 |
{ "11A0 }{ Zanabazar~ Square } |
| 2091 |
{ "11A5 }{ Soyombo } |
| 2092 |
{ "11AC }{ Pau~ Cin~ Hau } |
| 2093 |
{ "11C0 }{ Bhaiksuki } |
| 2094 |
{ "11C7 }{ Marchen } |
| 2095 |
{ "11D0 }{ Masaram~ Gondi } |
| 2096 |
{ "1200 }{ Cuneiform } |
| 2097 |
{ "1240 }{ Cuneiform~ Numbers~ and~ Punctuation } |
| 2098 |
{ "1248 }{ Early~ Dynastic~ Cuneiform } |
| 2099 |
{ "1300 }{ Egyptian~ Hieroglyphs } |
| 2100 |
{ "1440 }{ Anatolian~ Hieroglyphs } |
| 2101 |
{ "1680 }{ Bamum~ Supplement } |
| 2102 |
{ "16A4 }{ Mro } |
| 2103 |
{ "16AD }{ Bassa~ Vah } |
| 2104 |
{ "16B0 }{ Pahawh~ Hmong } |
| 2105 |
{ "16F0 }{ Miao } |
| 2106 |
{ "16FE }{ Ideographic~ Symbols~ and~ Punctuation } |
| 2107 |
{ "1700 }{ Tangut } |
| 2108 |
{ "1880 }{ Tangut~ Components } |
| 2109 |
{ "1B00 }{ Kana~ Supplement } |
| 2110 |
{ "1B10 }{ Kana~ Extended-A } |
| 2111 |
{ "1B17 }{ Nushu } |
| 2112 |
{ "1BC0 }{ Duployan } |
| 2113 |
{ "1BCA }{ Shorthand~ Format~ Controls } |
| 2114 |
{ "1D00 }{ Byzantine~ Musical~ Symbols } |
| 2115 |
{ "1D10 }{ Musical~ Symbols } |
| 2116 |
{ "1D20 }{ Ancient~ Greek~ Musical~ Notation } |
| 2117 |
{ "1D30 }{ Tai~ Xuan~ Jing~ Symbols } |
| 2118 |
{ "1D36 }{ Counting~ Rod~ Numerals } |
| 2119 |
{ "1D40 }{ Mathematical~ Alphanumeric~ Symbols } |
| 2120 |
{ "1D80 }{ Sutton~ SignWriting } |
| 2121 |
{ "1E00 }{ Glagolitic~ Supplement } |
| 2122 |
{ "1E80 }{ Mende~ Kikakui } |
| 2123 |
{ "1E90 }{ Adlam } |
| 2124 |
{ "1EE0 }{ Arabic~ Mathematical~ Alphabetic~ Symbols } |
| 2125 |
{ "1F00 }{ Mahjong~ Tiles } |
| 2126 |
{ "1F03 }{ Domino~ Tiles } |
| 2127 |
{ "1F0A }{ Playing~ Cards } |
| 2128 |
{ "1F10 }{ Enclosed~ Alphanumeric~ Supplement } |
| 2129 |
{ "1F20 }{ Enclosed~ Ideographic~ Supplement } |
| 2130 |
{ "1F30 }{ Miscellaneous~ Symbols~ and~ Pictographs } |
| 2131 |
{ "1F60 }{ Emoticons } |
| 2132 |
{ "1F65 }{ Ornamental~ Dingbats } |
| 2133 |
{ "1F68 }{ Transport~ and~ Map~ Symbols } |
| 2134 |
{ "1F70 }{ Alchemical~ Symbols } |
| 2135 |
{ "1F78 }{ Geometric~ Shapes~ Extended } |
| 2136 |
{ "1F80 }{ Supplemental~ Arrows-C } |
| 2137 |
{ "1F90 }{ Supplemental~ Symbols~ and~ Pictographs } |
| 2138 |
{ "2000 }{ CJK~ Unified~ Ideographs~ Extension~ B } |
| 2139 |
{ "2A70 }{ CJK~ Unified~ Ideographs~ Extension~ C } |
| 2140 |
{ "2B74 }{ CJK~ Unified~ Ideographs~ Extension~ D } |
| 2141 |
{ "2B82 }{ CJK~ Unified~ Ideographs~ Extension~ E } |
| 2142 |
{ "2CEB }{ CJK~ Unified~ Ideographs~ Extension~ F } |
| 2143 |
{ "2F80 }{ CJK~ Compatibility~ Ideographs~ Supplement } |
| 2144 |
{ "E010 }{ Tags } |
| 2145 |
{ "E000 }{ Variation~ Selectors~ Supplement } |
| 2146 |
{ "F000 }{ Supplementary~ Private~ Use~ Area-A } |
| 2147 |
% higher up not covered! |
| 2148 |
} |
| 2149 |
% \end{macrocode} |
| 2150 |
% If none of the above has matched we are somewhere within a block |
| 2151 |
% so we want keep the current name. However, since the case |
| 2152 |
% statement was executed within a |\tl_gset:Nx| we have to do this |
| 2153 |
% by passing the current block name back. |
| 2154 |
% \begin{macrocode} |
| 2155 |
{ \tl_use:N \g_@@_block_title_tl } |
| 2156 |
} |
| 2157 |
} |
| 2158 |
% \end{macrocode} |
| 2159 |
% \end{macro} |
| 2160 |
% |
| 2161 |
% |
| 2162 |
% \keysetup{display blocks} |
| 2163 |
% |
| 2164 |
% The Unicode blocks may get indicated in different ways: with titles, |
| 2165 |
% only through rules, or not at all. Here is the necessary setup. |
| 2166 |
% |
| 2167 |
% \begin{macrocode} |
| 2168 |
\bool_new:N \l_@@_display_block_bool |
| 2169 |
\tl_new:N \l_@@_display_block_action_tl |
| 2170 |
% \end{macrocode} |
| 2171 |
% |
| 2172 |
% \begin{macrocode} |
| 2173 |
\keys_define:nn {@@} |
| 2174 |
{ |
| 2175 |
,display-block .choice: |
| 2176 |
,display-block / titles .code:n = |
| 2177 |
\bool_set_true:N \l_@@_display_block_bool |
| 2178 |
\tl_set:Nn \l_@@_display_block_action_tl {\\} |
| 2179 |
,display-block / rules .code:n = |
| 2180 |
\bool_set_false:N \l_@@_display_block_bool |
| 2181 |
\tl_set:Nn \l_@@_display_block_action_tl {\\ \midrule} |
| 2182 |
,display-block / none .code:n = |
| 2183 |
\bool_set_false:N \l_@@_display_block_bool |
| 2184 |
\tl_set:Nn \l_@@_display_block_action_tl {\\} |
| 2185 |
,display-block .initial:n = titles |
| 2186 |
} |
| 2187 |
% \end{macrocode} |
| 2188 |
% |
| 2189 |
% That's all of the programming using the L3 layer. |
| 2190 |
% \begin{macrocode} |
| 2191 |
\ExplSyntaxOff |
| 2192 |
% \end{macrocode} |
| 2193 |
% What remains is to require all packages needed \ldots |
| 2194 |
% \begin{macrocode} |
| 2195 |
\RequirePackage{longtable,booktabs,caption,fontspec} |
| 2196 |
% \end{macrocode} |
| 2197 |
% \ldots and executing all options passed to the |
| 2198 |
% package via \cs{usepackage}. |
| 2199 |
% \begin{macrocode} |
| 2200 |
\ProcessKeysPackageOptions{@@} |
| 2201 |
%</package> |
| 2202 |
% \end{macrocode} |
| 2203 |
% |
| 2204 |
% |
| 2205 |
% |
| 2206 |
% |
| 2207 |
% |
| 2208 |
% \section{The standalone \texttt{unicodefont.tex} file} |
| 2209 |
% |
| 2210 |
% \begin{macrocode} |
| 2211 |
%<*standalone> |
| 2212 |
\documentclass{article} |
| 2213 |
% \end{macrocode} |
| 2214 |
% |
| 2215 |
% \begin{macrocode} |
| 2216 |
\setlength\textwidth{470pt} |
| 2217 |
\setlength\oddsidemargin{0pt} |
| 2218 |
\addtolength\textheight{7\baselineskip} |
| 2219 |
\addtolength\topmargin{-3\baselineskip} |
| 2220 |
% \end{macrocode} |
| 2221 |
% |
| 2222 |
% \begin{macrocode} |
| 2223 |
\usepackage{unicodefonttable} |
| 2224 |
% \end{macrocode} |
| 2225 |
% |
| 2226 |
% \begin{macrocode} |
| 2227 |
\def\DEFAULTfontname{Latin Modern Roman} |
| 2228 |
\def\DEFAULTfontfeatures{} |
| 2229 |
\def\DEFAULTtableconfig{} |
| 2230 |
\def\DEFAULTunicodefont{} |
| 2231 |
\begin{document} |
| 2232 |
% \end{macrocode} |
| 2233 |
% |
| 2234 |
% \begin{macrocode} |
| 2235 |
\typeout{^^J} |
| 2236 |
% \end{macrocode} |
| 2237 |
% |
| 2238 |
% \begin{macrocode} |
| 2239 |
\ifx\generatetable\undefined |
| 2240 |
\else |
| 2241 |
\typein[\answer]{^^JReuse settings from last time (default yes)?^^J^^J% |
| 2242 |
[ font name = \DEFAULTfontname^^J |
| 2243 |
\space unicode? = \ifx\DEFAULTunicodefont\empty yes^^J |
| 2244 |
\space font features = \DEFAULTfontfeatures |
| 2245 |
\else no\fi^^J |
| 2246 |
\space table config = \DEFAULTtableconfig \space]} |
| 2247 |
\fi |
| 2248 |
% \end{macrocode} |
| 2249 |
% |
| 2250 |
% \begin{macrocode} |
| 2251 |
\ifx\answer\empty |
| 2252 |
\let\FontNameToTable\DEFAULTfontname |
| 2253 |
\let\IsUnicodeFont\DEFAULTunicodefont |
| 2254 |
\let\FontFeaturesToApply\DEFAULTfontfeatures |
| 2255 |
\let\TableConfigurationToApply\DEFAULTtableconfig |
| 2256 |
\else |
| 2257 |
% \end{macrocode} |
| 2258 |
% |
| 2259 |
% \begin{macrocode} |
| 2260 |
\typein[\FontNameToTable]% |
| 2261 |
{^^JInput external font name as understood by fontspec, e.g.,^^J% |
| 2262 |
'TeX Gyre Pagella' or 'lmroman10-regular.otf'% |
| 2263 |
\ifx\DEFAULTfontname\empty\else |
| 2264 |
^^J^^J[default \DEFAULTfontname]\fi:} |
| 2265 |
\ifx\FontNameToTable\empty \let\FontNameToTable\DEFAULTfontname \fi |
| 2266 |
% \end{macrocode} |
| 2267 |
% |
| 2268 |
% \begin{macrocode} |
| 2269 |
\typein[\IsUnicodeFont]% |
| 2270 |
{^^JIs this a Unicode font?^^J^^J% |
| 2271 |
\ifx\DEFAULTunicodefont\empty [default yes]\else [default no]\fi:} |
| 2272 |
% \end{macrocode} |
| 2273 |
% |
| 2274 |
% \begin{macrocode} |
| 2275 |
\ifx\IsUnicodeFont\empty |
| 2276 |
% \ifx\DEFAULTunicodefont\empty |
| 2277 |
% \else |
| 2278 |
\let\IsUnicodeFont\DEFAULTunicodefont |
| 2279 |
% \fi |
| 2280 |
\else |
| 2281 |
\ifx\DEFAULTunicodefont\empty |
| 2282 |
\else |
| 2283 |
\let\IsUnicodeFont\empty |
| 2284 |
\fi |
| 2285 |
\fi |
| 2286 |
% \end{macrocode} |
| 2287 |
% |
| 2288 |
% \begin{macrocode} |
| 2289 |
\ifx\IsUnicodeFont\empty |
| 2290 |
\typein[\FontFeaturesToApply]% |
| 2291 |
{^^JInput font feature key/value list to apply% |
| 2292 |
\ifx\DEFAULTfontfeatures\empty\else |
| 2293 |
^^J^^J[default \DEFAULTfontfeatures]\fi:} |
| 2294 |
\ifx\FontFeaturesToApply\empty \let\FontFeaturesToApply\DEFAULTfontfeatures \fi |
| 2295 |
\else |
| 2296 |
\let\FontFeaturesToApply\DEFAULTfontfeatures |
| 2297 |
\fi |
| 2298 |
% \end{macrocode} |
| 2299 |
% |
| 2300 |
% \begin{macrocode} |
| 2301 |
\typein[\TableConfigurationToApply]% |
| 2302 |
{^^JInput table configuration key/value list to apply% |
| 2303 |
\ifx\DEFAULTtableconfig\empty\else |
| 2304 |
^^J^^J[default |
| 2305 |
\expandafter\detokenize\expandafter{\DEFAULTtableconfig}]\fi:} |
| 2306 |
\ifx\TableConfigurationToApply\empty |
| 2307 |
\let\TableConfigurationToApply\DEFAULTtableconfig |
| 2308 |
\fi |
| 2309 |
% \end{macrocode} |
| 2310 |
% |
| 2311 |
% \begin{macrocode} |
| 2312 |
\edef\generatetable{\noexpand\displayfonttable |
| 2313 |
\ifx\IsUnicodeFont\empty\else *\fi |
| 2314 |
\ifx\TableConfigurationToApply\empty\else |
| 2315 |
[\expandafter\unexpanded\expandafter{\TableConfigurationToApply}]\fi |
| 2316 |
{\FontNameToTable}% |
| 2317 |
\ifx\FontFeaturesToApply\empty\else[\FontFeaturesToApply]\fi |
| 2318 |
} |
| 2319 |
% \end{macrocode} |
| 2320 |
% |
| 2321 |
% \begin{macrocode} |
| 2322 |
\fi |
| 2323 |
% \end{macrocode} |
| 2324 |
% |
| 2325 |
% \begin{macrocode} |
| 2326 |
\makeatletter |
| 2327 |
\protected@write\@auxout{}{\gdef\string\generatetable |
| 2328 |
{\expandafter\detokenize\expandafter{\generatetable}}} |
| 2329 |
\protected@write\@auxout{}{\gdef\string\DEFAULTfontname{\FontNameToTable}} |
| 2330 |
\protected@write\@auxout{}{\gdef\string\DEFAULTunicodefont{\IsUnicodeFont}} |
| 2331 |
\protected@write\@auxout{}{\gdef\string\DEFAULTfontfeatures{\FontFeaturesToApply}} |
| 2332 |
\protected@write\@auxout{}{\gdef\string\DEFAULTtableconfig |
| 2333 |
{\expandafter\detokenize\expandafter{\TableConfigurationToApply}}} |
| 2334 |
\makeatother |
| 2335 |
% \end{macrocode} |
| 2336 |
% |
| 2337 |
% \begin{macrocode} |
| 2338 |
\generatetable |
| 2339 |
\end{document} |
| 2340 |
%</standalone> |
| 2341 |
% \end{macrocode} |
| 2342 |
% |
| 2343 |
% |
| 2344 |
% |
| 2345 |
% \section{A samples file} |
| 2346 |
% |
| 2347 |
% \begin{macrocode} |
| 2348 |
%<*samples> |
| 2349 |
% \end{macrocode} |
| 2350 |
% |
| 2351 |
% \begin{macrocode} |
| 2352 |
%<<VERBATIMLINE |
| 2353 |
%!TEX program = lualatex |
| 2354 |
|
| 2355 |
%VERBATIMLINE |
| 2356 |
% \end{macrocode} |
| 2357 |
% |
| 2358 |
% \begin{macrocode} |
| 2359 |
\documentclass{article} |
| 2360 |
|
| 2361 |
\usepackage{xparse,color} |
| 2362 |
|
| 2363 |
\usepackage{fontspec} |
| 2364 |
|
| 2365 |
\setmainfont{Linux Biolinum O} |
| 2366 |
\setmonofont{SourceCodePro} |
| 2367 |
|
| 2368 |
\usepackage{unicodefonttable} |
| 2369 |
|
| 2370 |
\addtolength\textwidth{30pt} |
| 2371 |
|
| 2372 |
\begin{document} |
| 2373 |
|
| 2374 |
\listoftables |
| 2375 |
|
| 2376 |
\section{Computer Modern --- 8bit font} |
| 2377 |
|
| 2378 |
\displayfonttable*[color=none, |
| 2379 |
range-end = 7F, |
| 2380 |
]{cmr10} |
| 2381 |
|
| 2382 |
%\section{Computer Modern Sans --- 8bit font} \displayfonttable*[]{cmss10} |
| 2383 |
|
| 2384 |
\newpage |
| 2385 |
|
| 2386 |
\section{TeX Gyre Heros (Helvetica) --- 8bit font} |
| 2387 |
|
| 2388 |
\displayfonttable*[color=red,nostatistics=false, |
| 2389 |
hex-digits = head+foot, |
| 2390 |
range-end = FF, |
| 2391 |
]{ec-qhvr} |
| 2392 |
|
| 2393 |
\newpage |
| 2394 |
|
| 2395 |
\section{Latin Modern Sans --- OTF font} |
| 2396 |
|
| 2397 |
\displayfonttable[ |
| 2398 |
% display-block = rules, |
| 2399 |
% missing-glyph = \tiny\setlength\fboxsep{0pt}\fbox{$\times$}, |
| 2400 |
hex-digits = block, |
| 2401 |
title-format-cont = \caption[]{\emph{continued}}, |
| 2402 |
]{Latin Modern Sans} |
| 2403 |
|
| 2404 |
\newpage |
| 2405 |
|
| 2406 |
\section{\TeX{} Gyre Pagella (Palatino) oldstyle figures --- OTF font} |
| 2407 |
|
| 2408 |
\displayfonttable{TeX Gyre Pagella}[Numbers=OldStyle] |
| 2409 |
|
| 2410 |
\newpage |
| 2411 |
|
| 2412 |
\section{Comparing Latin Modern Math with New Computer Modern Math} |
| 2413 |
|
| 2414 |
\displayfonttable[compare-with=NewCMMath-Regular.otf, range-end=1FFFF] |
| 2415 |
{latinmodern-math.otf} |
| 2416 |
|
| 2417 |
\end{document} |
| 2418 |
% \end{macrocode} |
| 2419 |
% |
| 2420 |
% \begin{macrocode} |
| 2421 |
%</samples> |
| 2422 |
% \end{macrocode} |
| 2423 |
% |
| 2424 |
% \Finale |
| 2425 |
% |
| 2426 |
|
| 2427 |
|
| 2428 |
\endinput |
| 2429 |
|
| 2430 |
%%%%%%%%%%%%%%%%%%% |