Issue with CJK font prioritization in flatpak after installing CJK fonts to the user in KDE

I’m currently having an issue with font prioritization in my applications installed through flatpak after having installed fonts to my user (I had previously no fonts installed to my user account) I noticed that the Japanese in most flatpak applications I have installed started defaulting to a font called ‘BestTen-DOT’ which is a font I had installed, but I had done nothing to set it as the font or anything like that. This issue was not present in any applications installed through rpm or any appimages and also for some reason libadwaita applications, unsure of why that last one is. While my other applications defaulted to ‘Noto Sans CJK JP’ for Japanese (which is the default on KDE) for some reasons installing other Japanese fonts seem to give them higher priority. I did try to delete ‘BestTen-DOT’ to see what would happen and that only caused it to switch to some other font I had installed which I did not want to set as the font either. A way I found to solve it was to delete all my user installed fonts, which caused it to go back to the default ‘Noto Sans CJK JP’, but this is obviously not a good solution.

I did find an non-ideal workaround for this issue, but it does cause me some other minor issues which I can deal with, but I found putting this into ~.config/fontconfig/conf.d/ did solve the issue mostly.

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <match target="pattern">
    <test name="family" qual="any">
      <string>sans</string>
    </test>
    <edit name="family" mode="prepend" binding="strong">
      <string>Noto Sans CJK JP</string>
    </edit>
  </match>

  <match target="pattern">
    <test name="family" qual="any">
      <string>sans-serif</string>
    </test>
    <edit name="family" mode="prepend" binding="strong">
      <string>Noto Sans CJK JP</string>
    </edit>
  </match>
</fontconfig>

If I had to guess the default CJK fonts which should be top priority by default just are not in Flatpak and installing any font automatically places it above for some reason, but I really have no clue.

I wanted to file a bug report for this, but I have no idea who to report this issue to, I don’t know if it’s a problem with Fedora, KDE or Flatpak or where to report it, so I’m trying my luck here.

You say “most Flatpak applications”, so I guess not all of them misbehaved.

Is there a pattern in which Flatpak apps have the problem? Particularly, I wonder if a specific Flatpak runtime is doing the wrong thing here (e.g. here’s a bug I reported which was a problem specifically in the KDE Flatpak runtime).

To see the runtime used by each Flatpak app you can do:

flatpak list --app --columns=application,runtime

Yeah, I don’t remember the details but I’ve run across awkward font things with flatpaks before and it gets a bit complicated. I think P G is onto something in that the runtime’s behavior is important, IIRC.

I tried checking with the command you gave, and from just a little looking around and testing it seems that the GNOME 51 runtime is unaffected, it does occur in the GNOME 50 and 49 runtime however, so I assume it affects anything older than 51.

I think all KDE runtime applications have the issue and I did also try some applications on the freedesktop runtime and they seemed unaffected except for Betterbird which defaults to a completely different font but also not the expected ‘Noto Sans CJK JP’, that was also fixed by applying the same config from earlier, that however seems to be an exception rather than the rule and I assume probably project specific and not due to the runtime.