summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/s-fnt-10.tex
blob: 95e9282b8b210267c7890e381235b07440264591 (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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
%D \module
%D   [      file=s-fnt-01,
%D        version=2006.10.10, % guess
%D          title=\CONTEXT\ Style File,
%D       subtitle=Listing Glyphs in Large Fonts,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA / Hans Hagen \& Ton Otten}]
%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 format, sprint = string.format, tex.sprint

function fonts.otf.show_all()
    local tfmdata = fonts.ids[font.current()]
    if tfmdata and tfmdata.shared then
        local otfdata = tfmdata.shared.otfdata
        if otfdata and otfdata.luatex then
            local unicodes = otfdata.luatex.unicodes
            sprint(tex.ctxcatcodes,format("\\starttabulate[|l|r|c|]"))
            for i, name in ipairs(table.sortedkeys(unicodes)) do
                local unicode = unicodes[name]
                if unicode >= 0 then
                    sprint(tex.ctxcatcodes,format("\\NC %s \\NC %s \\NC \\char%s \\NC\\NR",name,unicode,unicode))
                end
            end
            sprint(tex.ctxcatcodes,format("\\stoptabulate"))
        end
    end
end

function fonts.show_all()
    local tfmdata = fonts.ids[font.current()]
    if tfmdata then
        local chars = tfmdata.characters
        local descs = tfmdata.descriptions or { }
        local data = characters.data
        sprint(tex.ctxcatcodes,format("\\setuptabulate[header=repeat]"))
        sprint(tex.ctxcatcodes,format("\\starttabulatehead"))
        sprint(tex.ctxcatcodes,"\\NC\\bf unicode\\NC\\bf visual\\NC\\bf index\\NC\\bf glyph\\NC\\bf adobe\\NC\\bf context\\NC\\NR")
        sprint(tex.ctxcatcodes,"\\HL")
        sprint(tex.ctxcatcodes,format("\\stoptabulatehead"))
        sprint(tex.ctxcatcodes,format("\\starttabulate[|l|c|l|p|p|p|]"))
        for k, unicode in ipairs(table.sortedkeys(chars)) do
            if unicode >= 0 then
                local chr, des, dat = chars[unicode], descs[unicode], data[unicode]
                local index = chr.index or 0
                local cname = (dat and dat.contextname) or ""
                local aname = (dat and dat.adobename) or ""
                local gname = (des and des.name) or ""
                local mname = dat and dat.mathname
                if type(mname) ~= "string" then
                    mname = ""
                end
                local mspec = dat and dat.mathspec
                if mspec then
                    for m=1,#mspec do
                        local n = mspec[m].name
                        if n then
                            if mname == "" then
                                mname = n
                            else
                                mname = mname .. " " .. n
                            end
                        end
                    end
                end
                if mname ~= "" then
                    mname = "m: " .. mname
                    if cname ~= "" then
                        cname = cname .. " " .. mname
                    else
                        cname = mname
                    end
                end
                sprint(tex.ctxcatcodes,format("\\NC\\tttf U+%05X\\NC\\char%s\\NC\\tttf %05X\\NC\\tttf %s\\NC\\tttf %s\\NC\\tttf %s\\NC\\NR",unicode,unicode,index,gname,aname,cname))
            end
        end
        sprint(tex.ctxcatcodes,format("\\stoptabulate"))
    else
        sprint(tex.ctxcatcodes,"problems")
    end
end

function fonts.show_glyphs()
    local tfmdata = fonts.ids[font.current()]
    if tfmdata then
        local chars = tfmdata.characters
        for k, v in ipairs(table.sortedkeys(chars)) do
            if v >=0 then
                sprint(tex.ctxcatcodes,format("\\dontleavehmode{\\strut\\char%s}\\endgraf",v))
            end
        end
    end
end
\stopluacode

\def\ShowCompleteFont#1#2#3%
  {\bgroup
   \page
   \font\TestFont=#1 at #2
   \setuplayout[style=\TestFont]
   \setupheadertexts[]
   \setupfootertexts[#1 -- \pagenumber]
   \setupfootertexts[pagenumber]
   \setuplayout[width=middle,height=middle,topspace=1cm,backspace=1cm]
   \TestFont
   \nonknuthmode
   \startcolumns[n=#3]
   \TestFont
   \ctxlua { fonts.show_all() }
   \stopcolumns
   \page
   \egroup}

\def\ShowAllGlyphs#1#2#3%
  {\bgroup
   \page
   \font\TestFontA=#1 at 12pt
   \font\TestFontB=#1 at #2
   \setuplayout[style=\TestFontA]
   \setupheadertexts[]
   \setupfootertexts[#1 -- \pagenumber]
   \setuplayout[width=middle,height=middle,topspace=1cm,backspace=1cm,header=1cm,footer=2cm]
   \TestFontB \setupinterlinespace[line=1.2\dimexpr#2\relax] \raggedcenter
   \nonknuthmode
   \startcolumns[n=#3]
   \TestFontB
   \ctxlua { fonts.show_glyphs() }
   \stopcolumns
   \page
   \egroup}

\endinput

\starttext

% \ShowCompleteFont{name:dejavusansmono}{10pt}{2}
% \ShowCompleteFont{name:dejavuserif}{10pt}{2}
% \ShowCompleteFont{name:officinasansbookitcregular}{10pt}{2}
% \ShowCompleteFont{name:officinaserifbookitcregular}{10pt}{2}
% \ShowCompleteFont{name:serpentineserifeflight}{10pt}{2}
% \ShowCompleteFont{name:lmtypewriter10-regular}{10pt}{2}
% \ShowCompleteFont{lt55485}{10pt}{2}
% \ShowCompleteFont{lmr10}{10pt}{2}
% \ShowCompleteFont{lbr}{10pt}{2}
% \ShowCompleteFont{name:Cambria}{10pt}{2}
% \ShowCompleteFont{name:CambriaMath}{10pt}{2}
% \ShowCompleteFont{name:texgyrepagella-regular}{10pt}{2}
% \ShowCompleteFont{name:texgyrechorus-mediumitalic}{10pt}{2}
% \ShowAllGlyphs   {name:texgyrepagella-regular}    {48pt}{2}
% \ShowAllGlyphs   {name:texgyrechorus-mediumitalic}{48pt}{2}
% \ShowCompleteFont{name:euler10-regular}{10pt}{2}

% \ShowCompleteFont{name:palatinosansinformalcombold}{20pt}{2}
% \ShowCompleteFont{name:palatinonovaregular}{11pt}{2}
% \ShowCompleteFont{name:optimanovaltregular}{11pt}{2}

\stoptext