-- @titre Rapport des chasses -- @title Advance width report -- @categorie relire -- @resume Les chasses des glyphes dessinés d'un master, de la plus étroite à la plus large, avec la moyenne et les extrêmes. -- @summary Advance widths of the drawn glyphs of one master, narrowest first, with the average and the extremes. -- Fontista · bibliothèque de scripts · https://fontista.thinkspark.dev/scripts.html local MASTER = 1 -- which master: 1 = the first one local en = lang == "en" local m = font.masters[MASTER] or font.masters[1] local rows = {} for _, g in ipairs(font.glyphs) do local l = layer(g, m.id) if l and not l.empty then rows[#rows + 1] = { g, l.width } end end table.sort(rows, function(a, b) return a[2] < b[2] end) local sum = 0 for _, r in ipairs(rows) do sum = sum + r[2] print(string.format("%-28s %6.0f", r[1], r[2])) end if #rows == 0 then print(en and "No drawn glyph in this master." or "Aucun glyphe dessiné dans ce master.") else print(string.format(en and "%d glyphs in %s · average %.0f · narrowest %s (%.0f) · widest %s (%.0f)" or "%d glyphes dans %s · moyenne %.0f · plus étroit %s (%.0f) · plus large %s (%.0f)", #rows, m.name, sum / #rows, rows[1][1], rows[1][2], rows[#rows][1], rows[#rows][2])) end