mtx-context-fonts.tex /size: 2697 b    last modification: 2020-07-01 14:35
1%D \module
2%D   [       file=mtx-context-fonts,
3%D        version=2018.10.10,
4%D          title=\CONTEXT\ Extra Trickry,
5%D       subtitle=Show Font Info,
6%D         author=Hans Hagen,
7%D           date=\currentdate,
8%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9%C
10%C This module is part of the \CONTEXT\ macro||package and is
11%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12%C details.
13
14% begin help
15%
16% usage: context --extra=fonts [options] name
17%
18% --topspace=dimension  : distance above first line
19% --backspace=dimension : distance before left margin
20% --paperformat=spec    : paper*print or paperxprint
21% --compact             : small margins, 8pt font
22% --verycompact         : small margins, 7pt font
23%
24% example: context --extra=fonts --name=dejavu-serif
25% end help
26
27\input mtx-context-common.tex
28
29\usemodule[fonts-charts]
30\usemodule[fonts-tables]
31
32\input mtx-context-common.tex
33
34\doifdocumentargument {compact} {
35    \setdocumentargument{topspace} {5mm}
36    \setdocumentargument{backspace}{5mm}
37    \setdocumentargument{bodyfont} {8pt}
38}
39
40\doifdocumentargument {verycompact} {
41    \setdocumentargument{topspace} {5mm}
42    \setdocumentargument{backspace}{5mm}
43    \setdocumentargument{bodyfont} {7pt}
44}
45
46\setupbodyfont
47  [dejavu,9pt,tt,\getdocumentargument{bodyfont}] % dejavu is more complete
48
49\setuplayout
50  [header=0cm,
51   footer=1.5cm,
52   topspace=\getdocumentargumentdefault{topspace}{1.5cm},
53   backspace=\getdocumentargumentdefault{backspace}{1.5cm},
54   width=middle,
55   height=middle]
56
57\setuppapersize
58  [\getdocumentargument{paperformat_paper}]
59  [\getdocumentargument{paperformat_print}]
60
61\starttexdefinition unexpanded showfontdetails [#1]
62    \starttitle[title=#1]
63        \startsubject[title=Properties]
64            \showfontproperties[#1]
65        \stopsubject
66        \startsubject[title=Parameters]
67            \showfontparameters[#1]
68        \stopsubject
69        \startsubject[title=Positionings]
70            \showfontpositionings[#1]
71        \stopsubject
72        \startsubject[title=Substitutions]
73            \showfontsubstitutions[#1]
74        \stopsubject
75        \startsubject[title=Unicodevariants]
76            \showfontunicodevariants[#1]
77        \stopsubject
78        \startsubject[title=Ligatures]
79            \showfontligatures[#1]
80        \stopsubject
81        \showfontchart[#1,page=yes]
82    \stoptitle
83\stoptexdefinition
84
85\starttext
86
87    \startluacode
88        local files = document.files
89        if #files > 0 then
90            for i=1,#files do
91                context.showfontdetails { name = files[i] .. "*default" }
92            end
93        else
94            context("No font name(s) given.")
95        end
96    \stopluacode
97
98\stoptext
99