You are not logged in.

#1 2023-10-07 19:23:13

Megarock90
Member
Registered: 2012-01-18
Posts: 45

[SOLVED] Qt6 apps not obeying fontconfig for Japanese font.

I have a handful of japanese fonts installed, my system kept using a display one instead of one of the readable ones. After asking and reading about, I set up .config/fontconfig/conf.d/65-nonlatin.conf as

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig>
  <description>Set preferable fonts for non-Latin</description>
	<alias>
		<family>sans-serif</family>
		<prefer>
			<family>M PLUS 2</family> <!-- han (ja) -->
		</prefer>
	</alias>
	<alias>
		<family>serif</family>
		<prefer>
			<family>Yu Mincho</family> <!-- han (ja) -->
		</prefer>
	</alias>
<!--
	system-ui
-->
	<alias>
		<family>system-ui</family>
		<prefer>
			<family>M PLUS 2</family> <!-- han (ja) -->
		</prefer>
	</alias>
</fontconfig>

and this works perfectly for all apps EXCEPT qt6 apps (specifically Strawberry player and qbittorrent) which insist on using the display font, but ONLY for hiragana and katakana while kanji uses the correct font.
Strawberry
What could be causing this?

edit: for comparison, this is how that same album looks on Dolphin

Last edited by Megarock90 (2023-10-07 20:32:38)

Offline

#2 2023-10-07 20:01:37

seth
Member
Registered: 2012-09-03
Posts: 60,164

Re: [SOLVED] Qt6 apps not obeying fontconfig for Japanese font.

grep -irE '[^a-zA-Z]ja' /usr/share/fontconfig/conf.* /etc/fonts/conf.d

The theory is that there's some config w/ localized binding, https://wiki.archlinux.org/title/Font_c … s#Japanese

Offline

#3 2023-10-07 20:32:13

Megarock90
Member
Registered: 2012-01-18
Posts: 45

Re: [SOLVED] Qt6 apps not obeying fontconfig for Japanese font.

Yes, turns out the locale bit was important. 65-nonlatin.conf now looks like

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig>
  <description>Set preferable fonts for non-Latin</description>
  <!-- Default font (no fc-match pattern) -->
  <match>
    <edit mode="prepend" name="family">
      <string>Noto Sans</string>
    </edit>
  </match>
  <!-- Default font for the ja_JP locale (no fc-match pattern) -->
  <match>
    <test compare="contains" name="lang">
      <string>ja</string>
    </test>
    <edit mode="prepend" name="family">
      <string>M PLUS 2</string>
    </edit>
  </match>
  <!-- Default sans-serif font -->
  <match target="pattern">
    <test qual="any" name="family">
      <string>sans-serif</string>
    </test>
    <!--<test qual="any" name="lang"><string>ja</string></test>-->
    <edit name="family" mode="prepend" binding="same">
      <string>Noto Sans</string>
    </edit>
  </match>
  <!-- Default serif fonts -->
  <match target="pattern">
    <test qual="any" name="family">
      <string>serif</string>
    </test>
    <edit name="family" mode="prepend" binding="same">
      <string>Noto Serif</string>
    </edit>
    <edit name="family" mode="append" binding="same">
      <string>IPAPMincho</string>
    </edit>
    <edit name="family" mode="append" binding="same">
      <string>HanaMinA</string>
    </edit>
  </match>
  <!-- Default monospace fonts -->
  <match target="pattern">
    <test qual="any" name="family">
      <string>monospace</string>
    </test>
    <edit name="family" mode="prepend" binding="same">
      <string>Noto Sans Mono</string>
    </edit>
    <edit name="family" mode="append" binding="same">
      <string>Inconsolatazi4</string>
    </edit>
    <edit name="family" mode="append" binding="same">
      <string>IPAGothic</string>
    </edit>
</match>
  <alias>
    <family>sans-serif</family>
    <prefer>
      <family>M PLUS 2</family> <!-- han (ja) -->
    </prefer>
  </alias>
  <alias>
    <family>serif</family>
    <prefer>
      <family>Yu Mincho</family> <!-- han (ja) -->
    </prefer>
  </alias>
<!--
  system-ui
-->
  <alias>
    <family>system-ui</family>
    <prefer>
      <family>M PLUS 2</family> <!-- han (ja) -->
    </prefer>
  </alias>
</fontconfig>

Offline

Board footer

Powered by FluxBB