mirror of
https://github.com/tonsky/FiraCode.git
synced 2024-10-04 00:31:49 +03:00
Added SemiBold weight (closes #987)
This commit is contained in:
parent
84f8fa6b9c
commit
2a88d87bd5
4016
FiraCode.glyphs
4016
FiraCode.glyphs
File diff suppressed because one or more lines are too long
@ -16,6 +16,7 @@
|
|||||||
["parenleft" "question" "exclam"]
|
["parenleft" "question" "exclam"]
|
||||||
["parenleft" "question" "less" "exclam"]])
|
["parenleft" "question" "less" "exclam"]])
|
||||||
|
|
||||||
|
|
||||||
(defn gen-ignore-prefixes [liga]
|
(defn gen-ignore-prefixes [liga]
|
||||||
(str/join
|
(str/join
|
||||||
(for [prefix ignore-prefixes
|
(for [prefix ignore-prefixes
|
||||||
@ -28,6 +29,7 @@
|
|||||||
" " (str/join " " (drop 1 liga))
|
" " (str/join " " (drop 1 liga))
|
||||||
";\n"))))
|
";\n"))))
|
||||||
|
|
||||||
|
|
||||||
(def ignores
|
(def ignores
|
||||||
{ ["slash" "asterisk"]
|
{ ["slash" "asterisk"]
|
||||||
(str
|
(str
|
||||||
@ -113,6 +115,7 @@
|
|||||||
" ignore sub bar hyphen' bar;\n"
|
" ignore sub bar hyphen' bar;\n"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
;; DO NOT generate ignores at all
|
;; DO NOT generate ignores at all
|
||||||
(def skip-ignores? #{
|
(def skip-ignores? #{
|
||||||
;; #410 <<*>> <<+>> <<$>>
|
;; #410 <<*>> <<+>> <<$>>
|
||||||
@ -123,6 +126,7 @@
|
|||||||
["f" "l"] ["F" "l"] ["T" "l"]
|
["f" "l"] ["F" "l"] ["T" "l"]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
;; DO NOT generate ligature
|
;; DO NOT generate ligature
|
||||||
(def manual? #{
|
(def manual? #{
|
||||||
;; /\ \/
|
;; /\ \/
|
||||||
@ -130,6 +134,7 @@
|
|||||||
["backslash" "slash"]
|
["backslash" "slash"]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
(defn liga->rule
|
(defn liga->rule
|
||||||
"[f f i] => { [LIG LIG i] f_f_i.liga
|
"[f f i] => { [LIG LIG i] f_f_i.liga
|
||||||
[LIG f i] LIG
|
[LIG f i] LIG
|
||||||
@ -138,7 +143,8 @@
|
|||||||
(case (count liga)
|
(case (count liga)
|
||||||
2 (let [[a b] liga]
|
2 (let [[a b] liga]
|
||||||
(str/replace
|
(str/replace
|
||||||
(str "lookup 1_2 {\n"
|
(str
|
||||||
|
"lookup 1_2 {\n"
|
||||||
(when-not (skip-ignores? liga)
|
(when-not (skip-ignores? liga)
|
||||||
(str " ignore sub 1 1' 2;\n"
|
(str " ignore sub 1 1' 2;\n"
|
||||||
" ignore sub 1' 2 2;\n"))
|
" ignore sub 1' 2 2;\n"))
|
||||||
@ -146,11 +152,13 @@
|
|||||||
(get ignores liga)
|
(get ignores liga)
|
||||||
" sub 1.spacer 2' by 1_2.liga;\n"
|
" sub 1.spacer 2' by 1_2.liga;\n"
|
||||||
" sub 1' 2 by 1.spacer;\n"
|
" sub 1' 2 by 1.spacer;\n"
|
||||||
|
; "sub 1 2 by 1_2.liga;"
|
||||||
"} 1_2;")
|
"} 1_2;")
|
||||||
#"\d" {"1" a "2" b}))
|
#"\d" {"1" a "2" b}))
|
||||||
3 (let [[a b c] liga]
|
3 (let [[a b c] liga]
|
||||||
(str/replace
|
(str/replace
|
||||||
(str "lookup 1_2_3 {\n"
|
(str
|
||||||
|
"lookup 1_2_3 {\n"
|
||||||
(when-not (skip-ignores? liga)
|
(when-not (skip-ignores? liga)
|
||||||
(str " ignore sub 1 1' 2 3;\n"
|
(str " ignore sub 1 1' 2 3;\n"
|
||||||
" ignore sub 1' 2 3 3;\n"))
|
" ignore sub 1' 2 3 3;\n"))
|
||||||
@ -159,11 +167,13 @@
|
|||||||
" sub 1.spacer 2.spacer 3' by 1_2_3.liga;\n"
|
" sub 1.spacer 2.spacer 3' by 1_2_3.liga;\n"
|
||||||
" sub 1.spacer 2' 3 by 2.spacer;\n"
|
" sub 1.spacer 2' 3 by 2.spacer;\n"
|
||||||
" sub 1' 2 3 by 1.spacer;\n"
|
" sub 1' 2 3 by 1.spacer;\n"
|
||||||
|
; "sub 1 2 3 by 1_2_3.liga;"
|
||||||
"} 1_2_3;")
|
"} 1_2_3;")
|
||||||
#"\d" {"1" a "2" b "3" c}))
|
#"\d" {"1" a "2" b "3" c}))
|
||||||
4 (let [[a b c d] liga]
|
4 (let [[a b c d] liga]
|
||||||
(str/replace
|
(str/replace
|
||||||
(str "lookup 1_2_3_4 {\n"
|
(str
|
||||||
|
"lookup 1_2_3_4 {\n"
|
||||||
(when-not (skip-ignores? liga)
|
(when-not (skip-ignores? liga)
|
||||||
(str " ignore sub 1 1' 2 3 4;\n"
|
(str " ignore sub 1 1' 2 3 4;\n"
|
||||||
" ignore sub 1' 2 3 4 4;\n"))
|
" ignore sub 1' 2 3 4 4;\n"))
|
||||||
@ -173,6 +183,7 @@
|
|||||||
" sub 1.spacer 2.spacer 3' 4 by 3.spacer;\n"
|
" sub 1.spacer 2.spacer 3' 4 by 3.spacer;\n"
|
||||||
" sub 1.spacer 2' 3 4 by 2.spacer;\n"
|
" sub 1.spacer 2' 3 4 by 2.spacer;\n"
|
||||||
" sub 1' 2 3 4 by 1.spacer;\n"
|
" sub 1' 2 3 4 by 1.spacer;\n"
|
||||||
|
; "sub 1 2 3 4 by 1_2_3_4.liga;"
|
||||||
"} 1_2_3_4;")
|
"} 1_2_3_4;")
|
||||||
#"\d" {"1" a "2" b "3" c "4" d}))))
|
#"\d" {"1" a "2" b "3" c "4" d}))))
|
||||||
|
|
||||||
|
@ -22,6 +22,14 @@
|
|||||||
font-style: normal;
|
font-style: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Fira Code';
|
||||||
|
src: url('woff2/FiraCode-SemiBold.woff2') format('woff2'),
|
||||||
|
url("woff/FiraCode-SemiBold.woff") format("woff");
|
||||||
|
font-weight: 600;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Fira Code';
|
font-family: 'Fira Code';
|
||||||
src: url('woff2/FiraCode-Bold.woff2') format('woff2'),
|
src: url('woff2/FiraCode-Bold.woff2') format('woff2'),
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
.light { font-weight: 300; }
|
.light { font-weight: 300; }
|
||||||
.regular { font-weight: 400; }
|
.regular { font-weight: 400; }
|
||||||
.medium { font-weight: 500; }
|
.medium { font-weight: 500; }
|
||||||
|
.semibold { font-weight: 600; }
|
||||||
.bold { font-weight: 700; }
|
.bold { font-weight: 700; }
|
||||||
.variable { font-family: 'Fira Code VF'; font-variation-settings: 'wght' 400; }
|
.variable { font-family: 'Fira Code VF'; font-variation-settings: 'wght' 400; }
|
||||||
i { font-style: normal; color: #c33; }
|
i { font-style: normal; color: #c33; }
|
||||||
@ -63,6 +64,16 @@ take = (n, [x, <i>...</i>xs]:list) <i>--></i>
|
|||||||
last3 = reverse <i>>></i> take 3 <i>>></i> reverse</div>
|
last3 = reverse <i>>></i> take 3 <i>>></i> reverse</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="code semibold"><b># Fira Code Medium</b>
|
||||||
|
|
||||||
|
take = (n, [x, <i>...</i>xs]:list) <i>--></i>
|
||||||
|
| n <i><=</i> 0 <i>=></i> []
|
||||||
|
| empty list <i>=></i> []
|
||||||
|
| otherwise <i>=></i> [x] <i>++</i> take n-1, xs
|
||||||
|
|
||||||
|
last3 = reverse <i>>></i> take 3 <i>>></i> reverse</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="code bold"><b># Fira Code Bold</b>
|
<div class="code bold"><b># Fira Code Bold</b>
|
||||||
|
|
||||||
take = (n, [x, <i>...</i>xs]:list) <i>--></i>
|
take = (n, [x, <i>...</i>xs]:list) <i>--></i>
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
distr/ttf/FiraCode-SemiBold.ttf
Normal file
BIN
distr/ttf/FiraCode-SemiBold.ttf
Normal file
Binary file not shown.
63
docs/calt_performance.md
Normal file
63
docs/calt_performance.md
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
# Time to shape text with different calt code
|
||||||
|
|
||||||
|
Baseline:
|
||||||
|
|
||||||
|
```
|
||||||
|
sub 1 2 3 4 by 1_2_3_4.liga;
|
||||||
|
```
|
||||||
|
|
||||||
|
Spacers:
|
||||||
|
|
||||||
|
```
|
||||||
|
sub 1.spacer 2.spacer 3.spacer 4' by 1_2_3_4.liga;
|
||||||
|
sub 1.spacer 2.spacer 3' 4 by 3.spacer;
|
||||||
|
sub 1.spacer 2' 3 4 by 2.spacer;
|
||||||
|
sub 1' 2 3 4 by 1.spacer;
|
||||||
|
```
|
||||||
|
|
||||||
|
Lookups:
|
||||||
|
|
||||||
|
```
|
||||||
|
lookup 1_2_3_4 {
|
||||||
|
sub 1.spacer 2.spacer 3.spacer 4' by 1_2_3_4.liga;
|
||||||
|
sub 1.spacer 2.spacer 3' 4 by 3.spacer;
|
||||||
|
sub 1.spacer 2' 3 4 by 2.spacer;
|
||||||
|
sub 1' 2 3 4 by 1.spacer;
|
||||||
|
} 1_2_3_4;
|
||||||
|
```
|
||||||
|
|
||||||
|
Ignores:
|
||||||
|
|
||||||
|
```
|
||||||
|
lookup 1_2_3_4 {
|
||||||
|
ignore sub 1 1' 2 3 4;
|
||||||
|
ignore sub 1' 2 3 4 4;
|
||||||
|
sub 1.spacer 2.spacer 3.spacer 4' by 1_2_3_4.liga;
|
||||||
|
sub 1.spacer 2.spacer 3' 4 by 3.spacer;
|
||||||
|
sub 1.spacer 2' 3 4 by 2.spacer;
|
||||||
|
sub 1' 2 3 4 by 1.spacer;
|
||||||
|
} 1_2_3_4;
|
||||||
|
```
|
||||||
|
|
||||||
|
Benchmark:
|
||||||
|
|
||||||
|
```
|
||||||
|
time hb-shape -n 100000 distr/ttf/FiraCode-Regular.ttf "Hello +++ /// !== <-> world"
|
||||||
|
```
|
||||||
|
|
||||||
|
Setup:
|
||||||
|
|
||||||
|
```
|
||||||
|
HarfBuzz 2.6.4
|
||||||
|
3,2 GHz 6-Core Intel Core i7
|
||||||
|
MacOS 10.15.3
|
||||||
|
```
|
||||||
|
|
||||||
|
Results:
|
||||||
|
|
||||||
|
```
|
||||||
|
Baseline 0.407s
|
||||||
|
Spacers 1.415s
|
||||||
|
Lookups 2.080s
|
||||||
|
Ignores 2.656s
|
||||||
|
```
|
@ -3,7 +3,7 @@
|
|||||||
source venv/bin/activate
|
source venv/bin/activate
|
||||||
|
|
||||||
args=( "$@" )
|
args=( "$@" )
|
||||||
default_weights=( "Light" "Regular" "Retina" "Medium" "Bold" )
|
default_weights=( "Light" "Regular" "Retina" "Medium" "SemiBold" "Bold" )
|
||||||
weights=( "${args[@]:-"${default_weights[@]}"}" )
|
weights=( "${args[@]:-"${default_weights[@]}"}" )
|
||||||
|
|
||||||
for weight in "${weights[@]}"; do
|
for weight in "${weights[@]}"; do
|
||||||
|
Loading…
Reference in New Issue
Block a user