How can I have both a `Monospace` and `SansSerif` ...
# compose-desktop
c
How can I have both a
Monospace
and
SansSerif
font family set at the same time?
c
As in, the two different font families used for different portions of the same
Text()
composable? You can use
AnnotatedString
with the builder DSL, or Thistle markup to abstract away that relatively-verbose API.
c
Not exactly, I want a font that is both Sans Serif and Monospace
I’m rewriting a tool for authoring git commits and the diff viewer I’m writing needs to be in Monospace, but also needs to not have serifs so it is easier on the eyes
c
That really doesn't make sense, as far as Font Families go. You can't just compose two fonts into one, fonts are much more complicated than that. You probably want to just find and use a custom font, Google Fonts is great resource for finding free fonts
c
Thanks Casey 🙂
This will be my plan for tonight
👍 1
c
Yes, I’d advise using monospace fonts for the code, and then sans-serif for the UI font. They can co-exist in a UI, but will be really jarring if used in the same string token (alternating character fonts).
c
See my image Chris, I want a monospaced font without serifs in my diff viewer, not alternating font styles
👍 1
c
Gotcha. I would maybe start here to find a monospace, sans serif font: https://www.programmingfonts.org/ Then once you find one you like, see if the font files are available for use, e.g. on Google Fonts.
Though browsing through that site, it’s hard to find a monospace font that is devoid of any serifs 🤷