summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElie Roux <elie.roux@telecom-bretagne.eu>2013-05-15 09:02:32 -0700
committerElie Roux <elie.roux@telecom-bretagne.eu>2013-05-15 09:02:32 -0700
commit087a990dc8581be3a2980034e70f874d52f9577b (patch)
tree5a7d38a8e5cf55cceb6dd51becf102950819beb4
parent8a67b384a597b9af16ea915fe7e323d4328cdd3e (diff)
parent52f6ea217175fd1a39e6f80ea7a0f98fbf1364f6 (diff)
downloadluaotfload-087a990dc8581be3a2980034e70f874d52f9577b.tar.gz
Merge pull request #75 from phi-gamma/master
address feature request #74
-rw-r--r--Makefile4
-rw-r--r--luaotfload-auxiliary.lua88
-rw-r--r--luaotfload-blacklist.cnf2
-rw-r--r--luaotfload-colors.lua4
-rw-r--r--luaotfload-database.lua10
-rw-r--r--luaotfload-features.lua2
-rw-r--r--luaotfload-merged.lua8
-rwxr-xr-xluaotfload-tool.lua2
8 files changed, 86 insertions, 34 deletions
diff --git a/Makefile b/Makefile
index 7eb2fe5..fce2e70 100644
--- a/Makefile
+++ b/Makefile
@@ -25,7 +25,7 @@ MAN = $(MANPAGE)
COMPILED = $(DOC)
UNPACKED = luaotfload.sty luaotfload.lua
GENERATED = $(GRAPHED) $(UNPACKED) $(COMPILED) $(GLYPHS) $(MAN)
-SOURCE = $(DTX) $(MANSOURCE) $(OTFL) README Makefile NEWS $(SCRIPT) $(OLDSCRIPT) $(GLYPHSCRIPT)
+SOURCE = $(DTX) $(MANSOURCE) $(OTFL) README Makefile NEWS $(GLYPHSCRIPT)
# test files
TESTDIR = tests
@@ -35,7 +35,7 @@ TESTFILES_TL = $(filter-out $(TESTFILES_SYS), $(TESTFILES))
# Files grouped by installation location
SCRIPTFILES = $(SCRIPT) $(OLDSCRIPT) $(GLYPHSCRIPT)
-RUNFILES = $(UNPACKED) $(OTFL)
+RUNFILES = $(UNPACKED) $(filter-out $(SCRIPTFILES),$(OTFL))
DOCFILES = $(DOC) $(DOTPDF) README NEWS
MANFILES = $(MANPAGE)
SRCFILES = $(DTX) Makefile
diff --git a/luaotfload-auxiliary.lua b/luaotfload-auxiliary.lua
index a41520c..dde5686 100644
--- a/luaotfload-auxiliary.lua
+++ b/luaotfload-auxiliary.lua
@@ -76,16 +76,18 @@ local add_fontdata_fallbacks = function (fontdata)
metadata = { ascent = metadata.ascent },
}
--- for microtype and fontspec
- local fake_features = { } -- wrong: table.copy(resources.features)
+ --local fake_features = { }
+ local fake_features = table.copy(resources.features)
setmetatable(fake_features, { __index = function (tab, idx)
- warning("some package (probably fontspec) is outdated")
- warning(
- "attempt to index " ..
- "tfmdata.shared.otfdata.luatex.features (%s)",
- idx)
- --os.exit(1)
- return nil --- empty anyways
- end})
+ warning("some package (probably fontspec) is outdated")
+ warning(
+ "attempt to index " ..
+ "tfmdata.shared.otfdata.luatex.features (%s)",
+ idx)
+ --os.exit(1)
+ return tab[idx]
+ end,
+ })
fontdata.shared.otfdata.luatex = {
unicodes = resources.unicodes,
features = fake_features,
@@ -479,27 +481,65 @@ aux.sprint_math_dimension = sprint_math_dimension
--- extra database functions
-----------------------------------------------------------------------
+local namesresolve = fonts.names.resolve
+local namesscan_dir = fonts.names.scan_dir
+
--- migrated from luaotfload-database.lua
--- https://github.com/lualatex/luaotfload/pull/61#issuecomment-17776975
---- string -> (int, int)
+--- string -> (int * int)
local scan_external_dir = function (dir)
- local old_names, new_names = names.data
- if not old_names then
- old_names = load_names()
- end
- new_names = tablecopy(old_names)
- local n_scanned, n_new = fonts.names.scan_dir(dir, old_names,
- new_names)
- --- FIXME
- --- This doesn’t seem right. If a db update is triggered after this
- --- point, then the added fonts will be saved along with it --
- --- which is not as “temporarily” as it should be. (This should be
- --- addressed during a refactoring of names_resolve().)
- names.data = new_names
- return n_scanned, n_new
+ local old_names, new_names = names.data
+ if not old_names then
+ old_names = load_names()
+ end
+ new_names = tablecopy(old_names)
+ local n_scanned, n_new = scan_dir(dir, old_names, new_names)
+ --- FIXME
+ --- This doesn’t seem right. If a db update is triggered after this
+ --- point, then the added fonts will be saved along with it --
+ --- which is not as “temporarily” as it should be. (This should be
+ --- addressed during a refactoring of names_resolve().)
+ names.data = new_names
+ return n_scanned, n_new
end
aux.scan_external_dir = scan_external_dir
+--- https://github.com/lualatex/luaotfload/issues/74
+--- string -> (string * int)
+local resolve_fontname = function (name)
+ local foundname, subfont, success = namesresolve(nil, nil, {
+ name = name,
+ lookup = "name",
+ optsize = 0,
+ specification = "name:" .. name,
+ })
+ if success then
+ return foundname, subfont
+ end
+ return false, false
+end
+
+aux.resolve_fontname = resolve_fontname
+
+--- string list -> (string * int)
+local resolve_fontlist
+resolve_fontlist = function (names, n)
+ if not n then
+ return resolve_fontlist(names, 1)
+ end
+ local this = names[n]
+ if this then
+ local foundname, subfont = resolve_fontname(this)
+ if foundname then
+ return foundname, subfont
+ end
+ return resolve_fontlist(names, n+1)
+ end
+ return false, false
+end
+
+aux.resolve_fontlist = resolve_fontlist
+
-- vim:tw=71:sw=2:ts=2:expandtab
diff --git a/luaotfload-blacklist.cnf b/luaotfload-blacklist.cnf
index 943d347..2a21091 100644
--- a/luaotfload-blacklist.cnf
+++ b/luaotfload-blacklist.cnf
@@ -2,4 +2,6 @@
LastResort.ttf % a MacOSX font, but also available for free from unicode.org
% Segfaults under LuaTeX 0.76
lingoes.ttf
+% http://tug.org/pipermail/luatex/2013-May/004239.html
+Diablindall.ttf
diff --git a/luaotfload-colors.lua b/luaotfload-colors.lua
index ec076c2..7bd5c1f 100644
--- a/luaotfload-colors.lua
+++ b/luaotfload-colors.lua
@@ -7,12 +7,16 @@ if not modules then modules = { } end modules ['luaotfload-colors'] = {
}
--[[doc--
+
buggy coloring with the pre_output_filter when expansion is enabled
· tfmdata for different expansion values is split over different objects
· in ``initializeexpansion()``, chr.expansion_factor is set, and only
those characters that have it are affected
· in constructors.scale: chr.expansion_factor = ve*1000 if commented out
makes the bug vanish
+
+explanation: http://tug.org/pipermail/luatex/2013-May/004305.html
+
--doc]]--
diff --git a/luaotfload-database.lua b/luaotfload-database.lua
index f4c6fdc..0e46874 100644
--- a/luaotfload-database.lua
+++ b/luaotfload-database.lua
@@ -202,8 +202,10 @@ local fontnames_init = function (keep_cache) --- returns dbobj
}
end
-local make_name = function (path)
- return filereplacesuffix(path, "lua"), filereplacesuffix(path, "luc")
+--- string -> (string * string)
+local make_savenames = function (path)
+ return filereplacesuffix(path, "lua"),
+ filereplacesuffix(path, "luc")
end
--- When loading a lua file we try its binary complement first, which
@@ -1493,7 +1495,7 @@ save_lookups = function ( )
local lookups = names.lookups
local path = ensure_names_path()
if fileiswritable(path) then
- local luaname, lucname = make_name(names.path.lookup_path)
+ local luaname, lucname = make_savenames(names.path.lookup_path)
if luaname then
tabletofile(luaname, lookups, true)
if lucname and type(caches.compile) == "function" then
@@ -1514,7 +1516,7 @@ save_names = function (fontnames)
if not fontnames then fontnames = names.data end
local path = ensure_names_path()
if fileiswritable(path) then
- local luaname, lucname = make_name(names.path.path)
+ local luaname, lucname = make_savenames(names.path.path)
if luaname then
--tabletofile(luaname, fontnames, true, { reduce=true })
tabletofile(luaname, fontnames, true)
diff --git a/luaotfload-features.lua b/luaotfload-features.lua
index 39d4a88..f541964 100644
--- a/luaotfload-features.lua
+++ b/luaotfload-features.lua
@@ -1050,7 +1050,7 @@ local extract_subfont
do
local eof = P(-1)
local digit = R"09"
- --- Theoretically a valid subfont address can be up to seven
+ --- Theoretically a valid subfont address can be up to ten
--- digits long.
local sub_expr = P"(" * C(digit^1) * P")" * eof
local full_path = C(P(1 - sub_expr)^1)
diff --git a/luaotfload-merged.lua b/luaotfload-merged.lua
index f814bdb..14667bd 100644
--- a/luaotfload-merged.lua
+++ b/luaotfload-merged.lua
@@ -1,6 +1,6 @@
-- merged file : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 05/12/13 22:16:22
+-- merge date : 05/14/13 23:14:52
do -- begin closure to overcome local limits and interference
@@ -2046,7 +2046,11 @@ function file.splitname(str,splitdrive)
end
end
function file.splitbase(str)
- return str and lpegmatch(pattern_d,str)
+ if str then
+ return lpegmatch(pattern_d,str)
+ else
+ return "",str
+ end
end
function file.nametotable(str,splitdrive)
if str then
diff --git a/luaotfload-tool.lua b/luaotfload-tool.lua
index 352697c..721e3cf 100755
--- a/luaotfload-tool.lua
+++ b/luaotfload-tool.lua
@@ -347,7 +347,7 @@ actions.query = function (job)
lookup = "name",
specification = "name:" .. query,
optsize = 0,
- }
+ }
local foundname, subfont, success =
fonts.names.resolve(nil, nil, tmpspec)