-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add Local Font Access API demo #320
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 Local Font Access API demo #320
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot! It's looking good, just a few nits and a suggestion
selectElem.selectedIndex = 0; | ||
|
||
selectElem.addEventListener("change", applyFont); | ||
applyFont(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first font from the list is getting automatically applied as soon as the local fonts are fetched.
Would it possible to add the first option as a placeholder, something like "--Choose a font--"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a bad suggestion, but I don't think this is necessary.
Co-authored-by: Dipika Bhattacharya <dipika@foss-community.org>
Co-authored-by: Dipika Bhattacharya <dipika@foss-community.org>
Co-authored-by: Dipika Bhattacharya <dipika@foss-community.org>
Co-authored-by: Dipika Bhattacharya <dipika@foss-community.org>
The MDN Local Font Access API documentation has several pages that link to this demo hosted on Glitch.
Because Glitch is going away, and the linked demo above doesn't work, I've decided to create my own simple version of it, which is added in this PR.
Note that the Local Font Access API requires HTTPS. It won't work if you test it on localhost. Ironically, I ended up testing it in Glitch, as it is still around for a few more days: https://cat-judicious-hose.glitch.me/ ;-)