diff options
author | Khaled Hosny <khaledhosny@eglug.org> | 2010-01-30 11:44:22 +0200 |
---|---|---|
committer | Khaled Hosny <khaledhosny@eglug.org> | 2010-01-30 11:44:22 +0200 |
commit | 3e16f51a0c6dc4ecdcc71785fecac097b3c08fab (patch) | |
tree | 593901ecef543d03791375c3e4ecd0c6ca6a3ce1 | |
parent | cb96f3ca17901a91c33119ae8ba9c3487188fb59 (diff) | |
download | luaotfload-3e16f51a0c6dc4ecdcc71785fecac097b3c08fab.tar.gz |
Support per-script default features
Now default features are implicitly selected based on script, code
moved from fontspec (slightly simplified), default feature sets are
based on Pango.
-rw-r--r-- | otfl-font-xtx.lua | 101 |
1 files changed, 100 insertions, 1 deletions
diff --git a/otfl-font-xtx.lua b/otfl-font-xtx.lua index 2fb9b7f..30e902a 100644 --- a/otfl-font-xtx.lua +++ b/otfl-font-xtx.lua @@ -80,6 +80,100 @@ local function isstyle(s) end end end + +local default_features = { + arab = { + "ccmp", "locl", "isol", "fina", "medi", + "init", "rlig", "calt", "liga", "cswh", + "mset", "curs", "kern", "mark", "mkmk", + }, + latn = { + "ccmp", "locl", "liga", "clig", "kern", + "mark", "mkmk", + }, + hebr = { + "ccmp", "locl", "rlig", "kern", "mark", + "mkmk", + }, + deva = { + "ccmp", "locl", "init", "nukt", "akhn", + "rphf", "blwf", "half", "pstf", "vatu", + "pres", "blws", "abvs", "psts", "haln", + "calt", "blwm", "abvm", "dist", "kern", + "mark", "mkmk", + }, + khmr = { + "ccmp", "locl", "pref", "blwf", "abvf", + "pstf", "pres", "blws", "abvs", "psts", + "clig", "calt", "blwm", "abvm", "dist", + "kern", "mark", "mkmk", + }, + syrc = { + "ccmp", "locl", "isol", "fina", "fin1", + "fin2", "medi", "med2", "init", "rlig", + "calt", "liga", "kern", "mark", "mkmk", + }, + thai = { + "ccmp", "locl", "liga", "kern", "mark", + "mkmk", + }, + tibt = { + "ccmp", "locl", "pref", "blws", "abvs", + "psts", "clig", "calt", "blwm", "abvm", + "dist", "kern", "mark", "mkmk", + }, + hang = { }, +} + +default_features.cyrl = default_features.latn +default_features.grek = default_features.latn +default_features.armn = default_features.latn +default_features.geor = default_features.latn +default_features.runr = default_features.latn +default_features.ogam = default_features.latn +default_features.bopo = default_features.latn +default_features.cher = default_features.latn +default_features.copt = default_features.latn +default_features.dsrt = default_features.latn +default_features.ethi = default_features.latn +default_features.goth = default_features.latn +default_features.hani = default_features.latn +default_features.kana = default_features.latn +default_features.ital = default_features.latn +default_features.cans = default_features.latn +default_features.yi = default_features.latn +default_features.brai = default_features.latn +default_features.cprt = default_features.latn +default_features.limb = default_features.latn +default_features.osma = default_features.latn +default_features.shaw = default_features.latn +default_features.linb = default_features.latn +default_features.ugar = default_features.latn +default_features.glag = default_features.latn +default_features.xsux = default_features.latn +default_features.phnx = default_features.latn + +default_features.beng = default_features.deva +default_features.guru = default_features.deva +default_features.gujr = default_features.deva +default_features.orya = default_features.deva +default_features.taml = default_features.deva +default_features.telu = default_features.deva +default_features.knda = default_features.deva +default_features.mlym = default_features.deva +default_features.sinh = default_features.deva + +default_features.nko = default_features.arab +default_features.lao = default_features.thai + +local function parse_script(script) + if default_features[script] then + for _,v in next, default_features[script] do + list[v] = "yes" + end + end +end + local function issome () list.lookup = fonts.define.specify.colonized_default_lookup end local function isfile () list.lookup = 'file' end local function isname () list.lookup = 'name' end @@ -88,7 +182,12 @@ local function issub (v) list.sub = v end local function istrue (s) list[s] = 'yes' end --KH local function isfalse(s) list[s] = 'no' end local function isfalse(s) list[s] = nil end -- see mpg/luaotfload#4 -local function iskey (k,v) list[k] = v end +local function iskey (k,v) + if k == "script" then + parse_script(v) + end + list[k] = v +end local spaces = lpeg.P(" ")^0 -- ER: now accepting names like C:/program files/texlive/2009/... |