-
Notifications
You must be signed in to change notification settings - Fork 6
/
subset.mjs
executable file
·53 lines (48 loc) · 1.31 KB
/
subset.mjs
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
#!/usr/bin/env zx
const chars = [
'U+A0', // NBSP
'U+AD', // Soft Hyphen
'U+61C', // Arabic letter mark (ALM)
// Whitespaces, joiners, marks, and separators
'U+2000-200F',
'U+2028-202F',
'U+2060-206D',
'U+FEFF', // BOM
]
const chars_text = `
!"#$%&'()*+,-./0123456789:;<=>[\\]_{}«»·
،
ؘؘؙؚ؛
؟
ءآأؤإئابةتثجحخد
ذرزسشصضطظعغ
ـفقكلمنهوىيًٌٍَُ
ِّْٕٜٖٓٔ
٠١٢٣٤٥٦٧٨٩٪٫٬
ٰٱ
ی
۔
ۖۗۘۙۚۛۜ۟
ۣ۠ۡۢۤۥۦ۪ۭۧۨ۫۬
ࣰࣱࣲ
ࣳ
‐‑‒–—―‘’“”
•…‧
‹›
−
∙
﴾﴿
ﷲ
`.replaceAll('\n', '').trim()
const phrases = [
'U+E100-E103', // Private use
'U+FD40-FD4F', // Note: FD46 (صلى الله عليه وآله) isn't in the font
'U+FDFA-FDFB',
'U+FDFD-FDFF', // Avoid FDFC (﷼) ﷺﷻ﷽
]
await $`mkdir -p build`
for (const fmt of ['woff', 'woff2']) {
await $`pyftsubset Kitab-Regular.ttf --text=${chars_text} --unicodes=${chars.join(',')} --flavor=${fmt} --output-file=build/kitab-base.${fmt}`
await $`pyftsubset Kitab-Bold.ttf --text=${chars_text} --unicodes=${chars.join(',')} --flavor=${fmt} --output-file=build/kitab-base-bold.${fmt}`
await $`pyftsubset Kitab-Regular.ttf --text="۞۩" --unicodes=${phrases.join(',')} --flavor=${fmt} --output-file=build/kitab-phrases.${fmt}`
}