You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The neat part about the Google Fonts API is thatit provides the font hosting. No
38
-
need to download and serve the fonts. If you look at the generated CSS, you can
39
-
see a few different technologies to better serve fonts.
40
+
The neat part about Google Fonts is that the API takes care of the font
41
+
hosting. No need to download and serve the fonts. If you look at the generated
42
+
CSS, you can see how the serving is optimized compared to serving simple static
43
+
files.
40
44
41
-
#+CAPTION: Note the use of =woff2= and =unicode-range= to serve only the required glyphs. This page actually only needs the /latin/ range.
45
+
#+CAPTION: Note the use of =woff2= and =unicode-range= to serve only the required glyphs. This blog post actually only needs the /latin/ range.
42
46
#+BEGIN_SRC css
43
47
/* latin-ext */
44
48
@font-face {
@@ -79,9 +83,11 @@ see a few different technologies to better serve fonts.
79
83
:ID: 346f6172-0f28-4b18-b41f-a27789e7c580
80
84
:END:
81
85
82
-
Google maintains and develops [[https://github.com/googlefonts/fontc][fontc]], a Rust-based compiler that takes font sources
83
-
and converts them into ttf/otf files. It's a lot quicker than the previous Python
84
-
font compiler, [[https://github.com/googlefonts/fontmake][fontmake]], which was also developed and maintained by Google.
86
+
Google maintains and develops [[https://github.com/googlefonts/fontc][fontc]], a Rust-based compiler that takes font
87
+
sources and converts them into the binary ttf and otf files. Font sources come
88
+
in various formats, but usually boil down to definitions for outlines, kerning,
89
+
metadata and more. It's a lot quicker than the previous Python font compiler,
90
+
[[https://github.com/googlefonts/fontmake][fontmake]], which was also developed and maintained by Google.
85
91
86
92
** Fontations
87
93
:PROPERTIES:
@@ -102,30 +108,41 @@ open source. Since it's open source, I can actually present some of the stuff
102
108
I've done.
103
109
104
110
** Better Gradients for Resvg+TinySkia
111
+
:PROPERTIES:
112
+
:ID: 44143173-9bff-4337-8cf8-9a6edcad2636
113
+
:END:
105
114
106
115
*** Task
116
+
:PROPERTIES:
117
+
:ID: bd821425-fc63-4e7c-9db2-e4211d5f6ae5
118
+
:END:
107
119
108
-
My starter project was to fix [[https://github.com/googlefonts/sleipnir][Sleipnir]] rendering of color fonts like
120
+
My starter project was to fix [[https://github.com/googlefonts/sleipnir][Sleipnir]] rendering of color fonts like emojis and
109
121
[[https://fonts.google.com/specimen/Nabla?query=nabla&preview.script=Latn][Nabla]]. Sleipnir is a Rust library that can render text and icons into png or
110
122
svg.
111
123
112
124
This one was quite a rabbit hole. The most important skill I picked up was
113
-
understanding the font format. Fonts (ttf/otf files) are composed of tables. The
114
-
tables define things such as contours, supported unicodes, ligatures, kerning,
115
-
and lots of other stuff; it's a fairly extensible format.
125
+
understanding the font format. Fonts (binary ttf/otf files) are composed of
126
+
tables. The tables define things such as outline contours, supported unicodes,
127
+
ligatures, kerning, and lots of other stuff; it's a fairly extensible
128
+
format. Font's can make use any assortment of the spec to accomplish the
129
+
goal. The spec is fairly complicated due to decades of legacy.
116
130
117
131
To inspect the contents of a font, you can open it with the =ttx= command from
118
132
[[https://github.com/fonttools/fonttools][fonttools]]. This produces an =xml= representation of the tables. To help me out,
119
133
I even made an Emacs package that adds the ability to open ttf, otf, and
120
134
woff2[fn:woff2] font files. Check out [[https://github.com/wmedrano/ttx-mode][=ttx-mode=]] if interested.
121
135
122
136
*** Detour
137
+
:PROPERTIES:
138
+
:ID: 6a3f92bf-8748-4d06-998e-c1cac7374ef7
139
+
:END:
123
140
124
-
It turns out that getting Nabla to work was not too complicated. However, the
125
-
underlying 2D graphics library did not have the full expressiveness of Radial
126
-
Gradients and was missing Sweep Gradients entirely. I originally was going to
127
-
leave it as is, but my manager encouraged me to continue. So I ended up learning
128
-
some math and implementing [[https://github.com/linebender/tiny-skia/pull/164][radial gradient]] and [[https://github.com/linebender/tiny-skia/pull/166][sweep gradients]].
141
+
It turns out that getting Nabla to work was not too complicated. However,
142
+
=tiny-skia=, the underlying 2D graphics library, did not have fully support
143
+
Radial Gradients and was missing Sweep Gradients entirely. I originally was
144
+
going to leave it as is, but my manager encouraged me to continue. So I ended up
145
+
learning some math and implementing [[https://github.com/linebender/tiny-skia/pull/164][radial gradient]] and [[https://github.com/linebender/tiny-skia/pull/166][sweep gradients]].
129
146
130
147
What's rewarding about this is that it affects a few other users. Once /typst/
131
148
updates their dependencies, they should have better gradients ([[https://github.com/typst/typst/issues/7760][issues]]). I also
@@ -144,29 +161,34 @@ are pretty popular open source tools.
144
161
:END:
145
162
146
163
The main project I should be working on at the moment is landing IFT on the
147
-
client. I said should since I've spent most of this quarter procrastinating and
148
-
failing to comprehend specs. At least I've made a bit of progress.
164
+
client. IFT is a font technology that reduces the size of fonts on the web. I
165
+
said /should/ since I've spent most of this quarter procrastinating and failing
166
+
to comprehend specs. At least I've made a bit of progress.
149
167
150
168
IFT stands for Incremental Font Transfer. It is a font technology that
151
-
theoretically enables more efficient transfer of fonts. One of my coworkers has
152
-
been working on the spec and prototype for a while. He's done a great job at
153
-
authoring the [[https://www.w3.org/TR/IFT/][W3 Spec]] for it.
169
+
theoretically enables more efficient transfer of fonts. My coworker, Garret, has
170
+
been working on the spec and prototype for a while. The spec can be seen on
171
+
[[https://www.w3.org/TR/IFT/][W3.org]].
154
172
155
173
IFT requires 2 components:
156
174
157
-
1. A font must be IFT encoded. This splits the font into a base font and a
158
-
collection of patches.
175
+
1. An IFT encoded font. This splits the font into a base font and a collection
176
+
of patches.
159
177
2. Client support. Clients (web browsers) must be able to request and apply the
0 commit comments