%D \module
%D   [      file=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.

\startluacode

    local fontdata = fonts.hashes.identifiers

    function fonts.tracers.shapes() -- todo: ranges
        local NC, NR = context.NC, context.NR
        local char = context.char
        local chrs = fontdata[font.current()].characters
     -- local desc = fontdata[font.current()].descriptions
        context.starttabulate { "|l|c|c|c|c|l|" }
            context.FL()
                NC() context("unicode")
                NC() context("glyph")
                NC() context("shape")
                NC() context("lower")
                NC() context("upper")
             -- NC() context("name")
                NC() context("description")
                NC() NR()
            context.TL()
            for k, v in next, characters.data do
                if chrs[k] then
                    NC() context("0x%05X",k)
                    NC() char(k)
                    NC() char(v.shcode)
                    NC() char(v.lccode or k)
                    NC() char(v.uccode or k)
                 -- NC() context(desc[k].name)
                    NC() context(v.description)
                    NC() NR()
                end
            end
        context.stoptabulate()
    end

\stopluacode

\continueifinputfile{s-fnt-29.mkiv}

\setupbodyfont[dejavu,tt,9pt]

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

\setupfootertexts
  []
  [\fontname\font\quad\pagenumber]

\starttext

    \ctxlua{fonts.tracers.shapes()}

\stoptext
