File: checks.clj

package info (click to toggle)
fonts-firacode 6.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,796 kB
  • sloc: sh: 287; python: 146; makefile: 19
file content (23 lines) | stat: -rw-r--r-- 687 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
(ns fira-code.checks
  (:require
   [clojure.string :as str]
   [fira-code.coll :as coll]
   [fira-code.glyphs :as glyphs]))

(defn width-ok? [w]
  (#{"0" 0 1200} w))

(defn widths [font]
  (doseq [g     (:glyphs font)
          :when (not= "0" (:export g))
          :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)))))
  font)

(defn -main [& args]
  (let [path (or (first args) "FiraCode.glyphs")
        font (glyphs/load path)]
    (widths font)))