summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-05-09 16:19:12 -0700
committerPhilipp Gesang <phg42.2a@gmail.com>2013-05-09 16:19:12 -0700
commit2aeccd26f3cb654930ac4f310881c62ba2d796b4 (patch)
tree75c0e2a0a48a3f1b606610c6b06ec7d9647907bb
parentf0d437bc1bdf18f5eb7e296df7b3784cb04dabc2 (diff)
parenteb522f0f723c5ab94f43c72cce25d9ac6921a8d9 (diff)
downloadluaotfload-2aeccd26f3cb654930ac4f310881c62ba2d796b4.tar.gz
Merge pull request #54 from phi-gamma/master
workaround for paths in file lookups
-rw-r--r--NEWS1
-rw-r--r--luaotfload-features.lua32
-rwxr-xr-xmkglyphlist18
3 files changed, 47 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index df205dc..a432d98 100644
--- a/NEWS
+++ b/NEWS
@@ -26,6 +26,7 @@ Change History
* Hans adapted the font loader to several of our requests (attribute
allocation, custom merged package name etc.)
* Auxiliary functions for package authors
+ * Man page for luaotfload-tool
2013/04/27, luaotfload v1.3:
* blacklisting lingoes.ttf (segfaults)
diff --git a/luaotfload-features.lua b/luaotfload-features.lua
index f91aee7..5e8216c 100644
--- a/luaotfload-features.lua
+++ b/luaotfload-features.lua
@@ -32,6 +32,7 @@ local old_feature_list = { }
local report = logs.names_report
+local stringfind = string.find
local stringlower = string.lower
local stringgsub = string.gsub
local stringis_empty = string.is_empty
@@ -215,10 +216,25 @@ local toboolean = function (s)
return s
end
+--- dirty test if a file: request is actually a path: lookup; don’t
+--- ask!
+local check_garbage = function (_,i, garbage)
+ if stringfind(garbage, "/") then
+ report("log", 0, "load", --- ffs use path!
+ "warning: path in file: lookups is deprecated; ")
+ report("log", 0, "load", "use bracket syntax instead!")
+ report("log", 0, "load",
+ "position: %d; full match: “%s”",
+ i, garbage)
+ return true
+ end
+ return false
+end
+
local lpegmatch = lpeg.match
local P, S, R = lpeg.P, lpeg.S, lpeg.R
-local C, Cc, Cf, Cg, Cs, Ct
- = lpeg.C, lpeg.Cc, lpeg.Cf, lpeg.Cg, lpeg.Cs, lpeg.Ct
+local C, Cc, Cf, Cg, Cmt, Cs, Ct
+ = lpeg.C, lpeg.Cc, lpeg.Cf, lpeg.Cg, lpeg.Cmt, lpeg.Cs, lpeg.Ct
--- terminals and low-level classes -----------------------------------
--- note we could use the predefined ones from lpeg.patterns
@@ -259,9 +275,17 @@ local modifier = slash * (other_modifier --> ignore
local modifier_list = Cg(Ct(modifier^0), "modifiers")
--- lookups -----------------------------------------------------------
-local fontname = C((1-S"/:(")^1) --- like luatex-fonts
+local fontname = C((1-S":(/")^1) --- like luatex-fonts
+local unsupported = Cmt((1-S":(")^1, check_garbage)
local prefixed = P"name:" * ws * Cg(fontname, "name")
- + P"file:" * ws * Cg(fontname, "file")
+--- initially we intended file: to emulate the behavior of
+--- luatex-fonts, i.e. no paths allowed. after all, we do have XeTeX
+--- emulation with the path lookup and it interferes with db lookups.
+--- turns out fontspec and other widely used packages rely on file:
+--- with paths already, so we’ll add a less strict rule here. anyways,
+--- we’ll emit a warning.
+ + P"file:" * ws * Cg(unsupported, "path")
+ + P"file:" * ws * Cg(fontname, "file")
local unprefixed = Cg(fontname, "anon")
local path_lookup = lbrk * Cg(C((1-rbrk)^1), "path") * rbrk
diff --git a/mkglyphlist b/mkglyphlist
index 3366c9c..94aac39 100755
--- a/mkglyphlist
+++ b/mkglyphlist
@@ -21,6 +21,21 @@ local font_age = "./luaotfload-glyphlist.lua"
local glyph_source = "http://partners.adobe.com/public/developer/en/opentype/glyphlist.txt"
-----------------------------------------------------------------------
+-- fallbacks
+-----------------------------------------------------------------------
+--- Hans adds a small list of mappings that are not in the original
+--- glyph list but seem to be normalizations of some sort. I trust his
+--- experience, so I’ll just include them here. Background:
+--- http://www.ntg.nl/pipermail/ntg-context/2013/073089.html
+
+local fallbacks = {
+ ["SF10000"]=9484, ["SF20000"]=9492, ["SF30000"]=9488,
+ ["SF40000"]=9496, ["SF50000"]=9532, ["SF60000"]=9516,
+ ["SF70000"]=9524, ["SF80000"]=9500, ["SF90000"]=9508,
+ ["afii208"]=8213,
+}
+
+-----------------------------------------------------------------------
-- includes
-----------------------------------------------------------------------
require"lpeg"
@@ -73,6 +88,9 @@ local get_glyphs = function (data)
print("error: could not parse glyph list")
os.exit(-1)
end
+ for name, glyph in next, fallbacks do
+ res[name] = res[name] or glyph
+ end
return res
end