summaryrefslogtreecommitdiff
path: root/luaotfload.dtx
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2012-02-26 20:35:16 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2012-02-26 21:08:34 +0200
commit98ccfb13623868324496e6fcfa206862601ee554 (patch)
tree0e7890ba0784391ff5d8ffa58c1afdf5d12c8599 /luaotfload.dtx
parent820dae976c197221adf58fcea0d12d2f81e75dd2 (diff)
downloadluaotfload-98ccfb13623868324496e6fcfa206862601ee554.tar.gz
Make tlig actually work
Works OK in node mode, in base mode `` and '' are not ligated, also consolidated tlig and trep into one feature.
Diffstat (limited to 'luaotfload.dtx')
-rw-r--r--luaotfload.dtx30
1 files changed, 23 insertions, 7 deletions
diff --git a/luaotfload.dtx b/luaotfload.dtx
index 0e4745c..5f4dd94 100644
--- a/luaotfload.dtx
+++ b/luaotfload.dtx
@@ -330,12 +330,11 @@ and the derived files
% \begin{itemize*}
% \item |anum|: replaces European numbers with eastern Arabic numbers or
% Persian numbers, depending on the value of |language|.
-% \item |tlig|: applies legacy \tex ligatures (|`` '' -- -- !` ?`|).
-% \item |trep|: applies legacy \tex replacements (|` ' "|).
+% \item |tlig|: applies legacy \tex ligatures: |``|, |''|, |`|, |'|, |"|, |--|,
+% |---|, |!`| and |?`|.\footnote{For \xetex users: this is the equivalent of
+% writing |mapping=text-tex| using \xetex's input remapping feature.}
% \end{itemize*}
%
-% (For \xetex users: these last two are the equivalent of writing
-% |mapping=text-tex| using \xetex's input remapping feature.)
%
%
% \section{Font names database}
@@ -600,14 +599,22 @@ caches.compilemethod = "both"
% Now overriding the \context's definition of |tlig| and |trep| features.
%
% \begin{macrocode}
+local everywhere = { ["*"] = { ["*"] = true } }
+local noflags = { }
+
local tlig = {
[0x2013] = {0x002D, 0x002D}, -- endash
[0x2014] = {0x002D, 0x002D, 0x002D}, -- emdash
[0x201C] = {0x2018, 0x2018}, -- quotedblleft
[0x201D] = {0x2019, 0x2019}, -- quotedblright
+ [0x201E] = {0x002C, 0x002C}, -- quotedblbase
+ [0x00A1] = {0x0021, 0x2018}, -- exclamdown
+ [0x00BF] = {0x003F, 0x2018}, -- questiondown
+}
+
+local tlig2 = {
[0x201C] = {0x0060, 0x0060}, -- quotedblleft
[0x201D] = {0x0027, 0x0027}, -- quotedblright
- [0x201E] = {0x002C, 0x002C}, -- quotedblbase
[0x00A1] = {0x0021, 0x0060}, -- exclamdown
[0x00BF] = {0x003F, 0x0060}, -- questiondown
}
@@ -632,8 +639,17 @@ local tlig_specification = {
flags = noflags,
}
-fonts.handlers.otf.addfeature("tlig", tlig_specification)
-fonts.handlers.otf.addfeature("trep", trep_specification)
+local tlig2_specification = {
+ type = "ligature",
+ features = everywhere,
+ data = tlig2,
+ flags = noflags,
+}
+
+fonts.handlers.otf.addfeature("tlig",
+ { tlig_specification, tlig2_specification, trep_specification }
+)
+fonts.handlers.otf.addfeature("trep", {})
% \end{macrocode}
%
% we provide a callback for patching fonts on the fly, to be used by other