From b24ceb08e0ffc1a21af2b226f66c22e62219e287 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sat, 4 May 2013 11:24:19 +0200 Subject: make optical size (``/s=num``) work again also finally get rid of the old request parser --- luaotfload-features.lua | 113 +++--------------------------------------------- 1 file changed, 7 insertions(+), 106 deletions(-) diff --git a/luaotfload-features.lua b/luaotfload-features.lua index cd00a0f..0591115 100644 --- a/luaotfload-features.lua +++ b/luaotfload-features.lua @@ -57,27 +57,6 @@ local supported = { --- are valid but they might cancel prior settings --- example: {name:Antykwa Torunska/I/B} -> bold -local isstyle = function (request) - request = stringlower(request) - request = stringexplode(request, "/") - - for _,v in next, request do - local stylename = supported[v] - if stylename then - old_feature_list.style = stylename - elseif stringfind(v, "^s=") then - --- after all, we want everything after the second byte ... - local val = stringsub(v, 3) - old_feature_list.optsize = val - elseif stylename == false then - report("log", 0, - "load", "unsupported font option: %s", v) - elseif not stringis_empty(v) then - old_feature_list.style = stringgsub(v, "[^%a%d]", "") - end - end -end - --- TODO an option to dump the default features for a script would make --- a nice addition to luaotfload-tool @@ -169,84 +148,6 @@ local set_default_features = function (speclist) return speclist end --- --[==[obsolete-- -local function issome () old_feature_list.lookup = 'name' end -local function isfile () old_feature_list.lookup = 'file' end -local function isname () old_feature_list.lookup = 'name' end -local function thename(s) old_feature_list.name = s end -local function issub (v) old_feature_list.sub = v end -local function istrue (s) old_feature_list[s] = true end -local function isfalse(s) old_feature_list[s] = false end -local function iskey (k,v) old_feature_list[k] = v end - -local P, S, R, C = lpeg.P, lpeg.S, lpeg.R, lpeg.C - -local spaces = P(" ")^0 ---local namespec = (1-S("/:("))^0 -- was: (1-S("/: ("))^0 ---[[phg-- this prevents matching of absolute paths as file names --]]-- -local namespec = (1-S("/:("))^1 -local filespec = (R("az", "AZ") * P(":"))^-1 * (1-S(":("))^1 -local stylespec = spaces * P("/") * (((1-P(":"))^0)/isstyle) * spaces -local filename = (P("file:")/isfile * (filespec/thename)) - + (P("[") * P(true)/isname * (((1-P("]"))^0)/thename) * P("]")) -local fontname = (P("name:")/isname * (namespec/thename)) + P(true)/issome * (namespec/thename) -local sometext = (R("az","AZ","09") + S("+-.,"))^1 -local truevalue = P("+") * spaces * (sometext/istrue) -local falsevalue = P("-") * spaces * (sometext/isfalse) -local keyvalue = P("+") + (C(sometext) * spaces * P("=") * spaces * C(sometext))/iskey -local somevalue = sometext/istrue -local subvalue = P("(") * (C(P(1-S("()"))^1)/issub) * P(")") -- for Kim -local option = spaces * (keyvalue + falsevalue + truevalue + somevalue) * spaces -local options = P(":") * spaces * (P(";")^0 * option)^0 -local oldsyntax = (filename + fontname) * subvalue^0 * stylespec^0 * options^0 - ---- to be annihilated -local function old_behavior (specification) -- xetex mode - old_feature_list = { } - lpeg.match(oldsyntax,specification.specification) - old_feature_list = set_default_features(old_feature_list) - if old_feature_list.style then - specification.style = old_feature_list.style - old_feature_list.style = nil - end - if old_feature_list.optsize then - specification.optsize = old_feature_list.optsize - old_feature_list.optsize = nil - end - if old_feature_list.name then - if resolvers.findfile(old_feature_list.name, "tfm") then - old_feature_list.lookup = "file" - old_feature_list.name = file.addsuffix(old_feature_list.name, "tfm") - elseif resolvers.findfile(old_feature_list.name, "ofm") then - old_feature_list.lookup = "file" - old_feature_list.name = file.addsuffix(old_feature_list.name, "ofm") - end - - specification.name = old_feature_list.name - old_feature_list.name = nil - end - --- this test overwrites valid file: requests for xetex bracket - --- syntax - if old_feature_list.lookup then - specification.lookup = old_feature_list.lookup - old_feature_list.lookup = nil - end - if old_feature_list.sub then - specification.sub = old_feature_list.sub - old_feature_list.sub = nil - end - if not old_feature_list.mode then - -- if no mode is set, use our default - old_feature_list.mode = fonts.mode - end - specification.features.normal = fonts.handlers.otf.features.normalize(old_feature_list) - return specification -end - ---fonts.definers.registersplit(":",old_behavior,"cryptic") ---fonts.definers.registersplit("", old_behavior,"more cryptic") -- catches \font\text=[names] ---obsolete]==]-- - ----------------------------------------------------------------------- --- request syntax parser 2.2 ----------------------------------------------------------------------- @@ -352,13 +253,15 @@ local decimal = digit^1 * (dot * digit^0)^-1 --doc]]-- local style_modifier = (P"BI" + P"IB" + P"bi" + P"ib" + S"biBI") / stringlower -local other_modifier = P"S=" * decimal --- optical size; unsupported - + P"AAT" + P"aat" --- apple stuff; unsupported +local size_modifier = S"Ss" * P"=" --- optical size + * Cc"optsize" * C(decimal) +local other_modifier = P"AAT" + P"aat" --- apple stuff; unsupported + P"ICU" + P"icu" --- not applicable + P"GR" + P"gr" --- sil stuff; unsupported local garbage_modifier = ((1 - colon - slash)^0 * Cc(false)) local modifier = slash * (other_modifier --> ignore + Cs(style_modifier) --> collect + + Ct(size_modifier) --> collect + garbage_modifier) --> warn local modifier_list = Cg(Ct(modifier^0), "modifiers") @@ -445,12 +348,10 @@ local handle_slashed = function (modifiers) local style, optsize for i=1, #modifiers do local mod = modifiers[i] - if supported[mod] then + if type(mod) == "table" then --> optical size + optsize = tonumber(mod[2]) + elseif supported[mod] then style = supported[mod] - --elseif stringfind(v, "^s=") then - elseif stringsub(v, 1, 2) == "s=" then - local val = stringsub(v, 3) - optsize = val elseif stylename == false then report("log", 0, "load", "unsupported font option: %s", v) -- cgit v1.2.3 From 1c85daf6af67e3d80eca15231aab55df78773139 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sat, 4 May 2013 11:28:35 +0200 Subject: clean up ``luaotfload-features.lua`` --- luaotfload-features.lua | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/luaotfload-features.lua b/luaotfload-features.lua index 0591115..0bdd16f 100644 --- a/luaotfload-features.lua +++ b/luaotfload-features.lua @@ -19,8 +19,10 @@ local fonts = fonts fonts.constructors.namemode = "specification" -- somehow latex needs this (changed name!) => will change into an overload --- tricky: we sort of bypass the parser and directly feed all into --- the sub parser +--[[HH-- + tricky: we sort of bypass the parser and directly feed all into + the sub parser +--HH]]-- function fonts.definers.getspecification(str) return "", str, "", ":", str @@ -31,27 +33,9 @@ local old_feature_list = { } local report = logs.names_report local stringlower = string.lower -local stringsub = string.sub local stringgsub = string.gsub -local stringfind = string.find -local stringexplode = string.explode local stringis_empty = string.is_empty ---[[doc-- -Apparently, these “modifiers” are another measure of emulating \XETEX, -cf. “About \XETEX”, by Jonathan Kew, 2005; and - “The \XETEX Reference Guide”, by Will Robertson, 2011. ---doc]]-- - -local supported = { - b = "bold", - i = "italic", - bi = "bolditalic", - aat = false, - icu = false, - gr = false, -} - --- this parses the optional flags after the slash --- the original behavior is that multiple slashes --- are valid but they might cancel prior settings @@ -212,8 +196,6 @@ end ----------------------------------------------------------------------- -local stringlower = string.lower - local toboolean = function (s) if s == "true" then return true end if s == "false" then return false end @@ -348,7 +330,7 @@ local handle_slashed = function (modifiers) local style, optsize for i=1, #modifiers do local mod = modifiers[i] - if type(mod) == "table" then --> optical size + if type(mod) == "table" and mod[1] == "optsize" then --> optical size optsize = tonumber(mod[2]) elseif supported[mod] then style = supported[mod] @@ -414,15 +396,9 @@ local compare_requests = function (spec) return new end ---fonts.definers.registersplit(":", compare_requests, "cryptic") ---fonts.definers.registersplit("", compare_requests, "more cryptic") -- catches \font\text=[names] - fonts.definers.registersplit(":", handle_request, "cryptic") fonts.definers.registersplit("", handle_request, "more cryptic") -- catches \font\text=[names] ---fonts.definers.registersplit(":",old_behavior,"cryptic") ---fonts.definers.registersplit("", old_behavior,"more cryptic") -- catches \font\text=[names] - ---[[ end included font-ltx.lua ]] --[[doc-- -- cgit v1.2.3 From ae1b47cb7dbf4ed21129cbf1116865b63a87b95e Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sat, 4 May 2013 11:33:13 +0200 Subject: update NEWS --- NEWS | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 3858d8f..2cdf365 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,8 @@ Change History -------------- 2013/04/xx, luaotfload v2.2: + * There is now a central, non-personal dev repo on github: + https://github.com/lualatex/luaotfload * Synchronisation with ConTeXt from TeXLive 2013, inducing backward-incompatible changes in the font structure (fontspec and unicode-math must be updated) @@ -10,7 +12,7 @@ Change History the LuaTeX-Plain format) * Improved and extended documentation * Font filenames are stored in the database (file: lookups more efficient) - * Optional caching of name: lookups + * Optional caching of name: lookups (uses separate cache file) * Increased fidelity of XeTeX emulation * Renaming mkluatexfontdb into luaotfload-tool (the old behavior is kept if the script is symlinked/ renamed mkluatexfontdb) @@ -21,8 +23,8 @@ Change History * The Adobe Glyph List (font-age.lua) is now built via script (mkglyphlist) * Hans adapted the font loader to several of our requests (attribute allocation, custom merged package name etc.) - * There is now a central, non-personal dev repo on github: - https://github.com/lualatex/luaotfload + * Auxiliary functions for package authors + * Fallbacks for older versions of dependent packages 2013/04/27, luaotfload v1.3: * blacklisting lingoes.ttf (segfaults) -- cgit v1.2.3 From 21b1fb201a2fd9f058c1fee24dbd29df1debe6f7 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sat, 4 May 2013 11:49:12 +0200 Subject: bump version; add/update attributions --- luaotfload-auxiliary.lua | 2 +- luaotfload-colors.lua | 6 +++--- luaotfload-database.lua | 2 +- luaotfload-features.lua | 4 ++-- luaotfload-loaders.lua | 8 ++++++++ luaotfload-override.lua | 6 +++--- luaotfload-tool.lua | 13 +++++++++++-- 7 files changed, 29 insertions(+), 12 deletions(-) diff --git a/luaotfload-auxiliary.lua b/luaotfload-auxiliary.lua index bf567e3..fde4e24 100644 --- a/luaotfload-auxiliary.lua +++ b/luaotfload-auxiliary.lua @@ -4,7 +4,7 @@ -- DESCRIPTION: part of luaotfload -- REQUIREMENTS: luaotfload 2.2 -- AUTHOR: Khaled Hosny, Élie Roux, Philipp Gesang --- VERSION: 1.0 +-- VERSION: 2.2 -- CREATED: 2013-05-01 14:40:50+0200 ----------------------------------------------------------------------- -- diff --git a/luaotfload-colors.lua b/luaotfload-colors.lua index 3d8bfab..1525214 100644 --- a/luaotfload-colors.lua +++ b/luaotfload-colors.lua @@ -1,9 +1,9 @@ if not modules then modules = { } end modules ['luaotfload-colors'] = { - version = 1.001, + version = 2.200, comment = "companion to luaotfload.lua (font color)", - author = "Khaled Hosny and Elie Roux", + author = "Khaled Hosny, Elie Roux, Philipp Gesang", copyright = "Luaotfload Development Team", - license = "GPL" + license = "GNU GPL v2" } local newnode = node.new diff --git a/luaotfload-database.lua b/luaotfload-database.lua index 6f95208..8faeba2 100644 --- a/luaotfload-database.lua +++ b/luaotfload-database.lua @@ -1,7 +1,7 @@ if not modules then modules = { } end modules ['luaotfload-database'] = { version = 2.2, comment = "companion to luaotfload.lua", - author = "Khaled Hosny and Elie Roux", + author = "Khaled Hosny, Elie Roux, Philipp Gesang", copyright = "Luaotfload Development Team", license = "GNU GPL v2" } diff --git a/luaotfload-features.lua b/luaotfload-features.lua index 0bdd16f..0665804 100644 --- a/luaotfload-features.lua +++ b/luaotfload-features.lua @@ -1,7 +1,7 @@ if not modules then modules = { } end modules ["features"] = { - version = 1.000, + version = 2.200, comment = "companion to luaotfload.lua", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + author = "Hans Hagen, Khaled Hosny, Elie Roux, Philipp Gesang", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" } diff --git a/luaotfload-loaders.lua b/luaotfload-loaders.lua index 8ab6b29..c9c30de 100644 --- a/luaotfload-loaders.lua +++ b/luaotfload-loaders.lua @@ -1,3 +1,11 @@ +if not modules then modules = { } end modules ["loaders"] = { + version = 2.200, + comment = "companion to luaotfload.lua", + author = "Hans Hagen, Khaled Hosny, Elie Roux, Philipp Gesang", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + local fonts = fonts --- diff --git a/luaotfload-override.lua b/luaotfload-override.lua index 2b9ef8b..d796b0e 100644 --- a/luaotfload-override.lua +++ b/luaotfload-override.lua @@ -1,12 +1,11 @@ if not modules then modules = { } end modules ['luat-ovr'] = { - version = 1.001, + version = 2.2, comment = "companion to luatex-*.tex", - author = "Khaled Hosny and Elie Roux", + author = "Khaled Hosny, Elie Roux, Philipp Gesang", copyright = "Luaotfload Development Team", license = "GNU GPL v2" } - local module_name = "luaotfload" local texiowrite_nl = texio.write_nl @@ -27,6 +26,7 @@ We recreate the verbosity levels previously implemented in font-nms: ========================================================== --doc]]-- + local loglevel = 1 --- default local logout = "log" diff --git a/luaotfload-tool.lua b/luaotfload-tool.lua index 0833842..827ece9 100755 --- a/luaotfload-tool.lua +++ b/luaotfload-tool.lua @@ -1,8 +1,17 @@ #!/usr/bin/env texlua +----------------------------------------------------------------------- +-- FILE: luaotfload-tool.lua +-- DESCRIPTION: database functionality +-- REQUIREMENTS: luaotfload 2.2 +-- AUTHOR: Khaled Hosny, Élie Roux, Philipp Gesang +-- VERSION: 2.2 +-- CREATED: 2013-05-01 14:40:50+0200 +----------------------------------------------------------------------- --[[doc-- -This file was originally written by Elie Roux and Khaled Hosny and is under CC0 -license (see http://creativecommons.org/publicdomain/zero/1.0/legalcode). +This file was originally written (as \fileent{mkluatexfontdb.lua}) by +Elie Roux and Khaled Hosny and is under CC0 license (see +http://creativecommons.org/publicdomain/zero/1.0/legalcode). This file is a wrapper for the luaotfload font names module (luaotfload-database.lua). It is part of the luaotfload bundle, please -- cgit v1.2.3 From f70c8419d5abcc29f99ad50b8d9b20278310ff36 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sat, 4 May 2013 12:46:38 +0200 Subject: remove fontspec argument order workaround --- luaotfload-auxiliary.lua | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/luaotfload-auxiliary.lua b/luaotfload-auxiliary.lua index fde4e24..5de964d 100644 --- a/luaotfload-auxiliary.lua +++ b/luaotfload-auxiliary.lua @@ -354,16 +354,6 @@ end aux.provides_language = provides_language ---- fontspec apparently has the arguments shuffled ---- theirs: id -> lang -> script -> bool ---- ours: id -> script -> lang -> bool ---- whereas in the other check_* functions, script is ---- always the second argument ... -aux.provides_language_fontspec = function - (font_id, asked_language, asked_script) - return provides_language(font_id, asked_script, asked_language) -end - --[[doc-- We strip the syntax elements from feature definitions (shouldn’t actually be there in the first place, but who cares ...) -- cgit v1.2.3