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

Add a Google Font picker #21

Open
passiomatic opened this issue Feb 5, 2021 · 0 comments
Open

Add a Google Font picker #21

passiomatic opened this issue Feb 5, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@passiomatic
Copy link
Owner

passiomatic commented Feb 5, 2021

Instead of hand picking nice fonts from Google service we could embed in Elm Designer information for all available typefaces (see attachment) and let users to pick all the fonts they need. Picked fonts will then appear in the inspector font family drop down.

UI changes

To pick more fonts we could have a "Settings" modal which includes a "Fonts" section.

Initially the modal can preset a list of top 20 used/most popular (we have some data about that in the JSON file). The user can expand one of these fonts and see its specimen, filter by category (Top 20, Sans Serif, Serif, Display, Scripts, etc.) or search for a font name. By clicking on a "Add font" button user adds the font to those available in the workspace.

Referencing document fonts

Each font is referenced by name in the serialized document (see Codecs.fontFamilyCodec) so it is easy to lookup a font (see Fonts.findFamily).

Note: the issue that can arise is that a user install a font using the picker, save a document with that font, uninstall it and later then reopen the document. This trigger a "missing font" scenario that we'll handle in a separate way.

Building the final font URL

Using the font JSON information we can easily build the final font URL and requests actual font files from Google, like we do today.

Refreshing the data

Periodically (at each release?) we can easily refresh the font list using the Google Webfont Helper public API: https://gwfh.mranftl.com/fonts

curl https://gwfh.mranftl.com/api/font > google-fonts.json

Google Fonts dump:
google-fonts.json.zip

@passiomatic passiomatic added the enhancement New feature or request label Feb 5, 2021
@passiomatic passiomatic self-assigned this Aug 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant