Skip to content

Commit 5cc7f7e

Browse files
committed
feat: allow changing fonts
1 parent 504ed8a commit 5cc7f7e

File tree

123 files changed

+635
-82
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+635
-82
lines changed

package-lock.json

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/keybr-assets/lib/preload.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ export const preloadLinks: readonly PreloadLink[] = [
1212
),
1313
// Preload fonts.
1414
...[
15-
"/assets/opensans-400.latin.woff2",
16-
"/assets/ubuntu-mono-400.latin.woff2",
15+
"/assets/open-sans-400.latin.woff2",
16+
"/assets/open-sans-400italic.latin.woff2",
17+
"/assets/open-sans-700.latin.woff2",
18+
"/assets/open-sans-700italic.latin.woff2",
1719
].map(
1820
(href) =>
1921
({
File renamed without changes.
File renamed without changes.
+167
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
SplineFontDB: 3.2
2+
FontName: Whitespace
3+
FullName: Whitespace
4+
FamilyName: Whitespace
5+
Weight: Regular
6+
Copyright: Copyright (c) 2024, keybr.com
7+
UComments: "Created with FontForge (http://fontforge.org)"
8+
Version: 1.0
9+
ItalicAngle: 0
10+
UnderlinePosition: -409.6
11+
UnderlineWidth: 204.8
12+
Ascent: 1638
13+
Descent: 410
14+
InvalidEm: 0
15+
LayerCount: 2
16+
Layer: 0 0 "Back" 1
17+
Layer: 1 0 "Fore" 0
18+
XUID: [1021 148 372288191 4003857]
19+
FSType: 0
20+
OS2Version: 0
21+
OS2_WeightWidthSlopeOnly: 0
22+
OS2_UseTypoMetrics: 0
23+
CreationTime: 1712250907
24+
ModificationTime: 1712315091
25+
PfmFamily: 17
26+
TTFWeight: 400
27+
TTFWidth: 5
28+
LineGap: 0
29+
VLineGap: 0
30+
OS2TypoAscent: 1419
31+
OS2TypoAOffset: 0
32+
OS2TypoDescent: -338
33+
OS2TypoDOffset: 0
34+
OS2TypoLinegap: 100
35+
OS2WinAscent: 1700
36+
OS2WinAOffset: 0
37+
OS2WinDescent: 348
38+
OS2WinDOffset: 0
39+
HheadAscent: 1700
40+
HheadAOffset: 0
41+
HheadDescent: -348
42+
HheadDOffset: 0
43+
OS2CapHeight: 1419
44+
OS2XHeight: 1065
45+
OS2Vendor: 'PfEd'
46+
MarkAttachClasses: 1
47+
DEI: 91125
48+
LangName: 1033
49+
Encoding: UnicodeBmp
50+
UnicodeInterp: none
51+
NameList: AGL For New Fonts
52+
DisplaySize: -72
53+
AntiAlias: 1
54+
FitToEm: 0
55+
WinInfo: 57330 14 7
56+
BeginPrivate: 0
57+
EndPrivate
58+
Grid
59+
0 716.799804688 m 25
60+
1024 716.799804688 l 1053
61+
0 614.400390625 m 25
62+
1024 614.400390625 l 1049
63+
0 512 m 25
64+
1024 512 l 1049
65+
0 102.400390625 m 25
66+
1024 102.400390625 l 1049
67+
0 204.799804688 m 25
68+
1024 204.799804688 l 1049
69+
0 307.200195312 m 25
70+
1024 307.200195312 l 1049
71+
0 409.599609375 m 25
72+
1024 409.599609375 l 1049
73+
0 1638.40039062 m 1
74+
1024 1638.40039062 l 1
75+
1024 0 l 1
76+
0 0 l 1
77+
0 1638.40039062 l 1
78+
EndSplineSet
79+
TeXData: 1 0 0 524288 262144 174762 0 1048576 174762 783286 444596 497025 792723 393216 433062 380633 303038 157286 324010 404750 52429 2506097 1059062 262144
80+
BeginChars: 65536 4
81+
82+
StartChar: uniE000
83+
Encoding: 57344 57344 0
84+
Width: 1024
85+
Flags: HW
86+
LayerCount: 2
87+
Fore
88+
SplineSet
89+
664 532 m 0
90+
664 491 650 455 623 424 c 128
91+
596 393 559 377 514 377 c 0
92+
467 377 430 393 403 424 c 128
93+
376 455 362 491 362 532 c 0
94+
362 575 376 612 403 643 c 128
95+
430 674 467 690 514 690 c 0
96+
559 690 596 674 623 643 c 128
97+
650 612 664 575 664 532 c 0
98+
EndSplineSet
99+
Validated: 1
100+
EndChar
101+
102+
StartChar: uniE001
103+
Encoding: 57345 57345 1
104+
Width: 1024
105+
Flags: HW
106+
LayerCount: 2
107+
Fore
108+
SplineSet
109+
164 0 m 1
110+
164 205 l 1
111+
287 205 l 1
112+
287 102 l 1
113+
737 102 l 1
114+
737 205 l 1
115+
860 205 l 1
116+
860 0 l 1
117+
164 0 l 1
118+
EndSplineSet
119+
Validated: 1
120+
EndChar
121+
122+
StartChar: uniE002
123+
Encoding: 57346 57346 2
124+
Width: 1024
125+
Flags: HW
126+
LayerCount: 2
127+
Fore
128+
SplineSet
129+
102 449 m 1
130+
102 571 l 1
131+
594 571 l 1
132+
594 674 l 1
133+
758 512 l 1
134+
594 346 l 1
135+
594 449 l 1
136+
102 449 l 1
137+
819 674 m 1
138+
922 674 l 1
139+
922 346 l 1
140+
819 346 l 1
141+
819 674 l 1
142+
EndSplineSet
143+
Validated: 1
144+
EndChar
145+
146+
StartChar: uniE003
147+
Encoding: 57347 57347 3
148+
Width: 1024
149+
Flags: HW
150+
LayerCount: 2
151+
Fore
152+
SplineSet
153+
819 582 m 1
154+
819 358 l 1
155+
328 358 l 1
156+
328 256 l 1
157+
164 410 l 1
158+
328 563 l 1
159+
328 461 l 1
160+
717 461 l 1
161+
717 582 l 1
162+
819 582 l 1
163+
EndSplineSet
164+
Validated: 1
165+
EndChar
166+
EndChars
167+
EndSplineFont
1.71 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

packages/keybr-fonts/generate.py

+60-18
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/env python3
22

3+
# https://markoskon.com/creating-font-subsets/
4+
35
from fontTools.ttLib import TTFont
46
from fontTools.subset import parse_unicodes, Subsetter
57
from fontTools.merge import Merger
@@ -26,16 +28,32 @@ def __init__(self, font_file, font_name, merge_file=None):
2628

2729
self.font_family = font_family
2830
self.font_subfamily = font_subfamily
29-
self.font_weight = (
30-
"700"
31-
if font_subfamily == "Bold" or font_subfamily == "Bold Italic"
32-
else "400"
33-
)
34-
self.font_style = (
35-
"italic"
36-
if font_subfamily == "Italic" or font_subfamily == "Bold Italic"
37-
else "normal"
38-
)
31+
32+
if font_subfamily == "Light":
33+
self.font_weight = 300
34+
self.font_style = "normal"
35+
if font_subfamily == "Light Italic":
36+
self.font_weight = 300
37+
self.font_style = "italic"
38+
if font_subfamily == "Regular":
39+
self.font_weight = 400
40+
self.font_style = "normal"
41+
if font_subfamily == "Italic":
42+
self.font_weight = 400
43+
self.font_style = "italic"
44+
if font_subfamily == "Medium":
45+
self.font_weight = 500
46+
self.font_style = "normal"
47+
if font_subfamily == "Medium Italic":
48+
self.font_weight = 500
49+
self.font_style = "italic"
50+
if font_subfamily == "Bold":
51+
self.font_weight = 700
52+
self.font_style = "normal"
53+
if font_subfamily == "Bold Italic":
54+
self.font_weight = 700
55+
self.font_style = "italic"
56+
3957
self.font_name = (
4058
f"{font_name}-{self.font_weight}italic"
4159
if self.font_style == "italic"
@@ -93,39 +111,63 @@ def generate(font_file, font_name, merge_file=None):
93111
def main():
94112
generate(
95113
"fonts/OpenSans/static/OpenSans-Regular.ttf",
96-
"opensans",
114+
"open-sans",
115+
merge_file="Whitespace-em2048.ttf",
97116
)
98117
generate(
99118
"fonts/OpenSans/static/OpenSans-Italic.ttf",
100-
"opensans",
119+
"open-sans",
120+
merge_file="Whitespace-em2048.ttf",
101121
)
102122
generate(
103123
"fonts/OpenSans/static/OpenSans-Bold.ttf",
104-
"opensans",
124+
"open-sans",
125+
merge_file="Whitespace-em2048.ttf",
105126
)
106127
generate(
107128
"fonts/OpenSans/static/OpenSans-BoldItalic.ttf",
108-
"opensans",
129+
"open-sans",
130+
merge_file="Whitespace-em2048.ttf",
131+
)
132+
generate(
133+
"fonts/RobotoMono/static/RobotoMono-Regular.ttf",
134+
"roboto-mono",
135+
merge_file="Whitespace-em2048.ttf",
136+
)
137+
generate(
138+
"fonts/RobotoMono/static/RobotoMono-Italic.ttf",
139+
"roboto-mono",
140+
merge_file="Whitespace-em2048.ttf",
141+
)
142+
generate(
143+
"fonts/RobotoMono/static/RobotoMono-Bold.ttf",
144+
"roboto-mono",
145+
merge_file="Whitespace-em2048.ttf",
146+
)
147+
generate(
148+
"fonts/RobotoMono/static/RobotoMono-BoldItalic.ttf",
149+
"roboto-mono",
150+
merge_file="Whitespace-em2048.ttf",
109151
)
110152
generate(
111153
"fonts/Ubuntu/UbuntuMono-R.ttf",
112154
"ubuntu-mono",
113-
merge_file="Whitespace.ttf",
155+
merge_file="Whitespace-em1000.ttf",
114156
)
115157
generate(
116158
"fonts/Ubuntu/UbuntuMono-RI.ttf",
117159
"ubuntu-mono",
118-
merge_file="Whitespace.ttf",
160+
merge_file="Whitespace-em1000.ttf",
119161
)
120162
generate(
121163
"fonts/Ubuntu/UbuntuMono-B.ttf",
122164
"ubuntu-mono",
123-
merge_file="Whitespace.ttf",
165+
merge_file="Whitespace-em1000.ttf",
124166
)
125167
generate(
126168
"fonts/Ubuntu/UbuntuMono-BI.ttf",
127169
"ubuntu-mono",
128-
merge_file="Whitespace.ttf",
170+
merge_file="Whitespace-em1000.ttf",
129171
)
130172

131173

packages/keybr-fonts/lib/index.less

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
@import "opensans-400.css";
2-
@import "opensans-400italic.css";
3-
@import "opensans-700.css";
4-
@import "opensans-700italic.css";
1+
@import "open-sans-400.css";
2+
@import "open-sans-400italic.css";
3+
@import "open-sans-700.css";
4+
@import "open-sans-700italic.css";
5+
6+
@import "roboto-mono-400.css";
7+
@import "roboto-mono-400italic.css";
8+
@import "roboto-mono-700.css";
9+
@import "roboto-mono-700italic.css";
510

611
@import "ubuntu-mono-400.css";
712
@import "ubuntu-mono-400italic.css";

packages/keybr-fonts/lib/opensans-400.css packages/keybr-fonts/lib/open-sans-400.css

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,38 @@
33
font-weight: 400;
44
font-style: normal;
55
font-display: swap;
6-
src: url(../assets/opensans-400.cyrillic.woff2) format("woff2");
6+
src: url(../assets/open-sans-400.cyrillic.woff2) format("woff2");
77
unicode-range: U+0400-04FF;
88
}
99
@font-face {
1010
font-family: "Open Sans";
1111
font-weight: 400;
1212
font-style: normal;
1313
font-display: swap;
14-
src: url(../assets/opensans-400.greek.woff2) format("woff2");
14+
src: url(../assets/open-sans-400.greek.woff2) format("woff2");
1515
unicode-range: U+0370-03FF;
1616
}
1717
@font-face {
1818
font-family: "Open Sans";
1919
font-weight: 400;
2020
font-style: normal;
2121
font-display: swap;
22-
src: url(../assets/opensans-400.hebrew.woff2) format("woff2");
22+
src: url(../assets/open-sans-400.hebrew.woff2) format("woff2");
2323
unicode-range: U+0590-05FF;
2424
}
2525
@font-face {
2626
font-family: "Open Sans";
2727
font-weight: 400;
2828
font-style: normal;
2929
font-display: swap;
30-
src: url(../assets/opensans-400.latin.woff2) format("woff2");
30+
src: url(../assets/open-sans-400.latin.woff2) format("woff2");
3131
unicode-range: U+0000-00FF, U+2000-206F, U+2200-22FF, U+E000-E003;
3232
}
3333
@font-face {
3434
font-family: "Open Sans";
3535
font-weight: 400;
3636
font-style: normal;
3737
font-display: swap;
38-
src: url(../assets/opensans-400.latin-ext.woff2) format("woff2");
38+
src: url(../assets/open-sans-400.latin-ext.woff2) format("woff2");
3939
unicode-range: U+0100-017F, U+0180-024F, U+0300-036F, U+20A0-20CF;
4040
}

0 commit comments

Comments
 (0)