[varLib / ttLib] pen/GlyphSet API would be very handy for variable fonts
See original GitHub issueI would love the TTFont().getGlyphSet() API to be extended with variable font support. This is how I imagine this to work:
f = TTFont("myvarfont.ttf")
gs = f.getGlyphSet()
gs.setLocation({'wght': 120, 'wdth': 300})
g = gs['a']
g.draw(somePen)
print(g.width)
print(g.height)
To do this properly, varLib will have to grow a cleaner API to work with coordinates and deltas.
I have attached a very rough and sketchy implementation that uses some hacked up bits from varLib.mutator
. I think this shows which parts of varLib need to be redesigned for easier reuse.
See also #1020
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Introduction to variable fonts on the web
In this article, we will look at what variable fonts are, the benefits they offer, and how we can use them in our...
Read more >Variable fonts | Can I use... Support tables for HTML5, CSS3, etc
OpenType font settings that allows a single font file to behave like multiple fonts: it can contain all the allowed variations in width,...
Read more >1 DesignSpaceDocument Python API - fontTools
An object to read, write and edit interpolation systems for typefaces. Define sources, axes, rules, variable fonts and instances. Get an overview of...
Read more >[Variable Fonts] Check fonttools.varLib.mutator can generate a ...
This test is needed because the GF Team want to generate font instances from variable fonts. One of our variable test fonts, ...
Read more >Introducing variable fonts – Fonts Knowledge - Google Fonts
Variable fonts —officially known as OpenType Font Variations—remove the ... is greatly reduced compared to loading multiple individual font files—and that's ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sounds about right. I’ll give it a shot.
Okay I’ll see if that can be done. Good idea. It’s possible if we pass the location to
getGlyphSet
. I think that’s a fine idea. Then we can reuse your implementation.Sure that can be done.