%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] % ,\c!frame=\v!on]
        \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

\startsetups module:showallglyphshapes:stop

    % nothing

\stopsetups

\unexpanded\def\modulefontsstartshowglyphshapes{\setups[module:showallglyphshapes:start]}
\unexpanded\def\modulefontsstopshowglyphshapes {\setups[module:showallglyphshapes:stop]}

\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{file:stix2math.otf}{20bp}{0x1D44A}\stopTEXpage
    \startTEXpage[offset=0pt]\ShowGlyphShape{file:stix2math.otf}{20bp}{0x1D44C}\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

% \startTEXpage[offset=0pt]\ShowGlyphShape{file:husayninotebold.ttf}{50bp}{0xF034A}\stopTEXpage
% \startTEXpage[offset=0pt]\ShowGlyphShape{file:husayninotebold.ttf}{50bp}{0x006DD}\stopTEXpage
% \startTEXpage[offset=0pt]\ShowGlyphShape{file:husayninotebold.ttf}{50bp}{0x006DD}\stopTEXpage
% \startTEXpage[offset=0pt]\ShowGlyphShape{file:arabtype.ttf}{50bp}{0x0FCA1}\stopTEXpage

% \showallglyphshapes[name=name:cambria-math,size=100bp]
% \showallglyphshapes[name=name:arabtype,size=100bp]
% \showallglyphshapes[name=file:husayninotebold.ttf,size=100bp]
% \showallglyphshapes[name=name:dejavuserif,size=100bp]

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

\stoptext
