fontsource / search-directory

A search directory website for the Fontsource monorepo.
https://fontsource.org
MIT License
3 stars 1 forks source link

Preview first subset of font #35

Closed rossjrw closed 3 years ago

rossjrw commented 3 years ago

Currently, the only font subset that can appear in a preview on the site is latin:

https://github.com/fontsource/search-directory/blob/84b75e8682fa43fedacd12e2302fac7a3b7bc14c/src/js/components/MainView/index.js#L36-L41

This works fine for most fonts, but not all. Cascadia Code, for example, has subsets latin-ext and pl-latin-ext. It doesn't have the latin subset, so there's no preview. No preview makes this tool pretty pointless.

This PR changes that to preview the first subset provided by the font (data.subsets[0]). Now there's always a preview.

It seems like latin is always listed first for each font, so if latin is available, that's the preview. If that's not always the case, frankly, I don't care - any preview is better than none.

rossjrw commented 3 years ago

Nice to see a much more comprehensive fix than my slapdash hack. Thank you!