Added SemiBold weight (closes #987)

This commit is contained in:
Nikita Prokopov 2020-04-05 23:25:07 +02:00
parent 84f8fa6b9c
commit 2a88d87bd5
12 changed files with 2131 additions and 2040 deletions

File diff suppressed because one or more lines are too long

View File

@ -16,6 +16,7 @@
["parenleft" "question" "exclam"]
["parenleft" "question" "less" "exclam"]])
(defn gen-ignore-prefixes [liga]
(str/join
(for [prefix ignore-prefixes
@ -28,6 +29,7 @@
" " (str/join " " (drop 1 liga))
";\n"))))
(def ignores
{ ["slash" "asterisk"]
(str
@ -113,6 +115,7 @@
" ignore sub bar hyphen' bar;\n"
})
;; DO NOT generate ignores at all
(def skip-ignores? #{
;; #410 <<*>> <<+>> <<$>>
@ -123,6 +126,7 @@
["f" "l"] ["F" "l"] ["T" "l"]
})
;; DO NOT generate ligature
(def manual? #{
;; /\ \/
@ -130,6 +134,7 @@
["backslash" "slash"]
})
(defn liga->rule
"[f f i] => { [LIG LIG i] f_f_i.liga
[LIG f i] LIG
@ -138,42 +143,48 @@
(case (count liga)
2 (let [[a b] liga]
(str/replace
(str "lookup 1_2 {\n"
(when-not (skip-ignores? liga)
(str " ignore sub 1 1' 2;\n"
" ignore sub 1' 2 2;\n"))
(gen-ignore-prefixes liga)
(get ignores liga)
" sub 1.spacer 2' by 1_2.liga;\n"
" sub 1' 2 by 1.spacer;\n"
"} 1_2;")
(str
"lookup 1_2 {\n"
(when-not (skip-ignores? liga)
(str " ignore sub 1 1' 2;\n"
" ignore sub 1' 2 2;\n"))
(gen-ignore-prefixes liga)
(get ignores liga)
" sub 1.spacer 2' by 1_2.liga;\n"
" sub 1' 2 by 1.spacer;\n"
; "sub 1 2 by 1_2.liga;"
"} 1_2;")
#"\d" {"1" a "2" b}))
3 (let [[a b c] liga]
(str/replace
(str "lookup 1_2_3 {\n"
(when-not (skip-ignores? liga)
(str " ignore sub 1 1' 2 3;\n"
" ignore sub 1' 2 3 3;\n"))
(gen-ignore-prefixes liga)
(get ignores liga)
" sub 1.spacer 2.spacer 3' by 1_2_3.liga;\n"
" sub 1.spacer 2' 3 by 2.spacer;\n"
" sub 1' 2 3 by 1.spacer;\n"
"} 1_2_3;")
(str
"lookup 1_2_3 {\n"
(when-not (skip-ignores? liga)
(str " ignore sub 1 1' 2 3;\n"
" ignore sub 1' 2 3 3;\n"))
(gen-ignore-prefixes liga)
(get ignores liga)
" sub 1.spacer 2.spacer 3' by 1_2_3.liga;\n"
" sub 1.spacer 2' 3 by 2.spacer;\n"
" sub 1' 2 3 by 1.spacer;\n"
; "sub 1 2 3 by 1_2_3.liga;"
"} 1_2_3;")
#"\d" {"1" a "2" b "3" c}))
4 (let [[a b c d] liga]
(str/replace
(str "lookup 1_2_3_4 {\n"
(when-not (skip-ignores? liga)
(str " ignore sub 1 1' 2 3 4;\n"
" ignore sub 1' 2 3 4 4;\n"))
(gen-ignore-prefixes liga)
(get ignores liga)
" sub 1.spacer 2.spacer 3.spacer 4' by 1_2_3_4.liga;\n"
" sub 1.spacer 2.spacer 3' 4 by 3.spacer;\n"
" sub 1.spacer 2' 3 4 by 2.spacer;\n"
" sub 1' 2 3 4 by 1.spacer;\n"
"} 1_2_3_4;")
(str
"lookup 1_2_3_4 {\n"
(when-not (skip-ignores? liga)
(str " ignore sub 1 1' 2 3 4;\n"
" ignore sub 1' 2 3 4 4;\n"))
(gen-ignore-prefixes liga)
(get ignores liga)
" sub 1.spacer 2.spacer 3.spacer 4' by 1_2_3_4.liga;\n"
" sub 1.spacer 2.spacer 3' 4 by 3.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_2_3_4.liga;"
"} 1_2_3_4;")
#"\d" {"1" a "2" b "3" c "4" d}))))

View File

@ -22,6 +22,14 @@
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-family: 'Fira Code';
src: url('woff2/FiraCode-Bold.woff2') format('woff2'),

View File

@ -19,6 +19,7 @@
.light { font-weight: 300; }
.regular { font-weight: 400; }
.medium { font-weight: 500; }
.semibold { font-weight: 600; }
.bold { font-weight: 700; }
.variable { font-family: 'Fira Code VF'; font-variation-settings: 'wght' 400; }
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>
<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>
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.

Binary file not shown.

63
docs/calt_performance.md Normal file
View 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
```

View File

@ -3,7 +3,7 @@
source venv/bin/activate
args=( "$@" )
default_weights=( "Light" "Regular" "Retina" "Medium" "Bold" )
default_weights=( "Light" "Regular" "Retina" "Medium" "SemiBold" "Bold" )
weights=( "${args[@]:-"${default_weights[@]}"}" )
for weight in "${weights[@]}"; do