-
Notifications
You must be signed in to change notification settings - Fork 479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
variable fonts: VariationManager set axes values for rendering #722
Comments
1.3.4 is outdated and does not support variable fonts. Use 2.0.0 instead from the master branch. We will be updating the version on npm when 2.0.0 is finished. |
Thank you so much for your quick response! However, it seems like the SVG conversion has a minor bug. See updated codepen example (same URL - but updated)
Works beautifully (except this tiny flipping error).
|
Have you tried setting the variation in the options variable when you create the path? That might work better. And that way you can have the variation set for each individual time you get a path instead of on the path. Also, just a heads up, Google does some screwy things with Google fonts, so it's not generally a good idea to use fonts from there and to use the original source of the font, because oftentimes Google modifies the font when they upload it. |
If I remember correctly Font.variation.set() is only supposed to be used to set the default font variation. But I may be wrong as I don't have the documentation or the code in front of me. |
It also occurs without any specified axis info. |
I'm travelling right now so can't really look into this right now, but does |
Thanks for your help. I think I've found the problem.
So I guess the y transformation can either be removed from See new pen |
Just use |
I would actually need to use |
If that's the case, it's a good thing we found that before releasing 2.0.0 |
Thanks! |
Obviously, opentype.js variable font features are still quite new - so thanks a lot for these exiting new features!
From the current readme we should be able to set variable font axis values for rendering - which doesn't work.
Expected Behavior
The parsed font object should return some info when logging
Font.variation.activateDefaultVariation()
orFont.variation.getDefaultCoordinates()
Current Behavior
Cannot read properties of undefined (reading 'getInstance')
So we can't access or control any variation properties
Steps to Reproduce (for bugs)
I'm using version 1.3.4
here is a simple codepen example:
I can successfully parse and render the font - the Open Sans ttf version.
I can also retrieve the
fvar
table to retrieve the available axes as well as min, default, max values (returning the expected values).But I can't access the VariationManager API methods such as
Font.variation.getDefaultCoordinates()
Probably I'm just too stupid or the new API is still flux.
However, the readme could be more clear how we can set axes values for rendering
I think the API could take inspiration from fontkit as explained here "Getting outlines of variable font?
It is not clear if we need an abstraction for the axis values
Does this mean, we need to translate axis values to a range between 0-1 like so
Where 0 would translate to the min value in case of Open Sans '300'?
The text was updated successfully, but these errors were encountered: