From 15753d8bc80596a89ae0dd57e0d6132bf0731035 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Tue, 5 Apr 2016 23:43:40 +0200 Subject: [tool] status library API fallout With revision 5624, the status library was overhauled. Among others we lose the ``luatex_svn`` field which was rather useful for debugging :/ --- src/luaotfload-tool.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/luaotfload-tool.lua') diff --git a/src/luaotfload-tool.lua b/src/luaotfload-tool.lua index 69b6c97..f1f3ee2 100755 --- a/src/luaotfload-tool.lua +++ b/src/luaotfload-tool.lua @@ -310,14 +310,15 @@ local version_msg = function ( ) local out = function (...) texiowrite_nl (stringformat (...)) end local uname = os.uname () local meta = fonts.names.getmetadata () + local info = status.list () out (about, luaotfload.self) out ("%s version: %q", luaotfload.self, version) out ("Revision: %q", config.luaotfload.status.notes.revision) out ("Lua interpreter: %s; version %q", runtime[1], runtime[2]) - out ("Luatex SVN revision: %d", status.luatex_svn) +--[[out ("Luatex SVN revision: %d", info.luatex_svn)]] --> SVN r5624 out ("Luatex version: %.2f.%d", - status.luatex_version / 100, - status.luatex_revision) + info.luatex_version / 100, + info.luatex_revision) out ("Platform: type=%s name=%s", os.type, os.name) local uname_vars = tablesortedkeys (uname) -- cgit v1.2.3 From a2ea45941a60348f60a312abf8fb01b086dc41a6 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Thu, 7 Apr 2016 23:58:55 +0200 Subject: [*] update dates, version --- src/luaotfload-tool.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/luaotfload-tool.lua') diff --git a/src/luaotfload-tool.lua b/src/luaotfload-tool.lua index f1f3ee2..4b842dd 100755 --- a/src/luaotfload-tool.lua +++ b/src/luaotfload-tool.lua @@ -2,13 +2,13 @@ ----------------------------------------------------------------------- -- FILE: luaotfload-tool.lua -- DESCRIPTION: database functionality --- REQUIREMENTS: luaotfload 2.6 +-- REQUIREMENTS: luaotfload 2.7 -- AUTHOR: Khaled Hosny, Élie Roux, Philipp Gesang -- LICENSE: GPL v2.0 ----------------------------------------------------------------------- luaotfload = luaotfload or { } -local version = "2.6" +local version = "2.7" luaotfload.version = version luaotfload.self = "luaotfload-tool" -- cgit v1.2.3 From a02f276d8fd95bd0c644ec89f7822006baacf4b3 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sat, 9 Apr 2016 18:29:31 +0200 Subject: [tool,db] kill off fontforge This has been coming for some time: Upstream now provides full Opentype reader capabilities. This allows Luatex to drop those horrible fontforge libraries. Since the API is pretty similar, for Luaotfload it means little change and a decent speed gain. Though we still need to investigate whether the result is equivalent or at least acceptable. --- src/luaotfload-tool.lua | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'src/luaotfload-tool.lua') diff --git a/src/luaotfload-tool.lua b/src/luaotfload-tool.lua index 4b842dd..0981582 100755 --- a/src/luaotfload-tool.lua +++ b/src/luaotfload-tool.lua @@ -130,11 +130,38 @@ local backup = { texio.write, texio.write_nl = dummy_function, dummy_function require "fontloader-basics-gen.lua" - texio.write, texio.write_nl = backup.write, backup.write_nl utilities = backup.utilities -fonts = { names = { } } -- for db; normally provided by the fontloaders +require "fontloader-data-con" +require "fontloader-font-ini" +require "fontloader-font-con" +require "fontloader-fonts-enc" +require "fontloader-font-cid" +require "fontloader-font-map" +require "fontloader-font-tfm" +require "fontloader-font-afm" +require "fontloader-font-afk" +require "fontloader-font-oti" +require "fontloader-font-otr" +require "fontloader-font-cff" +require "fontloader-font-ttf" +require "fontloader-font-dsp" +require "fontloader-font-oup" +require "fontloader-font-otl" +require "fontloader-font-oto" +------- "fontloader-font-otj" +------- "fontloader-font-ota" +------- "fontloader-font-ots" +------- "fontloader-font-osd" +require "fontloader-font-lua" +require "fontloader-font-def" +require "fontloader-fonts-ext" +------- "fontloader-font-gbn" + +fonts = fonts or { } +local fontsnames = fonts.names or { } +fonts.names = fontsnames local require_init = { } -- cgit v1.2.3 From 6c5d9617441d47fc375749880b3faaff29e8c5d0 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sat, 16 Apr 2016 00:31:47 +0200 Subject: [tool] annihilate references to FF The tables emitted by the new font reader functions do not correspond to their Fontforge counterparts. Thus, some of the display routines had to be rewritten, in some cases like the names table this resulted in the removal of a good deal of obsolete code. --- src/luaotfload-tool.lua | 137 +++++++++++++----------------------------------- 1 file changed, 36 insertions(+), 101 deletions(-) (limited to 'src/luaotfload-tool.lua') diff --git a/src/luaotfload-tool.lua b/src/luaotfload-tool.lua index 0981582..eb069bf 100755 --- a/src/luaotfload-tool.lua +++ b/src/luaotfload-tool.lua @@ -104,6 +104,7 @@ local iosavedata = io.savedata local lfsisdir = lfs.isdir local lfsisfile = lfs.isfile local stringsplit = string.split +local tablekeys = table.keys local tableserialize = table.serialize local tablesortedkeys = table.sortedkeys local tabletohash = table.tohash @@ -425,7 +426,7 @@ local baseindent = " " --[[doc-- show_info_items -- Together with show_info_table prints the table returned by - fontloader.info(), recursing into nested tables if appropriate (as necessitated + readers.getinfo(), recursing into nested tables if appropriate (as necessitated by Luatex versions 0.78+ which include the pfminfo table in the result. --doc]]-- @@ -485,15 +486,16 @@ local p_words = Ct(p_word * (p_whitespace * p_word)^0) --- string -> int -> string list local reflow = function (text, width) local words - if type(text) == "string" then + local t_text = type (text) + if t_text == "string" then words = lpegmatch(p_words, text) if #words < 2 then return { text } end - else + elseif t_text == "table" then words = text - if #words < 2 then - return words + if #text < 2 then + return text end end @@ -540,42 +542,20 @@ local print_field = function (key, val) end end -local display_names = function (names) - print_heading("Font Metadata", 2) - for i=1, #names do - local lang, namedata = names[i].lang, names[i].names - print_heading(stringformat("Language: %s ", i, lang), 3) - texiowrite_nl "" - if namedata then - for field, value in next, namedata do - print_field(field, value) - end - end - end -end - --- see luafflib.c local general_fields = { --- second: l -> literal | n -> length | d -> date { "fullname", "l", "font name" }, { "version", "l", "font version" }, - { "creationtime", "d", "creation time" }, - { "modificationtime", "d", "modification time" }, { "subfonts", "n", "number of subfonts" }, { "glyphcnt", "l", "number of glyphs" }, { "weight", "l", "weight indicator" }, - { "design_size", "l", "design size" }, - { "design_range_bottom", "l", "design size min" }, - { "design_range_top", "l", "design size max" }, - { "fontstyle_id", "l", "font style id" }, - { "fontstyle_name", "S", "font style name" }, - { "strokewidth", "l", "stroke width" }, - { "units_per_em", "l", "units per em" }, - { "ascent", "l", "ascender height" }, - { "descent", "l", "descender height" }, - { "comments", "l", "comments" }, - { "os2_version", "l", "os2 version" }, - { "sfd_version", "l", "sfd version" }, + { "designsize", "l", "design size" }, + { "minsize", "l", "design size min" }, + { "maxsize", "l", "design size max" }, + { "units", "l", "units per em" }, + { "ascender", "l", "ascender height" }, + { "descender", "l", "descender height" }, } local display_general = function (fullinfo) @@ -635,7 +615,7 @@ local print_features = function (features) for script, languages in next, data do local field = stringformat(key_fmt, script).. fieldseparator .. " " local wd_field = #field - local lines = reflow(languages.list, textwidth - wd_field) + local lines = reflow(tablekeys(languages), textwidth - wd_field) local indent = stringrep(" ", wd_field) texiowrite_nl(field) texiowrite(lines[1]) @@ -648,67 +628,32 @@ local print_features = function (features) end end -local extract_feature_info = function (set) - local collected = { } - for i=1, #set do - local features = set[i].features - if features then - for j=1, #features do - local feature = features[j] - local scripts = feature.scripts - local tagname = stringlower(feature.tag) - local entry = collected[tagname] or { } - - for k=1, #scripts do - local script = scripts[k] - local scriptname = stringlower(script.script) - local c_script = entry[scriptname] or { - list = { }, - set = { }, - } - local list, set = c_script.list, c_script.set - - for l=1, #script.langs do - local langname = stringlower(script.langs[l]) - if not set[langname] then - list[#list+1] = langname - set[langname] = true - end - end - entry[scriptname] = c_script - end - collected[tagname] = entry - end - end - end - return collected +local display_feature_set = function (set) + print_features(set) end -local display_feature_set = function (set) - local collected = extract_feature_info(set) - print_features(collected) +local display_features_type = function (id, feat) + if next (feat) then + print_heading(id, 3) + display_feature_set(feat) + return true + end + return false end -local display_features = function (gsub, gpos) +local display_features = function (features) texiowrite_nl "" + print_heading("Features", 2) - 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 + if not display_features_type ("GSUB Features", features.gsub) + or not display_features_type ("GPOS Features", features.gpos) + then + texiowrite_nl("font defines neither gsub nor gpos features") end end local show_full_info = function (path, subfont, warnings) - local rawinfo, warn = fontloader.open(path, subfont) + local rawinfo, warn = fonts.handlers.otf.readers.loadfont (path, subfont) if warnings then show_fontloader_warnings(warn) end @@ -716,20 +661,10 @@ local show_full_info = function (path, subfont, warnings) texiowrite_nl(stringformat([[cannot open font %s]], path)) return end - local fontdata = { } - local fullinfo = fontloader.to_table(rawinfo) - local fields = fontloader.fields(rawinfo) - fontloader.close(rawinfo) - display_names(fullinfo.names) - display_general(fullinfo) - display_features(fullinfo.gsub, fullinfo.gpos) + display_general(rawinfo) + display_features(rawinfo.resources.features) end ---- Subfonts returned by fontloader.info() do not correspond ---- to the actual indices required by fontloader.open(), so ---- we try and locate the correct one by matching the request ---- against the full name. - local subfont_by_name subfont_by_name = function (lst, askedname, n) if not n then @@ -741,7 +676,7 @@ subfont_by_name = function (lst, askedname, n) if fonts.names.sanitize_fontname (font.fullname) == askedname then return font end - return subfont_by_name (lst, askedname, n+1) + return subfont_by_name (lst, askedname, n) end return false end @@ -749,9 +684,9 @@ end --[[doc-- The font info knows two levels of detail: - a) basic information returned by fontloader.info(); and + a) basic information returned by readers.getinfo(); and b) detailed information that is a subset of the font table - returned by fontloader.open(). + returned by readers.loadfont(). --doc]]-- local show_font_info = function (basename, askedname, detail, warnings) @@ -763,7 +698,7 @@ local show_font_info = function (basename, askedname, detail, warnings) fullname = resolvers.findfile(basename) end if fullname then - local shortinfo = fontloader.info(fullname) + local shortinfo, _warn = fonts.handlers.otf.readers.getinfo (fullname) local nfonts = #shortinfo if nfonts > 0 then -- true type collection local subfont -- cgit v1.2.3 From def18cd19d849e3ad6ed3c2416ac8ad6f8aef203 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sat, 16 Apr 2016 23:06:33 +0200 Subject: [tool] adapt fullinfo to new loader Note that this will explode on the current loader code due to a typo in font-otr.lua. Patch submitted upstream, please be patient. --- src/luaotfload-tool.lua | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/luaotfload-tool.lua') diff --git a/src/luaotfload-tool.lua b/src/luaotfload-tool.lua index eb069bf..9b8ffc3 100755 --- a/src/luaotfload-tool.lua +++ b/src/luaotfload-tool.lua @@ -392,6 +392,7 @@ local format_counter = function (stack) end local print_heading = function (title, level) + if not title then return end local structuredata if currentdepth == level then -- top is current counterstack[#counterstack] = counterstack[#counterstack] + 1 @@ -547,15 +548,19 @@ local general_fields = { --- second: l -> literal | n -> length | d -> date { "fullname", "l", "font name" }, { "version", "l", "font version" }, - { "subfonts", "n", "number of subfonts" }, - { "glyphcnt", "l", "number of glyphs" }, + { "width", "l", "width" }, + { "averagewidth", "l", "average width" }, + { "panosewidth", "l", "panose width" }, { "weight", "l", "weight indicator" }, + { "pfmweight", "l", "numerical weight" }, + { "panoseweight", "l", "panose weight" }, { "designsize", "l", "design size" }, { "minsize", "l", "design size min" }, { "maxsize", "l", "design size max" }, { "units", "l", "units per em" }, { "ascender", "l", "ascender height" }, { "descender", "l", "descender height" }, + { "capheight", "l", "capital height" }, } local display_general = function (fullinfo) @@ -661,7 +666,7 @@ local show_full_info = function (path, subfont, warnings) texiowrite_nl(stringformat([[cannot open font %s]], path)) return end - display_general(rawinfo) + display_general(rawinfo.metadata) display_features(rawinfo.resources.features) end @@ -698,7 +703,11 @@ local show_font_info = function (basename, askedname, detail, warnings) fullname = resolvers.findfile(basename) end if fullname then - local shortinfo, _warn = fonts.handlers.otf.readers.getinfo (fullname) + local shortinfo = fonts.handlers.otf.readers.getinfo (fullname, { + subfont = nil, + platformnames = true, + rawfamilynames = true, + }) local nfonts = #shortinfo if nfonts > 0 then -- true type collection local subfont -- cgit v1.2.3