summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2014-07-24 22:51:59 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2014-07-24 22:51:59 +0200
commit11e08634285978b21fc1f1a03060f5a0c3bd7e7c (patch)
tree9b48a03ec440a67d96c85db248d359bbc8cccb42
parent7c5c912858ba4b6ebd9d7f4f2e3bfa06171f6886 (diff)
parentb8dcba5de882bd04b27472a3fdc3a562c55d1ad8 (diff)
downloadluaotfload-11e08634285978b21fc1f1a03060f5a0c3bd7e7c.tar.gz
Merge pull request #239 from phi-gamma/master
confdumper: documentation and extension
-rw-r--r--doc/luaotfload-tool.rst13
-rw-r--r--doc/luaotfload.conf.rst9
-rw-r--r--src/luaotfload-configuration.lua27
3 files changed, 46 insertions, 3 deletions
diff --git a/doc/luaotfload-tool.rst b/doc/luaotfload-tool.rst
index 4b1a934..99e3fb2 100644
--- a/doc/luaotfload-tool.rst
+++ b/doc/luaotfload-tool.rst
@@ -6,7 +6,7 @@
generate and query the Luaotfload font names database
-----------------------------------------------------------------------
-:Date: 2014-03-30
+:Date: 2014-07-24
:Copyright: GPL v2.0
:Version: 2.5
:Manual section: 1
@@ -42,6 +42,8 @@ SYNOPSIS
**luaotfload-tool** --diagnose=CHECK
+**luaotfload-tool** --conf=FILE --dumpconf
+
DESCRIPTION
=======================================================================
@@ -277,6 +279,13 @@ miscellaneous
commas, e.g. ``--diagnose=files,permissions``.
Specify ``thorough`` to run all checks.
+--conf=FILE Read the configuration from *FILE*. See
+ **luaotfload.conf**\(%) for documentation
+ concerning the format and available options.
+--dumpconf Print the currently active configuration; the
+ output can be saved to a file and used for
+ bootstrapping a custom configuration files.
+
FILES
=======================================================================
@@ -297,7 +306,7 @@ them with the next run of *LuaTeX*.
SEE ALSO
=======================================================================
-**luatex** (1), **lua** (1)
+**luaotfload.conf**\(5), **luatex**\(1), **lua**\(1)
* ``texdoc luaotfload`` to display the manual for the *Luaotfload*
package
diff --git a/doc/luaotfload.conf.rst b/doc/luaotfload.conf.rst
index 774095b..b0d19d9 100644
--- a/doc/luaotfload.conf.rst
+++ b/doc/luaotfload.conf.rst
@@ -55,7 +55,14 @@ along with lots of other information.
To observe the difference in behavior, save above snippet to
``./luaotfload.conf`` and update the font index: ::
- luaotfload --update --force
+ luaotfload-tool --update --force
+
+The current configuration can be written to disk using
+**luaotfload-tool**: ::
+
+ luaotfload-tool --dumpconf > luaotfload.conf
+
+The result can itself be used as a configuration file.
SYNTAX
diff --git a/src/luaotfload-configuration.lua b/src/luaotfload-configuration.lua
index 10e791a..0b2da64 100644
--- a/src/luaotfload-configuration.lua
+++ b/src/luaotfload-configuration.lua
@@ -494,6 +494,25 @@ local format_boolean = function (var, val)
return stringformat (indent .. "%s = %s", var, val == true and "true" or "false")
end
+local format_keyval = function (var, val)
+ local list = { }
+ local keys = table.sortedkeys (val)
+ for i = 1, #keys do
+ local key = keys[i]
+ local subval = val[key]
+ if subval == true then
+ list[#list + 1] = stringformat ("%s", key)
+ else
+ list[#list + 1] = stringformat ("%s=%s", key, val[key])
+ end
+ end
+ if next (list) then
+ return stringformat (indent .. "%s = %s",
+ var,
+ tableconcat (list, ","))
+ end
+end
+
local format_section = function (title)
return stringformat ("[%s]", title)
end
@@ -543,6 +562,9 @@ local formatters = {
strip = { false, format_boolean },
update_live = { false, format_boolean },
},
+ default_features = {
+ __default = { true, format_keyval },
+ },
misc = {
bisect = { false, format_boolean },
statistics = { false, format_boolean },
@@ -792,6 +814,10 @@ local dump = function ()
local var = varnames[j]
local val = vars[var]
local comment, sformat = unpack (sformats[var] or { })
+ if not sformat then
+ comment, sformat = unpack (sformats.__default or { })
+ end
+
if sformat then
local dashedvar = dashed (var)
if comment then
@@ -800,6 +826,7 @@ local dump = function ()
confdata[#confdata + 1] = sformat (dashedvar, val)
end
end
+
end
confdata[#confdata + 1] = ""
end