summaryrefslogtreecommitdiff
path: root/tex/context/modules/mkiv/s-fonts-shapes.mkiv
blob: 4a0377adaeef51efa779264ae55b4742936da218 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
%D \module
%D   [      file=s-fonts-shapes, % s-fnt-29,
%D        version=2010.09.27,
%D          title=\CONTEXT\ Style File,
%D       subtitle=Tracing Shapes,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

%D I will redo this module (using outlines).

\startmodule[fonts-shapes]

\registerctxluafile{s-fonts-shapes}{}

\installmodulecommandluasingle \showfontshapes          {moduledata.fonts.shapes.showlist}
\installmodulecommandluasingle \showglyphshape          {moduledata.fonts.shapes.showglyphshape}
\installmodulecommandluatwo    \showlastglyphshapefield {moduledata.fonts.shapes.showlastglyphshapefield}
\installmodulecommandluasingle \showallglyphshapes      {moduledata.fonts.shapes.showallglypshapes}

\let\modulefontsstartshowglyphshape\gobblethreearguments
\let\modulefontsstopshowglyphshape \relax

\unprotect

\startsetups module:showallglyphshapes:start

    \unexpanded\def\modulefontsstartshowglyphshape##1##2##3{
        \startTEXpage[\c!offset=\exheight]
        \edef\lastshownglyphshapefieldunicode{##1}%
        \edef\lastshownglyphshapefieldname   {##2}%
        \edef\lastshownglyphshapefieldindex  {##3}%
        \raggedcenter
    }

    \unexpanded\def\modulefontsstopshowglyphshape {
        \par
        \doifsomething {\lastshownglyphshapefieldunicode} {
            \begingroup
                \dontleavehmode
                \tttf
                \setstrut
                \strut
                0x\uchexnumbers\lastshownglyphshapefieldunicode
                \space:\space
                \lastshownglyphshapefieldname
                \space:\space
                \lastshownglyphshapefieldindex
                \par
            \endgroup
        }
        \stopTEXpage
    }

\stopsetups

\protect

% downward compatibility:

\unexpanded\def\ShowGlyphShape#1#2#3% name size glyph
  {\ctxlua{moduledata.fonts.shapes.showglyphshape { name = "#1", size = "#2", character = "#3" } }}

\stopmodule

\continueifinputfile{s-fonts-shapes.mkiv}

\setupbodyfont[dejavu,9pt]

\setuplayout
  [backspace=1cm,
   topspace=1cm,
   footer=1cm,
   header=0cm,
   height=middle,
   width=middle]

\setupfootertexts
  []
  [\saveddefinedfontname\quad\pagenumber]

\starttext

%     \savedefinedfont[Bold*default]
%     \showfontshapes[number=\saveddefinedfontid]
%     \page

%     \showfontshapes[name=BoldItalic*default]
%     \page

    % \startTEXpage \ShowGlyphShape{simplenaskhi}{100bp}{0x62A}       \stopTEXpage
    % \startTEXpage \ShowGlyphShape{simplenaskhi}{100bp}{0x2004}      \stopTEXpage
    % \startTEXpage \ShowGlyphShape{simplenaskhi}{100bp}{0xF0299}     \stopTEXpage
    % \startTEXpage \ShowGlyphShape{simplenaskhi}{100bp}{NameMe.1190} \stopTEXpage

%     \startTEXpage[offset=0pt]\ShowGlyphShape{name:cambria-math}{20bp}{0x00066}\stopTEXpage
%     \startTEXpage[offset=0pt]\ShowGlyphShape{name:cambria-math}{20bp}{0x1D453}\stopTEXpage
%     \startTEXpage[offset=0pt]\ShowGlyphShape{name:cambria-math}{20bp}{0x1D43F}\stopTEXpage
%     \startTEXpage[offset=0pt]\ShowGlyphShape{name:cambria-math}{50bp}{0x1D444}\stopTEXpage
%     \startTEXpage[offset=0pt]\ShowGlyphShape{name:cambria-math}{50bp}{0x1D447}\stopTEXpage
%     \startTEXpage[offset=0pt]\ShowGlyphShape{name:cambria-math}{50bp}{0x02112}\stopTEXpage
%     \startTEXpage[offset=0pt]\ShowGlyphShape{name:cambria-math}{50bp}{0x1D432}\stopTEXpage
%     \startTEXpage[offset=0pt]\ShowGlyphShape{name:cambria-math}{50bp}{0x1D43D}\stopTEXpage
%     \startTEXpage[offset=0pt]\ShowGlyphShape{name:cambria-math}{50bp}{0x1D44A}\stopTEXpage
%     \startTEXpage[offset=0pt]\ShowGlyphShape{name:cambria-math}{50bp}{0x1D45D}\stopTEXpage
%     \page

\showallglyphshapes[name=name:cambria-math,size=100bp]
% \showallglyphshapes[name=name:dejavuserif,size=100bp]

% \showallglyphshapes[name=file:brill.otf,size=100bp]
% \showallglyphshapes[name=file:minionmath-regular.otf,size=100bp]

\stoptext