main.clj 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. (ns fira-code.main
  2. (:require
  3. [clojure.string :as str]
  4. [fira-code.calt :as calt]
  5. [fira-code.coll :as coll]
  6. [fira-code.checks :as checks]
  7. [fira-code.classes :as classes]
  8. [fira-code.features :as features]
  9. [fira-code.glyphs :as glyphs]
  10. [fira-code.not-space :as not-space]
  11. [fira-code.spacers :as spacers]
  12. [fira-code.time :as time]
  13. [flatland.ordered.map :refer [ordered-map]]))
  14. (defn -main [& args]
  15. (let [path (or (first args) "FiraCode.glyphs")
  16. font (glyphs/load path)
  17. ligas (for [g (:glyphs font)
  18. :let [name (:glyphname g)]
  19. :when (str/ends-with? name ".liga")
  20. :when (not= "0" (:export g))
  21. :let [[_ liga] (re-matches #"([A-Za-z_]+)\.liga" name)]]
  22. (str/split liga #"_")) ;; [ ["dash" "greater" "greater"] ... ]
  23. font' (-> font
  24. (calt/replace-calt ligas)
  25. (classes/fill-all)
  26. (features/fill-all)
  27. (spacers/add-spacers ligas)
  28. (not-space/regen-not-space)
  29. (checks/widths))]
  30. (glyphs/save! path font')
  31. (println)))