-
Notifications
You must be signed in to change notification settings - Fork 45
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
Text line-height, character and paragraph #24
Comments
So it looks like you can't set it in the constructor... yet. But we should definitely add that in. Here is where the constructor is populating those fields: https://github.com/amzn/sketch-constructor/blob/master/models/TextStyle/TextStyle.js#L49 Just something we haven't implemented yet. In the meantime you can always construct the TextStyle class and then directly set those attributes: const textStyle = new TextStyle({ /* args */ });
textStyle.encodedAttributes.paragraphStyle.maximumLineHeight = 40; That is obviously gross and not how I envisioned people using this library. If you are keen to, you can open up a PR and we can get that in. If not, I can probably put it together sometime next week. What I would expect is the constructor to take those attributes and set them like this: const textStyle = new TextStyle({
maxiumLineHeight: 40,
minimumLineHeight: 40,
paragraphSpacing: 100
}); |
@dbanksdesign thanks for the detailed instructions 👏, will try |
@dbanksdesign tried to follow your suggestion, but with no success so far...
const textStyle = new TextStyle({ /* args */ });
textStyle.encodedAttributes.paragraphStyle.maximumLineHeight = 40; and inspect the I was wondering if Thanks for help! |
ahh good to know about the attributedString thing. We kind of do something similar in the Text component where we just apply the styles to both the TextStyle and attributed string: But we don't add the paragraphStyle in there... so we gotta do that. Glad someone is finding these issues... |
First of all, thank you! This library is awesome 👍
I was wondering if it's possible to use props for text paragraph styles?
In the json output (from
sketch-json
) it looks like this:Thanks
The text was updated successfully, but these errors were encountered: