1if not modules then modules = { } end modules ['font-imp-tex'] = {
2 version = 1.001,
3 comment = "companion to font-ini.mkiv",
4 author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
5 copyright = "PRAGMA ADE / ConTeXt Development Team",
6 license = "see context related readme files"
7}
8
9local next = next
10
11local fonts = fonts
12local otf = fonts.handlers.otf
13local registerotffeature = otf.features.register
14local addotffeature = otf.addfeature
15
16
17
18local specification = {
19 type = "ligature",
20 order = { "tlig" },
21 prepend = true,
22 data = {
23
24
25 [0x2013] = { 0x002D, 0x002D },
26 [0x2014] = { 0x002D, 0x002D, 0x002D },
27
28
29
30
31
32 },
33}
34
35addotffeature("tlig",specification)
36
37registerotffeature {
38
39 name = "tlig",
40 description = "tex ligatures",
41}
42
43
44
45local specification = {
46 type = "substitution",
47 order = { "trep" },
48 prepend = true,
49 data = {
50
51 [0x0027] = 0x2019,
52
53 },
54}
55
56addotffeature("trep",specification)
57
58registerotffeature {
59
60 name = "trep",
61 description = "tex replacements",
62}
63
64
65
66
67
68local anum_arabic = {
69 [0x0030] = 0x0660,
70 [0x0031] = 0x0661,
71 [0x0032] = 0x0662,
72 [0x0033] = 0x0663,
73 [0x0034] = 0x0664,
74 [0x0035] = 0x0665,
75 [0x0036] = 0x0666,
76 [0x0037] = 0x0667,
77 [0x0038] = 0x0668,
78 [0x0039] = 0x0669,
79}
80
81local anum_persian = {
82 [0x0030] = 0x06F0,
83 [0x0031] = 0x06F1,
84 [0x0032] = 0x06F2,
85 [0x0033] = 0x06F3,
86 [0x0034] = 0x06F4,
87 [0x0035] = 0x06F5,
88 [0x0036] = 0x06F6,
89 [0x0037] = 0x06F7,
90 [0x0038] = 0x06F8,
91 [0x0039] = 0x06F9,
92}
93
94local function valid(data)
95 local features = data.resources.features
96 if features then
97 for k, v in next, features do
98 for k, v in next, v do
99 if v.arab then
100 return true
101 end
102 end
103 end
104 end
105end
106
107local specification = {
108 {
109 type = "substitution",
110 features = { arab = { urd = true, dflt = true } },
111 order = { "anum" },
112 data = anum_arabic,
113 valid = valid,
114 },
115 {
116 type = "substitution",
117 features = { arab = { urd = true } },
118 order = { "anum" },
119 data = anum_persian,
120 valid = valid,
121 },
122}
123
124addotffeature("anum",specification)
125
126registerotffeature {
127
128 name = "anum",
129 description = "arabic digits",
130}
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145 |