2020-04-15 19:51:08 +03:00
|
|
|
(ns fira-code.checks
|
|
|
|
(:require
|
|
|
|
[clojure.string :as str]
|
|
|
|
[fira-code.coll :as coll]
|
|
|
|
[fira-code.glyphs :as glyphs]))
|
|
|
|
|
|
|
|
(defn width-ok? [w]
|
2020-08-31 20:19:10 +03:00
|
|
|
(#{"0" 0 1200} w))
|
2020-04-15 19:51:08 +03:00
|
|
|
|
|
|
|
(defn widths [font]
|
|
|
|
(doseq [g (:glyphs font)
|
|
|
|
:when (not= "0" (:export g))
|
2021-12-06 23:43:36 +03:00
|
|
|
:let [[w & _ :as ws] (mapv :width (:layers g))]]
|
|
|
|
(when-not (apply = ws)
|
|
|
|
(println (str "WARN glyph '" (:glyphname g) "' has different widths=" (pr-str ws))))
|
|
|
|
(when-not (width-ok? w)
|
|
|
|
(println (str "WARN glyph '" (:glyphname g) "' has unexpected width=" (pr-str w)))))
|
2020-04-15 19:51:08 +03:00
|
|
|
font)
|
|
|
|
|
|
|
|
(defn -main [& args]
|
|
|
|
(let [path (or (first args) "FiraCode.glyphs")
|
|
|
|
font (glyphs/load path)]
|
2021-12-06 23:43:36 +03:00
|
|
|
(widths font)))
|