darktile icon indicating copy to clipboard operation
darktile copied to clipboard

Support for multiple fonts and fallbacks

Open pinpox opened this issue 3 years ago • 2 comments

It would be nice to be able to specify different fonts for normal, italic, bold and bold-italic aswell as fallback fonts.

In my current terminal e.g. I use a more "curly" font for italics: image

Additionally, it would be great to be able to specify fallbacks. I use a non-patched font as default and have specified fallbacks for powerline symbols and for emojis

image

A configuration format like this or similar could work

font:
  ligatures: true  # Enable font ligatures e.g. render '≡' instead of '==='
  normal:
    - family: "my normal font"       # Font family. Find possible values for this by running 'darktile list-fonts'
      size: 16         # Font size
      dpi: 72          # DPI
    - family: "my normal fallback 1"       # Font family. Find possible values for this by running 'darktile list-fonts'
      size: 16         # Font size
      dpi: 72          # DPI
    - family: "my normal fallback 2"       # Font family. Find possible values for this by running 'darktile list-fonts'
      size: 16         # Font size
      dpi: 72          # DPI
  italic:
    - family: "my italic font"       # Font family. Find possible values for this by running 'darktile list-fonts'
      size: 16         # Font size
      dpi: 72          # DPI
    - family: "my italic fallback 1"       # Font family. Find possible values for this by running 'darktile list-fonts'
      size: 16         # Font size
      dpi: 72          # DPI
    - family: "my italic fallback 2"       # Font family. Find possible values for this by running 'darktile list-fonts'
      size: 16         # Font size
      dpi: 72          # DPI
  bold:
    # ...
  bold-italic:
    # ...

pinpox avatar Aug 03 '21 09:08 pinpox

I would be thrilled if this would be possible. FWIW I find the most reasonable way to implement multiple fonts is to use CSS Unicode Character Ranges so users can map specific code points to specific fonts. This feature is what made me use Kitty terminal.

loveencounterflow avatar Aug 30 '21 14:08 loveencounterflow

I don't know exactly how it's implemented, but wezterm allows for multiple fonts with a configuration like this:

	font = wezterm.font_with_fallback( {
		{family="Recursive Mono Linear Static", weight="Medium"},
		"Inconsolata Nerd Font Mono",
		"Noto Color Emoji",
	}),

You don't need to define specific ranges, it just takes the first font that happens to include the character. Just adding this as a thought, character ranges would probably more precise, but require a more complicated configuration.

pinpox avatar Aug 30 '21 18:08 pinpox