summaryrefslogtreecommitdiff
path: root/tex/context/modules/mkiv/s-fonts-basics.mkiv
blob: 370be35986bb2dee3b9c94be593afd6d38636a11 (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
163
164
165
166
167
168
169
170
171
172
173
174
175
%D \module
%D   [      file=s-fonts-basics, % was 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 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 This module is just a check for \type {luatex-basics-prepare}.

\usemodule[article]

\setupbodyfont[9pt]

\starttext

\definefontfeature
  [boundingbox]
  [boundingbox=yes]

\definefont
  [TestFont]
  [file:arialuni.ttf*boundingbox]

\startluacode

local data = characters.data

local indicscripts = table.sorted {
    "devanagari",
    "kannada",
    "malayalam",
    "tamil",
    "bengali",
    "gurmukhi",
    "gujarati",
    "oriya",
    "telugu",
}

local arabicscripts = table.sorted {
    "arabic",
    "syriac",
    "mandiac",
    "nko",
}

local allindic  = true
local allarabic = true
local dotted    = utf.char(0x25CC)

local left = table.setmetatableindex (
    { r = dotted, b = dotted, t = dotted, s = dotted },
    function(t,k) local v = "" if k then t[k] = v end return v end
)

local right = table.setmetatableindex (
    { l = dotted },
    function(t,k) local v = "" if k then t[k] = v end return v end
)

for i=1,#indicscripts do
    local script = indicscripts[i]
    local first, last = characters.blockrange(script)
    context.starttitle { title = script }
    context.starttabulate { "|Tc|Tc|Tc|Tc|Tc|Tc|Tc|Tp|" }
        context.FL()
        context.BC() context("unicode")
        context.BC() context("glyph")
        context.BC() context("category")
        context.BC() context("indic")
        context.BC() context("mark")
        context.BC() context("class")
        context.BC() context("order")
        context.BC() context("description")
        context.NC() context.NR()
        context.ML()
        for i=first,last do
            local d = data[i]
            if d and d.unicodeslot then
                local indic       = d.indic
                local category    = d.category or "?"
                local description = d.description
                if not indic then
                    context.NC() context("\\red %U",i)
                    context.NC() context("\\red\\showstruts\\strut\\TestFont %c",i)
                    context.NC() context("\\red %s",category)
                    context.NC()
                    context.NC()
                    context.NC()
                    context.NC()
                    context.NC() context(description)
                    context.NC() context.NR()
                else
                    local indicclass = d.indicclass
                    local indicmark  = d.indicmark
                    local indicorder = d.indicorder
                    if allindic or indic == "d" or indicmark or indicclass or indicorder then
                        local l = left [indicmark]
                        local r = right[indicmark]
                        context.NC() context("%U",i)
                        context.NC() context("\\showstruts\\strut\\TestFont %s%c%s",l,i,r)
                        context.NC() context(category)
                        context.NC() context(indic or "?")
                        context.NC() context(indicmark or "")
                        context.NC() context(indicclass or "")
                        context.NC() context(indicorder or "")
                        context.NC() context(description)
                        context.NC() context.NR()
                    end
                end
            end
        end
        context.LL()
    context.stoptabulate()
    context.stoptitle()
end

for i=1,#arabicscripts do
    local script = arabicscripts[i]
    local first, last = characters.blockrange(script)
    context.starttitle { title = script }
    context.starttabulate { "|Tc|Tc|Tc|Tc|Tp|" }
        context.FL()
        context.BC() context("unicode")
        context.BC() context("glyph")
        context.BC() context("category")
        context.BC() context("arabic")
        context.BC() context("description")
        context.NC() context.NR()
        context.ML()
        for i=first,last do
            local d = data[i]
            if d and d.unicodeslot then
                local arabic      = d.arabic
                local category    = d.category or ""
                local description = d.description or ""
                if arabic then
                    context.NC() context("%U",i)
                    context.NC() context("\\showstruts\\strut\\TestFont %c",i)
                    context.NC() context(category)
                    context.NC() context(arabic)
                    context.NC() context(description)
                    context.NC() context.NR()
                elseif allarabic then
                    context.NC() context("\\red %U",i)
                    context.NC() context("\\red\\showstruts\\strut\\TestFont %c",i)
                    context.NC() context("\\red %s",category)
                    context.NC()
                    context.NC() context("\\red %s",description)
                    context.NC() context.NR()
                end
            end
        end
        context.LL()
    context.stoptabulate()
    context.stoptitle()
end

-- local olddata  = io.loaddata("char-def.lua")
-- local preamble = string.gsub(olddata,"characters%.data%s*=%s*%{.*","")

-- local newdata = table.serialize(data,"characters.data", { hexify = true, noquotes = true })
-- local newdata = string.gsub(newdata,"%{%s+%[0xFE0E%]=\"text style\",%s+%[0xFE0F%]=\"emoji style\",%s+%}","variants_emoji")

-- io.savedata("char-def-new.lua",newdata)

\stopluacode

\stoptext