Skip to content

Commit

Permalink
Equal-based arrows #346, substitute features from *.fea files
Browse files Browse the repository at this point in the history
  • Loading branch information
tonsky committed May 12, 2020
1 parent 6329264 commit 8cc5687
Show file tree
Hide file tree
Showing 12 changed files with 2,881 additions and 1,133 deletions.
3,758 changes: 2,648 additions & 1,110 deletions FiraCode.glyphs

Large diffs are not rendered by default.

44 changes: 21 additions & 23 deletions clojure/fira_code/calt.clj
Original file line number Diff line number Diff line change
Expand Up @@ -87,37 +87,38 @@
" ignore sub bracketleft bar' bracketright;\n"

;; #410 <*>> <+>> <$>>
;; #346 >>->>
;; #346 >>->> >>=>>
["greater" "greater"]
(str " ignore sub [asterisk plus dollar hyphen] greater' greater;\n"
" ignore sub greater' greater hyphen;\n")
(str " ignore sub [asterisk plus dollar hyphen equal] greater' greater;\n"
" ignore sub greater' greater [hyphen equal];\n")

;; #410 <*>>> <+>>> <$>>>
;; #346 >>>->>> >>>=>>>
["greater" "greater" "greater"]
" ignore sub [asterisk plus dollar] greater' greater greater;\n"
(str " ignore sub [asterisk plus dollar hyphen equal] greater' greater greater;\n"
" ignore sub greater' greater greater [hyphen equal];\n")

;; #410 <<*> <<+> <<$>
;; #346 <<-<<
;; #346 <<-<< <<=<<
["less" "less"]
(str " ignore sub hyphen less' less;\n"
" ignore sub less' less [asterisk plus dollar hyphen];\n")
(str " ignore sub [hyphen equal] less' less;\n"
" ignore sub less' less [asterisk plus dollar hyphen equal];\n")

;; #410 <<<*> <<<+> <<<$>
;; #346 <<<-<<< <<<=<<<
["less" "less" "less"]
" ignore sub less' less less [asterisk plus dollar];\n"
(str " ignore sub [hyphen equal] less' less less;\n"
" ignore sub less' less less [asterisk plus dollar hyphen equal];\n")

;; #968 [==> [=>
["equal" "greater"]
" ignore sub bracketleft equal' greater;\n"

["equal" "equal" "greater"]
" ignore sub bracketleft equal' equal greater;\n"

;; #346 <==> <===> |==| |===|
["equal" "equal"]
" ignore sub bracketleft equal' equal;\n"
(str " ignore sub [bracketleft less greater bar] equal' equal;\n"
" ignore sub equal' equal [bracketright less greater bar] ;\n")

["equal" "equal" "equal"]
" ignore sub bracketleft equal' equal equal;\n"
(str " ignore sub [bracketleft less greater bar] equal' equal equal;\n"
" ignore sub equal' equal equal [bracketright less greater bar];\n")

;; #968 [-> [-->
;; #346 <--> <---> |--| |---|
Expand All @@ -130,10 +131,10 @@
(str " ignore sub [bracketleft less greater bar] hyphen' hyphen hyphen;\n"
" ignore sub hyphen' hyphen hyphen [bracketright less greater bar];\n")

;; #346 ||-||
;; #346 ||-|| ||=||
["bar" "bar"]
(str " ignore sub hyphen bar' bar;\n"
" ignore sub bar' bar hyphen;\n")
(str " ignore sub [hyphen equal] bar' bar;\n"
" ignore sub bar' bar [hyphen equal];\n")
})


Expand Down Expand Up @@ -252,7 +253,4 @@
(get counts 4) " quadruples, "
(count ligas') " total" #_")"))

(glyphs/update-code font :features "calt"
#(str/replace %
#"### start of generated calt\n[^#]+\n### end of generated calt\n"
(str "### start of generated calt\n" calt "\n### end of generated calt\n")))))
(glyphs/update-code font :features "calt" (constantly calt))))
16 changes: 16 additions & 0 deletions clojure/fira_code/features.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
(ns fira-code.features
(:require
[clojure.java.io :as io]
[clojure.string :as str]
[fira-code.glyphs :as glyphs]))


(defn append-features [font]
(let [features (->> (file-seq (io/file "features"))
(filter #(str/ends-with? (.getName %) ".fea"))
(sort-by #(.getName %))
(map slurp)
(map str/trim)
(str/join "\n\n"))]
(glyphs/update-code font :features "calt"
#(str % "\n\n" features))))
2 changes: 2 additions & 0 deletions clojure/fira_code/main.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[fira-code.calt :as calt]
[fira-code.coll :as coll]
[fira-code.checks :as checks]
[fira-code.features :as features]
[fira-code.glyphs :as glyphs]
[fira-code.not-space :as not-space]
[fira-code.spacers :as spacers]
Expand All @@ -22,6 +23,7 @@
(str/split liga #"_")) ;; [ ["dash" "greater" "greater"] ... ]
font' (-> font
(calt/replace-calt ligas)
(features/append-features)
(spacers/add-spacers ligas)
(not-space/regen-not-space)
(checks/widths))]
Expand Down
96 changes: 96 additions & 0 deletions features/arrows.fea
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
### Arbitrary-length arrows #346

lookup arrows {
# continue hyphen
sub [less_start.arw less_less_start.arw less_middle.arw less_less_middle.arw greater_start.arw greater_greater_start.arw greater_middle.arw greater_greater_middle.arw bar_start.arw bar_bar_start.arw bar_middle.arw bar_bar_middle.arw hyphen_start.arw hyphen_end.arw] hyphen' by hyphen_end.arw;

# double middles
sub [hyphen_start.arw hyphen_end.arw] less.spacer less' hyphen by less_less_middle.arw;
sub [hyphen_start.arw hyphen_end.arw] less' less hyphen by less.spacer;
sub [hyphen_start.arw hyphen_end.arw] greater.spacer greater' hyphen by greater_greater_middle.arw;
sub [hyphen_start.arw hyphen_end.arw] greater' greater hyphen by greater.spacer;
sub [hyphen_start.arw hyphen_end.arw] bar.spacer bar' hyphen by bar_bar_middle.arw;
sub [hyphen_start.arw hyphen_end.arw] bar' bar hyphen by bar.spacer;

# single middles
sub [hyphen_start.arw hyphen_end.arw] less' hyphen by less_middle.arw;
sub [hyphen_start.arw hyphen_end.arw] greater' hyphen by greater_middle.arw;
sub [hyphen_start.arw hyphen_end.arw] bar' hyphen by bar_middle.arw;

# double ends
sub [hyphen_start.arw hyphen_end.arw] less.spacer less' by less_less_end.arw;
sub [hyphen_start.arw hyphen_end.arw] less' less by less.spacer;
sub [hyphen_start.arw hyphen_end.arw] greater.spacer greater' by greater_greater_end.arw;
sub [hyphen_start.arw hyphen_end.arw] greater' greater by greater.spacer;
sub [hyphen_start.arw hyphen_end.arw] bar.spacer bar' by bar_bar_end.arw;
sub [hyphen_start.arw hyphen_end.arw] bar' bar by bar.spacer;

# single ends
sub [hyphen_start.arw hyphen_end.arw] less' by less_end.arw;
sub [hyphen_start.arw hyphen_end.arw] greater' by greater_end.arw;
sub [hyphen_start.arw hyphen_end.arw] bar' by bar_end.arw;

# double beginnings
sub less.spacer less' hyphen by less_less_start.arw;
sub less' less hyphen by less.spacer;
sub greater.spacer greater' hyphen by greater_greater_start.arw;
sub greater' greater hyphen by greater.spacer;
sub bar.spacer bar' hyphen by bar_bar_start.arw;
sub bar' bar hyphen by bar.spacer;

# single beginnings
sub less' hyphen by less_start.arw;
sub greater' hyphen by greater_start.arw;
sub bar' hyphen by bar_start.arw;
sub hyphen' [hyphen less greater bar] by hyphen_start.arw;
} arrows;

lookup double_arrows {
# Disable >=< #548
# ignore sub greater' equal less;
# ignore sub greater equal' less;
# ignore sub greater equal less';

# continue hyphen
sub [less_start.darw less_less_start.darw less_middle.darw less_less_middle.darw greater_start.darw greater_greater_start.darw greater_middle.darw greater_greater_middle.darw bar_start.darw bar_bar_start.darw bar_middle.darw bar_bar_middle.darw equal_start.darw equal_end.darw] equal' by equal_end.darw;

# double middles
sub [equal_start.darw equal_end.darw] less.spacer less' equal by less_less_middle.darw;
sub [equal_start.darw equal_end.darw] less' less equal by less.spacer;
sub [equal_start.darw equal_end.darw] greater.spacer greater' equal by greater_greater_middle.darw;
sub [equal_start.darw equal_end.darw] greater' greater equal by greater.spacer;
sub [equal_start.darw equal_end.darw] bar.spacer bar' equal by bar_bar_middle.darw;
sub [equal_start.darw equal_end.darw] bar' bar equal by bar.spacer;

# single middles
sub [equal_start.darw equal_end.darw] less' equal by less_middle.darw;
sub [equal_start.darw equal_end.darw] greater' equal by greater_middle.darw;
sub [equal_start.darw equal_end.darw] bar' equal by bar_middle.darw;

# double ends
sub [equal_start.darw equal_end.darw] less.spacer less' by less_less_end.darw;
sub [equal_start.darw equal_end.darw] less' less by less.spacer;
sub [equal_start.darw equal_end.darw] greater.spacer greater' by greater_greater_end.darw;
sub [equal_start.darw equal_end.darw] greater' greater by greater.spacer;
sub [equal_start.darw equal_end.darw] bar.spacer bar' by bar_bar_end.darw;
sub [equal_start.darw equal_end.darw] bar' bar by bar.spacer;

# single ends
sub [equal_start.darw equal_end.darw] less' by less_end.darw;
sub [equal_start.darw equal_end.darw] greater' by greater_end.darw;
sub [equal_start.darw equal_end.darw] bar' by bar_end.darw;

# double beginnings
sub less.spacer less' equal by less_less_start.darw;
sub less' less equal by less.spacer;
sub greater.spacer greater' equal by greater_greater_start.darw;
sub greater' greater equal by greater.spacer;
sub bar.spacer bar' equal by bar_bar_start.darw;
sub bar' bar equal by bar.spacer;

# single beginnings
sub less' equal by less_start.darw;
sub greater' equal by greater_start.darw;
sub bar' equal by bar_start.darw;
sub equal' [equal less greater bar] by equal_start.darw;
} double_arrows;
31 changes: 31 additions & 0 deletions features/case.fea
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
### Lowercase/uppercase operators

lookup lowercase_hyphen {
ignore sub @Tall \hyphen' @Lowercase;
ignore sub @Lowercase \hyphen' @Tall;
sub \hyphen' @Lowercase by \hyphen.lc;
sub @Lowercase \hyphen' by \hyphen.lc;
} lowercase_hyphen;

lookup lowercase_plus {
ignore sub @Tall \plus' @Lowercase;
ignore sub @Lowercase \plus' @Tall;
sub \plus' @Lowercase by \plus.lc;
sub @Lowercase \plus' by \plus.lc;
} lowercase_plus;

lookup lowercase_asterisk {
ignore sub @Tall \asterisk' @Lowercase;
ignore sub @Lowercase \asterisk' @Tall;
sub \asterisk' @Lowercase by \asterisk.lc;
sub @Lowercase \asterisk' by \asterisk.lc;
} lowercase_asterisk;

lookup uppercase_colon {
ignore sub @Tall \colon' @Lowercase;
ignore sub @Lowercase \colon' @Tall;
sub @Tall \colon' by \colon.uc;
sub \colon' @Tall by \colon.uc;
# pos @Tall \colon' <0 160 0 0>;
# pos \colon' @Tall <0 160 0 0>;
} uppercase_colon;
15 changes: 15 additions & 0 deletions features/conj_disj.fea
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
### Logical conjuntion/disjunction #738

lookup slash_backslash {
ignore sub @NotSpace slash' backslash;
ignore sub slash' backslash @NotSpace;
sub slash.spacer backslash' by slash_backslash.liga;
sub slash' backslash by slash.spacer;
} slash_backslash;

lookup backslash_slash {
ignore sub @NotSpace backslash' slash;
ignore sub backslash' slash @NotSpace;
sub backslash.spacer slash' by backslash_slash.liga;
sub backslash' slash by backslash.spacer;
} backslash_slash;
7 changes: 7 additions & 0 deletions features/cross.fea
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
### 0xFF
sub [zero zero.zero] x' [@Digit @HexDigit] by x.multiply;
sub [zero.tosf zero.zero.tosf zero.tosf.zero] x' [@DigitTosf @HexDigit] by x.multiply.tosf;

### 800x600
sub @Digit x' @Digit by x.multiply;
sub @DigitTosf x' @DigitTosf by x.multiply.tosf;
4 changes: 4 additions & 0 deletions features/fi_fl.fea
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### fi/fl #795

sub [f i.salt_low j.salt_low] [i j]' by [i.salt_low j.salt_low];
sub [F T I l.salt_low] l' by l.salt_low;
13 changes: 13 additions & 0 deletions features/greek.fea
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
### Greek

lookup caltGreekUCdiph {
sub @GreekUCdiphIOTA Iota' by Iotadieresis;
sub @GreekUCdiphUPSILON Upsilon' by Upsilondieresis;
} caltGreekUCdiph;

lookup caltGreekUC {
sub @GreekUCAcc' @GreekUC by @GreekUCcalt;
sub @GreekUC @GreekUCAcc' by @GreekUCcalt;
sub @GreekUCAcc' space @GreekUC by @GreekUCcalt;
sub @GreekUC space @GreekUCAcc' by @GreekUCcalt;
} caltGreekUC;
1 change: 1 addition & 0 deletions features/less_tilde_greater.fea
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sub less asciitilde' greater by asciitilde_asciitilde.liga;
27 changes: 27 additions & 0 deletions showcases/v3/showcases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,30 @@ r 0 123456789 & && $ <$ <$> $> @ <= >=
⎜ 3 ⎟ ⎢ c ⎥ ⎨ z ⎬
⎜ 4 ⎟ ⎢ d ⎥ ⎪ y ⎪
⎝ 5 ⎠ ⎣ e ⎦ ⎩ x ⎭


# Arbitrary-length arrows #346

<--------------------------------------------<<
----- ----< ---<< ----> --->> ----| ---||
<---- <---< <--<< <---> <-->> <---| <--|| --<--
<<--- <<--< <<-<< <<--> <<->> <<--| <<-|| -<<-
>---- >---< >--<< >---> >-->> >---| >--|| -->--
>>--- >>--< >>-<< >>--> >>->> >>--| >>-|| ->>-
|---- |---< |--<< |---> |-->> |---| |--|| --|--
||--- ||--< ||-<< ||--> ||->> ||--| ||-|| -||-
|--<--<<-->>-->--|--||--|
- -- --- |> <| ||> <|| <!-- -~ .- ~-

<============================================<<
===== ====< ===<< ====> ===>> ====| ===||
<==== <===< <==<< <===> <==>> <===| <==|| ==<==
<<=== <<==< <<=<< <<==> <<=>> <<==| <<=|| =<<=
>==== >===< >==<< >===> >==>> >===| >==|| ==>==
>>=== >>==< >>=<< >>==> >>=>> >>==| >>=|| =>>=
|==== |===< |==<< |===> |==>> |===| |==|| ==|==
||=== ||==< ||=<< ||==> ||=>> ||==| ||=|| =||=
|==<==<<==>>==>==|==||==|
.= ..= := ::= != !== ?= #= /= /==
=:= =!= = == === =/= >= <= ^=
>=< :>= <||>

0 comments on commit 8cc5687

Please sign in to comment.