font-family recommendations

64 points by runxiyu


chrismorgan

As you may note, this is a draft, quite incomplete, got bits and pieces in two or three different shapes, bit of a mess. It’ll probably end up more than one page, in quite a different form, possibly at least partly hand-written/-drawn/-laid-out (it’s really liberating! try it!).

But for now I’ve been focusing on the implementation of my lightweight markup language instead; it’s just about usable now, probably even less than one last 90% left. Then I’ll get back to writing and publishing more.

isuffix

Ugly bit of browser history which doesn’t seem to be documented in any spec I can find, but everyone that old remembers.

If you use font-family: monospace; (explicitly or implicitly), font-size will probably default to 81.25% instead of 100%. (Users can change the generic fonts, the base font size, and the base monospace font size.)

If there’s a second family in the list, this doesn’t happen; so font-family: my-web-font, monospace; is fine, and font-family: monospace, monospace; is fine.

This is a really interesting tidbit. I can confirm that it isn't currently documented on MDN (unless my searching is bad). Does anyone have an explanation for why this happened and/or why isn't it documented?

runxiyu
  1. For https://lindenii.org I’ve taken the solution of simply not specifying a font-family at all, and respect whatever default font the user chose on their user agent. I prefer sans-serif. But if the user uses a serif default, I don’t see a good reason to override it.

  2. Unfortunately this kinda breaks down for https://runxiyu.org/soc/ta/ where I’m using characters that the vast majority of typefaces do not have. Hence, I included web fonts that have them:

    @font-face {
    	font-family: "PlangothicFallback";
    	src: url("/fonts/PlangothicP1-Regular.woff2") format("woff2");
    	font-weight: 400;
    	font-style: normal;
    	font-display: swap;
    }
    
    @font-face {
    	font-family: "PlangothicFallback";
    	src: url("/fonts/PlangothicP2-Regular.woff2") format("woff2");
    	font-weight: 400;
    	font-style: normal;
    	font-display: swap;
    }
    
    html {
    	font-family: sans-serif, "PlangothicFallback";
    }
    

    Which forces the rest of the text to sans-serif instead of the user’s default. I'm not sure if there’s a better way to do this, short of wrapping every unusual character in <unusual-character> or such.

  3. I wish there was a way to specify something like “the user’s preferred font for code”.

  4. Thanks a lot for the “monospace, monospace” trick! The sizing did confuse me quite a bit.