summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/font-lig.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkiv/font-lig.lua')
-rw-r--r--tex/context/base/mkiv/font-lig.lua48
1 files changed, 48 insertions, 0 deletions
diff --git a/tex/context/base/mkiv/font-lig.lua b/tex/context/base/mkiv/font-lig.lua
new file mode 100644
index 000000000..bb9ee0096
--- /dev/null
+++ b/tex/context/base/mkiv/font-lig.lua
@@ -0,0 +1,48 @@
+if not modules then modules = { } end modules ['font-lig'] = {
+ version = 1.001,
+ comment = "companion to font-ini.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files",
+}
+
+-- This module is not loaded but generated a file for plain TeX as a substitute
+-- for collapsing the input: "luatex-fonts-lig.lua" with "collapse=yes".
+
+local standalone = not characters
+
+if standalone then
+ require("char-utf")
+end
+
+local data = { }
+
+for first, seconds in next, characters.graphemes do
+ for second, combined in next, seconds do
+ data[combined] = { first, second }
+ end
+end
+
+-- data['c'] = { 'a', 'b' }
+-- data['d'] = { 'c', 'c' }
+
+local feature = {
+ name = "collapse",
+ type = "ligature",
+ prepend = true,
+ dataset = {
+ { data = data },
+ { data = data },
+ }
+}
+
+if standalone then
+ local filename = "luatex-fonts-lig.lua"
+ local filedata = "-- this file is generated by context\n\n"
+ .. "fonts.handlers.otf.addfeature "
+ .. table.serialize(feature,false)
+ logs.report("fonts","pseudo ligature file %a saved",filename)
+ io.savedata(filename,filedata)
+else
+ fonts.handlers.otf.addfeature(feature)
+end