summaryrefslogtreecommitdiff
path: root/texmf-dist/tex/generic/harftex/harf-base.lua
diff options
context:
space:
mode:
Diffstat (limited to 'texmf-dist/tex/generic/harftex/harf-base.lua')
-rw-r--r--texmf-dist/tex/generic/harftex/harf-base.lua28
1 files changed, 28 insertions, 0 deletions
diff --git a/texmf-dist/tex/generic/harftex/harf-base.lua b/texmf-dist/tex/generic/harftex/harf-base.lua
index 4b5931fd..37970b29 100644
--- a/texmf-dist/tex/generic/harftex/harf-base.lua
+++ b/texmf-dist/tex/generic/harftex/harf-base.lua
@@ -9,4 +9,32 @@ local hb = require("luaharfbuzz")
-- escaping raw bytes, so skip that as well.
hb.CH_GID_PREFIX = 0x110000 + 256
+
+-- Legacy TeX Input Method Disguised as Font Ligatures hack.
+--
+-- Single replacements, keyed by character to replace. Handled separately
+-- because TeX ligaturing mechanism does not support one-to-one replacements.
+local trep = {
+ [0x0022] = 0x201D, -- ["]
+ [0x0027] = 0x2019, -- [']
+ [0x0060] = 0x2018, -- [`]
+}
+
+-- Ligatures. The value is a character "ligature" table as described in the
+-- manual.
+local tlig ={
+ [0x2013] = { [0x002D] = { char = 0x2014 } }, -- [---]
+ [0x002D] = { [0x002D] = { char = 0x2013 } }, -- [--]
+ [0x0060] = { [0x0060] = { char = 0x201C } }, -- [``]
+ [0x0027] = { [0x0027] = { char = 0x201D } }, -- ['']
+ [0x0021] = { [0x0060] = { char = 0x00A1 } }, -- [!`]
+ [0x003F] = { [0x0060] = { char = 0x00BF } }, -- [?`]
+ [0x002C] = { [0x002C] = { char = 0x201E } }, -- [,,]
+ [0x003C] = { [0x003C] = { char = 0x00AB } }, -- [<<]
+ [0x003E] = { [0x003E] = { char = 0x00BB } }, -- [>>]
+}
+
+hb.texrep = trep
+hb.texlig = tlig
+
return hb