Skip to content

Commit 8edd007

Browse files
committed
Old-style figures no longer prevent ligatures (closes #561 closes #715)
1 parent 85f4fec commit 8edd007

File tree

5 files changed

+264
-1172
lines changed

5 files changed

+264
-1172
lines changed

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,16 @@ All notable changes to this project will be documented in this file.
5353
- Added Forces `||-` ligature and U+22A2..U+22AF `⊢ ⊣ ⊤ ⊥ ⊦ ⊧ ⊨ ⊩ ⊪ ⊫ ⊬ ⊭ ⊮ ⊯` [#709]
5454
- Tuned `fl` and `fi` pairs [#795]
5555
- Disabled ligatures after regexp lookahead/lookbehinds `(?<=<` `(?<=>` `(?<==>` `(?<=|` `(?<==` `(?=:=` `(?=!=` `(?==` `(?===` `(?==>` `(?=>` `(?=>>` `(?=<<` `(?=/=` `(?!!` `(?!!.` `(?!=` `(?!==` `(?<!!` `(?<!!.` `(?<!=` `(?<!==` `(?<!--` [#578]
56-
- Removed ..= [#757]
56+
- Removed `..=` [#757]
5757
- Alternatives (stylistic sets):
5858
- Lowercase `r` (ss01) [#601]
59-
- `<=` `>=` (ss02) [#263] [#617]
59+
- Less than/greater than `<=` `>=` (ss02) [#263] [#617]
6060
- Ampersand `&` (ss03) [#617]
6161
- Dotted zero `0` (zero, ss04)
6262
- Dollar sign `$` (ss05) [#617]
6363
- At sign `@` (ss06) [#617] [#748] [#817]
64+
- Old-style figures (onum, ss07) [#561] [#715]
65+
- Old-style figures no longer prevent ligatures [#561] [#715]
6466

6567

6668
#### 1.207 (April 6, 2019)

FiraCode.glyphs

Lines changed: 219 additions & 1161 deletions
Large diffs are not rendered by default.

clojure/glyphs.clj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
(ns glyphs
2+
(:refer-clojure :exclude [load])
23
(:require
34
[clojure.java.io :as io]
45
[clojure.string :as str]
@@ -128,6 +129,14 @@
128129

129130
; (-> (slurp "FiraCode.glyphs") parse serialize (->> (spit "FiraCode_saved.glyphs")))
130131

132+
(defn load [path]
133+
(println "Parsing" path "...")
134+
(parse (slurp path)))
135+
136+
(defn save! [path font]
137+
(println "Saving" path "...")
138+
(spit path (serialize font)))
139+
131140
(defn -main [& args]
132141
(let [font (-> (slurp "FiraCode.glyphs") parse)]
133142
(with-open [os (io/writer "clojure/FiraCode.edn")]

clojure/regen_calt.clj

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
;; clj -m regen-calt
2+
13
(ns regen-calt
24
(:require
35
[clojure.string :as str]
@@ -187,9 +189,8 @@
187189
:else (compare l1 l2)))
188190

189191
(defn -main [& args]
190-
(let [file (or (first args) "FiraCode.glyphs")
191-
_ (println "Parsing" file "...")
192-
font (glyphs/parse (slurp file))
192+
(let [path (or (first args) "FiraCode.glyphs")
193+
font (glyphs/load path)
193194
ligas (for [g (:glyphs font)
194195
:let [name (:glyphname g)]
195196
:when (str/ends-with? name ".liga")
@@ -199,16 +200,12 @@
199200
calt (->> ligas (remove manual?) (sort compare-ligas) (map liga->rule) (str/join "\n\n"))
200201
font' (replace-calt font calt)]
201202

202-
(println "Saving" file "...")
203-
(spit file (glyphs/serialize font'))
203+
(glyphs/save! path font')
204204

205205
(println "Total ligatures count:" (count ligas))
206206
(println " " (->> ligas
207207
(group-by count)
208208
(sort-by first)
209209
(map (fn [[k v]] (str (count v) (case k 2 " pairs", 3 " triples", 4 " quadruples"))))
210210
(str/join ", ")))
211-
(println)))
212-
213-
(-main)
214-
211+
(println)))

clojure/regen_classes.clj

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
;; clj -m regen-classes
2+
3+
(ns regen-classes
4+
(:require
5+
[clojure.string :as str]
6+
[glyphs :as glyphs]
7+
[flatland.ordered.map :refer [ordered-map]]))
8+
9+
(defn -main [& args]
10+
(let [path (or (first args) "FiraCode.glyphs")
11+
font (glyphs/load path)
12+
not-spaces (->> (:glyphs font)
13+
(remove #(re-find #"^\.|space$|space\." (:glyphname %)))
14+
(remove #(= "0" (:export %))))
15+
_ (println "Generating class:NotSpace with" (count not-spaces) "glyphs")
16+
class (ordered-map
17+
:code (str/join " " (map :glyphname not-spaces))
18+
:name "NotSpace")
19+
classes (->> (:classes font)
20+
(remove #(= "NotSpace" (:name %)))
21+
(cons class))
22+
font' (assoc font :classes classes)
23+
_ (glyphs/save! path font')
24+
_ (println)]))
25+
26+
; (-main)

0 commit comments

Comments
 (0)