summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-08-07 03:46:47 -0700
committerPhilipp Gesang <phg42.2a@gmail.com>2013-08-07 03:46:47 -0700
commit276d4f282bc6b9899fb026a0b96c2eb1f9219e35 (patch)
tree36ca2231814c48e0f2b954ca12e7ce779a552aa6
parent86a83bbbd05bdbec3c4d08b16dee864ab05b5dd7 (diff)
parent749917ae9796808d937c38375ebdb3fbfb0fcc1c (diff)
downloadluaotfload-276d4f282bc6b9899fb026a0b96c2eb1f9219e35.tar.gz
Merge pull request #119 from phi-gamma/master
type1 support, improve design size handling, better ``--find``, various fixes
-rw-r--r--NEWS8
-rw-r--r--luaotfload-database.lua278
-rw-r--r--luaotfload-features.lua40
-rw-r--r--luaotfload-merged.lua53
-rwxr-xr-xluaotfload-tool.lua81
-rw-r--r--luaotfload-tool.rst9
6 files changed, 299 insertions, 170 deletions
diff --git a/NEWS b/NEWS
index 960a8d5..399ed97 100644
--- a/NEWS
+++ b/NEWS
@@ -2,11 +2,13 @@ Change History
--------------
2013/XX/XX, luaotfload v2.4
- * additional self-tests, now in separate file (luaotfload-diagnostics.lua)
- * better path and directory handling, especially on Windows
+ * Additional self-tests, now in separate file (luaotfload-diagnostics.lua)
+ * Better path and directory handling, especially on Windows
* database now indexes Type1 fonts (PFA, PFB) and makes them accessible
with style modifiers (requires --format=+pfa,pfb option to luaotfload-tool)
- * test runner (script mktests)
+ * Test runner (script mktests)
+ * New luaotfload-tool option: ``--no-reload``
+ * ``luaotfload-tool --find`` now understands request syntax
2013/07/10, luaotfload v2.3a
* Detect LuaJIT interpreter (LuaJITTeX)
diff --git a/luaotfload-database.lua b/luaotfload-database.lua
index ac2d0db..11cc97d 100644
--- a/luaotfload-database.lua
+++ b/luaotfload-database.lua
@@ -102,7 +102,7 @@ if config.luaotfload.update_live ~= false then
config.luaotfload.update_live = true
end
-names.version = 2.208
+names.version = 2.210
names.data = nil --- contains the loaded database
names.lookups = nil --- contains the lookup cache
@@ -259,6 +259,7 @@ This is a sketch of the luaotfload db:
fullname : string; // <- metadata
sanitized : {
family : string;
+ fontstyle_name : string; // <- new in 2.4
fontname : string; // <- metadata
fullname : string; // <- namedata.names
metafamily : string;
@@ -384,35 +385,38 @@ local fuzzy_limit = 1 --- display closest only
--- bool? -> dbobj
load_names = function (dry_run)
- local starttime = os.gettimeofday()
- local foundname, data = load_lua_file(names.path.index.lua)
+ local starttime = os.gettimeofday ()
+ local foundname, data = load_lua_file (names.path.index.lua)
if data then
- report("both", 2, "db",
- "Font names database loaded", "%s", foundname)
- report("info", 3, "db", "Loading took %0.f ms",
- 1000*(os.gettimeofday()-starttime))
+ report ("both", 2, "db",
+ "Font names database loaded", "%s", foundname)
+ report ("info", 3, "db", "Loading took %0.f ms",
+ 1000*(os.gettimeofday()-starttime))
local db_version, nms_version = data.version, names.version
if db_version ~= nms_version then
- report("both", 0, "db",
- [[Version mismatch; expected %4.3f, got %4.3f]],
- nms_version, db_version)
+ report ("both", 0, "db",
+ [[Version mismatch; expected %4.3f, got %4.3f]],
+ nms_version, db_version)
if not fonts_reloaded then
- report("both", 0, "db", [[Force rebuild]])
- return update_names({ }, true, false)
+ report ("both", 0, "db", [[Force rebuild]])
+ data = update_names ({ }, true, false)
+ if not data then
+ report ("both", 0, "db",
+ "Database creation unsuccessful.")
+ end
end
end
else
- report("both", 0, "db",
- [[Font names database not found, generating new one.]])
- report("both", 0, "db",
- [[This can take several minutes; please be patient.]])
+ report ("both", 0, "db",
+ [[Font names database not found, generating new one.]])
+ report ("both", 0, "db",
+ [[This can take several minutes; please be patient.]])
data = update_names (fontnames_init (get_font_filter ()),
nil, dry_run)
- local success = save_names(data)
if not success then
- report("both", 0, "db", "Database creation unsuccessful.")
+ report ("both", 0, "db", "Database creation unsuccessful.")
end
end
fonts_loaded = true
@@ -509,7 +513,7 @@ local verbose_lookup = function (data, kind, filename)
return false
end
---- string -> (string | string * string)
+--- string -> (string * string * bool)
crude_file_lookup_verbose = function (filename)
if not names.data then names.data = load_names() end
local data = names.data
@@ -520,24 +524,24 @@ crude_file_lookup_verbose = function (filename)
--- look up in db first ...
found = verbose_lookup(filenames, "bare", filename)
if found then
- return found
+ return found, nil, true
end
found = verbose_lookup(filenames, "base", filename)
if found then
- return found
+ return found, nil, true
end
--- ofm and tfm, returns pair
for i=1, #type1_formats do
local format = type1_formats[i]
if resolvers.findfile(filename, format) then
- return file.addsuffix(filename, format), format
+ return file.addsuffix(filename, format), format, true
end
end
- return filename, nil
+ return filename, nil, false
end
---- string -> (string | string * string)
+--- string -> (string * string * bool)
crude_file_lookup = function (filename)
if not names.data then names.data = load_names() end
local data = names.data
@@ -554,15 +558,17 @@ crude_file_lookup = function (filename)
if found == nil then
found = dummy_findfile(filename)
end
- return found or filename
+ return found or filename, nil, true
end
+
for i=1, #type1_formats do
local format = type1_formats[i]
if resolvers.findfile(filename, format) then
- return file.addsuffix(filename, format), format
+ return file.addsuffix(filename, format), format, true
end
end
- return filename, nil
+
+ return filename, nil, false
end
--[[doc--
@@ -720,16 +726,16 @@ end
--- “found” is the match accumulator
local add_to_match = function (found, size, face)
- local optsize, dsnsize, maxsize, minsize
- if #face.size > 0 then
- optsize = face.size
- dsnsize = optsize[1] and optsize[1] / 10
- -- can be nil
- maxsize = optsize[2] and optsize[2] / 10 or dsnsize
- minsize = optsize[3] and optsize[3] / 10 or dsnsize
- end
local continue = true
- if optsize then
+
+ local optsize = face.size
+
+ if optsize and next (optsize) then
+ local dsnsize, maxsize, minsize
+ dsnsize = optsize[1]
+ maxsize = optsize[2]
+ minsize = optsize[3]
+
if dsnsize == size or (size > minsize and size <= maxsize) then
found[1] = face
continue = false ---> break
@@ -740,6 +746,7 @@ local add_to_match = function (found, size, face)
found[1] = face
continue = false ---> break
end
+
return found, continue
end
@@ -818,21 +825,26 @@ resolve = function (_, _, specification) -- the 1st two parameters are used by C
return specification.name, false, false
end
+ local synonym_set = style_synonyms.set
+ local stylesynonyms = synonym_set[style]
+ local regularsynonyms = synonym_set.regular
+
local exact = { } --> collect exact style matches
local synonymous = { } --> collect matching style synonyms
local fallback --> e.g. non-matching style (fontspec is anal about this)
local candidates = { } --> secondary results, incomplete matches
- local synonym_set = style_synonyms.set
for n, face in next, data.mappings do
- local family, subfamily, fullname, prefmodifiers
- local psname, fontname, pfullname, metafamily
+ local family, metafamily
+ local prefmodifiers, fontstyle_name, subfamily
+ local psname, fullname, fontname, pfullname
local facenames = face.sanitized
if facenames then
family = facenames.family
subfamily = facenames.subfamily
- prefmodifiers = facenames.prefmodifiers or facenames.subfamily
+ fontstyle_name = facenames.fontstyle_name
+ prefmodifiers = facenames.prefmodifiers or fontstyle_name or subfamily
fullname = facenames.fullname
psname = facenames.psname
fontname = facenames.fontname
@@ -845,14 +857,16 @@ resolve = function (_, _, specification) -- the 1st two parameters are used by C
if name == family
or name == metafamily
then
- if style == prefmodifiers then
+ if style == prefmodifiers
+ or style == fontstyle_name
+ then
local continue
exact, continue = add_to_match(exact, askedsize, face)
if continue == false then break end
elseif style == subfamily then
exact = add_to_match(exact, askedsize, face)
- elseif synonym_set[style] and synonym_set[style][prefmodifiers]
- or synonym_set.regular[prefmodifiers]
+ elseif stylesynonyms and stylesynonyms[prefmodifiers]
+ or regularsynonyms[prefmodifiers]
then
--- treat synonyms for prefmodifiers as first-class
--- (needed to prioritize DejaVu Book over Condensed)
@@ -863,8 +877,8 @@ resolve = function (_, _, specification) -- the 1st two parameters are used by C
or name == psname
then
synonymous = add_to_match(synonymous, askedsize, face)
- elseif synonym_set[style] and synonym_set[style][subfamily]
- or synonym_set.regular[subfamily]
+ elseif stylesynonyms and stylesynonyms[subfamily]
+ or regularsynonyms[subfamily]
then
synonymous = add_to_match(synonymous, askedsize, face)
elseif prefmodifiers == "regular"
@@ -911,14 +925,17 @@ resolve = function (_, _, specification) -- the 1st two parameters are used by C
-- least difference from the requested size.
local closest
local least = math.huge -- initial value is infinity
+
for i,face in next, found do
- local dsnsize = face.size[1]/10
+
+ local dsnsize = face.size and face.size[1] or 0
local difference = mathabs(dsnsize - askedsize)
if difference < least then
closest = face
least = difference
end
end
+
local success, filename, subfont
= get_font_file(data.filenames.full, closest)
if success == true then
@@ -987,14 +1004,13 @@ end
--- string -> ('a -> 'a) -> 'a list -> 'a
reload_db = function (why, caller, ...)
- report("both", 1, "db", "Reload initiated; reason: %q", why)
- names.data = update_names(names.data, false, false)
- local success = save_names()
- if success then
+ report ("both", 1, "db", "Reload initiated; reason: %q", why)
+ names.data = update_names (names.data, false, false)
+ if names.data then
fonts_reloaded = true
- return caller(...)
+ return caller (...)
end
- report("both", 0, "db", "Database update unsuccessful.")
+ report ("both", 0, "db", "Database update unsuccessful.")
end
--- string -> string -> int
@@ -1127,79 +1143,101 @@ table as returned by the font file reader need to be relocated.
--- string -> int -> bool -> string -> fontentry
ot_fullinfo = function (filename, subfont, texmf, basename)
- local tfmdata = { }
+ local namedata = { }
local metadata = load_font_file (filename, subfont)
if not metadata then
return nil
end
+ local english_names
+
+ if metadata.names then
+ for _, raw_namedata in next, metadata.names do
+ if raw_namedata.lang == "English (US)" then
+ english_names = raw_namedata.names
+ end
+ end
+ else
+ -- no names table, propably a broken font
+ report("log", 1, "db",
+ "Broken font %s rejected due to missing names table.",
+ basename)
+ return
+ end
+
+ local fontnames = {
+ --- see
+ --- https://developer.apple.com/fonts/TTRefMan/RM06/Chap6name.html
+ fullname = english_names.compatfull
+ or english_names.fullname,
+ family = english_names.preffamilyname
+ or english_names.family,
+ prefmodifiers = english_names.prefmodifiers,
+ subfamily = english_names.subfamily,
+ psname = english_names.postscriptname,
+ pfullname = metadata.fullname,
+ fontname = metadata.fontname,
+ metafamily = metadata.familyname,
+ }
+
-- see http://www.microsoft.com/typography/OTSPEC/features_pt.htm#size
if metadata.fontstyle_name then
for _, name in next, metadata.fontstyle_name do
if name.lang == 1033 then --- I hate magic numbers
- tfmdata.fontstyle_name = name.name
+ fontnames.fontstyle_name = name.name
end
end
end
- if metadata.names then
- for _, namedata in next, metadata.names do
- if namedata.lang == "English (US)" then
- local names = {
- --- see
- --- https://developer.apple.com/fonts/TTRefMan/RM06/Chap6name.html
- fullname = namedata.names.compatfull
- or namedata.names.fullname,
- family = namedata.names.preffamilyname
- or namedata.names.family,
- prefmodifiers = namedata.names.prefmodifiers,
- subfamily = tfmdata.fontstyle_name
- or namedata.names.subfamily,
- psname = namedata.names.postscriptname,
- pfullname = metadata.fullname,
- fontname = metadata.fontname,
- metafamily = metadata.familyname,
- }
--- tfmdata.names = names
- tfmdata.sanitized = sanitize_names(names)
- end
- end
+ namedata.sanitized = sanitize_names (fontnames)
+
+ namedata.fontname = metadata.fontname
+ namedata.fullname = metadata.fullname
+ namedata.familyname = metadata.familyname
+ namedata.weight = metadata.pfminfo.weight
+ namedata.width = metadata.pfminfo.width
+ namedata.slant = metadata.italicangle
+ --- this is for querying, see www.ntg.nl/maps/40/07.pdf for details
+ namedata.units_per_em = metadata.units_per_em
+ namedata.version = metadata.version
+ -- don't waste the space with zero values
+
+ local design_size = metadata.design_size
+ local design_range_top = metadata.design_range_top
+ local design_range_bottom = metadata.design_range_bottom
+
+ local fallback_size = design_size ~= 0 and design_size
+ or design_range_bottom ~= 0 and design_range_bottom
+ or design_range_top ~= 0 and design_range_top
+
+ if fallback_size then
+ design_size = (design_size or fallback_size) / 10
+ design_range_top = (design_range_top or fallback_size) / 10
+ design_range_bottom = (design_range_bottom or fallback_size) / 10
+ namedata.size = {
+ design_size, design_range_top, design_range_bottom,
+ }
else
- -- no names table, propably a broken font
- report("log", 1, "db", "Broken font rejected", "%s", basefile)
- return
+ namedata.size = false
end
- tfmdata.fontname = metadata.fontname
- tfmdata.fullname = metadata.fullname
- tfmdata.familyname = metadata.familyname
- tfmdata.weight = metadata.pfminfo.weight
- tfmdata.width = metadata.pfminfo.width
- tfmdata.slant = metadata.italicangle
- --- this is for querying
- tfmdata.units_per_em = metadata.units_per_em
- tfmdata.version = metadata.version
- -- don't waste the space with zero values
- tfmdata.size = {
- metadata.design_size ~= 0 and metadata.design_size or nil,
- metadata.design_range_top ~= 0 and metadata.design_range_top or nil,
- metadata.design_range_bottom ~= 0 and metadata.design_range_bottom or nil,
- }
--- file location data (used to be filename field)
- tfmdata.filename = filename --> sys
- tfmdata.basename = basename --> texmf
- tfmdata.texmf = texmf or false
- tfmdata.subfont = subfont
+ namedata.filename = filename --> sys
+ namedata.basename = basename --> texmf
+ namedata.texmf = texmf or false
+ namedata.subfont = subfont
- return tfmdata
+ return namedata
end
--[[doc--
- Type1 font inspector. PFB’s contain a good deal less name fields
- which makes it tricky in some parts to find a meaningful representation
- for the database.
+ Type1 font inspector. In comparison with OTF, PFB’s contain a good
+ deal less name fields which makes it tricky in some parts to find a
+ meaningful representation for the database.
+
+ Good read: http://www.adobe.com/devnet/font/pdfs/5004.AFM_Spec.pdf
--doc]]--
@@ -1212,7 +1250,7 @@ t1_fullinfo = function (filename, _subfont, texmf, basename)
local fullname = metadata.fullname
local familyname = metadata.familyname
local italicangle = metadata.italicangle
- local weight = metadata.weight
+ local weight = metadata.weight --- string identifier
--- we have to improvise and detect whether we deal with
--- italics since pfb fonts don’t come with a “subfamily”
@@ -1242,7 +1280,7 @@ t1_fullinfo = function (filename, _subfont, texmf, basename)
end
end
- if not style then
+ if not style or style == "" then
style = "regular"
--- else italic
end
@@ -1261,15 +1299,18 @@ t1_fullinfo = function (filename, _subfont, texmf, basename)
namedata.fullname = fullname
namedata.familyname = familyname
- namedata.weight = 0 -- dummy
+ namedata.slant = italicangle
+ namedata.units_per_em = 1000 --- ps fonts standard
namedata.version = metadata.version
+ namedata.weight = metadata.pfminfo.weight --- integer
+ namedata.width = metadata.pfminfo.width
- namedata.size = { }
+ namedata.size = false
namedata.filename = filename --> sys
namedata.basename = basename --> texmf
namedata.texmf = texmf or false
- namedata.subfont = subfont
+ namedata.subfont = false
return namedata
end
@@ -2167,7 +2208,7 @@ update_names = function (fontnames, force, dry_run)
if config.luaotfload.update_live == false then
report("info", 2, "db",
- "skipping database update")
+ "Skipping database update")
--- skip all db updates
return fontnames or names.data
end
@@ -2220,14 +2261,25 @@ update_names = function (fontnames, force, dry_run)
"Scanned %d font files; %d new entries.", n_scanned, n_new)
report("info", 3, "db",
"Rebuilt in %0.f ms", 1000*(os.gettimeofday()-starttime))
+ names.data = newfontnames
+
+ if dry_run ~= true then
+
+ save_names ()
+
+ local success, _lookups = flush_lookup_cache ()
+ if success then
+ local success = names.save_lookups ()
+ if success then
+ logs.names_report ("info", 2, "cache",
+ "Lookup cache emptied")
+ return newfontnames
+ end
+ end
+ end
return newfontnames
end
---- The lookup cache is an experimental feature of version 2.2;
---- instead of incorporating it into the database it gets its own
---- file. As we update it after every single addition this saves us
---- quite some time.
-
--- unit -> bool
save_lookups = function ( )
local lookups = names.lookups
diff --git a/luaotfload-features.lua b/luaotfload-features.lua
index 4088379..db0b1d0 100644
--- a/luaotfload-features.lua
+++ b/luaotfload-features.lua
@@ -14,11 +14,25 @@ local lpegmatch = lpeg.match
---[[ begin included font-ltx.lua ]]
--- this appears to be based in part on luatex-fonts-def.lua
-local fonts = fonts
+local fonts = fonts
+local definers = fonts.definers
+local handlers = fonts.handlers
+
+local as_script, normalize
+
+if handlers then
+ normalize = handlers.otf.features.normalize
+else
+ normalize = function () end
+ as_script = true
+end
+
--HH A bit of tuning for definitions.
-fonts.constructors.namemode = "specification" -- somehow latex needs this (changed name!) => will change into an overload
+if fonts.constructors then
+ fonts.constructors.namemode = "specification" -- somehow latex needs this (changed name!) => will change into an overload
+end
--[[HH--
tricky: we sort of bypass the parser and directly feed all into
@@ -39,9 +53,6 @@ local stringformat = string.format
local stringis_empty = string.is_empty
local mathceil = math.ceil
---- TODO an option to dump the default features for a script would make
---- a nice addition to luaotfload-tool
-
local defaults = {
dflt = {
"ccmp", "locl", "rlig", "liga", "clig",
@@ -1185,20 +1196,21 @@ local handle_request = function (specification)
--- The next line sets the “rand” feature to “random”; I haven’t
--- investigated it any further (luatex-fonts-ext), so it will
--- just stay here.
- specification.features.normal
- = fonts.handlers.otf.features.normalize(request.features)
+ specification.features.normal = normalize (request.features)
return specification
end
-local compare_requests = function (spec)
- local old = old_behavior(spec)
- local new = handle_request(spec)
- return new
+if as_script == true then --- skip the remainder of the file
+ fonts.names.handle_request = handle_request
+ report ("log", 5, "load",
+ "Exiting early from luaotfload-features.lua.")
+ return
+else
+ local registersplit = definers.registersplit
+ registersplit (":", handle_request, "cryptic")
+ registersplit ("", handle_request, "more cryptic") -- catches \font\text=[names]
end
-fonts.definers.registersplit(":", handle_request, "cryptic")
-fonts.definers.registersplit("", handle_request, "more cryptic") -- catches \font\text=[names]
-
---[[ end included font-ltx.lua ]]
--[[doc--
diff --git a/luaotfload-merged.lua b/luaotfload-merged.lua
index c17a541..146ba36 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 : 07/14/13 14:53:44
+-- merge date : 08/01/13 01:31:02
do -- begin closure to overcome local limits and interference
@@ -2416,9 +2416,9 @@ function string.booleanstring(str)
end
function string.is_boolean(str,default)
if type(str)=="string" then
- if str=="true" or str=="yes" or str=="on" or str=="t" then
+ if str=="true" or str=="yes" or str=="on" or str=="t" or str=="1" then
return true
- elseif str=="false" or str=="no" or str=="off" or str=="f" then
+ elseif str=="false" or str=="no" or str=="off" or str=="f" or str=="0" then
return false
end
end
@@ -4880,33 +4880,38 @@ function mappings.addtounicode(data,filename)
if not unicode or unicode=="" then
local split=lpegmatch(namesplitter,name)
local nsplit=split and #split or 0
- if nsplit>=2 then
- local t,n={},0
- for l=1,nsplit do
- local base=split[l]
- local u=unicodes[base] or unicodevector[base]
- if not u then
+ local t,n={},0
+ unicode=true
+ for l=1,nsplit do
+ local base=split[l]
+ local u=unicodes[base] or unicodevector[base]
+ if not u then
+ break
+ elseif type(u)=="table" then
+ if u[1]>=private then
+ unicode=false
break
- elseif type(u)=="table" then
- n=n+1
- t[n]=u[1]
- else
- n=n+1
- t[n]=u
end
- end
- if n==0 then
- elseif n==1 then
- originals[index]=t[1]
- tounicode[index]=tounicode16(t[1],name)
+ n=n+1
+ t[n]=u[1]
else
- originals[index]=t
- tounicode[index]=tounicode16sequence(t)
+ if u>=private then
+ unicode=false
+ break
+ end
+ n=n+1
+ t[n]=u
end
- nl=nl+1
- unicode=true
+ end
+ if n==0 then
+ elseif n==1 then
+ originals[index]=t[1]
+ tounicode[index]=tounicode16(t[1],name)
else
+ originals[index]=t
+ tounicode[index]=tounicode16sequence(t)
end
+ nl=nl+1
end
if not unicode or unicode=="" then
local foundcodes,multiple=lpegmatch(uparser,name)
diff --git a/luaotfload-tool.lua b/luaotfload-tool.lua
index 3bec847..d5cd8e7 100755
--- a/luaotfload-tool.lua
+++ b/luaotfload-tool.lua
@@ -209,6 +209,7 @@ This tool is part of the luaotfload package. Valid options are:
DATABASE
-u --update update the database
+ -n --no-reload suppress db update
-f --force force re-indexing all fonts
-l --flush-lookups empty lookup cache of font requests
-D --dry-run skip loading of fonts, just scan
@@ -486,7 +487,7 @@ local general_fields = {
{ "design_range_bottom", "l", "design size min" },
{ "design_range_top", "l", "design size max" },
{ "fontstyle_id", "l", "font style id" },
- { "fontstyle_name", "l", "font style name" },
+ { "fontstyle_name", "S", "font style name" },
{ "strokewidth", "l", "stroke width" },
{ "units_per_em", "l", "units per em" },
{ "ascent", "l", "ascender height" },
@@ -506,6 +507,25 @@ local display_general = function (fullinfo)
local val
if mode == "l" then
val = fullinfo[key]
+ elseif mode == "S" then --- style names table
+ local data = fullinfo[key]
+ if type (data) == "table" then
+ if #data > 0 then
+ for n = 1, #data do
+ local nth = data[n]
+ if nth.lang == 1033 then
+ val = nth.name
+ goto found
+ end
+ end
+ val = next (data).name
+ else
+ val = ""
+ end
+ ::found::
+ else
+ val = data
+ end
elseif mode == "n" then
local v = fullinfo[key]
if v then
@@ -534,7 +554,6 @@ local print_features = function (features)
for script, languages in next, data do
local field = stringformat(key_fmt, script).. fieldseparator .. " "
local wd_field = #field
- --inspect(languages.list)
local lines = reflow(languages.list, textwidth - wd_field)
local indent = stringrep(" ", wd_field)
texiowrite_nl(field)
@@ -591,11 +610,20 @@ end
local display_features = function (gsub, gpos)
texiowrite_nl ""
- print_heading("Features", 2)
- print_heading("GSUB Features", 3)
- display_feature_set(gsub)
- print_heading("GPOS Features", 3)
- display_feature_set(gpos)
+
+ if gsub or gpos then
+ print_heading("Features", 2)
+
+ if gsub then
+ print_heading("GSUB Features", 3)
+ display_feature_set(gsub)
+ end
+
+ if gpos then
+ print_heading("GPOS Features", 3)
+ display_feature_set(gpos)
+ end
+ end
end
local show_full_info = function (path, subfont, warnings)
@@ -733,7 +761,7 @@ end
actions.blacklist = function (job)
names.read_blacklist()
local n = 0
- for n, entry in next, table.sortedkeys(fonts.names.blacklist) do
+ for n, entry in next, table.sortedkeys(names.blacklist) do
texiowrite_nl(stringformat("(%d %s)", n, entry))
end
return true, false
@@ -744,8 +772,7 @@ actions.generate = function (job)
fontnames = names.update(fontnames, job.force_reload, job.dry_run)
logs.names_report("info", 2, "db",
"Fonts in the database: %i", #fontnames.mappings)
- local success = names.save(fontnames)
- if success then
+ if names.data then
return true, true
end
return false, false
@@ -784,16 +811,37 @@ end
actions.query = function (job)
+ require "luaotfload-features"
+
local query = job.query
+
local tmpspec = {
name = query,
lookup = "name",
- specification = "name:" .. query,
+ specification = query,
optsize = 0,
+ features = { },
}
- local foundname, subfont, success =
- fonts.names.resolve(nil, nil, tmpspec)
+ tmpspec = names.handle_request (tmpspec)
+
+ if not tmpspec.size then
+ tmpspec.size = 655360 --- assume 10pt
+ end
+
+ local foundname, subfont, success
+
+ if tmpspec.lookup == "name"
+ or tmpspec.lookup == "anon" --- not *exactly* as resolvers.anon
+ then
+ foundname, subfont = names.resolve (nil, nil, tmpspec)
+ if foundname then
+ foundname, _, success = names.crude_file_lookup (foundname)
+ end
+ elseif tmpspec.lookup == "file" then
+ foundname, _, success =
+ names.crude_file_lookup (tmpspec.name)
+ end
if success then
logs.names_report(false, 0,
@@ -816,7 +864,7 @@ actions.query = function (job)
if job.fuzzy == true then
logs.names_report(false, 0,
"resolve", "Looking for close matches, this may take a while ...")
- local success = fonts.names.find_closest(query, job.fuzzy_limit)
+ local _success = names.find_closest(query, job.fuzzy_limit)
end
end
return true, true
@@ -1026,6 +1074,7 @@ local process_cmdline = function ( ) -- unit -> jobspec
limit = 1,
list = 1,
log = 1,
+ ["no-reload"] = "n",
["prefer-texmf"] = "p",
quiet = "q",
["show-blacklist"] = "b",
@@ -1036,7 +1085,7 @@ local process_cmdline = function ( ) -- unit -> jobspec
warnings = "w",
}
- local short_options = "bDfFiIlpquvVhw"
+ local short_options = "bDfFiIlnpquvVhw"
local options, _, optarg =
alt_getopt.get_ordered_opts (arg, short_options, long_options)
@@ -1115,6 +1164,8 @@ local process_cmdline = function ( ) -- unit -> jobspec
result.asked_diagnostics = optarg[n]
elseif v == "formats" then
names.set_font_filter (optarg[n])
+ elseif v == "n" then
+ config.luaotfload.update_live = false
end
end
diff --git a/luaotfload-tool.rst b/luaotfload-tool.rst
index 2d3ae2f..03ff407 100644
--- a/luaotfload-tool.rst
+++ b/luaotfload-tool.rst
@@ -15,13 +15,14 @@
SYNOPSIS
=======================================================================
-**luaotfload-tool** [ -bDfFiIlpquvVhw ]
+**luaotfload-tool** [ -bDfFiIlnpquvVhw ]
**luaotfload-tool** --update [ --force ] [ --quiet ] [ --verbose ]
[ --prefer-texmf ] [ --dry-run ]
[ --formats=[+|-]EXTENSIONS ]
**luaotfload-tool** --find=FONTNAME [ --fuzzy ] [ --info ] [ --inspect ]
+ [ --no-reload ]
**luaotfload-tool** --flush-lookups
@@ -59,6 +60,9 @@ update mode
--update, -u Update the database; indexes new fonts.
--force, -f Force rebuilding of the database; re-indexes
all fonts.
+--no-reload, -n Suppress auto-updates to the database (e.g.
+ when ``--find`` is passed an unknown name).
+
--prefer-texmf, -p Organize the file name database in a way so
that it prefer fonts in the *TEXMF* tree over
system fonts if they are installed in both.
@@ -89,6 +93,9 @@ query mode
--find=NAME Resolve a font name; this looks up <name> in
the database and prints the file name it is
mapped to.
+ ``--find`` also understands request syntax,
+ i.e. ``--find=file:foo.otf`` checks whether
+ ``foo.otf`` is indexed.
--fuzzy, -F Show approximate matches to the file name if
the lookup was unsuccessful (requires
``--find``).