FreeBSD Desktop – Part 15 – Configuration – Fonts & Frameworks

The title of this article kinda sounds for me like Fast & Furious title … In this part of FreeBSD Desktop series we will focus on the fonts settings andΒ GTK/QT frameworks configuration to make applications based on them look good … or at least better.

You may want to check other articles in the FreeBSD Desktop series on the FreeBSD Desktop – Global Page where you will find links to all episodes of the series along with table of contents for each episode’s contents.

Fonts

Proper rendering of fonts in the system is not an easy task, even most popular desktop oriented operating systems like macOS (Mac OS X) and Windows have problems with it.

We will of course focus on FreeBSD fonts settings but most of that information will be reusable on other operating systems that use X11 Window System for the desktop.

To not duplicate the knowledge already available for this topic please read these two sources for handling fonts on the FreeBSD operating system.

System Settings

The font rendering on X11 Window System desktops is made by fontconfig package. The system wide configuration is kept under /usr/local/etc/fonts directory. You can even verify that it belongs to the fontconfig package with pkg-which(8) command.

% pkg which /usr/local/etc/fonts/fonts.conf.sample
/usr/local/etc/fonts/fonts.conf.sample was installed by package fontconfig-2.12.6,1

For the fonts settings there are two directories for that purpose.

  • /usr/local/etc/fonts/conf.avail
  • /usr/local/etc/fonts/conf.d

If you want to enable a feature then you create a symlink in the /usr/local/etc/fonts/conf.d directory that leads to a small config file in the /usr/local/etc/fonts/conf.avail directory.

Here are all available options.

% ls -1 /usr/local/etc/fonts/conf.avail
10-autohint.conf
10-hinting-full.conf
10-hinting-medium.conf
10-hinting-none.conf
10-hinting-slight.conf
10-no-sub-pixel.conf
10-scale-bitmap-fonts.conf
10-sub-pixel-bgr.conf
10-sub-pixel-rgb.conf
10-sub-pixel-vbgr.conf
10-sub-pixel-vrgb.conf
10-unhinted.conf
11-lcdfilter-default.conf
11-lcdfilter-legacy.conf
11-lcdfilter-light.conf
20-unhint-small-dejavu-sans-mono.conf
20-unhint-small-dejavu-sans.conf
20-unhint-small-dejavu-serif.conf
20-unhint-small-vera.conf
25-unhint-nonlatin.conf
30-metric-aliases.conf
31-cantarell.conf
40-nonlatin.conf
42-luxi-mono.conf
45-generic.conf
45-latin.conf
49-sansserif.conf
50-user.conf
51-local.conf
57-dejavu-sans-mono.conf
57-dejavu-sans.conf
57-dejavu-serif.conf
60-generic.conf
60-latin.conf
65-fonts-persian.conf
65-khmer.conf
65-nonlatin.conf
69-unifont.conf
70-no-bitmaps.conf
70-yes-bitmaps.conf
80-delicious.conf
90-synthetic.conf

… and here are options enabled on my system.

% ls -1 /usr/local/etc/fonts/conf.d
10-hinting-none.conf
10-hinting-slight.conf
10-scale-bitmap-fonts.conf
10-sub-pixel-rgb.conf
10-unhinted.conf
11-lcdfilter-default.conf
20-unhint-small-dejavu-sans-mono.conf
20-unhint-small-dejavu-sans.conf
20-unhint-small-dejavu-serif.conf
20-unhint-small-vera.conf
30-metric-aliases.conf
40-nonlatin.conf
42-luxi-mono.conf
45-generic.conf
45-latin.conf
49-sansserif.conf
50-user.conf
51-local.conf
57-dejavu-sans-mono.conf
57-dejavu-sans.conf
57-dejavu-serif.conf
60-generic.conf
60-latin.conf
65-fonts-persian.conf
65-nonlatin.conf
69-unifont.conf
80-delicious.conf
90-synthetic.conf
99pdftoopvp.conf
README

You may even check which of these files/features are enabled by which package.

% for FILE in /usr/local/etc/fonts/conf.d/*.conf; do pkg which ${FILE}; done
/usr/local/etc/fonts/conf.d/10-hinting-none.conf was not found in the database
/usr/local/etc/fonts/conf.d/10-hinting-slight.conf was installed by package fontconfig-2.12.6,1
/usr/local/etc/fonts/conf.d/10-scale-bitmap-fonts.conf was installed by package fontconfig-2.12.6,1
/usr/local/etc/fonts/conf.d/10-sub-pixel-rgb.conf was not found in the database
/usr/local/etc/fonts/conf.d/10-unhinted.conf was not found in the database
/usr/local/etc/fonts/conf.d/11-lcdfilter-default.conf was not found in the database
/usr/local/etc/fonts/conf.d/20-unhint-small-dejavu-sans-mono.conf was installed by package dejavu-2.37
/usr/local/etc/fonts/conf.d/20-unhint-small-dejavu-sans.conf was installed by package dejavu-2.37
/usr/local/etc/fonts/conf.d/20-unhint-small-dejavu-serif.conf was installed by package dejavu-2.37
/usr/local/etc/fonts/conf.d/20-unhint-small-vera.conf was installed by package fontconfig-2.12.6,1
/usr/local/etc/fonts/conf.d/30-metric-aliases.conf was installed by package fontconfig-2.12.6,1
/usr/local/etc/fonts/conf.d/40-nonlatin.conf was installed by package fontconfig-2.12.6,1
/usr/local/etc/fonts/conf.d/42-luxi-mono.conf was installed by package font-bh-ttf-1.0.3_3
/usr/local/etc/fonts/conf.d/45-generic.conf was installed by package fontconfig-2.12.6,1
/usr/local/etc/fonts/conf.d/45-latin.conf was installed by package fontconfig-2.12.6,1
/usr/local/etc/fonts/conf.d/49-sansserif.conf was installed by package fontconfig-2.12.6,1
/usr/local/etc/fonts/conf.d/50-user.conf was installed by package fontconfig-2.12.6,1
/usr/local/etc/fonts/conf.d/51-local.conf was installed by package fontconfig-2.12.6,1
/usr/local/etc/fonts/conf.d/57-dejavu-sans-mono.conf was installed by package dejavu-2.37
/usr/local/etc/fonts/conf.d/57-dejavu-sans.conf was installed by package dejavu-2.37
/usr/local/etc/fonts/conf.d/57-dejavu-serif.conf was installed by package dejavu-2.37
/usr/local/etc/fonts/conf.d/60-generic.conf was installed by package fontconfig-2.12.6,1
/usr/local/etc/fonts/conf.d/60-latin.conf was installed by package fontconfig-2.12.6,1
/usr/local/etc/fonts/conf.d/65-fonts-persian.conf was installed by package fontconfig-2.12.6,1
/usr/local/etc/fonts/conf.d/65-nonlatin.conf was installed by package fontconfig-2.12.6,1
/usr/local/etc/fonts/conf.d/69-unifont.conf was installed by package fontconfig-2.12.6,1
/usr/local/etc/fonts/conf.d/80-delicious.conf was installed by package fontconfig-2.12.6,1
/usr/local/etc/fonts/conf.d/90-synthetic.conf was installed by package fontconfig-2.12.6,1
/usr/local/etc/fonts/conf.d/99pdftoopvp.conf was installed by package cups-filters-1.16.0_5

Most of the settings are of course make by the fontconfig package. As you see the 4 files are not installed by any package, they were symlinked/configured by me.

These settings seems to make fonts look best, I will ‘repeat’ these settings in various other files that we will use.

/usr/local/etc/fonts/conf.d/10-hinting-none.conf was not found in the database
/usr/local/etc/fonts/conf.d/10-sub-pixel-rgb.conf was not found in the database
/usr/local/etc/fonts/conf.d/10-unhinted.conf was not found in the database
/usr/local/etc/fonts/conf.d/11-lcdfilter-default.conf was not found in the database

If you would like to make system wide settings then do not use the provided /usr/local/etc/fonts/fonts.conf file. Use the /usr/local/etc/fonts/local.conf instead because /usr/local/etc/fonts/fonts.conf file will be replaced with next fontconfig package update.

User Settings

I keep most of the settings/fonts in the user home dir like ~/.config and ~/.fonts directories. Its easier for me to move/backup/import these then to edit or merge the system files everytime.

The fonts are kept in the ~/.fonts directory. I will of course share the fonts of this directory, here is the list of the fonts that are available for download as fonts.tar.gz file.

  • Arvo
  • Calibri
  • Cambria
  • Cantarell
  • Clear Sans
  • Consolas
  • Constantia
  • Corbel
  • Cormorant
  • Cosmic Sans Neue Mono
  • Courier Prime Code
  • Courier Prime Sans
  • Fira Code
  • Fira Mono
  • Fira Sans
  • Francophil Sans
  • Garamond
  • Georgia
  • IBM Plex Mono
  • IBM Plex Sans
  • Inconsolata
  • Monofur
  • Monoid
  • Pro Font Windows
  • Proggy Tiny Zero
  • PT Sans
  • SV Basic Manual
  • Trebuchet MS
  • Ubuntu
  • Ubuntu Mono

I would say that Consolas, Ubuntu Mono and Inconsolata are one of the best monospaced fonts while Trebuchet MS is probably the best looking (and properly rendered) font for non-monospaced/sans serif font category. I also really like Fira, IBM Plex and also Ubuntu family. The new Cantarell font is also pretty nice.

Lots of these fonts can be installed using installing FreeBSD Ports under /usr/ports/x11-fonts category and by pkg(8) packages, but its simpler for me to keep (and move) them in the ~/.fonts directory then to install packages everytime I need them. I also only keep the ones that I need/use while port/package often provides while set of them. For long time the user configuration for fonts was kept under ~/.fonts.conf file but it is no more. The new place is the ~/.config/fontconfig/fonts.conf file.

Mine config is not that long but check its contents for yourself.

While WordPress is quite a nice platform it has it problems – it will not render properly content in HTML or XML. To not introduce eventual problems related to that I will post a screenshot of the config below along with link to the ~/.config/fontconfig/fonts.conf file.

fonts.conf.jpg

These settings were forged for more then 15 years of my time first using Slackware and Gentoo Linux and since about 2005 – FreeBSD. As You can see from the comments I swap several bad looking fonts for good looking ones.

For example if You do not like the Arial font you may want to swap it into the Trebuchet MS font with this snippet added to the ~/.config/fontconfig/fonts.conf file.

Similarly with another XML snippet – I will post a screenshot of the config below along with link to the example file.

fonts.conf.swap.jpg

To make the test we will use this simple fonts-swap-test.html HTML file.

Here is how it looks in Epiphany after the change in the ~/.config/fontconfig/fonts.conf file.

epiphany-swap-example

The Arial font has been swapped into Trebuchet MS one. For sure Epiphany, Firefox and Midori do respect this swap, I did not tried other browsers.

Remember to reload the fontconfig cache after changes to the ~/.config/fontconfig/fonts.conf file, you may do that using already posted fc-cache.sh script.

Frameworks

Some also call them toolkits. Things like GTK or QT are in this category.

GTK

My favorite framework and least PITA one at the same time for good looking desktop was GTK2. GTK1 was always ugly, fast and light, but ugly. I think we can agree on that. GTK2 from the times when GNOME 2 was considered ‘heavy’ desktop environment. Now GTK2 is mostly deprecated (some applications still use it and they still work good) in favor of GTK3 and GNOME 2 is dead. Fortunately it has been forked into project named MATE and MATE seems light now, what an irony. Fortunately because old GNOME 2 file manager – Nautilus – seems to be one of the best file managers for the UNIX systems, sure not the lightest/fastest one, but a one that suits lots/most of the needs. Under the MATE team the Nautilus has been rebranded into Caja. Caja accompanied by Thunar from the Xfce desktop environment with its mass rename tool seems to be the most universal solution for graphical file management on UNIX. They also look similar/coherent as they both use GTK3 toolkit now (before they both used GTK2 framework).

GNOME 3 and its apps use GTK3 exclusively. You may also check Cinnamon which is GNOME 3 fork with an idea to provide GNOME 2 classic experience based on modern tools and modern GTK3 framework. The MATE desktop also moved to the GTK3 so we now have two GNOME 2 successors based on GTK3. The GTK3 is not a problematic framework, but some of its applications are, probably most of the ones written on/for the GNOME 3 environment. They come with their own built-in window buttons/handlers overwriting/ignoring the ones provided by window managers. Not so long ago the default settings left you with additional border of 5 or so pixels for each side of the window if You do not use composition/shadows manager like compton, which wastes screen space. Below you will find example from just 2 months ago with this problem.

taskbar-full-desktop

Fortunately its gone now (the additional border) and Epiphany – as an example of such GNOME 3 app – works/displays properly and is shown below.

epiphany.png

Both GTK2 and GTK3 use/used these environment variables exported by export(1). I am not sure if they are still respected but I do not want to check all my apps to find out and keeping then in the ~/.xinitrc file does not hurt.

# GTK ANTIALIASING
  export GDK_USE_XFT=1

GTK2

The configuration for GTK2 framework is kept in the ~/.gtkrc-2.0 file.

Alternatively – when you use various graphical tools/managers for GTK2 settings like lxapperance you may want to use ~/.gtkrc-2.0.mine instead.

Here is mine ~/.gtkrc-2.0 file with its contents.

% cat ~/.gtkrc-2.0
  include "/home/vermaden/.gtkrc-2.0.mine"
  gtk-theme-name="Arc"
  gtk-icon-theme-name="faenza"
  gtk-font-name="Ubuntu 10"
  gtk-cursor-theme-size=0
  gtk-toolbar-style=GTK_TOOLBAR_ICONS
  gtk-toolbar-icon-size=GTK_ICON_SIZE_SMALL_TOOLBAR
  gtk-button-images=1
  gtk-menu-images=1
  gtk-enable-event-sounds=1
  gtk-xft-antialias=1
  gtk-xft-hinting=0
  gtk-xft-hintstyle="hintnone"
  gtk-xft-rgba="rgb"

The selected theme is Arc (use /usr/ports/x11-themes/gtk-arc-themes port/package) and the icon theme is Faenza (use /usr/ports/x11-themes/mate-icon-theme-faenza port/package). For the user the GTK themes are kept under the ~/.themes directory while icon sets are kept under the ~/.icons directory. I also set font to Ubuntu in the size of 10. Remember that it can also be set as ubuntu or UBUNTU. To check what font will be selected by what You type there use the fc-match(1) command from the fontconfig package.

% fc-match ubuntu
ubuntu.ttf: "Ubuntu" "Regular"

% fc-match UBUNTU
ubuntu.ttf: "Ubuntu" "Regular"

The last 4 settings – gtk-xft-* – are the ones related to fonts rendering, as I said earlier, these settings will be ‘repeated’ over various other files. Currently there is no single file to configure all fonts behavior unfortunately.

The GTK2 File Chooser keeps its configuration in the ~/.config/gtk-2.0/gtkfilechooser.ini file, its not needed to configure this file.

The GTK2 Bookmarks are stored in the ~/.gtk-bookmarks file.

Here are contents of mine.

% cat ~/.gtk-bookmarks
file:///home/vermaden/hydepark ~/hydepark
file:///home/vermaden/books ~/books
file:///home/vermaden/gfx ~/gfx
file:///home/vermaden/gfx/wallpapers ~/gfx/wallpapers
file:///home/vermaden/gfx/screenshots ~/gfx/screenshots
file:///home/vermaden/misc ~/misc
file:///home/vermaden/misc/aix ~/misc/aix
file:///home/vermaden/misc/bsd ~/misc/bsd
file:///home/vermaden/misc/hp-ux ~/misc/hp-ux
file:///home/vermaden/misc/linux ~/misc/linux
file:///home/vermaden/misc/solaris ~/misc/solaris
file:///home/vermaden/misc/hardware ~/misc/hardware
file:///home/vermaden/misc/emc ~/misc/emc
file:///home/vermaden/misc/tsm ~/misc/tsm
file:///home/vermaden/mp3 ~/mp3
file:///home/vermaden/photo.NEW ~/photo.NEW
file:///home/vermaden/vm ~/vm
file:///home/vermaden/vm/iso ~/vm/iso
file:///home/vermaden/vm/storage ~/vm/storage

GTK3

The GTK3 files are more ordered then GTK2 files. The main configuration is kept in the ~/.config/gtk-3.0/settings.ini file.

Here are my current GTK3 settings.

% cat ~/.config/gtk-3.0/settings.ini
[Settings]
  gtk-theme-name          = Arc
  gtk-icon-theme-name     = faenza
  gtk-font-name           = Ubuntu 10
  gtk-cursor-theme-size   = 0
  gtk-toolbar-style       = GTK_TOOLBAR_ICONS
  gtk-toolbar-icon-size   = GTK_ICON_SIZE_SMALL_TOOLBAR
  gtk-button-images       = 1
  gtk-menu-images         = 1
  gtk-enable-event-sounds = 1
  gtk-xft-antialias       = 1
  gtk-xft-hinting         = 0
  gtk-xft-hintstyle       = hintnone
  gtk-xft-rgba            = rgb

Besides little different syntax the settings are the same as in the GTK2 configuration, thus I will not comment them again to not repeat myself.

The GTK3 Bookmarks are kept in the ~/.config/gtk-3.0/bookmarks file and their syntax is the same as it were for the GTK2 toolkit.

% cat ~/.config/gtk-3.0/bookmarks
file:///home/vermaden/hydepark ~/hydepark
file:///home/vermaden/books ~/books
file:///home/vermaden/gfx ~/gfx
file:///home/vermaden/gfx/wallpapers ~/gfx/wallpapers
file:///home/vermaden/gfx/screenshots ~/gfx/screenshots
file:///home/vermaden/misc ~/misc
file:///home/vermaden/misc/aix ~/misc/aix
file:///home/vermaden/misc/bsd ~/misc/bsd
file:///home/vermaden/misc/hp-ux ~/misc/hp-ux
file:///home/vermaden/misc/linux ~/misc/linux
file:///home/vermaden/misc/solaris ~/misc/solaris
file:///home/vermaden/misc/hardware ~/misc/hardware
file:///home/vermaden/misc/emc ~/misc/emc
file:///home/vermaden/misc/tsm ~/misc/tsm
file:///home/vermaden/mp3 ~/mp3
file:///home/vermaden/photo.NEW ~/photo.NEW
file:///home/vermaden/vm ~/vm
file:///home/vermaden/vm/iso ~/vm/iso
file:///home/vermaden/vm/storage ~/vm/storage

As the GTK2 Bookmarks and GTK3 Bookmarks have the same format you may symlink one to another to not keep two lists of your favorite places.

As the GTK3 framework uses CSS you may tune the GTK3 to your needs in the ~/.config/gtk-3.0/gtk.css file according to the documentation provided by the GNOME team – GTK+ CSS Overview – available here.

I have tried various hacks in the past but after removing them my problems with GTK3 toolkit vanished. If you will find some interesting settings then let me know πŸ™‚

QT

The QT toolkit configuration was always a real PITA and this haven’t changed in the latest QT5 release. The default themes provided are ugly and the ones available to download are not that much better. The KDE Plasma 5 looks quite well but making QT4/QT5 look nice on a custom window manager environment is whole other story. With my settings I have minimized the ‘damage’ of the tragic QT look.

I also feel that GTK and its configuration is more UNIX oriented as you only need to edit the files while QT feels more Windows oriented as you often need the graphical config tool to set the options properly.

The QT3/QT4/QT5 use/used these environment variables exported by export(1). I am not sure if they are still respected but I do not want to check all my apps to find out and keeping then in the ~/.xinitrc file does not hurt.

# QT ANTIALIASING
  export QT_XFT=1

# QT MUST KNOW WHERE IS GTK2 CONFIG
  export GTK2_RC_FILES="${HOME}/.gtkrc-2.0"

# QT5 qt5ct
  export QT_QPA_PLATFORMTHEME=qt5ct

QT3

I am not sure if any ‘current’ application uses it, the legendary Opera 12.x used it for sure and configuration was made using the qtconfig graphical utility.

QT4

The QT4 configuration is kept in the ~/.config/Trolltech.conf file (very obvious indeed) and the graphical tool/editor is qt4-qtconfig installed from qt4-qtconfig port/package.

Here is how my current configuration looks like (yes its long and ugly).

% cat ~/.config/Trolltech.conf
[Qt%20Plugin%20Cache%204.8.false]
usr\local\lib\qt4\plugins\imageformats\libqgif.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-12-19T09:37:13
usr\local\lib\qt4\plugins\imageformats\libqico.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-12-19T09:37:13
usr\local\lib\qt4\plugins\imageformats\libqjpeg.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-12-19T09:37:13
usr\local\lib\qt4\plugins\imageformats\libqmng.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-12-19T09:37:13
usr\local\lib\qt4\plugins\imageformats\libqsvg.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-12-19T09:37:13
usr\local\lib\qt4\plugins\imageformats\libqtga.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-12-19T09:37:13
usr\local\lib\qt4\plugins\imageformats\libqtiff.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-12-19T09:37:13
usr\local\lib\qt4\plugins\iconengines\libqsvgicon.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2015-11-21T02:41:20
usr\local\lib\qt4\plugins\inputmethods\libqimsw-multi.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang no-pkg-config, 2015-11-21T02:41:27
usr\local\lib\kde4\plugins\imageformats\kimg_dds.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:10:23
usr\local\lib\kde4\plugins\imageformats\kimg_eps.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:10:23
usr\local\lib\kde4\plugins\imageformats\kimg_exr.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:10:23
usr\local\lib\kde4\plugins\imageformats\kimg_jp2.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:10:23
usr\local\lib\kde4\plugins\imageformats\kimg_pcx.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:10:23
usr\local\lib\kde4\plugins\imageformats\kimg_pic.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:10:23
usr\local\lib\kde4\plugins\imageformats\kimg_psd.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:10:23
usr\local\lib\kde4\plugins\imageformats\kimg_ras.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:10:23
usr\local\lib\kde4\plugins\imageformats\kimg_rgb.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:10:23
usr\local\lib\kde4\plugins\imageformats\kimg_tga.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:10:23
usr\local\lib\kde4\plugins\imageformats\kimg_xcf.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:10:23
usr\local\lib\kde4\plugins\imageformats\kimg_xview.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:10:23
usr\local\lib\kde4\okularpart.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:52:40
usr\local\lib\kde4\okularGenerator_epub.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:52:40
usr\local\lib\kde4\plugins\kscreen\KSC_XRandR.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:12:14
usr\local\lib\kde4\okularGenerator_mobi.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:52:40
usr\local\lib\kde4\okularGenerator_txt.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:52:40
usr\local\lib\kde4\okularGenerator_fb.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:52:40
usr\local\lib\kde4\okularGenerator_ghostview.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:52:40
usr\local\lib\kde4\okularGenerator_ooo.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:52:40
usr\local\lib\kde4\okularGenerator_poppler.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:52:40
usr\local\lib\qt4\plugins\styles\libkvantum.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2018-07-07T05:29:12
usr\local\lib\keepassx\libkeepassx-autotype-x11.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2018-08-09T05:30:15

[Qt%20Factory%20Cache%204.8]
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\qt4\plugins\imageformats\libqgif.so=2017-12-19T09:37:13, gif
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\qt4\plugins\imageformats\libqico.so=2017-12-19T09:37:13, ico
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\qt4\plugins\imageformats\libqjpeg.so=2017-12-19T09:37:13, jpeg, jpg
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\qt4\plugins\imageformats\libqmng.so=2017-12-19T09:37:13, mng
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\qt4\plugins\imageformats\libqsvg.so=2017-12-19T09:37:13, svg, svgz
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\qt4\plugins\imageformats\libqtga.so=2017-12-19T09:37:13, tga
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\qt4\plugins\imageformats\libqtiff.so=2017-12-19T09:37:13, tiff, tif
com.trolltech.Qt.QIconEngineFactoryInterfaceV2%3A\usr\local\lib\qt4\plugins\iconengines\libqsvgicon.so=2015-11-21T02:41:20, svg, svgz, svg.gz
com.trolltech.Qt.QIconEngineFactoryInterface%3A\usr\local\lib\qt4\plugins\iconengines\libqsvgicon.so=2015-11-21T02:41:20
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\kde4\plugins\imageformats\kimg_dds.so=2017-11-26T09:10:23, dds
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\kde4\plugins\imageformats\kimg_eps.so=2017-11-26T09:10:23, eps, EPS, epsi, EPSI, epsf, EPSF
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\kde4\plugins\imageformats\kimg_exr.so=2017-11-26T09:10:23, exr, EXR
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\kde4\plugins\imageformats\kimg_jp2.so=2017-11-26T09:10:23, jp2
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\kde4\plugins\imageformats\kimg_pcx.so=2017-11-26T09:10:23, pcx, PCX
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\kde4\plugins\imageformats\kimg_pic.so=2017-11-26T09:10:23, pic
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\kde4\plugins\imageformats\kimg_psd.so=2017-11-26T09:10:23, psd, PSD
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\kde4\plugins\imageformats\kimg_ras.so=2017-11-26T09:10:23, ras, RAS
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\kde4\plugins\imageformats\kimg_rgb.so=2017-11-26T09:10:23, rgb, RGB, rgba, RGBA, bw, BW, sgi, SGI
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\kde4\plugins\imageformats\kimg_tga.so=2017-11-26T09:10:23, tga, TGA
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\kde4\plugins\imageformats\kimg_xcf.so=2017-11-26T09:10:23, xcf, XCF
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\kde4\plugins\imageformats\kimg_xview.so=2017-11-26T09:10:23, xv
com.trolltech.Qt.QStyleFactoryInterface%3A\usr\local\lib\qt4\plugins\styles\libkvantum.so=2018-07-07T05:29:12, Kvantum

[Qt]
style=Cleanlooks
customColors\0=4287598479
customColors\1=4294967295
customColors\2=4278233855
customColors\3=4294967295
customColors\4=4294967295
customColors\5=4294967295
customColors\6=4294967295
customColors\7=4294967295
customColors\8=4294967295
customColors\9=4294967295
customColors\10=4294967295
customColors\11=4294967295
customColors\12=4294967295
customColors\13=4294967295
customColors\14=4294967295
customColors\15=4294967295
font="Ubuntu,10,-1,5,50,0,0,0,0,0"
Palette\active=#000000, #dedede, #ffffff, #eeeeee, #6f6f6f, #949494, #000000, #ffffff, #000000, #ffffff, #dedede, #000000, #8f8f8f, #ffffff, #8f8f8f, #c753ae, #eeeeee, #000000, #ffffdc, #000000
Palette\inactive=#000000, #dedede, #ffffff, #ffffff, #6f6f6f, #949494, #000000, #ffffff, #000000, #ffffff, #dedede, #000000, #8f8f8f, #ffffff, #8f8f8f, #c753ae, #eeeeee, #000000, #ffffdc, #000000
Palette\disabled=#808080, #dedede, #ffffff, #ffffff, #6f6f6f, #949494, #808080, #ffffff, #808080, #ffffff, #dedede, #000000, #8f8f8f, #808080, #8f8f8f, #c753ae, #eeeeee, #000000, #ffffdc, #000000
fontPath=@Invalid()
embedFonts=true
doubleClickInterval=400
cursorFlashTime=1000
wheelScrollLines=3
resolveSymlinks=false
globalStrut\width=0
globalStrut\height=0
useRtlExtensions=false
XIMInputStyle=On The Spot
DefaultInputMethod=xim
audiosink=Auto
videomode=Auto
GUIEffects=none
filedialog="@ByteArray(\0\0\0\xbe\0\0\0\x3\0\0\0\x1e\0\0\0\xff\0\0\0\0\0\0\0\x2\0\0\0K\0\0\xe\0\x1\0\0\0\x6\x1\0\0\0\x1\0\0\0\x2\0\0\0\x5\x66ile:\0\0\0\x15\x66ile:///home/vermaden\0\0\0\x5\0\0\0.\0/\0h\0o\0m\0\x65\0/\0v\0\x65\0r\0m\0\x61\0\x64\0\x65\0n\0/\0\x64\0o\0w\0n\0l\0o\0\x61\0\x64\0\0\0\x34\0/\0h\0o\0m\0\x65\0/\0v\0\x65\0r\0m\0\x61\0\x64\0\x65\0n\0/\0g\0\x61\0m\0\x65\0s\0.\0L\0O\0\x43\0\x41\0L\0\0\0*\0/\0h\0o\0m\0\x65\0/\0v\0\x65\0r\0m\0\x61\0\x64\0\x65\0n\0/\0v\0m\0/\0i\0s\0o\0\0\0\xa4\0/\0h\0o\0m\0\x65\0/\0v\0\x65\0r\0m\0\x61\0\x64\0\x65\0n\0/\0\x64\0o\0w\0n\0l\0o\0\x61\0\x64\0/\0W\0i\0n\0\x64\0o\0w\0s\0 \0\x37\0w\0s\0z\0y\0s\0t\0k\0i\0\x65\0 \0w\0\x65\0r\0s\0j\0\x65\0 \0x\0\x38\0\x36\0 \0x\0\x36\0\x34\0 \0[\0P\0L\0]\0/\0W\0i\0n\0\x64\0o\0w\0s\0 \0\x37\0 \0S\0P\0\x31\0 \0 \0[\0P\0L\0]\0\0\0\x32\0/\0h\0o\0m\0\x65\0/\0v\0\x65\0r\0m\0\x61\0\x64\0\x65\0n\0/\0v\0m\0/\0s\0t\0o\0r\0\x61\0g\0\x65\0\0\0*\0/\0h\0o\0m\0\x65\0/\0v\0\x65\0r\0m\0\x61\0\x64\0\x65\0n\0/\0v\0m\0/\0i\0s\0o\0\0\0~\0\0\0\xff\0\0\0\0\0\0\0\x1\0\0\0\0\0\0\0\0\x1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x1T\0\0\0\x4\x1\x1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x64\xff\xff\xff\xff\0\0\0\x81\0\0\0\0\0\0\0\x4\0\0\0\xb5\0\0\0\x1\0\0\0\0\0\0\0)\0\0\0\x1\0\0\0\0\0\0\0,\0\0\0\x1\0\0\0\0\0\0\0J\0\0\0\x1\0\0\0\0\0\0\0\x1)"

[Qt%20Plugin%20Cache%204.6.false]
usr\local\share\google-earth\plugins\imageformats\libqgif.so=40601, 0, generic linux lsb-g++ full-config, 2011-05-17T09:42:02
usr\local\share\google-earth\plugins\imageformats\libqjpeg.so=40601, 0, generic linux lsb-g++ full-config, 2011-05-17T09:42:02

[Qt%20Factory%20Cache%204.6]
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\share\google-earth\plugins\imageformats\libqgif.so=2011-05-17T09:42:02, gif
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\share\google-earth\plugins\imageformats\libqjpeg.so=2011-05-17T09:42:02, jpeg, jpg

… and how it looks when loaded in the qt4-qtconfig editor.

qt4-qtconfig.jpg

QT5

The QT5 is kinda special as it requires this export(1) in the ~/.xinitrc (or ~/.xsession) file.

# QT5 qt5ct
  export QT_QPA_PLATFORMTHEME=qt5ct

Do not ask me why and I do not even want to know πŸ™‚

The QT5 configuration is kept in the ~/.config/qt5ct/qt5ct.conf file and the graphical tool/editor is qt5ct installed from qt5ct port/package.

Here is how my current QT5 configuration looks like.

% cat ~/.config/qt5ct/qt5ct.conf
[Appearance]
color_scheme_path=/usr/local/share/qt5ct/colors/dusk.conf
custom_palette=true
icon_theme=Faenza
standard_dialogs=default
style=Fusion

[Fonts]
fixed=@Variant(\0\0\0@\0\0\0\x10\0\x43\0o\0n\0s\0o\0l\0\x61\0s@$\0\0\0\0\0\0\xff\xff\xff\xff\x5\x1\0\x32\x10)
general=@Variant(\0\0\0@\0\0\0\f\0U\0\x62\0u\0n\0t\0u@$\0\0\0\0\0\0\xff\xff\xff\xff\x5\x1\0\x19\x10)

[Interface]
activate_item_on_single_click=1
buttonbox_layout=3
cursor_flash_time=1000
dialog_buttons_have_icons=1
double_click_interval=400
gui_effects=@Invalid()
menus_have_icons=true
stylesheets=/usr/local/share/qt5ct/qss/fusion-fixes.qss
toolbutton_style=4
underline_shortcut=1
wheel_scroll_lines=3

[SettingsWindow]
geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x2\0\0\0\0\x2\x84\0\0\0j\0\0\x5\xd5\0\0\x3w\0\0\x2\x86\0\0\0\x81\0\0\x5\xd3\0\0\x3s\0\0\0\0\0\0\0\0\x6@)

… and how it looks when loaded in the qt5ct editor.

qt5ct.jpg

Back to the Xdefaults

The ~/.Xdefaults file (some use ~/.Xresources instead) also contain fonts information and setup of the cursor theme for the X11 Window System session.

Below you will find my settings, as mentined earlier, also ‘copied’ here.

! FONTS
! -----------------------------------------------------------------------------
  Xft.antialias:  true
  Xft.hinting:    false
  Xft.hintstyle:  0
  Xft.dpi:        75
  Xft.rgba:       none

! CURSOR
! -----------------------------------------------------------------------------
  Xcursor.theme: Vanilla-DMZ
  Xcursor.size:  24

The cursor theme is from the /usr/ports/x11-themes/cursor-dmz-theme port/package.

Xinitrc and Back Again

For the record, the complete GTK/QT settings in the ~/.xinitrc file are as follows.

# QT MUST KNOW WHERE IS GTK2 CONFIG
  export GTK2_RC_FILES="${HOME}/.gtkrc-2.0"

# QT5 qt5ct
  export QT_QPA_PLATFORMTHEME=qt5ct

# GTK/QT ANTIALIASING
  export QT_XFT=1
  export GDK_USE_XFT=1

# FORCE LIBREOFFICE TO USE GTK THEME
  export OOO_FORCE_DESKTOP=gnome

Hope that information provided in this article moved you one more step closer to good looking and practical FreeBSD desktop πŸ˜‰

UPDATE 1

There is one more possible way to make the FreeBSD Desktop QT4/QT5 toolkits look less ugly. The default GNOME theme is Adwaita. There also exists adwaita-qt – a QT port of that Adwaita theme. It aims to make QT to look like the GTK+ 3 Adwaita theme.

adwaita

To make use of them add the adwaita-qt4 and adwaita-qt5 packages.

# pkg install adwaita-qt4 adwaita-qt5

Then use qt4-qtconfig to set the style to Adwaita as the default QT4 theme.

qt4

After setup QT4 theme can be verified like that.

% grep -B 1 style= ~/.config/Trolltech.conf
[Qt]
style=Adwaita

Then start qt5ct to set the style to Adwaita as the default QT5 theme.

qt5

After setup QT5 theme can be verified like that.

% grep -B 1 -i adwaita ~/.config/qt5ct/qt5ct.conf
[Appearance]
style=Adwaita

Transmission rendered in GTK+ toolkit.

trans-gtk

Transmission rendered in QT4 toolkit.

trans-qt.png

Still not perfect but at least less ugly πŸ™‚

EOF

25 thoughts on “FreeBSD Desktop – Part 15 – Configuration – Fonts & Frameworks

  1. Pingback: FreeBSD desktop (15) | 0ddn1x: tricks with *nix

  2. Pingback: FreeBSD Desktop – Part 16 – Configuration – Pause Any Application | vermaden

  3. Pingback: FreeBSD Desktop – Part 17 – Automount Removable Media | πŸ†…πŸ…΄πŸ†πŸ„ΌπŸ„°πŸ„³πŸ…”πŸ…

  4. Pingback: FreeBSD Desktop – Part 2.1 – Install FreeBSD 12 | πšŸπšŽπš›πš–πšŠπšπšŽπš—

  5. Pingback: FreeBSD Desktop – Part 1 – Simplified Boot | πšŸπšŽπš›πš–πšŠπšπšŽπš—

  6. Pingback: FreeBSD Desktop – Part 2 – Install | πšŸπšŽπš›πš–πšŠπšπšŽπš—

  7. Pingback: FreeBSD Desktop – Part 3 – X11 Window System | πšŸπšŽπš›πš–πšŠπšπšŽπš—

  8. Pingback: FreeBSD Desktop – Part 4 – Key Components – Window Manager | πšŸπšŽπš›πš–πšŠπšπšŽπš—

  9. Pingback: FreeBSD Desktop – Part 5 – Key Components – Status Bar | πšŸπšŽπš›πš–πšŠπšπšŽπš—

  10. Pingback: FreeBSD Desktop – Part 6 – Key Components – Task Bar | πšŸπšŽπš›πš–πšŠπšπšŽπš—

  11. Pingback: FreeBSD Desktop – Part 7 – Key Components – Wallpaper Handling | πšŸπšŽπš›πš–πšŠπšπšŽπš—

  12. Pingback: FreeBSD Desktop – Part 8 – Key Components – Application Launcher | πšŸπšŽπš›πš–πšŠπšπšŽπš—

  13. Pingback: FreeBSD Desktop – Part 14 – Configuration – Tint2 | πšŸπšŽπš›πš–πšŠπšπšŽπš—

  14. Pingback: In Other BSDs for 2019/03/16 – DragonFly BSD Digest

  15. BSDfan

    Drobna uwaga, bo to widzΔ™ czΔ™sto powtarzany bΕ‚Δ…d w internetach – Qt a nie QT. QT z reguΕ‚y odnosiΕ‚o sie do QuickTime’a.

    Like

    Reply
  16. Pingback: FreeBSD Desktop – Part 18 – Global Dashboard | πšŸπšŽπš›πš–πšŠπšπšŽπš—

  17. Kane

    What web browser are you using here?
    I am confused since it looks like a closed source one that I thought wasnt on bsd

    Like

    Reply
    1. Kane

      Oh, I am an idiot. I didn’t realize ephiphany wasthe browser, assumed no one would name their browser something so silly.
      ignore me

      Like

      Reply
  18. Abraham Joseph

    FreeBSD has now, latest Gnome-3.38 packages available. Setting up a FreeBSD Gnome desktop will be less hassle now. Gnome-3 offers gnome-tweaks, where you can configure fonts including lcdfilter (subpixel rendering) to your choice. Other apps like gnome-color-manager will auto-detect your display/monitor and use the correct icc/icm color profile. @vermaden: May be not for most seasoned FreeBSD users….but, to attract new users especially from Linux sphere, potentially systemd refugees also, an article on how to configure Gnome-3.38 on FreeBSD-12.2 will be great. Of course, if you are willing. I am using Gnome-3 on FreeBSD since few weeks and it’s stable and cleanly implemented with consolekit2 by the FreeBSD community. I thank them for their work.

    Liked by 1 person

    Reply
  19. Pingback: FreeBSD GNOME 3 Fast Track | πšŸπšŽπš›πš–πšŠπšπšŽπš—

  20. vmisev

    Pls check “UW ttyp0” – monospace bitmap screen fonts by Uwe Waldmann
    http://people.mpi-inf.mpg.de/~uwe/misc/uw-ttyp0/

    I’m always mentioning them whenever I tweet about vt cons πŸ˜‰
    Fonts are especially good for EE users.

    Like

    Reply
    1. vermaden Post author

      Thanks for mentioning them – its always good to have choice.

      But I must be frank with you … I really love the new terminal font that FreeBSD uses by default since introduction of version 13.0 and I will never change it to anything else currently πŸ™‚

      Regards.

      Like

      Reply

Leave a comment