checks.clj 687 B

1234567891011121314151617181920212223
  1. (ns fira-code.checks
  2. (:require
  3. [clojure.string :as str]
  4. [fira-code.coll :as coll]
  5. [fira-code.glyphs :as glyphs]))
  6. (defn width-ok? [w]
  7. (#{"0" 0 1200} w))
  8. (defn widths [font]
  9. (doseq [g (:glyphs font)
  10. :when (not= "0" (:export g))
  11. :let [[w & _ :as ws] (mapv :width (:layers g))]]
  12. (when-not (apply = ws)
  13. (println (str "WARN glyph '" (:glyphname g) "' has different widths=" (pr-str ws))))
  14. (when-not (width-ok? w)
  15. (println (str "WARN glyph '" (:glyphname g) "' has unexpected width=" (pr-str w)))))
  16. font)
  17. (defn -main [& args]
  18. (let [path (or (first args) "FiraCode.glyphs")
  19. font (glyphs/load path)]
  20. (widths font)))