Skip to content
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

Some of the exported styles is not showing the correct font #51

Open
mathande opened this issue May 4, 2018 · 2 comments
Open

Some of the exported styles is not showing the correct font #51

mathande opened this issue May 4, 2018 · 2 comments

Comments

@mathande
Copy link

mathande commented May 4, 2018

I'm having trouble importing styles with the font "open sans" from an exported json. All of the styles is in "open sans" from the beginning, but when I try to import them into a new sketch file some of the styles are now showing the font "helvetica". Some of the styles are showing correct fonts though(open sans). Any idea what is wrong?

Regards,
Mathias

@nilssonH
Copy link
Collaborator

This sounds more like a Sketch bug to me, can't really reproduce it either 😕

@DanMad
Copy link

DanMad commented May 23, 2018

I was facing the same issue. I believe I have identified and solved the problem, finally.

Sketch doesn't seem to like the following values for the font key in the JSON export:

  • "OpenSans-Bold"
  • "OpenSans-Light"
  • "OpenSans-Italic"
  • "Inconsolata-Bold"

From what I can tell, Sketch was adding different fonts (and weights) intermittently as it wasn't able to read the aforementioned values. I was importing my list of text styles and they would all come in as "Helvetica", Regular.

I tweaked the values to reflect Mac OS's Font Book application's naming convention. I did a global find and replace in the JSON file:

  • "OpenSans" --> "Open Sans"
  • "OpenSans-Bold" --> "Open Sans Bold"
  • "OpenSans-Light" --> "Open Sans Light"
  • "OpenSans-Italic" --> "Open Sans Italic"
  • "Inconsolata-Bold" --> "Inconsolata Bold"

This solves the problem. It seems it is a matter of formatting the font value a little differently (no hyphens, appropriate use of spaces) in the JSON export @nilshoenson.

Interestingly, when doing some isolation testing with a colleague, it came to light that "Helvetica" is assigned to text styles that are using fonts that other people's systems do not already have installed, rather than Sketch's default behaviour where the text style essentially locked and provides the user with a warning.

I hope this helps, @mathande and anyone else who is facing this issue.

It's my second day using Text Styles. Such a great plugin!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants