font-lig.lua /size: 1333 b    last modification: 2020-07-01 14:35
1
if
not
modules
then
modules
=
{
}
end
modules
[
'
font-lig
'
]
=
{
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 9
-- This module is not loaded but generated a file for plain TeX as a substitute
10
-- for collapsing the input: "luatex-fonts-lig.lua" with "collapse=yes".
11 12
local
next
=
next
13 14
local
standalone
=
not
characters
15 16
if
standalone
then
17
require
(
"
char-utf
"
)
18
end
19 20
local
data
=
{
}
21 22
for
first
,
seconds
in
next
,
characters
.
graphemes
do
23
for
second
,
combined
in
next
,
seconds
do
24
data
[
combined
]
=
{
first
,
second
}
25
end
26
end
27 28
-- data['c'] = { 'a', 'b' }
29
-- data['d'] = { 'c', 'c' }
30 31
local
feature
=
{
32
name
=
"
collapse
"
,
33
type
=
"
ligature
"
,
34
prepend
=
true
,
35
dataset
=
{
36
{
data
=
data
}
,
37
{
data
=
data
}
,
38
}
39
}
40 41
if
standalone
then
42
local
filename
=
"
luatex-fonts-lig.lua
"
43
local
filedata
=
"
-- this file is generated by context\n\n
"
44
.
.
"
fonts.handlers.otf.addfeature
"
45
.
.
table
.
serialize
(
feature
,
false
)
46
logs
.
report
(
"
fonts
"
,
"
pseudo ligature file %a saved
"
,
filename
)
47
io
.
savedata
(
filename
,
filedata
)
48
else
49
fonts
.
handlers
.
otf
.
addfeature
(
feature
)
50
end
51