Fix an error that prevents any text layers from being imported #105
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Steps to Reproduce
Expected Results
The generated .sketch file contains all text layers from the original Figma document.
Actual Results
Solution
The culprit is emoji detection logic when text layer attributes are prepared: instead of a special fill style override for emojis there's now a glyph-level "emojiCodePoints" field that we should use to detect them.
Testing
I've updated
tests/data/structure.fig
to the latest Figma file format version so runningwill now trigger the error.
Note
There're other test cases in
test_structure.py
that fail for a different reason – see #104Now, I'm not 100% happy with this PR:
Do we need to be backwards-compatible with the previous versions of .fig file format? I've left the old code branch intact but the more I think about it the less I'm inclined to keep it around. So what's fig2sketch's official stance on maintaining backward compatibility?
What does the process of updating .fig files used in tests look like? I've imported
tests/data/structure.fig
to Figma and immediately downloaded it back – is this enough? I guess the same trick will work fortests/data/vector.fig
buttests/data/broken_images.fig
seemingly requires an additional step to corrupt one of the bundled images – and I couldn't find a script that does it anywhere in the repo.