.ttf are missing .Name and .Family
It's any .TTF fonts on my system -- I don't think I have a single TTF in the .List() that works.
I'd like to use the Name and Family for a little font-inspector with a web frontend.
I'd like to use the .Match(name) func to autocomplete the font-family CSS attribute to take the frustration out of trying to nail the whitespace and little variations one has to do to get the web-compatible names of fonts.
Any ideas?
Might've found some solution for now:
https://stackoverflow.com/questions/70892173/how-can-i-get-the-font-family-name-from-a-ttf-file-in-golang
So I'll .List() all the fonts to get the paths,
parse those without a .Name by .Filename with the truetype package,
and modify the .Name and .Family accordingly.
Update:
This works fine, but not always -- I have some hackily-made TTFs I downloaded online that, I guess, don't even have proper metadata.
Also, the fontnames can still be off with their whitespace -- the truetype font family is not always the same as the CSS wants -- but it's all about missing spaces (InputSerifMono -> Input Serif Mono, always when it's some [serif|mono] variant-word involved).
Now, my guess when I get pointers to Font from .List() is that I can modify the data under the pointer, it'll get changed for the sysfont lib and the .Match() will now take the parsed TTF name and family into account...
Update:
That doesn't do it -- I have no way to "enhance" the internal "registry" that takes care of the matching with adjusted data. Gotta do my own fuzzy-search, but wanted to do that on the frontend if I could anyway -- I don't like the sysfont API of always returning "closest" font without any signaling that it's not exact anyway -- ideally it would be a short list sorted by score.