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
VarComposites #2958
VarComposites #2958
Conversation
You should probably run black. |
Thanks. Will do every few commits. |
@justvanrossum I have a question for you: Currently I'm setting all transformation components on VarComponent, and flags controls which ones are compiled. This is a bit uneasy to work with since if client modifies the transformation components they also need to modify the flags. We cannot just compile transformation components smartly since they should all match across masters when compiling a variable font... An alternative would be to NOT set attribute for those components that should not be compiled into the font. That would be inconvenient to use when working with the component though. Can you advise which one you prefer? |
Sounds good.
Ideally, the flags would be computed autimatically based on the transformation data.
Couldn't a VF compiler take that into account and adjust accordingly? |
It can. A bit more work but doable indeed. Which then means, the glyf compiler should calculate flags based on presence of attributes only, and cannot drop components that have default value. |
@justvanrossum This branch now has compile/decompile/toXML/fromXML. It's a bit crude as axisIndices are retained as integers not tags. To convert to tags I need to pass fvar down to glyf compile/decompile, which is a bit inconvenient. |
I don't follow. Ideally (I think), all fields would be present as attributes, but only those that don't have the default value get compiled into the binary. |
The problem is that the same flag controls whether variations for the transform components is encoded. So there are cases that eg. a translateX of 0 should be encoded, because it has variations. So the glyf-table compiler cannot just discard translateX of 0 automatically. |
Ah yes, now I get it. The variations in gvar have to match up. |
Currently |
Oh. If .flags is missing we can calculate it! |
Maybe |
I'll try that. The cff table does it just fine. |
Or I can just save the axisTags. That's all I need. |
Ah yes. As long as they're refreshed on each compile/decompile call, that should be fine. |
All done. |
This comment was marked as outdated.
This comment was marked as outdated.
I still have to handle the following flag:
It gets messy. |
I bet :( Feel free to simplify this in the spec — we can be pragmatic about this. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
I made the compiler handle this flag automatically. |
e73d134
to
19a6552
Compare
This is now works in:
|
This comment was marked as outdated.
This comment was marked as outdated.
And add tests. See thread starting at: #2958 (comment)
Err. Actually fixing. |
And add tests. See thread starting at: #2958 (comment)
And add tests. See thread starting at: #2958 (comment)
I see you added some generic xml-roundtripping tests for varComponents in the unit tests for scaleUpem module.. that's not ideal, althoughj some tests is always better than no tests. The glyf table module has unit test module of its own, in Tests/ttLib/tables/glyf_test.py, that's where I'd expect to find things like those. |
Ah thanks. I was wrongly looking for ttx tests and not finding them. Will move there. |
This seems to be in good shape again. |
Looks good to me i general, and the I do worry that we don't have a solution for |
We can do that in a followup PR. Sad thing is we don't have the font around; I suppose we can add a glyf.font link. |
@anthrotype @justvanrossum Can we move towards merging this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
a follow up PR can deal with recalcBounds for varComposites
let's also file an issue tracking implementation of recalcBouds for varComposites |
|
I've started implementing these. decompile() seems to work so far.