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