[NTG-context] [font-syn.lua] remove call to fontloader.to_table()

Philipp Gesang Philipp.Gesang at alumni.uni-heidelberg.de
Sat Nov 9 18:45:50 CET 2013


Hi all,

calling fontloader.to_table() appears to be redundant when
extracting font names, see the attached patch. On my system I
measured 42 (patched) vs 59 (vanilla) seconds for rebuilding the
entire index:

  mtxrun --script fonts --reload --force

The resulting index is -- except for the uuid, naturally --
identical in both cases.

Best,
Philipp

-------------- next part --------------
--- /home/phg/base/font-syn.lua	2013-10-25 00:01:04.000000000 +0200
+++ font-syn.lua	2013-11-09 18:30:33.540364371 +0100
@@ -266,8 +266,21 @@
 function fontloader.fullinfo(...) -- check with taco what we get / could get
     local ff = fontloader.open(...)
     if ff then
-        local d = ff and fontloader.to_table(ff)
-        d.glyphs, d.subfonts, d.gpos, d.gsub, d.lookups = nil, nil, nil, nil, nil
+        local fields = table.tohash (fontloader.fields (ff), true)
+        local d   = {
+            names               = fields.names               and ff.names,
+            familyname          = fields.familyname          and ff.familyname,
+            fullname            = fields.fullname            and ff.fullname,
+            fontname            = fields.fontname            and ff.fontname,
+            weight              = fields.weight              and ff.weight,
+            italicangle         = fields.italicangle         and ff.italicangle,
+            units_per_em        = fields.units_per_em        and ff.units_per_em,
+            design_range_bottom = fields.design_range_bottom and ff.design_range_bottom,
+            design_range_top    = fields.design_range_top    and ff.design_range_top,
+            design_size         = fields.design_size         and ff.design_size,
+            italicangle         = fields.italicangle         and ff.italicangle,
+            pfminfo             = fields.pfminfo             and ff.pfminfo,
+        }
         fontloader.close(ff)
         return d
     else
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20131109/15313d31/attachment.pgp>


More information about the ntg-context mailing list