summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/font-ext.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-05-16 11:12:18 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-05-16 11:12:18 +0200
commitcbc37c39432e0ebe38e0922fc6d14c2955ab3ba2 (patch)
tree38358e219d38f2a49f227d96d24fdc27eb2544e6 /tex/context/base/mkiv/font-ext.lua
parentfd0c4577a4b6e85ca2db664906e1a03807ce133f (diff)
downloadcontext-cbc37c39432e0ebe38e0922fc6d14c2955ab3ba2.tar.gz
2017-05-15 21:54:00
Diffstat (limited to 'tex/context/base/mkiv/font-ext.lua')
-rw-r--r--tex/context/base/mkiv/font-ext.lua49
1 files changed, 49 insertions, 0 deletions
diff --git a/tex/context/base/mkiv/font-ext.lua b/tex/context/base/mkiv/font-ext.lua
index 6edfe7025..965b6e6dc 100644
--- a/tex/context/base/mkiv/font-ext.lua
+++ b/tex/context/base/mkiv/font-ext.lua
@@ -1296,3 +1296,52 @@ do -- another hack for a crappy font
}
end
+
+do
+
+ local tounicode = fonts.mappings.tounicode
+
+ local function check(tfmdata,key,value)
+ if value == "ligatures" then
+ local private = fonts.constructors and fonts.constructors.privateoffset or 0xF0000
+ local collected = fonts.handlers.otf.readers.getcomponents(tfmdata.shared.rawdata)
+ if collected and next(collected)then
+ for unicode, char in next, tfmdata.characters do
+ if true then -- if unicode >= private or (unicode >= 0xE000 and unicode <= 0xF8FF) then
+ local u = collected[unicode]
+ if u then
+ local n = #u
+ for i=1,n do
+ if u[i] > private then
+ n = 0
+ break
+ end
+ end
+ if n > 0 then
+ if n == 1 then
+ u = u[1]
+ end
+ char.unicode = u
+ char.tounicode = tounicode(u)
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+
+ -- forceunicodes=ligatures : aggressive lig resolving (e.g. for emoji)
+ --
+ -- kind of like: \enabletrackers[fonts.mapping.forceligatures]
+
+ registerotffeature {
+ name = "forceunicodes",
+ description = "forceunicodes",
+ manipulators = {
+ base = check,
+ node = check,
+ }
+ }
+
+end