News for hackers. Stuff that matters.
Re:Monaspace by helix278 on Thursday November 09, 2023 @03:53PM (#38211121)
How would you configure a text editor or terminal to use different fonts based on syntax (e.g. neon for code, argon for comments)?
Re:Monaspace by idan on Thursday November 09, 2023 @04:24PM (#38211565)
Hi! I worked on this at Next.

Unfortunately, it's on the editor to support mixing fonts. There's never been multiple compatible monospaced fonts before so no editors really support this yet. Lots of editors also don't support variable typefaces properly yet (ahem, VS Code) but this is going to change.

Ultimately what you're describing is the future! But we have to release the typefaces to bootstrap that future.

We made a prototype extension that hack it into VS Code. But they're hacky af and not really releasable.

Re:Monaspace by ctenb on Thursday November 09, 2023 @04:51PM (#38211857)
I wonder if terminal escape code sequences would arise to support this too!
Re:Monaspace by afc on Thursday November 09, 2023 @06:03PM (#38212652)
Do you know of any Linux terminal (eg. xterm, gnome-terminal, etc.) that would support multiple fonts? I'm intrigued, shouldn't be very hard to add support to command-line programs (once terminals supported it).
Re:Monaspace by naikrovek on Thursday November 09, 2023 @08:41PM (#38214024)
Wezterm does. expansive configuration and scripting abilities are available.
Re:Monaspace by aidenn0 on Friday November 10, 2023 @01:42AM (#38215837)
> so no editors really support this yet

Emacs and Vim have both supported this since at least last century.

Re:Monaspace by tmtvl on Friday November 10, 2023 @08:37AM (#38218610)
To expand on this, Emacs uses a system called "faces" to draw different textual elements, for example font-lock-comment-face to draw comments. Faces can have different attributes, like font family, foreground colour, background colour, having a box around it,...

So if I want to use a variable pitch font (like say... DejaVu Sans) to draw comments, I can set the font-lock-comment-face to use the "DejaVu Sans" family.

Re:Monaspace by leipert on Thursday November 09, 2023 @04:22PM (#38211536)
In vscode probably easy because it is all CSS?

Other editors/terminal emulators would probably need to add support for this.

Re:Monaspace by layer8 on Thursday November 09, 2023 @06:57PM (#38213091)
Some IDEs support configuring the font per syntactic category, i.e. with the same granularity as syntax highlighting colors.
Re:Monaspace by HellsMaddy on Thursday November 09, 2023 @10:48PM (#38214835)
I've configured Neovim's syntax highlighting to make comments bold italic, and then I've configured my terminal (Kitty) to display a different font for bold italic text.

Using this approach, you can use up to 4 different fonts: One for normal text, one for italic, one for bold, and one for bold italic. And the font for each group doesn't necessarily need to be that style, e.g. you can use a non-bold version for the `bold` font, etc.

Re:Monaspace by bool3max on Friday November 10, 2023 @05:03AM (#38217031)
Feels very hacky.
Re:Monaspace by HellsMaddy on Friday November 10, 2023 @09:54PM (#38227225)
The terminal is by nature very hacky.
Re:Monaspace by overbytecode on Friday November 10, 2023 @07:19AM (#38217970)
I use kitty and neovim too, would you mind sharing how you got this to work?
Re:Monaspace by HellsMaddy on Saturday November 11, 2023 @01:28AM (#38228056)
In Neovim, make sure your desired highlight groups have `gui=bold,italic`, e.g.

    hi Comment guifg=#7e7490 gui=bold,italic
In Kitty, set the desired fonts:

    font_family      IosevkaTerm Nerd Font Mono
    italic_font      IosevkaTerm Nerd Font Mono
    bold_font        IosevkaTerm Nerd Font Mono
    bold_italic_font Iosevka Term Slab