diff options
author | Philipp Gesang <phg42.2a@gmail.com> | 2013-04-27 18:26:21 +0200 |
---|---|---|
committer | Philipp Gesang <phg42.2a@gmail.com> | 2013-04-27 18:26:21 +0200 |
commit | 9fceb52298c05c31666521b4226362322b18c178 (patch) | |
tree | 1fd1dd690b11060ba0782f10290be4d287cd3db7 | |
parent | 90c3c46541e8508982254ee43eff8983a0444e66 (diff) | |
download | luaotfload-9fceb52298c05c31666521b4226362322b18c178.tar.gz |
update fontconfig test
-rw-r--r-- | luaotfload-database.lua | 17 | ||||
-rw-r--r-- | tests/fontconfig_conf_reading.tex | 8 | ||||
-rw-r--r-- | tests/fonts.conf.test | 44 |
3 files changed, 42 insertions, 27 deletions
diff --git a/luaotfload-database.lua b/luaotfload-database.lua index edc3a5b..3085b63 100644 --- a/luaotfload-database.lua +++ b/luaotfload-database.lua @@ -86,12 +86,19 @@ config.luaotfload.resolver = config.luaotfload.resolver or "normal" -- We use the cache.* of ConTeXt (see luat-basics-gen), we can -- use it safely (all checks and directory creations are already done). It -- uses TEXMFCACHE or TEXMFVAR as starting points. -local writable_path = caches.getwritablepath("names","") -if not writable_path then - error("Impossible to find a suitable writeable cache...") +local writable_path +if caches then + writable_path = caches.getwritablepath("names","") + if not writable_path then + error("Impossible to find a suitable writeable cache...") + end + names.path.dir = writable_path + names.path.path = filejoin(writable_path, names.path.basename) +else --- running as script, inject some dummies + caches = { } + logs = { report = function () end } end -names.path.dir = writable_path -names.path.path = filejoin(writable_path, names.path.basename) + --[[doc-- Auxiliary functions diff --git a/tests/fontconfig_conf_reading.tex b/tests/fontconfig_conf_reading.tex index dbbbc3c..66ab377 100644 --- a/tests/fontconfig_conf_reading.tex +++ b/tests/fontconfig_conf_reading.tex @@ -1,6 +1,8 @@ \directlua{ -require("lualibs") -require("otfl-font-nms.lua") -texio.write_nl(table.serialize(fonts.names.read_fonts_conf("fonts.conf.test", {}))) + config = { lualibs = { load_extended = false } } + require"lualibs" + require"luaotfload-database" + local results = fonts.names.read_fonts_conf{"fonts.conf.test"} + inspect(results) } \bye diff --git a/tests/fonts.conf.test b/tests/fonts.conf.test index 0e5b961..3c3e132 100644 --- a/tests/fonts.conf.test +++ b/tests/fonts.conf.test @@ -1,19 +1,25 @@ -<!-- this is a comment --> -<!-- this is a comment with the <dir>test 0 failed!</dir> --> -<!----> -<!-- -this is a comment --> -<!-- -this is a comment ---> -<!-- -this is a comment -<dir>test -1 failed!</dir> ---> -<dir>test 1 ok</dir> -<dir>test 2 ok</dir><dir>test 3 ok</dir> -<dir>test 4 ok</dir><!-- comment--><dir>test 5 ok</dir> -<!-- this starts to be more debian-specific... change it to fit your system --> -<include>/etc/fonts/conf.d</include><!-- this is a dir --> -<include>/etc/fonts/fonts.conf</include> -<include ignore_missing="no">/etc/fonts/conf.d/69-unifont.conf</include> +<?xml version="1.0"?> +<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> +<!-- /etc/fonts/fonts.conf file to configure system font access --> +<fontconfig> + <!-- this is a comment --> + <!-- this is a comment with the <dir>test 0 failed!</dir> --> + <!----> + <!-- + this is a comment --> + <!-- + this is a comment + --> + <!-- + this is a comment + <dir>test -1 failed!</dir> + --> + <include prefix="xdg">fontconfig/fonts.conf</include><!-- this is a dir --> + <dir>test 1 ok</dir> + <dir>test 2 ok</dir><dir>test 3 ok</dir> + <dir>test 4 ok</dir><!-- comment--><dir>test 5 ok</dir> + <!-- this starts to be more debian-specific... change it to fit your system --> + <include>/etc/fonts/conf.d</include><!-- this is a dir --> + <include>/etc/fonts/fonts.conf</include> + <include ignore_missing="no">/etc/fonts/conf.d/69-unifont.conf</include> +</fontconfig> |