Closed rickmcgeer closed 7 months ago
Nice idea, @rickmcgeer! I implemented this in the linked PR. This is basically just an alias that will internally set a font name. So checking for fontName === 'Mono' for example will not work in other places. Also, we currently support specifying exactly one fontFamily, so using for example, "Mono" as a fallback, as is often done, will not work in lively. The reason for this is that usually, this is done to handle the font availability on specific systems, which we do not need as we explicitly ship and bundle a selected set of fonts.
Describe the Feature This is related to https://github.com/LivelyKernel/lively.next/issues/1458. 'Sans Serif' is not a valid font family. But it's quite common for people to select classes of font as the font name, generally as the last choice (e.g., "Barlow, Arial, 'Sans Serif'") in order to ensure that they don't spend mornings like I did, chasing down bad font names.
Graphics We've all seen this, but here's a sample from GMail:
Implementation Details A simple solution is to have default fonts for each class ( Sans Serif, Serif, and Fixed Width -- perhaps others) , and in
sanitizeFont
(seeHave code that looks something like this:
Obviously that's too simplistic, and you'll want
genericFonts
to be pulled from a config, but that's the idea.