From fdf373f65a219335e6942329077e0452921c81ca Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Thu, 7 Nov 2013 02:21:38 +0100 Subject: [tests] adapt spec runner --- mkcharacters | 1 + mkglyphlist | 2 ++ mkstatus | 1 + mktests | 7 ++++--- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/mkcharacters b/mkcharacters index 63c78ed..69201fb 100755 --- a/mkcharacters +++ b/mkcharacters @@ -153,3 +153,4 @@ end io.write "Emergency exit.\n" os.exit(1) +--- vim:ft=lua:ts=2:et:sw=2 diff --git a/mkglyphlist b/mkglyphlist index 8b89935..e476eca 100755 --- a/mkglyphlist +++ b/mkglyphlist @@ -169,3 +169,5 @@ end return main() + +--- vim:ft=lua:ts=2:et:sw=2 diff --git a/mkstatus b/mkstatus index a8d9233..8ca4237 100755 --- a/mkstatus +++ b/mkstatus @@ -146,3 +146,4 @@ end return main () +--- vim:ft=lua:ts=2:et:sw=2 diff --git a/mktests b/mktests index cf53626..e7949fb 100755 --- a/mktests +++ b/mktests @@ -149,7 +149,7 @@ local default_spec = { local resolve_font_name = function () local failed, total = 0, 0 - local resolve_name = names.resolve + local resolve_name = names.resolve_name for nset = 1, #font_name_tests do local set = font_name_tests[nset] @@ -161,7 +161,7 @@ local resolve_font_name = function () local input_spec = table.copy (default_spec) input_spec.name = input input_spec.specification = input_spec.lookup .. ":" .. input - local result = resolve_name (nil, nil, input_spec) == output + local result = resolve_name (input_spec) == output total = total + 1 if not result then failed = failed + 1 @@ -174,7 +174,7 @@ local resolve_font_name = function () or default_spec.lookup) .. ":" .. input_spec.name input_spec.optsize = input_spec.optsize or default_spec.optsize - local result = resolve_name (nil, nil, input_spec) == output + local result = resolve_name (input_spec) == output total = total + 1 if not result then failed = failed + 1 @@ -218,3 +218,4 @@ end return main () +--- vim:ft=lua:ts=2:et:sw=2 -- cgit v1.2.3 From cb961dc32d9539a581bec5490fcb4307ead8932c Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Thu, 7 Nov 2013 02:39:30 +0100 Subject: [tests] fix tests With the new handler, a request optical size of 0pt means the default size. --- luaotfload-database.lua | 8 ++++---- mktests | 16 ++++++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/luaotfload-database.lua b/luaotfload-database.lua index d25b846..bace8bb 100644 --- a/luaotfload-database.lua +++ b/luaotfload-database.lua @@ -2628,12 +2628,12 @@ do if prefmodifiers then style = choose_exact (prefmodifiers) elseif subfamily then - --style = choose_exact (subfamily) + style = choose_exact (subfamily) end end - if not style and splitstyle then - style = choose_exact (splitstyle) - end +-- if not style and splitstyle then +-- style = choose_exact (splitstyle) +-- end return style end diff --git a/mktests b/mktests index e7949fb..eaf931f 100755 --- a/mktests +++ b/mktests @@ -77,21 +77,21 @@ local infer_regular_style = { { "DejaVu Serif", "DejaVuSerif.ttf" }, { "DejaVu Sans", "DejaVuSans.ttf" }, { "Adobe Garamond Pro", "agaramondpro_regular.otf" }, - { "Garamond Premier Pro", "GaramondPremrPro-Capt.otf" }, + { "Garamond Premier Pro", "GaramondPremrPro.otf" }, { "CMU Serif", "cmunrm.otf" }, { "CMU Sans Serif", "cmunss.otf" }, } local choose_optical_size = { - { { name = "Latin Modern Roman", optsize = 0 }, "lmroman5-regular.otf" }, + { { name = "Latin Modern Roman", optsize = 1 }, "lmroman5-regular.otf" }, { { name = "Latin Modern Roman", optsize = 10 }, "lmroman10-regular.otf" }, { { name = "Latin Modern Roman", optsize = 12 }, "lmroman12-regular.otf" }, { { name = "Latin Modern Roman", optsize = 42 }, "lmroman17-regular.otf" }, - { { name = "EB Garamond", optsize = 0 }, "EBGaramond08-Regular.otf" }, + { { name = "EB Garamond", optsize = 1 }, "EBGaramond08-Regular.otf" }, { { name = "EB Garamond", optsize = 8 }, "EBGaramond08-Regular.otf" }, { { name = "EB Garamond", optsize = 12 }, "EBGaramond12-Regular.otf" }, { { name = "EB Garamond", optsize = 42 }, "EBGaramond12-Regular.otf" }, - { { name = "Garamond Premier Pro", optsize = 0 }, "GaramondPremrPro-Capt.otf" }, + { { name = "Garamond Premier Pro", optsize = 1 }, "GaramondPremrPro-Capt.otf" }, { { name = "Garamond Premier Pro", optsize = 10 }, "GaramondPremrPro.otf" }, { { name = "Garamond Premier Pro", optsize = 15 }, "GaramondPremrPro-Subh.otf" }, { { name = "Garamond Premier Pro", optsize = 42 }, "GaramondPremrPro-Disp.otf" }, @@ -133,6 +133,13 @@ local resolve_t1_font = { { { name = "Nimbus Roman No9 L", style = "bolditalic" }, "utmbi8a.pfb" }, } +local translate_style = { + regular = "r", + italic = "i", + bold = "b", + bolditalic = "bi", +} + local font_name_tests = { infer_regular_style, choose_optical_size, @@ -174,6 +181,7 @@ local resolve_font_name = function () or default_spec.lookup) .. ":" .. input_spec.name input_spec.optsize = input_spec.optsize or default_spec.optsize + input_spec.style = translate_style [input_spec.style] local result = resolve_name (input_spec) == output total = total + 1 if not result then -- cgit v1.2.3 From 03bf4071685290a746bafb33deb448ee3246bfc0 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sat, 9 Nov 2013 14:15:17 +0100 Subject: [db] remove calls to fontloaderto_table() --- luaotfload-database.lua | 66 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 51 insertions(+), 15 deletions(-) diff --git a/luaotfload-database.lua b/luaotfload-database.lua index bace8bb..8f1f34d 100644 --- a/luaotfload-database.lua +++ b/luaotfload-database.lua @@ -1279,6 +1279,32 @@ find_closest = function (name, limit) return false end --- find_closest() +--[[doc-- + + load_font_file -- Extract relevant information from a font. The + fields we require for the index are, by category: + + -- style: + .design_size + .design_range_top + .design_range_bottom + .pfminfo (table) + .italicangle + .units_per_em + .fontstyle_name + -- font names: + .names (table) + .fullname + .fontname + .familyname + -- .version + + Since we don’t actually require metrics and glyph information we + can omit calling the very expensive ``fontloader.to_table()`` + altogether. + +--doc]]-- + local load_font_file = function (filename, subfont) local rawfont, _msg = fontloaderopen (filename, subfont) if not rawfont then @@ -1286,17 +1312,27 @@ local load_font_file = function (filename, subfont) return end - local metadata = fontloaderto_table (rawfont) +-- local metadata = fontloaderto_table (rawfont) + local fontstyle_name = rawfont.fontstyle_name + local names = rawfont.names + local pfminfo = rawfont.pfminfo + + local metadata = { + design_size = rawfont.design_size, + design_range_top = rawfont.design_range_top, + design_range_bottom = rawfont.design_range_bottom, + names = names and tablecopy (names) or { }, + fullname = rawfont.fullname, + fontstyle_name = fontstyle_name and tablecopy (fontstyle_name) or { }, + fontname = rawfont.fontname, + familyname = rawfont.familyname, + pfminfo = pfminfo and tablecopy (pfminfo) or { }, + italicangle = rawfont.italicangle, + units_per_em = rawfont.units_per_em, + version = rawfont.version, + } fontloaderclose (rawfont) - - metadata.glyphs = nil - metadata.subfonts = nil - metadata.gpos = nil - metadata.gsub = nil - metadata.lookups = nil - collectgarbage "collect" - return metadata end @@ -2446,8 +2482,8 @@ local scan_os_fonts = function (currentnames, dry_run) local n_scanned, n_new = 0, 0 - report ("info", 2, "db", "Scanning OS fonts...") - report ("info", 3, "db", + report ("info", 1, "db", "Scanning OS fonts...") + report ("info", 2, "db", "Searching in static system directories...") report_status_start (2, 4) @@ -3175,18 +3211,18 @@ save_names = function (currentnames) tabletofile (luaname, currentnames, true) caches.compile (currentnames, luaname, lucname) end - report ("info", 1, "db", "Font index saved at ...") + report ("info", 2, "db", "Font index saved at ...") local success = false if lfsisfile (luaname) then - report ("info", 3, "db", "Text: " .. luaname) + report ("info", 2, "db", "Text: " .. luaname) success = true end if lfsisfile (gzname) then - report ("info", 3, "db", "Gzip: " .. gzname) + report ("info", 2, "db", "Gzip: " .. gzname) success = true end if lfsisfile (lucname) then - report ("info", 3, "db", "Byte: " .. lucname) + report ("info", 2, "db", "Byte: " .. lucname) success = true end if success then -- cgit v1.2.3