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.
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
andpl-latin-ext
. It doesn't have thelatin
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 iflatin
is available, that's the preview. If that's not always the case, frankly, I don't care - any preview is better than none.