Skip to content

Conversation

@scottrippey
Copy link
Contributor

@scottrippey scottrippey commented Mar 7, 2019

What

  • As a follow-up to Added defaultLanguage to font objects #194, this PR enables a global fontkit.setDefaultLanguage(lang) method.
  • Fonts will use the global language property, unless you explicitly override it via font.setDefaultLanguage(lang)
  • If a font property isn't available in the given language, it will attempt to find a backup language to use. For example, it will look for defaultLanguage, then "en", then just whatever is first.
  • Additionally, unit tests were added for fontkit.setDefaultLanguage as well as font.setDefaultLanguage

@scottrippey
Copy link
Contributor Author

FYI, I analyzed all the included fonts, and Amiri was the only font that included an alternate language ("ar" Arabic). Very glad to find this font to test with!

@scottrippey
Copy link
Contributor Author

@devongovett I matured this defaultLanguage approach a lot, and added unit tests! What do you think?

@devongovett devongovett merged commit abbe9c2 into foliojs:master Mar 11, 2019
@scottrippey scottrippey deleted the global-default-language branch March 11, 2019 18:07
@scottrippey
Copy link
Contributor Author

Thanks @devongovett !
What's the next step to get this published?

@devongovett
Copy link
Member

It is already published in v1.8.0! 😉

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

Successfully merging this pull request may close these issues.

2 participants