From 0a1d8feda744a647f56d97805e6e5d07d107cd71 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Thu, 5 Nov 2015 22:16:05 +0100 Subject: [mk*] kill version and modification headers from scripts too --- scripts/mkcharacters | 2 -- scripts/mkglyphlist | 2 -- scripts/mkimport | 2 -- scripts/mktests | 2 -- 4 files changed, 8 deletions(-) (limited to 'scripts') diff --git a/scripts/mkcharacters b/scripts/mkcharacters index abed2c9..9e9fd1a 100755 --- a/scripts/mkcharacters +++ b/scripts/mkcharacters @@ -5,8 +5,6 @@ -- DESCRIPTION: import parts of char-def.lua -- REQUIREMENTS: lua, ConTeXt, the lualibs package -- AUTHOR: Philipp Gesang (Phg), --- VERSION: 2.5 --- MODIFIED: 2014-02-11 07:24:25+0100 ----------------------------------------------------------------------- -- we create a stripped-down version of char-def.lua ----------------------------------------------------------------------- diff --git a/scripts/mkglyphlist b/scripts/mkglyphlist index 8fde098..f66a686 100755 --- a/scripts/mkglyphlist +++ b/scripts/mkglyphlist @@ -5,8 +5,6 @@ -- DESCRIPTION: part of the luaotfload package -- REQUIREMENTS: lua, lpeg, luasocket, the lualibs package -- AUTHOR: Philipp Gesang (Phg), --- VERSION: 2.5 --- MODIFIED: 2014-02-11 06:44:50+0100 ----------------------------------------------------------------------- -- interesting thread on the Context list: -- http://www.ntg.nl/pipermail/ntg-context/2008/029057.html diff --git a/scripts/mkimport b/scripts/mkimport index 0833ccb..e8b83c0 100755 --- a/scripts/mkimport +++ b/scripts/mkimport @@ -5,8 +5,6 @@ -- DESCRIPTION: check luaotfload imports against Context -- REQUIREMENTS: luatex, the lualibs package, Context MkIV -- AUTHOR: Philipp Gesang (Phg), --- VERSION: 42 --- CREATED: 2014-12-08 22:36:15+0100 ------------------------------------------------------------------------------- -- diff --git a/scripts/mktests b/scripts/mktests index b36b6dd..757e360 100755 --- a/scripts/mktests +++ b/scripts/mktests @@ -5,8 +5,6 @@ -- DESCRIPTION: test the behavior of Luaotfload -- REQUIREMENTS: Luatex > 0.76, Luaotfload -- AUTHOR: Philipp Gesang (Phg), --- VERSION: 2.4 --- MODIFIED: 2014-05-15 22:16:47+0200 ----------------------------------------------------------------------- -- --===================================================================-- -- cgit v1.2.3 From b3565971e4ea5525da149268b1cd372b8d77f42c Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Thu, 19 Nov 2015 08:11:22 +0100 Subject: [import] allow passing search location on command line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit And btw don’t hard code my own homedir =) --- scripts/mkimport | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) (limited to 'scripts') diff --git a/scripts/mkimport b/scripts/mkimport index e8b83c0..9ea224a 100755 --- a/scripts/mkimport +++ b/scripts/mkimport @@ -51,7 +51,7 @@ local tableconcat = table.concat -- config ------------------------------------------------------------------------------- -local context_root = "/home/phg/context/tex/texmf-context" +local parms = { } local our_prefix = "fontloader" local luatex_fonts_prefix = "luatex" local fontloader_subdir = "src/fontloader" @@ -69,7 +69,6 @@ local subdirs = { local searchdirs = { --- order is important! fontloader_subdir, - context_root } local prefixes = { @@ -259,7 +258,7 @@ end local derive_category_path = function (cat) local subpath = origin_paths[cat] or die ("category " .. cat .. " unknown") - local location = file.join (context_root, subpath) + local location = file.join (parms.context_root, subpath) if not lfsisdir (location) then die ("invalid base path defined for category " .. cat .. " at " .. location) @@ -482,7 +481,8 @@ end --[[ [local import_file = function (name, kind)] ]] local import = function (arg) if #arg > 1 then - local name = arg[2] or die ("invalid filename " .. tostring (arg[2])) + local tgt = parms.target + local name = tgt or die ("invalid filename " .. tostring (tgt)) local stat = import_file (name) if stat == import_failed then die ("failed to import file " .. name) @@ -526,10 +526,10 @@ local search_paths = function (target) end - local found = find_in_path (context_root, origin_paths.context, target) + local found = find_in_path (parms.context_root, origin_paths.context, target) if found then return found end - local found = find_in_path (context_root, origin_paths.fontloader, target) + local found = find_in_path (parms.context_root, origin_paths.fontloader, target) if found then return found end return false end @@ -656,7 +656,7 @@ local describe = function (target, location) end local tell = function (arg) - local target = arg[2] + local target = parms.target if not target then die "no filename given" end local location = search (target) @@ -846,12 +846,31 @@ local check_job = function (j) return job_kind[j] or die ("invalid job type “%s”.", j) end +local parse_argv = function (argv) + local job + local tgt + local pth + + local argc = #arg + if argc < 1 or argc > 3 then return "help" end + job = arg[1] or "help" + if argc > 1 then + tgt = arg[2] + if argc == 3 then pth = arg[3] end + end + if not pth then pth = "~/context/tex/texmf-context" end + parms.context_root = kpse.expand_path (pth) + parms.target = tgt + searchdirs [#searchdirs + 1] = pth + return job +end + ------------------------------------------------------------------------------- -- entry point ------------------------------------------------------------------------------- local main = function () - local job = arg[1] or "help" + local job = parse_argv (arg) local runner = check_job (job) return runner(arg) end -- cgit v1.2.3 From f385ec0f5919feed2839f6146a6ebbbce5926354 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Fri, 20 Nov 2015 00:01:41 +0100 Subject: [chars] allow passing location of char-def.lua on command line --- scripts/mkcharacters | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/mkcharacters b/scripts/mkcharacters index 9e9fd1a..59582f2 100755 --- a/scripts/mkcharacters +++ b/scripts/mkcharacters @@ -13,7 +13,7 @@ -- config ----------------------------------------------------------------------- local charfile = "./build/luaotfload-characters.lua" -local chardef = "/home/phg/base/char-def.lua" +local chardef = arg[1] --- for every code point char-def.lua provides a set of fields. they --- are: @@ -63,6 +63,11 @@ for _, lib in next, { "lualibs-lua.lua", require(found) end +if not chardef then + chardef = kpse.expand_path("~/context/tex/texmf-context/tex/context/base/") + .. "/char-def.lua" +end + if not (chardef and lfs.isfile(chardef)) then --- we could grab the file from contextgarden but as Context is part --- of TL it’s not worth bothering @@ -70,6 +75,9 @@ if not (chardef and lfs.isfile(chardef)) then "Could not find ConTeXt.") end +io.write(string.format("extracting data from char-def.lua at %s\n", + chardef)) + ----------------------------------------------------------------------- -- functionality ----------------------------------------------------------------------- -- cgit v1.2.3 From cf6c8c94cc88db6564ccea266b3c6d8f7a5bb1a1 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Fri, 20 Nov 2015 00:43:05 +0100 Subject: [tests] adapt lookup test runner (fallout from db reorganization) --- scripts/mktests | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 59 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/scripts/mktests b/scripts/mktests index 757e360..ad8c4f5 100755 --- a/scripts/mktests +++ b/scripts/mktests @@ -18,14 +18,68 @@ local tests = { } local lpeg = require "lpeg" local lpegmatch = lpeg.match +config = { luaotfload = { } } +luatexbase = { } + kpse.set_program_name "luatex" require "lualibs" require "luaotfload-basics-gen.lua" require "luaotfload-log.lua" -require "luaotfload-parsers" -require "luaotfload-configuration" -require "luaotfload-database" + +fonts = { names = { } } -- for db; normally provided by the fontloaders + +local require_init = { } + +local loadmodule = function (name) + local v = require ("luaotfload-" .. name) + if v then + local mod = { } + local tv = type (v) + if tv == "table" then + mod.name = name + mod.init = v.init + require_init [#require_init + 1] = mod + elseif tv == "function" then + mod.name = name + mod.init = v + require_init [#require_init + 1] = mod + end + end +end + +require "alt_getopt" + +loadmodule "log.lua" --- this populates the luaotfload.log.* namespace +loadmodule "parsers" --- fonts.conf, configuration, and request syntax +loadmodule "configuration" --- configuration file handling +loadmodule "database" +loadmodule "resolvers" --- Font lookup + +do --- init_modules + --- NB we don’t command the logger at this point. + local todo = #require_init + local ret = true + for i = 1, todo do + local mod = require_init[i] + local name = mod.name + local init = mod.init + if type (init) ~= "function" then + error ("luaotfload broken; module " + .. name .. " missing initializers!") + end + local v = mod.init () + if v == true then + --- evaluated well + elseif type (v) == "table" then + luaotfload[name] = v + else + error ("luaotfload broken; initialization of module " + .. name .. " returned " .. tostring (v) .. ".") + return false + end + end +end local names = fonts.names @@ -234,7 +288,6 @@ local default_spec = { local resolve_font_name = function () local failed, total = 0, 0 - local resolve_name = names.resolve_name for nset = 1, #font_name_tests do local set = font_name_tests[nset] @@ -246,7 +299,7 @@ local resolve_font_name = function () local input_spec = table.copy (default_spec) input_spec.name = input input_spec.specification = input_spec.lookup .. ":" .. input - local result = resolve_name (input_spec) == output + local result = fonts.names.lookup_font_name (input_spec) == output total = total + 1 if not result then failed = failed + 1 @@ -260,7 +313,7 @@ local resolve_font_name = function () .. ":" .. input_spec.name input_spec.optsize = input_spec.optsize or default_spec.optsize input_spec.style = translate_style [input_spec.style] - local result = resolve_name (input_spec) == output + local result = fonts.names.lookup_font_name (input_spec) == output total = total + 1 if not result then failed = failed + 1 -- cgit v1.2.3