You are not logged in.

#1 2019-03-25 06:15:11

berilac
Member
Registered: 2016-12-24
Posts: 11

[SOLVED] Custom Font Package Broke Some GUI's

I recently added a handful of free fonts found online, to my system (running pretty simple OpenBox setup).
I did my best to follow good Arch practices by making a pacman package for the task.

The trouble is, once installed, some of my apps started using the 'architects_hand' font for menus, etc.
(VLC, MasterPDFEditor for instance, but not Firefox or Pidgin among others).
My current suspicion is it's somehow linked with Qt (think that's what VLC uses for GUI).
However, qtconfig is inheriting from GTK+, so I'm now looking there for potential solution.

For the life of me, I can't figure out why.
As far as I can tell, this should not have occurred.

Any help or thoughts would be greatly appreciated.
If you would like more info, please ask.

Here is my PKGBUILD:

pkgname=architectural-font-collection
pkgver=1.0
pkgrel=1
pkgdesc="Small collection of architectural fonts from free sources online"
url=""
arch=(any)
#license=(custom)
#srcdir="TTF"
source=('architects_hand.zip'
        'blambot_saucer-bb.zip'
        'designer_notes.zip'
        'draftquick.zip'
        'handwriting_draft.zip'
        'peax-webdesign_pwscratchedfont.zip'
        'Woolkarth-Bold Bold.ttf')
sha256sums=('68ce550d4d0f65249ee148ccbb51a9e1d3800e5e340fe5db092970e33d803960'
            'd447136413922d9bd7df85070a2731e20a557fd72a4a6a934798180b87eb3118'
            '1896be580ffcf4f3c2f07245cc08f77be0c306936eaaabd94a9a6618df2ef9ce'
            '5503fcd9e4aed3c992be6ae7483fc7e595419214110b47fbe13d742a3ab9f660'
            '13e9961d2b7eba176ca3cb17a255db35e6f75bebe51fe2fb396ee006eda02a61'
            '7e0f9d4d3de08812570e9c09fec99651d311169ff6135eb5d77e699eaccd8439'
            '40d925b208680d77b732d006f6ce7b1c0885ac4edaa20a1243f8859ee6434bd9')

package() {
  install -d "$pkgdir/usr/share/fonts/${pkgname%-fonts}"
  install -t "$pkgdir/usr/share/fonts/${pkgname%-fonts}" -m644 *.ttf
  #install -Dm644 LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

# vim:set ts=2 sw=2 et:

Last edited by berilac (2019-03-27 12:14:48)

Offline

#2 2019-03-25 07:32:52

seth
Member
Registered: 2012-09-03
Posts: 49,992

Re: [SOLVED] Custom Font Package Broke Some GUI's

Please provide the outputs of

fc-match sans-serif
fc-match gnarf

and a url for the actual font(s)

Also see https://wiki.archlinux.org/index.php/Fo … ault_fonts on how to enforce a default for (in your case likely) sans-serif.

Offline

#3 2019-03-25 08:24:45

berilac
Member
Registered: 2016-12-24
Posts: 11

Re: [SOLVED] Custom Font Package Broke Some GUI's

Hi seth, thanks so much for such a quick response.

fc-match outputs:

$> fc-match sans-serif
NotoSans-Regular.ttf: "Noto Sans" "Regular"
$>fc-match gnarf
NotoSans-Regular.ttf: "Noto Sans" "Regular"

Font links:
(I think the reason I did not include these directly into PKGBUILD was that at least one site requested no direct links...)
Architects Hand
Blambot Saucer
Designer Notes
Draftquick
Handrwriting Draft
PW Scratched
Woolkarth Bold

Just realised you probably meant url for the fonts output by fc-match... oh well.

Also I don't seem to have any XDG environment variables.
I guess it's fine just to use '/etc/fonts/local.conf'
Incidentally - I created this file earlier, containing:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
    <match>
        <edit mode="prepend" name="family"><string>Noto Sans</string></edit>
    </match>
    <match target="pattern">
        <test qual="any" name="family"><string>serif</string></test>
        <edit name="family" mode="assign" binding="same"><string>Noto Serif</string></edit>
    </match>
    <match target="pattern">
        <test qual="any" name="family"><string>sans-serif</string></test>
        <edit name="family" mode="assign" binding="same"><string>Noto Sans</string></edit>
    </match>
    <match target="pattern">
        <test qual="any" name="family"><string>monospace</string></test>
        <edit name="family" mode="assign" binding="same"><string>Noto Mono</string></edit>
    </match>
</fontconfig>

I believe the above file is redundant though - I just found an almost identical file in $HOME/.config/fontconfig/conf.d/99-fonts.conf
Changing this has immediate effect on `fc-match`.

Last edited by berilac (2019-03-25 08:26:19)

Offline

#4 2019-03-25 12:09:46

seth
Member
Registered: 2012-09-03
Posts: 49,992

Re: [SOLVED] Custom Font Package Broke Some GUI's

The default sans-serif is resolved to NotoSans.
What font is configured in  ~/.gtkrc-2.0 ?
(Assuming the actually uses the gtk+ style, try to "strace some_qt_app 2>&1 | grep gtk" and post the output of "qtdiag-qt5" (comes w/ qt5-tools)

Offline

#5 2019-03-25 13:07:43

berilac
Member
Registered: 2016-12-24
Posts: 11

Re: [SOLVED] Custom Font Package Broke Some GUI's

There is no font configured in ~/.gtkrc-2.0
Also, there was no font set in ~/.config/gtk-3.0/settings.ini

I tried setting one, but seems to have no effect (though I do see it update the relevant tab in qtconfig-qt4).
I'm starting to think this is somehow a specific config issue with one or two programs, i.e. vlc.

Tried the strace line with vlc, got nothing.
Ran it again with 'qt' instead of 'gtk' and got this (so I guess it is using qt at least):

stat("/usr/lib/vlc/plugins/gui/libqt_plugin.so", {st_mode=S_IFREG|0755, st_size=3393440, ...}) = 0
openat(AT_FDCWD, "/usr/lib/vlc/plugins/gui/libqt_plugin.so", O_RDONLY|O_CLOEXEC) = 11

Ran strace with masterpdfeditor4, got this:

lstat("/usr/lib/qt/plugins/platformthemes/libqgtk3.so", {st_mode=S_IFREG|0755, st_size=382840, ...}) = 0
openat(AT_FDCWD, "/usr/lib/qt/plugins/platformthemes/libqgtk3.so", O_RDONLY|O_CLOEXEC) = 6

Output from qtdiag-qt5:

Qt 5.12.2 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 8.2.1 20181127) on "xcb" 
OS: Arch Linux [linux version 5.0.3-arch1-1-ARCH]

Architecture: x86_64; features: SSE2 SSE3 SSSE3 SSE4.1 SSE4.2 AVX AVX2 RTM HLE

Environment:

Features: QT_NO_EXCEPTIONS

Library info:
  PrefixPath: /usr
  DocumentationPath: /usr/share/doc/qt
  HeadersPath: /usr/include/qt
  LibrariesPath: /usr/lib
  LibraryExecutablesPath: /usr/lib/qt/libexec
  BinariesPath: /usr/bin
  PluginsPath: /usr/lib/qt/plugins
  ImportsPath: /usr/lib/qt/imports
  Qml2ImportsPath: /usr/lib/qt/qml
  ArchDataPath: /usr/lib/qt
  DataPath: /usr/share/qt
  TranslationsPath: /usr/share/qt/translations
  ExamplesPath: /usr/share/doc/qt/examples
  TestsPath: /usr/tests
  SettingsPath: /etc/xdg

Standard paths [*...* denote writable entry]:
  FontsLocation: "Fonts" */home/###/.local/share/fonts* /home/###/.fonts
  AppLocalDataLocation: "Application Data" */home/###/.local/share/QtProject/qtdiag* /usr/local/share/QtProject/qtdiag /usr/share/QtProject/qtdiag
  AppDataLocation: "Application Data" */home/###/.local/share/QtProject/qtdiag* /usr/local/share/QtProject/qtdiag /usr/share/QtProject/qtdiag
  AppConfigLocation: "Application Configuration" */home/###/.config/QtProject/qtdiag* /etc/xdg/QtProject/qtdiag

Theme:
  Platforms requested : unknown,generic
            available : gtk3,snap,flatpak,xdgdesktopportal
  Styles requested    : Fusion,Windows
         available    : Windows,Fusion
  System font         : "Sans Serif" 9

Fonts:
  General font : "Sans Serif" 9
  Fixed font   : "monospace" 9
  Title font   : "Noto Sans" 12
  Smallest font: "Noto Sans" 12

Hope it's ok, I left a bunch out from the above output. A lot seemed irrelevant. If you really want it though, I can post again.

Offline

#6 2019-03-25 14:20:12

seth
Member
Registered: 2012-09-03
Posts: 49,992

Re: [SOLVED] Custom Font Package Broke Some GUI's

fc-match "Sans Serif"

You're not following the gtk settings (nor even have the gtk+ qpa installed), see https://wiki.archlinux.org/index.php/Qt … KDE_Plasma

Offline

#7 2019-03-26 06:22:11

berilac
Member
Registered: 2016-12-24
Posts: 11

Re: [SOLVED] Custom Font Package Broke Some GUI's

seth wrote:
fc-match "Sans-Serif"

Are you referring to the output above? :

  System font         : "Sans Serif" 9

Fonts:
  General font : "Sans Serif" 9

When you say I'm not following gtk settings, that is quite possible. Early on I used deepin-desktop, and trialed a couple of other DM's before settling with OpenBox simplicity.
So my configs are likely not well optimised in part...

I have been over the wiki page on GTK+ - I assume that's what you meant by "not following" the settings - but I will work through it more methodically in a moment.

Did you mean Qt5 QPA (via `qt5ct` package)?
I have not installed it, but through that part of the wiki (that you lined above) I tried the following test:

$> XDG_CURRENT_DESKTOP=GNOME vlc

This fixes the issue! smile
So I'm thinking I should just implement some XDG Environment vars.

What do you think? Is that a hacky solution or perfectly reasonable?

What I don't understand though, is why VLC and any other app having the same issue, specifically fail by using that one new font - which is in it's own directory...
I can't see how my installation process could cause that font to be set somewhere, or become a fallback...
But I guess that's a separate issue.

Thanks again for the help

Offline

#8 2019-03-26 06:29:30

berilac
Member
Registered: 2016-12-24
Posts: 11

Re: [SOLVED] Custom Font Package Broke Some GUI's

OK, so I can partly see where the problem may have arisen but I'm still not sure how the font then became some kind of "default" ?

$> fc-query -f '%{family[0]}\n' /usr/share/fonts/architectural-font-collection/Architect_\'s\ Hand.ttf 
Sans Serif

Not sure if relevant but all the other fonts in that directory have a family name equal to the font name.

Offline

#9 2019-03-26 08:21:32

seth
Member
Registered: 2012-09-03
Posts: 49,992

Re: [SOLVED] Custom Font Package Broke Some GUI's

You've no platform requested ;-)

How to align the Qt QPA is entirely to your personal preference, there's no "proper" solution.
However, I'd advise AGAINST setting XDG_CURRENT_DESKTOP and contain the effect to Qt operating on the QT_QPA_PLATFORMTHEME and QT_STYLE_OVERRIDE variables.  There're mutliple QPA themes available but qt5ct provides you with a desktop independent config dialog.

You can "fix" the font situation independent of this by either putting better fonts into the prefer list for "Sans Serif" or possibly by overriding the family for the troublesome font, but that requires the font to be detectable eg. by it's "fullname" entry, complete "fc-query" output for the file?

Offline

#10 2019-03-27 12:12:18

berilac
Member
Registered: 2016-12-24
Posts: 11

Re: [SOLVED] Custom Font Package Broke Some GUI's

Thanks again, seth!

qt5ct plus setting QT_QPA_PLATFORMTHEME solved the problem.
Set QT_STYLE_OVERRIDE to "gtk2" for consistency with my other settings, and good measure smile

Looked into overriding the family for the troublesome font.
Best way I could think of would be to script it with fontforge (for automated solution) - but for the time being it's more trouble than it's worth.

For the record, here's complete `fc-query` for that font:

$> fc-query /usr/share/fonts/architectural-font-collection/Architect_\'s\ Hand.ttf 
Pattern has 24 elts (size 32)
	family: "Sans Serif"(s) "Architect's Hand"(s)
	familylang: "pt"(s) "en"(s)
	style: "Normal"(s) "obyčejné"(s) "Standard"(s) "Κανονικά"(s) "Regular"(s) "Normaali"(s) "Normál"(s) "Normale"(s) "Standaard"(s) "Normalny"(s) "Обычный"(s) "Normálne"(s) "Navadno"(s) "thường"(s) "Arrunta"(s)
	stylelang: "ca"(s) "cs"(s) "de"(s) "el"(s) "en"(s) "fi"(s) "hu"(s) "it"(s) "nl"(s) "pl"(s) "ru"(s) "sk"(s) "sl"(s) "vi"(s) "eu"(s)
	fullname: "Architect's Hand"(s)
	fullnamelang: "en"(s)
	slant: 0(i)(s)
	weight: 80(f)(s)
	width: 100(f)(s)
	foundry: "TMC "(s)
	file: "/usr/share/fonts/architectural-font-collection/Architect_'s Hand.ttf"(s)
	index: 0(i)(s)
	outline: True(s)
	scalable: True(s)
	charset: 
	0000: 00000000 fffffff7 ffffffff ffffffff 00000000 859f6604 04b8260f 04b8268f
	0001: 00000000 00020000 00000000 00000000 00000000 00000000 00000000 00000000
	0002: 00000000 00000000 00000000 00000000 00000000 00000000 04000200 00000000
	0003: 00000000 00000000 00000000 40000000 00100000 00000000 00000000 00000000
	0021: 00000000 00000040 00000000 00000000 00000000 00000000 00000000 00000000
	0022: 44060040 00000000 00000000 00000031 00000000 00000000 00000000 00000000
(s)
	lang: fj|ho|ia|id|ie|io|mg|nr|om|so|ss|st|sw|ts|uz|xh|zu|kj|kwm|ms|ng|rn|rw|sn|su|za(s)
	fontversion: 331612(i)(s)
	capability: "otlayout:arab otlayout:cyrl otlayout:grek otlayout:hebr otlayout:latn"(s)
	fontformat: "TrueType"(s)
	decorative: False(s)
	postscriptname: "Architect'sHand"(s)
	color: False(s)
	symbol: False(s)
	variable: False(s)

The output here shows two 'family' names.
Under 'Font Info' > 'TTF Names' in `Fontforge` it finds 'Family' as the same name as the font, but also 'Preferred Family' for Portuguese language set to 'Sans Serif'.
Seems actually that there are a few issues with that fonts' setup anyway.

I am mostly inclined simply to delete it smile

Right, so most of that info is just for the record and anyone who may be interested in future.

This problem is solved smile

Offline

Board footer

Powered by FluxBB