• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

sile-typesetter / sile / 11770252752

11 Nov 2024 01:09AM UTC coverage: 32.853% (-27.5%) from 60.402%
11770252752

Pull #2164

github

web-flow
chore(deps): Bump DeterminateSystems/nix-installer-action from 14 to 15

Bumps [DeterminateSystems/nix-installer-action](https://github.com/determinatesystems/nix-installer-action) from 14 to 15.
- [Release notes](https://github.com/determinatesystems/nix-installer-action/releases)
- [Commits](https://github.com/determinatesystems/nix-installer-action/compare/v14...v15)

---
updated-dependencies:
- dependency-name: DeterminateSystems/nix-installer-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #2164: chore(deps): Bump DeterminateSystems/nix-installer-action from 14 to 15

5855 of 17822 relevant lines covered (32.85%)

2493.73 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/packages/math/unicode-mathvariants.lua
1
local scriptType = {
×
2
   upright = 1,
3
   boldScript = 2,
4
   boldItalic = 3,
5
   -- tailed = 4,
6
   bold = 5,
7
   fraktur = 6,
8
   script = 7,
9
   initial = 8,
10
   monospace = 9,
11
   sansSerif = 10,
12
   doubleStruck = 11,
13
   -- looped = 12,
14
   -- stretched = 13,
15
   italic = 14,
16
   boldFraktur = 15,
17
   sansSerifBoldItalic = 16,
18
   sansSerifItalic = 17,
19
   boldSansSerif = 18,
20
}
21

22
local mathVariantAttribute = {
×
23
   normal = scriptType.upright,
24
   ["bold-script"] = scriptType.boldScript, -- MathML Core "bold-script" (annex C.1)
25
   ["bold-italic"] = scriptType.boldItalic, --MathML Core "bold-italic" (annex C.2)
26
   -- tailed = scriptType.tailed, -- MathML Core "tailed" (annex C.3) not supported yet
27
   bold = scriptType.bold, -- MathML Core "bold" (annex C.4)
28
   fraktur = scriptType.fraktur, --MatML Core "bold" (annex C.5)
29
   script = scriptType.script, -- MathML Core "script" (annex C.6)
30
   monospace = scriptType.monospace, -- MathML Core "monospace" (annex C.7)
31
   -- initial = scriptType.initial, -- MathML Core "initial" (annex C.8) not supported yet
32
   ["sans-serif"] = scriptType.sansSerif, -- MathML Core "sans-serif" (annex C.9)
33
   ["double-struck"] = scriptType.doubleStruck, -- MathML Core "double-struck" (annex C.10)
34
   -- looped = scriptType.looped, -- MathML Core "looped" (annex C.11) not supported yet
35
   -- stretched = scriptType.stretched,-- MathML Core "stretched" (annex C.12) not supported yet
36
   italic = scriptType.italic, --MathML Core "italic" (annex C.13)
37
   ["bold-fraktur"] = scriptType.boldFraktur, --MathML Core "bold-fraktur" (annex C.14)
38
   ["sans-serif-bold-italic"] = scriptType.sansSerifBoldItalic, --MathML Core "sans-serif-bold-italic" (annex C.15)
39
   ["sans-serif-italic"] = scriptType.sansSerifItalic, --MathML Core "sans-serif-italic" (annex C.16)
40
   ["bold-sans-serif"] = scriptType.boldSansSerif, --MathML Core "sans-serif-bold" (annex C.17)
41
}
42

43
local function mathVariantToScriptType (attr)
44
   if mathVariantAttribute[attr] then
×
45
      return mathVariantAttribute[attr]
×
46
   end
47
end
48

49
local mathScriptConversionTable = {
×
50
   latinUpper = {
×
51
      [scriptType.upright] = function (codepoint)
×
52
         return codepoint
×
53
      end,
54
      [scriptType.boldScript] = function (codepoint)
×
55
         -- MathML Core "bold-script" (annex C.1)
56
         return codepoint + 0x1D4D0 - 0x41
×
57
      end,
58
      [scriptType.boldItalic] = function (codepoint)
×
59
         -- MathML Core "bold-italic" (annex C.2)
60
         return codepoint + 0x1D468 - 0x41
×
61
      end,
62
      [scriptType.bold] = function (codepoint)
×
63
         -- MathML Core "bold" (annex C.4)
64
         return codepoint + 0x1D400 - 0x41
×
65
      end,
66
      [scriptType.doubleStruck] = function (codepoint)
×
67
         -- MathML Core "double-struck" (annex C.10)
68
         return codepoint == 0x43 and 0x2102 -- C
×
69
            or codepoint == 0x48 and 0x210D -- H
×
70
            or codepoint == 0x4E and 0x2115 -- N
×
71
            or codepoint == 0x50 and 0x2119 -- P
×
72
            or codepoint == 0x51 and 0x211A -- Q
×
73
            or codepoint == 0x52 and 0x211D -- R
×
74
            or codepoint == 0x5A and 0x2124 -- Z
×
75
            or codepoint + 0x1D538 - 0x41
×
76
      end,
77
      [scriptType.fraktur] = function (codepoint)
×
78
         -- MathML Core "fraktur" (annex C.5)
79
         return codepoint == 0x43 and 0x212D -- C
×
80
            or codepoint == 0x48 and 0x210B -- H
×
81
            or codepoint == 0x49 and 0x2110 -- I
×
82
            or codepoint == 0x52 and 0x211C -- R
×
83
            or codepoint == 0x5A and 0x2128 -- Z
×
84
            or codepoint + 0x1D504 - 0x41
×
85
      end,
86
      [scriptType.script] = function (codepoint)
×
87
         -- MathML Core "script" (annex C.6)
88
         return codepoint == 0x42 and 0x212C -- B
×
89
            or codepoint == 0x45 and 0x2130 -- E
×
90
            or codepoint == 0x46 and 0x2131 -- F
×
91
            or codepoint == 0x48 and 0x210B -- H
×
92
            or codepoint == 0x49 and 0x2110 -- I
×
93
            or codepoint == 0x4C and 0x2112 -- L
×
94
            or codepoint == 0x4D and 0x2133 -- M
×
95
            or codepoint == 0x52 and 0x211D -- R
×
96
            or codepoint + 0x1D49C - 0x41
×
97
      end,
98
      [scriptType.monospace] = function (codepoint)
×
99
         -- MathML Core "monospace" (annex C.7)
100
         return codepoint + 0x1D670 - 0x41
×
101
      end,
102
      [scriptType.sansSerif] = function (codepoint)
×
103
         -- MathML Core "sans-serif" (annex C.9)
104
         return codepoint + 0x1D5A0 - 0x41
×
105
      end,
106
      [scriptType.italic] = function (codepoint)
×
107
         -- MathML Core "italic" (annex C.13)
108
         return codepoint + 0x1D434 - 0x41
×
109
      end,
110
      [scriptType.boldFraktur] = function (codepoint)
×
111
         -- MathML Core "bold-fraktur" (annex C.14)
112
         return codepoint + 0x1D56C - 0x41
×
113
      end,
114
      [scriptType.sansSerifBoldItalic] = function (codepoint)
×
115
         -- MathML Core "sans-serif-bold-italic" (annex C.15)
116
         return codepoint + 0x1D63C - 0x41
×
117
      end,
118
      [scriptType.sansSerifItalic] = function (codepoint)
×
119
         -- MathML Core "sans-serif-italic" (annex C.16)
120
         return codepoint + 0x1D608 - 0x41
×
121
      end,
122
      [scriptType.boldSansSerif] = function (codepoint)
×
123
         -- MathML Core "sans-serif-bold" (annex C.17)
124
         return codepoint + 0x1D5D4 - 0x41
×
125
      end,
126
   },
127
   latinLower = {
×
128
      [scriptType.upright] = function (codepoint)
×
129
         return codepoint
×
130
      end,
131
      [scriptType.boldScript] = function (codepoint)
×
132
         -- MathML Core "bold-script" (annex C.1)
133
         return codepoint + 0x1D4EA - 0x61
×
134
      end,
135
      [scriptType.boldItalic] = function (codepoint)
×
136
         -- MathML Core "bold-italic" (annex C.2)
137
         return codepoint + 0x1D482 - 0x61
×
138
      end,
139
      [scriptType.bold] = function (codepoint)
×
140
         -- MathML Core "bold" (annex C.4)
141
         return codepoint + 0x1D41A - 0x61
×
142
      end,
143
      [scriptType.doubleStruck] = function (codepoint)
×
144
         -- MathML Core "double-struck" (annex C.10)
145
         return codepoint + 0x1D552 - 0x61
×
146
      end,
147
      [scriptType.fraktur] = function (codepoint)
×
148
         -- MathML Core "fraktur" (annex C.5)
149
         return codepoint + 0x1D51E - 0x61
×
150
      end,
151
      [scriptType.script] = function (codepoint)
×
152
         -- MathML Core "script" (annex C.6)
153
         return codepoint == 0x65 and 0x212F -- e
×
154
            or codepoint == 0x67 and 0x210A -- g
×
155
            or codepoint == 0x6F and 0x2134 -- o
×
156
            or codepoint + 0x01D4B6 - 0x61
×
157
      end,
158
      [scriptType.monospace] = function (codepoint)
×
159
         -- MathML Core "monospace" (annex C.7)
160
         return codepoint + 0x1D68A - 0x61
×
161
      end,
162
      [scriptType.sansSerif] = function (codepoint)
×
163
         -- MathML Core "sans-serif" (annex C.9)
164
         return codepoint + 0x1D5BA - 0x61
×
165
      end,
166
      [scriptType.italic] = function (codepoint)
×
167
         -- MathML Core "italic" (annex C.13)
168
         return codepoint == 0x68 and 0x210E -- h
×
169
            or codepoint + 0x1D44E - 0x61
×
170
      end,
171
      [scriptType.boldFraktur] = function (codepoint)
×
172
         -- MathML Core "bold-fraktur" (annex C.14)
173
         return codepoint + 0x1D586 - 0x61
×
174
      end,
175
      [scriptType.sansSerifBoldItalic] = function (codepoint)
×
176
         -- MathML Core "sans-serif-bold-italic" (annex C.15)
177
         return codepoint + 0x1D656 - 0x61
×
178
      end,
179
      [scriptType.sansSerifItalic] = function (codepoint)
×
180
         -- MathML Core "sans-serif-italic" (annex C.16)
181
         return codepoint + 0x1D622 - 0x61
×
182
      end,
183
      [scriptType.boldSansSerif] = function (codepoint)
×
184
         -- MathML Core "sans-serif-bold" (annex C.17)
185
         return codepoint + 0x1D5EE - 0x61
×
186
      end,
187
   },
188
   number = {
×
189
      [scriptType.upright] = function (codepoint)
×
190
         return codepoint
×
191
      end,
192
      [scriptType.bold] = function (codepoint)
×
193
         -- MathML Core "bold" (annex C.4)
194
         return codepoint + 0x1D7CE - 0x30
×
195
      end,
196
      [scriptType.monospace] = function (codepoint)
×
197
         -- MathML Core "monospace" (annex C.7)
198
         return codepoint + 0x1D7F6 - 0x30
×
199
      end,
200
      [scriptType.sansSerif] = function (codepoint)
×
201
         -- MathML Core "sans-serif" (annex C.9)
202
         return codepoint + 0x1D7E2 - 0x30
×
203
      end,
204
      [scriptType.doubleStruck] = function (codepoint)
×
205
         -- MathML Core "double-struck" (annex C.10)
206
         return codepoint + 0x1D7D8 - 0x30
×
207
      end,
208
      [scriptType.boldSansSerif] = function (codepoint)
×
209
         -- MathML Core "sans-serif-bold" (annex C.17)
210
         return codepoint + 0x1D7EC - 0x30
×
211
      end,
212
   },
213
   greekUpper = {
×
214
      [scriptType.upright] = function (codepoint)
×
215
         return codepoint
×
216
      end,
217
      [scriptType.boldItalic] = function (codepoint)
×
218
         -- MathML Core "bold-italic" (annex C.2)
219
         -- TODO NOT ADDRESSED
220
         -- ∇ U+2207 𝜵 U+1D735
221
         return codepoint == 0x3F4 and 0x1D6A - 0x391 -- capital theta
×
222
            or codepoint + 0x1D71C - 0x391
×
223
      end,
224
      [scriptType.bold] = function (codepoint)
×
225
         -- MathML Core "italic" (annex C.4)
226
         -- TODO NOT ADDRESSED
227
         -- ∇ U+2207 𝛁 U+1D6C1
228
         -- ϴ U+03F4 𝚹 U+1D6B9
229
         return codepoint + 0x1D6A8 - 0x391
×
230
      end,
231
      [scriptType.italic] = function (codepoint)
×
232
         -- MathML Core "italic" (annex C.13)
233
         -- TODO NOT ADDRESSED
234
         -- ϴ U+03F4 𝛳 U+1D6F3
235
         -- ∇ U+2207 𝛻 U+1D6FB
236
         return codepoint + 0x1D6E2 - 0x391
×
237
      end,
238
      [scriptType.sansSerifBoldItalic] = function (codepoint)
×
239
         -- MathML Core "sans-serif-bold-italic" (annex C.15)
240
         -- TODO NOT ADDRESSED
241
         -- ϴ U+03F4 𝞡 U+1D7A1
242
         -- ∇ U+2207 𝞩 U+1D7A9
243
         return codepoint + 0x1D790 - 0x391
×
244
      end,
245
      [scriptType.boldSansSerif] = function (codepoint)
×
246
         -- MathML Core "sans-serif-italic" (annex C.17)
247
         -- TODO NOT ADDRESSED
248
         -- ϴ U+03F4 𝝧 U+1D767
249
         -- ∇ U+2207 𝝯 U+1D76F
250
         return codepoint + 0x1D756 - 0x391
×
251
      end,
252
   },
253
   greekLower = {
×
254
      [scriptType.upright] = function (codepoint)
×
255
         return codepoint
×
256
      end,
257
      [scriptType.boldItalic] = function (codepoint)
×
258
         -- MathML Core "bold-italic" (annex C.2)
259
         -- TODO NOT ADDRESSED
260
         -- ϑ U+03D1 𝝑 U+1D751
261
         -- ϰ U+03F0 𝝒 U+1D752
262
         -- ϕ U+03D5 𝝓 U+1D753
263
         -- ϱ U+03F1 𝝔 U+1D754
264
         -- ϖ U+03D6 𝝕 U+1D755
265
         return codepoint + 0x1D736 - 0x3B1
×
266
      end,
267
      [scriptType.bold] = function (codepoint)
×
268
         -- MathML Core "italic" (annex C.4)
269
         -- TODO NOT ADDRESSED
270
         -- ϵ U+03F5 𝛜 U+1D6DC
271
         -- ϑ U+03D1 𝛝 U+1D6DD
272
         -- ϰ U+03F0 𝛞 U+1D6DE
273
         -- ϕ U+03D5 𝛟 U+1D6DF
274
         -- ϱ U+03F1 𝛠 U+1D6E0
275
         -- ϖ U+03D6 𝛡 U+1D6E1
276
         -- Ϝ U+03DC 𝟊 U+1D7CA
277
         -- ϝ U+03DD 𝟋 U+1D7CB
278
         return codepoint + 0x1D6C2 - 0x3B1
×
279
      end,
280
      [scriptType.italic] = function (codepoint)
×
281
         -- MathML Core "italic" (annex C.13)
282
         -- TODO NOT ADDRESSED
283
         -- ϵ U+03F5 𝜖 U+1D716
284
         -- ϑ U+03D1 𝜗 U+1D717
285
         -- ϰ U+03F0 𝜘 U+1D718
286
         -- ϕ U+03D5 𝜙 U+1D719
287
         -- ϱ U+03F1 𝜚 U+1D71A
288
         -- ϖ U+03D6 𝜛 U+1D71B
289
         return codepoint + 0x1D6FC - 0x3B1
×
290
      end,
291
      [scriptType.sansSerifBoldItalic] = function (codepoint)
×
292
         -- MathML Core "sans-serif-bold-italic" (annex C.15)
293
         -- TODO NOT ADDRESSED
294
         -- ∂ U+2202 𝟃 U+1D7C3
295
         -- ϵ U+03F5 𝟄 U+1D7C4
296
         -- ϑ U+03D1 𝟅 U+1D7C5
297
         -- ϰ U+03F0 𝟆 U+1D7C6
298
         -- ϕ U+03D5 𝟇 U+1D7C7
299
         -- ϱ U+03F1 𝟈 U+1D7C8
300
         -- ϖ U+03D6 𝟉 U+1D7C9
301
         return codepoint + 0x1D7AA - 0x3B1
×
302
      end,
303
      [scriptType.boldSansSerif] = function (codepoint)
×
304
         -- MathML Core "sans-serif-italic" (annex C.17)
305
         -- TODO NOT ADDRESSED
306
         -- ∂ U+2202 𝞉 U+1D789
307
         -- ϵ U+03F5 𝞊 U+1D78A
308
         -- ϑ U+03D1 𝞋 U+1D78B
309
         -- ϰ U+03F0 𝞌 U+1D78C
310
         -- ϕ U+03D5 𝞍 U+1D78D
311
         -- ϱ U+03F1 𝞎 U+1D78E
312
         -- ϖ U+03D6 𝞏 U+1D78F
313
         return codepoint + 0x1D770 - 0x3B1
×
314
      end,
315
   },
316
}
317

318
local function convertMathVariantScript (text, script)
319
   local converted = ""
×
320
   for _, uchr in luautf8.codes(text) do
×
321
      local dst_char = luautf8.char(uchr)
×
322
      local converter
323
      if uchr >= 0x41 and uchr <= 0x5A then
×
324
         converter = mathScriptConversionTable.latinUpper[script]
×
325
      elseif uchr >= 0x61 and uchr <= 0x7A then
×
326
         converter = mathScriptConversionTable.latinLower[script]
×
327
      elseif uchr >= 0x30 and uchr <= 0x39 then
×
328
         converter = mathScriptConversionTable.number[script]
×
329
      elseif uchr >= 0x391 and uchr <= 0x3A9 and uchr ~= 0x3A2 then
×
330
         converter = mathScriptConversionTable.greekUpper[script]
×
331
      elseif uchr >= 0x3B1 and uchr <= 0x3C9 then
×
332
         converter = mathScriptConversionTable.greekLower[script]
×
333
      end
334
      dst_char = converter and luautf8.char(converter(uchr)) or dst_char
×
335
      converted = converted .. dst_char
×
336
   end
337
   return converted
×
338
end
339

340
return {
×
341
   mathVariantToScriptType = mathVariantToScriptType,
342
   scriptType = scriptType,
343
   convertMathVariantScript = convertMathVariantScript,
344
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc