Debian Codegraph @

texmf-dist/doc/fonts/firamath/firamath-specimen.tex

raw
1 \documentclass{article}
2
3 \PassOptionsToPackage{log-declarations=false}{xparse}
4 \PassOptionsToPackage{no-math}{fontspec}
5 \PassOptionsToPackage{table}{xcolor}
6 \PassOptionsToPackage{titles}{tocloft}
7 %\PassOptionsToPackage{showframe}{geometry}
8 \usepackage{%
9 expl3,xparse,
10 ctexheading,geometry,fancyhdr,tocloft,fontspec,xcolor,hologo,
11 array,longtable,multirow,hhline,
12 hyperref,zref-totpages}
13
14 \makeatletter\ExplSyntaxOn
15
16 \seq_const_from_clist:Nn \c_@@_unicode_reserved_seq
17 {
18 % Greek and Coptic
19 378, 379, 380, 381, 382, 383, 38B, 38D, 3A2,
20 % General Punctuation
21 2065,
22 % Superscripts and Subscripts
23 2072, 2073, 208F, 209D, 209E, 209F,
24 % Currency Symbols
25 20C0, 20C1, 20C2, 20C3, 20C4, 20C5, 20C6, 20C7, 20C8, 20C9,
26 20CA, 20CB, 20CC, 20CD, 20CE, 20CF,
27 % Combining Diacritical Marks for Symbols
28 20F1, 20F2, 20F3, 20F4, 20F5, 20F6, 20F7, 20F8, 20F9, 20FA,
29 20FB, 20FC, 20FD, 20FE, 20FF,
30 % Number Forms
31 218C, 218D, 218E, 218F,
32 % Control Pictures
33 2427, 2428, 2429, 242A, 242B, 242C, 242D, 242E, 242F, 2430,
34 2431, 2432, 2433, 2434, 2435, 2436, 2437, 2438, 2439, 243A,
35 243B, 243C, 243D, 243E, 243F,
36 % Optical Character Recognition
37 244B, 244C, 244D, 244E, 244F, 2450, 2451, 2452, 2453, 2454,
38 2455, 2456, 2457, 2458, 2459, 245A, 245B, 245C, 245D, 245E,
39 245F,
40 % Miscellaneous Symbols and Arrows
41 2B74, 2B75, 2B96,
42 % Alphabetic Presentation Forms
43 FB07, FB08, FB09, FB0A, FB0B, FB0C, FB0D, FB0E, FB0F, FB10,
44 FB11, FB12, FB18, FB19, FB1A, FB1B, FB1C, FB37, FB3D, FB3F,
45 FB42, FB45,
46 % Arabic Presentation Forms-B
47 FE75, FEFD, FEFE,
48 % Mathematical Alphanumeric Symbols
49 1D455, 1D49D, 1D4A0, 1D4A1, 1D4A3, 1D4A4, 1D4A7, 1D4A8, 1D4AD, 1D4BA,
50 1D4BC, 1D4C4, 1D506, 1D50B, 1D50C, 1D515, 1D51D, 1D53A, 1D53F, 1D545,
51 1D547, 1D548, 1D549, 1D551, 1D6A6, 1D6A7, 1D7CC, 1D7CD,
52 % Geometric Shapes Extended
53 1F7D9, 1F7DA, 1F7DB, 1F7DC, 1F7DD, 1F7DE, 1F7DF, 1F7EC, 1F7ED, 1F7EE,
54 1F7EF, 1F7F0, 1F7F1, 1F7F2, 1F7F3, 1F7F4, 1F7F5, 1F7F6, 1F7F7, 1F7F8,
55 1F7F9, 1F7FA, 1F7FB, 1F7FC, 1F7FD, 1F7FE, 1F7FF,
56 }
57
58 \seq_const_from_clist:Nn \c_@@_unicode_control_seq
59 {
60 % C0 Controls and Basic Latin
61 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F,
62 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1A, 1B, 1C, 1D, 1E, 1F,
63 7F,
64 % C1 Controls and Latin-1 Supplement
65 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 8A, 8B, 8C, 8D, 8E, 8F,
66 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 9A, 9B, 9C, 9D, 9E, 9F
67 }
68
69 % Require `\c_@@_glyph_non_unicode_with_type_seq`
70 \file_input:n { firamath-glyph-list.tex }
71
72 % #1 = symbol index
73 \cs_new_protected:Npn \@@_symbol:n #1
74 { \tex_char:D \int_eval:n {#1} \scan_stop: }
75 \prg_new_protected_conditional:Npnn \@@_if_char_exist:n #1 { T, F, TF }
76 {
77 \tex_iffontchar:D \tex_font:D \int_eval:n {#1} \scan_stop:
78 \prg_return_true:
79 \else:
80 \prg_return_false:
81 \fi:
82 }
83 % #1 = glyph name
84 % See https://tex.stackexchange.com/q/420167
85 \cs_new_protected:Npn \@@_glyph_from_name:n #1
86 { \tex_XeTeXglyph:D \tex_XeTeXglyphindex:D "#1" \scan_stop: }
87
88 % Centering with fixed width
89 \newcolumntype {C} [1] { > { \centering \arraybackslash } m {#1} }
90 % Empty array rule
91 \newcolumntype {E} { ! { \skip_horizontal:N \arrayrulewidth } }
92
93 \definecolor { encoding @ bg } { HTML } { BDBDBD }
94 \definecolor { reserved @ bg } { HTML } { EA4335 }
95 \definecolor { control @ bg } { HTML } { 4285F4 }
96 \definecolor { nochar @ text } { HTML } { E0E0E0 }
97
98 \cs_set:Npn \NumberStyle { \ttfamily \footnotesize }
99 \cs_set:Npn \GlyphStyle { \SymbolFont \Large }
100 \cs_set:Npn \EncodingStyle
101 { \ttfamily \fontsize { 4 } { 5 } \selectfont \cellcolor { encoding@bg } }
102
103 \cs_set:Npn \GlyphStrut { \@@_set_arstrut:nn { 20 pt } { 10 pt } }
104 \cs_set:Npn \NonUnicodeGlyphStrut { \@@_set_arstrut:nn { 32 pt } { 20 pt } }
105 \cs_set:Npn \NonUnicodeHighGlyphStrut { \@@_set_arstrut:nn { 64 pt } { 40 pt } }
106 \cs_set:Npn \EncodingStrut { \@@_set_arstrut:nn { 4.5 pt } { 1 pt } }
107
108 \dim_const:Nn \c_@@_cell_wd_dim { 30 pt }
109 \dim_const:Nn \c_@@_column_sep_dim { 0 pt }
110 \dim_const:Nn \c_@@_row_number_ht_dim { 20 pt }
111 \dim_const:Nn \c_@@_row_number_sep_dim { 6 pt }
112 \dim_const:Nn \c_@@_non_unicode_wd_dim { 87 pt }
113
114 % The total number of glyphs.
115 \newcounter { glyph }
116 \setcounter { glyph } { -1 }
117
118 % The main function.
119 \NewDocumentCommand \fonttable { s m g }
120 {
121 \IfBooleanTF {#1}
122 { \@@_non_unicode:nn {#2} }
123 { \@@_unicode:nn {#2} {#3} }
124 \clearpage
125 }
126
127 % #1 = section name
128 % #2 = begin/end encoding
129 \cs_new_protected:Npn \@@_unicode:nn #1#2
130 {
131 \tl_set:Nn \l_@@_glyph_count_tl
132 { \ref* { count: glyph @ #1 } / \ref* { count: codepoint @ #1 } }
133 \section { #1 ~ (\tl_use:N \l_@@_glyph_count_tl) }
134 \cs_set_eq:NN \@@_left_foot: \@@_left_foot_unicode:
135 \@@_parse_encoding:n {#2}
136 \int_gzero:N \g_@@_glyph_int
137 \int_gzero:N \g_@@_code_point_int
138 \@@_make_table:
139 \newcounter { glyph @ #1 }
140 \newcounter { codepoint @ #1 }
141 \int_set:cn { c @ glyph @ #1 } { \g_@@_glyph_int - 1 }
142 \int_set:cn { c @ codepoint @ #1 } { \g_@@_code_point_int - 1 }
143 \refstepcounter { glyph @ #1 } \label { count: glyph @ #1 }
144 \refstepcounter { codepoint @ #1 } \label { count: codepoint @ #1 }
145 }
146 \tl_new:N \l_@@_glyph_count_tl
147 \int_new:N \g_@@_glyph_int
148 \int_new:N \g_@@_code_point_int
149
150 \cs_new_protected:Npn \@@_left_foot_unicode:
151 {
152 \mode_leave_vertical:
153 \footnotesize
154 \@@_color_box:nn { reserved @ bg } Reserved~ Code~ Points, \quad
155 \@@_color_box:nn { control @ bg } Control~ Codes.
156 }
157 \cs_new_protected:Npn \@@_color_box:nn #1#2
158 {
159 \group_begin:
160 \color {#1} \rule [ -2 pt ] { 10 pt } { 10 pt }
161 \group_end:
162 \ = \ #2
163 }
164
165 % #1 = `begin` - `end`
166 \cs_new_protected:Npn \@@_parse_encoding:n #1
167 {
168 \seq_set_split:Nnn \l_tmpa_seq { - } {#1}
169 \int_set:Nn \l_@@_begin_int { \seq_item:Nn \l_tmpa_seq { 1 } }
170 \int_set:Nn \l_@@_end_int { \seq_item:Nn \l_tmpa_seq { 2 } }
171 }
172 \int_new:N \l_@@_begin_int
173 \int_new:N \l_@@_end_int
174
175 \cs_new_protected:Npn \@@_make_table:
176 {
177 \longtable { r | * { 16 } { C { \c_@@_cell_wd_dim } | } }
178 \@@_long_table_head:
179 \@@_multi_row:nn
180 { \int_use:N \l_@@_begin_int }
181 { \int_use:N \l_@@_end_int }
182 \endlongtable
183 }
184 \dim_set_eq:NN \tabcolsep \c_@@_column_sep_dim
185
186 % These functions must be expandable:
187 % \@@_long_table_head:, \@@_first_row:,
188 % \@@_multi_row:nn, \@@_row:n, \@@_div_sixteen:n,
189 % \@@_hline:, \@@_set_arstrut:nn, \@@_restore_arstrut:, etc.,
190 % so that `noalign` can work properly.
191 % Hence we use `\cs_new:Npn` and `\int_step_function:nnnN` here.
192
193 \cs_new:Npn \@@_long_table_head:
194 {
195 % It's very hackable here!
196 % The dimension is measured by hand. Not universal at all.
197 \@@_set_arstrut:nn { 0 pt } { 0 pt }
198 \multicolumn { 17 } { c } { \rule { 0 pt } { 1.29 cm } } \\
199 \@@_first_row:
200 \endhead
201 \@@_first_row:
202 \endfirsthead
203 }
204
205 \cs_new:Npn \@@_first_row:
206 {
207 \multicolumn { 17 } { r }
208 {
209 \tabular
210 {
211 % Skip row number
212 r |
213 * { 15 } { C { \c_@@_cell_wd_dim } E }
214 C { \c_@@_cell_wd_dim } |
215 }
216 % I don't know why there are so many `#`.
217 \int_step_inline:nnn { 0 } { 15 }
218 { & \@@_first_row_cell:n {####1} }
219 \endtabular
220 }
221 \\*
222 \@@_hline:
223 }
224 \cs_new_protected:Npn \@@_first_row_cell:n #1
225 { \NumberStyle \int_to_Hex:n {#1} }
226
227 \cs_new:Npn \@@_multi_row:nn #1#2
228 {
229 \int_step_function:nnnN
230 { \@@_div_sixteen:n {#1} * 16 }
231 { 16 }
232 { (\@@_div_sixteen:n {#2} + 1) * 16 - 1 }
233 \@@_row:n
234 }
235 \cs_new:Npn \@@_div_sixteen:n #1
236 { \int_div_truncate:nn {#1} { 16 } }
237
238 \cs_new:Npn \@@_row:n #1
239 {
240 % Glyph row
241 \GlyphStrut
242 % Row number
243 \multirow { 2 } * { \@@_row_nummber:n {#1} }
244 \int_step_inline:nnn {#1} { #1 + 15 }
245 { & \@@_glyph:n {##1} }
246 \\*
247 \@@_restore_arstrut:
248 % Encoding row
249 \@@_hline:
250 \EncodingStrut
251 \int_step_inline:nnn {#1} { #1 + 15 }
252 { & \@@_encoding:n {##1} }
253 \\
254 \@@_hline:
255 }
256
257 % To skip the first column (i.e. row index).
258 % LaTeX3 syntax makes `~` to equal space, so we need to change its catcode temporarily.
259 \group_begin:
260 \char_set_catcode_active:N \~
261 \cs_new:Npn \@@_hline:
262 { \hhline { ~ | * { 16 } { - } } }
263 \group_end:
264
265 \cs_new:Npn \@@_set_arstrut:nn #1#2
266 {
267 \tex_noalign:D
268 {
269 \group_begin:
270 % Store the old strutbox
271 \box_gset_eq:NN \l_@@_old_arstrut_box \@arstrutbox
272 % Change the dimensions of \@arstrutbox
273 \hbox_set_to_wd:Nnn \l_tmpa_box { \c_zero_dim } { }
274 \box_set_ht:Nn \l_tmpa_box {#1}
275 \box_set_dp:Nn \l_tmpa_box {#2}
276 \hbox_gset:Nn \@arstrutbox { \box_use:N \l_tmpa_box }
277 \group_end:
278 }
279 }
280 \cs_new:Npn \@@_restore_arstrut:
281 {
282 \tex_noalign:D
283 { \box_gset_eq:NN \@arstrutbox \l_@@_old_arstrut_box }
284 }
285 \box_new:N \l_@@_old_arstrut_box
286
287 \cs_new_protected:Npn \@@_row_nummber:n #1
288 {
289 \raisebox { \dim_use:N \c_@@_row_number_ht_dim }
290 {
291 \NumberStyle
292 \int_set:Nn \l_tmpa_int { #1 / 16 }
293 \int_compare:nNnTF { \l_tmpa_int } < { "10 }
294 { 00 }
295 {
296 \int_compare:nNnT { \l_tmpa_int } < { "100 }
297 { 0 }
298 }
299 \int_to_Hex:n { \l_tmpa_int }
300 \skip_horizontal:N \c_@@_row_number_sep_dim
301 }
302 }
303
304 \cs_new_protected:Npn \@@_glyph:n #1
305 {
306 \tl_set:Nx \l_tmpa_tl { \int_to_Hex:n {#1} }
307 \seq_if_in:NVTF \c_@@_unicode_reserved_seq \l_tmpa_tl
308 { \cellcolor { reserved@bg } }
309 {
310 \seq_if_in:NVTF \c_@@_unicode_control_seq \l_tmpa_tl
311 { \cellcolor { control@bg } }
312 {
313 % It must be outside `\@@_if_char_exist`
314 \GlyphStyle
315 \@@_if_char_exist:nTF {#1}
316 {
317 \@@_symbol:n {#1}
318 \refstepcounter { glyph }
319 \int_gincr:N \g_@@_glyph_int
320 }
321 {
322 \normalfont
323 \int_compare:nNnTF {#1} < { "10000 }
324 { \BMPFallbackFont } { \SMPFallbackFont }
325 \textcolor { nochar@text } { \@@_symbol:n {#1} }
326 }
327 \int_gincr:N \g_@@_code_point_int
328 }
329 }
330 }
331
332 \cs_new_protected:Npn \@@_encoding:n #1
333 {
334 \group_begin:
335 \EncodingStyle
336 \int_compare:nNnTF {#1} < { "10 }
337 { 000 }
338 {
339 \int_compare:nNnTF {#1} < { "100 }
340 { 00 }
341 {
342 \int_compare:nNnT {#1} < { "1000 }
343 { 0 }
344 }
345 }
346 \int_to_Hex:n {#1}
347 \group_end:
348 }
349
350 % #1 = section name
351 % #2 = non-unicode data file
352 \cs_new_protected:Npn \@@_non_unicode:nn #1#2
353 {
354 \tl_set:Nn \l_@@_glyph_count_tl { \ref* { count: glyph @ non-unicode } }
355 \section { #1 ~ (\tl_use:N \l_@@_glyph_count_tl) }
356 \cs_set_eq:NN \@@_left_foot: \prg_do_nothing:
357 \int_gzero:N \g_@@_non_unicode_glyph_int
358 \@@_non_unicode_print:
359 \newcounter { glyph @ non-unicode }
360 \int_set:cn { c @ glyph @ non-unicode } { \g_@@_non_unicode_glyph_int - 1 }
361 \refstepcounter { glyph @ non-unicode } \label { count: glyph @ non-unicode }
362 \refstepcounter { glyph } \label { count: glyph }
363 }
364 \int_new:N \g_@@_non_unicode_glyph_int
365
366 \cs_new_protected:Npn \@@_non_unicode_print:
367 {
368 \seq_map_inline:Nn \c_@@_glyph_non_unicode_with_type_seq
369 { \@@_non_unicode_print_class:nn ##1 }
370 }
371
372 % #1 = class
373 % #2 = clist of glyph names
374 \cs_new_protected:Npn \@@_non_unicode_print_class:nn #1#2
375 {
376 \subsection { #1 ~ (\clist_count:n {#2}) }
377 \clist_map_inline:nn {#2}
378 {
379 \@@_non_unicode_cell:n {##1}
380 \refstepcounter { glyph }
381 \int_gincr:N \g_@@_non_unicode_glyph_int
382 }
383 }
384
385 \cs_new_protected:Npn \@@_non_unicode_cell:n #1
386 {
387 \tabular { | C { \c_@@_non_unicode_wd_dim } | }
388 % Glyph
389 \hline
390 \NonUnicodeGlyphStrut \GlyphStyle
391 \@@_glyph_from_name:n {#1}
392 \\
393 \@@_restore_arstrut:
394 % Encoding (glyph name)
395 \hline
396 \EncodingStrut \EncodingStyle
397 #1
398 \\
399 \@@_restore_arstrut:
400 \hline
401 \endtabular
402 % A space allowing line break
403 \
404 }
405
406 % Header and footer.
407 \fancyhf { }
408 \fancyhead [ R ] { \thepage }
409 \fancyfoot [ L ]
410 {
411 \footnotesize
412 \int_compare:nNnTF { \int_use:c { c@page } } = { \ztotpages }
413 { \@@_left_foot_last_page: } { \@@_left_foot: }
414 }
415 \fancyfoot [ R ]
416 {
417 \footnotesize \itshape
418 Copyright~ \copyright{}~ 2018--2020~ by~ Xiangdong~ Zeng
419 }
420 % `\headrulewidth` is not a dim variable.
421 \cs_set:Npn \headrulewidth { 0 pt }
422 \cs_new_protected:Npn \@@_left_foot_last_page:
423 {
424 \itshape
425 Other~ fonts~ used~ in~ this~ document:~
426 FiraGO,~ Fira~ Code,~ GNU~ Unifont. \\
427 Colors~ are~ inspired~ by~ Google~ Material~ Design.
428 }
429
430 \ExplSyntaxOff\makeatother
431
432 \geometry{a4paper, hmargin=1cm, vmargin=2.5cm}
433 \ctexset{section/format=\Large\bfseries\centering}
434 \hypersetup{bookmarksnumbered=true, colorlinks=true,
435 linkcolor=[HTML]34A853, urlcolor=[HTML]E91E63}
436
437 \setmainfont{FiraGO}[BoldFont=* SemiBold, Numbers=Monospaced]
438 \setmonofont{Fira Code}[UprightFont=* Light, BoldFont=* Regular]
439
440 \newfontface\BMPFallbackFont{Unifont}
441 \newfontface\SMPFallbackFont{Unifont Upper}
442 \newfontface\SymbolFont{Fira Math Regular}
443
444 \title{\bfseries\huge Fira Math\\
445 \itshape\Large Sans-serif font with Unicode math support}
446 \author{Xiangdong Zeng}
447 \date{2020/10/15\quad v0.3.4}
448
449 \begin{document}
450
451 \newgeometry{hmargin=1.5in, vmargin=1.0in}
452
453 \maketitle
454
455 \begin{abstract}
456 \href{https://github.com/firamath/firamath}{Fira Math} is a sans-serif font
457 with Unicode math support. The design of this font is based on
458 \href{https://github.com/mozilla/Fira}{Fira Sans} and
459 \href{https://bboxtype.com/typefaces/FiraGO}{FiraGO}. Fira Math is distributed
460 in OpenType format, and can be used with
461 \href{https://www.ctan.org/pkg/unicode-math}{unicode-math} package under
462 \hologo{XeTeX} or \hologo{LuaTeX}. There are \ref*{count:glyph} glyphs in
463 Fira Math at present.
464
465 Fira Math is licensed under the
466 \href{http://scripts.sil.org/OFL}{SIL Open Font License}, Version 1.1.
467 \end{abstract}
468
469 \setlength\cftbeforesubsecskip{1ex}
470 \tableofcontents
471
472 \clearpage
473
474 \restoregeometry
475 \pagestyle{fancy}
476
477 \fonttable{C0 Controls and Basic Latin}{"0-"7F}
478 \fonttable{C1 Controls and Latin-1 Supplement}{"80-"FF}
479 \fonttable{Latin Extended-A}{"100-"17F}
480 \fonttable{Latin Extended-B}{"180-"24F}
481 \fonttable{Combining Diacritical Marks}{"300-"36F}
482 \fonttable{Greek and Coptic}{"370-"3FF}
483 \fonttable{Cyrillic}{"400-"4FF}
484 \fonttable{General Punctuation}{"2000-"206F}
485 \fonttable{Currency Symbols}{"20A0-"20CF}
486 \fonttable{Combining Diacritical Marks for Symbols}{"20D0-"20FF}
487 \fonttable{Letterlike Symbols}{"2100-"214F}
488 \fonttable{Number Forms}{"2150-"218F}
489 \fonttable{Arrows}{"2190-"21FF}
490 \fonttable{Mathematical Operators}{"2200-"22FF}
491 \fonttable{Miscellaneous Technical}{"2300-"23FF}
492 \fonttable{Block Elements}{"2580-"259F}
493 \fonttable{Geometric Shapes}{"25A0-"25FF}
494 \fonttable{Miscellaneous Symbols}{"2600-"26FF}
495 \fonttable{Miscellaneous Mathematical Symbols-A}{"27C0-"27EF}
496 \fonttable{Supplemental Arrows-A}{"27F0-"27FF}
497 \fonttable{Supplemental Arrows-B}{"2900-"297F}
498 \fonttable{Miscellaneous Mathematical Symbols-B}{"2980-"29FF}
499 \fonttable{Supplemental Mathematical Operators}{"2A00-"2AFF}
500 \fonttable{Miscellaneous Symbols and Arrows}{"2B00-"2BFF}
501 \fonttable{Alphabetic Presentation Forms}{"FB00-"FB4F}
502 \fonttable{Mathematical Alphanumeric Symbols}{"1D400-"1D7FF}
503 \fonttable{Geometric Shapes Extended}{"1F780-"1F7FF}
504 \fonttable*{Non-Unicode Glyphs}
505
506 \end{document}