diff options
author | Khaled Hosny <khaledhosny@eglug.org> | 2012-05-13 00:35:10 +0200 |
---|---|---|
committer | Khaled Hosny <khaledhosny@eglug.org> | 2012-05-13 00:35:10 +0200 |
commit | efa8114de758153a8773ca906ef7eaf2ba40c4ae (patch) | |
tree | dd9776787db35d0e7c92a7dd6003940f51cb0cfc | |
parent | a54bf71df0e790a2665cc2242d4cf452ca3bb81b (diff) | |
download | luaotfload-efa8114de758153a8773ca906ef7eaf2ba40c4ae.tar.gz |
Make anum work again
-rw-r--r-- | luaotfload.dtx | 62 | ||||
-rw-r--r-- | tests/anum.tex | 21 |
2 files changed, 75 insertions, 8 deletions
diff --git a/luaotfload.dtx b/luaotfload.dtx index 47b2595..9bf0ac9 100644 --- a/luaotfload.dtx +++ b/luaotfload.dtx @@ -650,6 +650,68 @@ fonts.handlers.otf.addfeature("tlig", tlig_specification) fonts.handlers.otf.addfeature("trep", { }) % \end{macrocode} % +% And overriding the \context's definition of |anum|. +% +% \begin{macrocode} +local anum_arabic = { + [0x0030] = 0x0660, + [0x0031] = 0x0661, + [0x0032] = 0x0662, + [0x0033] = 0x0663, + [0x0034] = 0x0664, + [0x0035] = 0x0665, + [0x0036] = 0x0666, + [0x0037] = 0x0667, + [0x0038] = 0x0668, + [0x0039] = 0x0669, +} + +local anum_persian = { + [0x0030] = 0x06F0, + [0x0031] = 0x06F1, + [0x0032] = 0x06F2, + [0x0033] = 0x06F3, + [0x0034] = 0x06F4, + [0x0035] = 0x06F5, + [0x0036] = 0x06F6, + [0x0037] = 0x06F7, + [0x0038] = 0x06F8, + [0x0039] = 0x06F9, +} + +local function valid(data) + local features = data.resources.features + if features then + for k, v in next, features do + for k, v in next, v do + if v.arab then + return true + end + end + end + end +end + +local anum_specification = { + { + type = "substitution", + features = { arab = { far = true, urd = true, snd = true } }, + data = anum_persian, + flags = { }, + valid = valid, + }, + { + type = "substitution", + features = { arab = { ["*"] = true } }, + data = anum_arabic, + flags = { }, + valid = valid, + }, +} + +fonts.handlers.otf.addfeature("anum",anum_specification) +% \end{macrocode} +% % we provide a callback for patching fonts on the fly, to be used by other % packages. % diff --git a/tests/anum.tex b/tests/anum.tex index bfbee2f..773955f 100644 --- a/tests/anum.tex +++ b/tests/anum.tex @@ -1,12 +1,17 @@ \input luaotfload.sty -\font\testa={name:dejavusans:script=arab;language=ara;+anum} -\font\testp={name:dejavusans:script=arab;language=far;+anum} -\font\tests={name:dejavusans:script=arab;language=snd;+anum} -\font\testu={name:dejavusans:script=arab;language=urd;+anum} +\font\testd={name:amiri:script=arab;language=dflt;+anum} +\font\testa={name:amiri:script=arab;language=ara;+anum} +\font\testp={name:amiri:script=arab;language=far;+anum} +\font\tests={name:amiri:script=arab;language=snd;+anum} +\font\testu={name:amiri:script=arab;language=urd;+anum} +\font\testx={name:amiri:script=arab;language=xxx;+anum} -\testa 0123456789\par -\testp 0123456789\par -\tests 0123456789\par -\testu 0123456789\par +\def\test{\luatextextdir TRT ضرب 0123456789} +\testd \test\par +\testa \test\par +\testp \test\par +\tests \test\par +\testu \test\par +\testx \test\par \bye |