Fonts

Long time ago I've planned to give a chance to fonts with ligatures. I looked at Fira Code and Pragmata Pro. Some time later I've found the best font ever - iosevka. It's open source and can be customized.

Building iosevka

You need to install some build-time dependencies. All of them can be removed after the building.

  • nodejs
  • otfcc from layman:4nykey

Tune some parameters (I prefer more vertically compacted version):

diff --git a/parameters.toml b/parameters.toml
index 1e26721..f3db81a 100644
--- a/parameters.toml
+++ b/parameters.toml
@@ -8,10 +8,10 @@ manufacturer = 'Belleve Invis'
 designer = 'Belleve Invis'
 description = 'Spatial efficient monospace font family for programming. Built from code. http://be5invis.github.io/Iosevka'

-leading = 1250     # Default line height times 1000.
+leading = 1050     # Default line height times 1000.
 descenderPad = 0   # Additional line height, added to descender.
 width = 500        # Character width. Increase this if you think that Iosevka is too narrow.
-cap = 735          # Cap height (as well as ascender).
+cap = 705          # Cap height (as well as ascender).
 xheight = 530      # X-height.
 #descender = -205  # Depth of descender. Currently unused.

Make your custom set and build:

make custom-config set=hoxnox design='type ss03 cv33' upright='type ss03 cv33' italic='type ss03 cv33' oblique='type ss03 cv33'
make custom set=hoxnox

Install fonts and update the cache

cp dist/iosevka-hoxnox/* ~/.fonts/
fc-cache -f

Check:

~  fc-list | grep Iosevka
/home/hoxnox/.fonts/iosevka-hoxnox-extralightoblique.ttf: Iosevka Type Type,Iosevka Type Type Extralight Oblique:style=Extralight Oblique,Regular
/home/hoxnox/.fonts/iosevka-hoxnox-bolditalic.ttf: Iosevka Type Type:style=Bold Italic
/home/hoxnox/.fonts/iosevka-hoxnox-heavyoblique.ttf: Iosevka Type Type,Iosevka Type Type Heavy Oblique:style=Heavy Oblique,Regular
/home/hoxnox/.fonts/iosevka-hoxnox-thinoblique.ttf: Iosevka Type Type,Iosevka Type Type Thin Oblique:style=Thin Oblique,Regular
/home/hoxnox/.fonts/iosevka-hoxnox-thin.ttf: Iosevka Type Type,Iosevka Type Type Thin:style=Thin,Regular
/home/hoxnox/.fonts/iosevka-hoxnox-italic.ttf: Iosevka Type Type:style=Italic
/home/hoxnox/.fonts/iosevka-hoxnox-heavy.ttf: Iosevka Type Type,Iosevka Type Type Heavy:style=Heavy,Regular
/home/hoxnox/.fonts/iosevka-hoxnox-lightitalic.ttf: Iosevka Type Type,Iosevka Type Type Light:style=Light Italic,Italic
/home/hoxnox/.fonts/iosevka-hoxnox-extralightitalic.ttf: Iosevka Type Type,Iosevka Type Type Extralight:style=Extralight Italic,Italic
/home/hoxnox/.fonts/iosevka-hoxnox-heavyitalic.ttf: Iosevka Type Type,Iosevka Type Type Heavy:style=Heavy Italic,Italic
/home/hoxnox/.fonts/iosevka-hoxnox-regular.ttf: Iosevka Type Type:style=Regular
/home/hoxnox/.fonts/iosevka-hoxnox-medium.ttf: Iosevka Type Type,Iosevka Type Type Medium:style=Medium,Regular
/home/hoxnox/.fonts/iosevka-hoxnox-boldoblique.ttf: Iosevka Type Type,Iosevka Type Type Bold Oblique:style=Bold Oblique,Regular
/home/hoxnox/.fonts/iosevka-hoxnox-thinitalic.ttf: Iosevka Type Type,Iosevka Type Type Thin:style=Thin Italic,Italic
/home/hoxnox/.fonts/iosevka-hoxnox-extralight.ttf: Iosevka Type Type,Iosevka Type Type Extralight:style=Extralight,Regular
/home/hoxnox/.fonts/iosevka-hoxnox-mediumoblique.ttf: Iosevka Type Type,Iosevka Type Type Medium Oblique:style=Medium Oblique,Regular
/home/hoxnox/.fonts/iosevka-hoxnox-bold.ttf: Iosevka Type Type:style=Bold
/home/hoxnox/.fonts/iosevka-hoxnox-mediumitalic.ttf: Iosevka Type Type,Iosevka Type Type Medium:style=Medium Italic,Italic
/home/hoxnox/.fonts/iosevka-hoxnox-lightoblique.ttf: Iosevka Type Type,Iosevka Type Type Light Oblique:style=Light Oblique,Regular
/home/hoxnox/.fonts/iosevka-hoxnox-oblique.ttf: Iosevka Type Type,Iosevka Type Type Oblique:style=Oblique,Regular
/home/hoxnox/.fonts/iosevka-hoxnox-light.ttf: Iosevka Type Type,Iosevka Type Type Light:style=Light,Regular

It's essential to have the bold version of the font with the regular one. Terminal uses both of them. It will look ugly if the bold version is missing.

Now the font name can be used in terminal settings. It can be found after colon in fc-list output.

Unfortunately at that point I didn't see any ligatures. That's because not many terminals actually support it. I had to switch to qterminal. But it didn't help either! fabrizioschiavi decided to delete ligatures from "Mono" version of the font. By the coincidence qterminal doesn't allow to choose not monospace fonts. It wouldn't not be a problem if the parameter in the configuration file was human readable. It's not:

font=@Variant(\0\0\0@\0\0\0\"\0I\0o\0s\0\x65\0v\0k\0\x61\0 \0T\0y\0p\0\x65\0 \0T\0y\0p\0\x65@$\0\0\0\0\0\0\xff\xff\xff\xff\x2\x1\0\x32\x10)

I had to patch the sources (see below), choose the appropriate font in the patched version and use the font line from the configuration file (see above).

diff --git a/src/fontdialog.cpp b/src/fontdialog.cpp
index 30fc914..f6c3e5a 100644
--- a/src/fontdialog.cpp
+++ b/src/fontdialog.cpp
@@ -23,8 +23,7 @@ FontDialog::FontDialog(const QFont &f)
 {
     setupUi(this);

-    fontComboBox->setFontFilters(QFontComboBox::MonospacedFonts
-                                 | QFontComboBox::NonScalableFonts
+    fontComboBox->setFontFilters(QFontComboBox::NonScalableFonts
                                  | QFontComboBox::ScalableFonts);

     fontComboBox->setCurrentFont(f);
diff --git a/src/propertiesdialog.cpp b/src/propertiesdialog.cpp
index 82ad5b1..655bf86 100644
--- a/src/propertiesdialog.cpp
+++ b/src/propertiesdialog.cpp
@@ -219,8 +219,7 @@ void PropertiesDialog::changeFontButton_clicked()
     if (!dia.exec())
         return;
     QFont f = dia.getFont();
-    if (QFontInfo(f).fixedPitch())
-        setFontSample(f);
+    setFontSample(f);
 }

 void PropertiesDialog::chooseBackgroundImageButton_clicked()

But there was another problem. On my 4K 195dpi monitor I've got vertical font truncation. Finaly it was fixed too (see putch at the end of the tread).

Iosevka has powerline glyphs, so if you have powerline or airline installed, you'll see these fancy arrows.

Colors

After all the font was set, ligatures worked, but the colors were ugly. I've found good online visual editor. It helped to create a very nice color scheme. Good start point was theme from lusy3m's themes repository. You can import it into the editor as Terminal.app. After all you must export file in konsole format and save into ~/.config/qterminal.org/color-schemes with .colorsheme extension.

Now I'm satisfied for some time. =)

fancy linux screenshot

PS: The article about tuning FontConfig can be found at gentoo wiki.


Comments

comments powered by Disqus