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
* refactor(docs): differentiable link text
hyperlinks should contain an differentiable and descriptive linktext regarding their linked target.
* docs: added source
* Update README.md
* chore: formatting
* Update README.md
Copy file name to clipboardExpand all lines: variable-fonts/README.md
+9-7Lines changed: 9 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -8,24 +8,26 @@ Spoiler: At the moment (2024-08-21) there aren't much information about the tech
8
8
9
9
> Variable fonts are an evolution of the OpenType font specification that enables many different variations of a typeface to be incorporated into a single file.
10
10
11
-
- It is fully supported in all browsers. See [here](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_fonts/Variable_fonts_guide).
12
-
- In general the font file (.otf/.ttf) contains an additional [table](https://learn.microsoft.com/en-us/typography/opentype/spec/fvar) to enable the variable font.
- It is fully supported in all browsers, see [MDNs Variable_fonts_guide](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_fonts/Variable_fonts_guide).
14
+
- In general the font file (`.otf`/`.ttf`) contains an additional [table](https://learn.microsoft.com/en-us/typography/opentype/spec/fvar) to enable the variable font.
13
15
14
16
## The idea
15
17
16
18
In a naive way I thought: "We have already an icon font, it should be easy to convert it to a variable font" - I was wrong.
17
19
18
-
First of all if we use for example this [tool](https://github.com/db-ui/gif) we can generate different file types. And it may contain different icon sizes (e.g. 16,24,32) which might look different, with different weights etc.
20
+
First of all if we use for example this [tool](https://github.com/db-ui/gif) we can generate different file types. And it may contain different icon sizes (e.g. 16,24,32) which might look different, with different weights etc.
19
21
20
22
But the biggest problem is that a variable font has a restriction: To interpolate a font glyph, it needs the same amount of points and lines and in the same order. Otherwise, it won't be able to interpolate properly.
21
23
22
24
## The tools
23
25
24
-
A great place to start is [opentype.js](https://opentype.js.org/). You can check already created variable fonts here. And there is a good JS library behind it. Currently, they don't support writing variable fonts, but there is a [PR](https://github.com/opentypejs/opentype.js/pull/701) for this.
26
+
A great place to start is [opentype.js](https://opentype.js.org/). You can check already created variable fonts here. And there is a good JS library behind it. Currently, they don't support writing variable fonts, but there is a [PR for variable fonts support](https://github.com/opentypejs/opentype.js/pull/701).
25
27
26
-
## Create own variable font with open source tools
28
+
## Create our own variable font with open source tools
27
29
28
-
Based on this [video](https://www.youtube.com/watch?v=xoQuWARCUWI) you can create your own variable font with some open source tools. You need those tools:
30
+
Based on a [YouTube video](https://www.youtube.com/watch?v=xoQuWARCUWI) you can create your own variable font with some open source tools. You need those tools:
@@ -40,7 +42,7 @@ Based on this [video](https://www.youtube.com/watch?v=xoQuWARCUWI) you can creat
40
42
4. We use [FontForge](https://fontforge.org/) to open the `test.woff2`
41
43
5. We will save the current font as `.sfd` format like `test.sfd`. Then we change the font name via FontForge settings to something like `test_bold` and save another file as `test_bold.sfd`.
42
44
6. Next we scroll to the bottom of the `test_bold` font inside FontForge and change the positions of the points inside the glyph. In this case we use the empty space between the rectangles to widen them.
43
-
7. After this we will create a font from both the `test.sfd` and `test_bold.sfd` as `.ufo` file. **Warning** the svg might get redrawn by `@db-ui/gif` you may need to fix issues (like the direction) in FontForge by using the "Element/Validation" setting.
45
+
7. After this we will create a font from both the `test.sfd` and `test_bold.sfd` as `.ufo` file. **Warning** the SVG might get redrawn by `@db-ui/gif` you may need to fix issues (like the direction) in FontForge by using the "Element/Validation" setting.
44
46
8. Next we need to create a `.designspace` file. This is a representation (XML) for how the axis works. Check the `test.designspace` for more information.
45
47
9. Now we need to run `fontmake -m test.designspace -o variable --production-names --output-path test.ttf`
46
48
10. Goto [this](https://opentype.js.org/glyph-inspector.html) website and open the `test.ttf`. You should change the `weight` of the icon with the slider provided. You may also see `index.html` and `index.css` to check how you use an axis inside HTML/CSS.
0 commit comments