Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Linux / Wine: font fallback for extended unicode range? (Read 3726 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Linux / Wine: font fallback for extended unicode range?

I am happily using foobar2000 under Arch Linux + music on NAS without major issues (after finding and installing https://github.com/sammoth/foo_out_pulse - without it, sound output was quite brittle and interrupted during each tagging operation).

I am merely running into problems getting extended unicode characters to correctly render in the Playlist view + Properties grid UI elements (see attached screenshot). As you can see, the file tag (as rendered in the window title) is fine, just the font replacement rules seem to work. Even better: when I start editing the track title, the characters start rendering correctly, too. I have installed a broad sweep of fonts (unifonts, Arial Unicode MS, corefonts) in hope that one of them would be picked up.

Has anybody gotten this working?

Re: Linux / Wine: font fallback for extended unicode range?

Reply #1
It's not doing its own font substitution for fallback characters. It relies on either GDI or GDI+ font rendering to fall back on other fonts automatically.

Web browsers do this manually, by probing all installed fonts on startup, and creating their own fallback maps, doing the font switching manually.

Re: Linux / Wine: font fallback for extended unicode range?

Reply #2
As a workaround I use adobe-source-han-sans-otc font in foobar which contains 65.5k glyphs (the max limit for single font file). This covers most unicode characters. Would be nice to be able to use the same font as rest of the system for consistency though.

Re: Linux / Wine: font fallback for extended unicode range?

Reply #3
Mikko's post sent me on a short download spree and got me downloading several extended range unicode fonts. Turns out none worked better than my current default. I am giving up on this front for now as it is only a minor cosmetic issue. If tags were in danger, I would probably go on investigating  ;)

Thanks for the pointers, though!

Re: Linux / Wine: font fallback for extended unicode range?

Reply #4
Literally the only thing that can be done is that Wine implements default remapping of the system font, like Windows does on its own. foobar2000 should not have to implement web browser tactics of auto font remapping on its own.

Re: Linux / Wine: font fallback for extended unicode range?

Reply #5
Older topic but comes up on google; It turns out wine can infact remap fonts, it just is not automatic.

You need to use regedit and at a new key.

  • Open regedit in wine with
    Code: [Select]
    wine regedit
    or if foobar is in a different prefix from default
    Code: [Select]
    WINEPREFIX=/path/to/prefix wine regedit
  • Go to
    Code: [Select]
    HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink
  • Add a new "Multi-String Value" and set it's name to the font you want to use on foobar2000. For example "DejaVu Sans Condensed"
  • Then set it's value to the desired fallback font, in the format:
    Code: [Select]
    font file.ttf,Font Name As Seen in Font Dialog
    The first parameter before comma is just the filename of the font, to check it find where your distro stores fonts (one common place is /usr/share/fonts)
    The other parameter after comma should be the font name as written in the font select dialog, for example in foobar2000 font settings.

    Here is an example value where I use one of the KoPubWolrd fonts (which might be also available as a package on your distro):
    Code: [Select]
    KoPubWorld Dotum_Pro Medium.otf,KoPubWorldDotum_Pro Medium

According to the source, you could presumably have multiple fonts as fallback by adding another entry on next line:
Code: [Select]
KoPubWorld Dotum_Pro Medium.otf,KoPubWorldDotum_Pro Medium
another font.ttf,Another Font
But I have not tested that.

Anyways, now foobar2000 uses the font set in settings first, and the font defined in registry for other characters not supported by the first font.

(PS: You can test it by typing somewhere two different characters that are only supported in the two separate fonts. For example DejaVu Sans Condensed does not support various asian characters, and the KoPubWorld font does not support for example zero-width space. So If only one font is used (like without the fontlink registry key), the other character is a square box, where as if fallback works, both characters would render fine.)

Re: Linux / Wine: font fallback for extended unicode range?

Reply #6
Older topic but comes up on google; It turns out wine can infact remap fonts, it just is not automatic.

You need to use regedit and at a new key.

  • Open regedit in wine with
    Code: [Select]
    wine regedit
    or if foobar is in a different prefix from default
    Code: [Select]
    WINEPREFIX=/path/to/prefix wine regedit
  • Go to
    Code: [Select]
    HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink
  • Add a new "Multi-String Value" and set it's name to the font you want to use on foobar2000. For example "DejaVu Sans Condensed"
  • Then set it's value to the desired fallback font, in the format:
    Code: [Select]
    font file.ttf,Font Name As Seen in Font Dialog
    The first parameter before comma is just the filename of the font, to check it find where your distro stores fonts (one common place is /usr/share/fonts)
    The other parameter after comma should be the font name as written in the font select dialog, for example in foobar2000 font settings.

    Here is an example value where I use one of the KoPubWolrd fonts (which might be also available as a package on your distro):
    Code: [Select]
    KoPubWorld Dotum_Pro Medium.otf,KoPubWorldDotum_Pro Medium

According to the source, you could presumably have multiple fonts as fallback by adding another entry on next line:
Code: [Select]
KoPubWorld Dotum_Pro Medium.otf,KoPubWorldDotum_Pro Medium
another font.ttf,Another Font
But I have not tested that.

Anyways, now foobar2000 uses the font set in settings first, and the font defined in registry for other characters not supported by the first font.

(PS: You can test it by typing somewhere two different characters that are only supported in the two separate fonts. For example DejaVu Sans Condensed does not support various asian characters, and the KoPubWorld font does not support for example zero-width space. So If only one font is used (like without the fontlink registry key), the other character is a square box, where as if fallback works, both characters would render fine.)

Yes, you can have as many fallback fonts as you like. Take a look here

Right now I have this for IBM Plex Sans (beautiful font)

Code: [Select]
IBMPLEXSANSARABIC-REGULAR.OTF,IBM Plex Sans Arabic
IBMPLEXSANSHEBREW-REGULAR.OTF,IBM Plex Sans Hebrew
IBMPLEXSANSJP-REGULAR.OTF,IBM Plex Sans JP
IBMPLEXSANSKR-REGULAR.OTF,IBM Plex Sans KR
IBMPLEXSANSTHAI-REGULAR.OTF,IBM Plex Sans Thai
IBMPLEXSANSTHAILOOPED-REGULAR.OTF,IBM Plex Sans Thai Looped
MEIRYO.TTC,Meiryo UI,128,96
MEIRYO.TTC,Meiryo UI
MSGOTHIC.TTC,MS UI Gothic
MSJH.TTC,Microsoft JhengHei UI,128,96
MSJH.TTC,Microsoft JhengHei UI
MSYH.TTC,Microsoft YaHei UI,128,96
MSYH.TTC,Microsoft YaHei UI
MALGUN.TTF,Malgun Gothic,128,96
MALGUN.TTF,Malgun Gothic
MINGLIU.TTC,PMingLiU
SIMSUN.TTC,SimSun
GULIM.TTC,Gulim
YUGOTHM.TTC,Yu Gothic UI,128,96
YUGOTHM.TTC,Yu Gothic UI
SEGOEUI.TTF,Segoe UI
SEGUISYM.TTF,Segoe UI Symbol
SEGUIEMJ.TTF,Segoe UI Emoji
SEGMDL2.TTF,Segoe MDL2 Assets
FONTAWESOME-WEBFONT.TTF,FontAwesome
TAHOMA.TTF,Tahoma

That use all IBM Sans variation, Microsoft CJKs, Segoe UI (default windows) with all symbols, emojis and assets with the addition of fontawesome.

Re: Linux / Wine: font fallback for extended unicode range?

Reply #7
As a workaround I use adobe-source-han-sans-otc font in foobar which contains 65.5k glyphs (the max limit for single font file). This covers most unicode characters. Would be nice to be able to use the same font as rest of the system for consistency though.

Can I ask which font you used from that page specifically? I tried setting SourceHanSans.ttc as my fallback and I got mostly half-width characters.

Previously, I was using wqy-microhei.ttc (https://github.com/anthonyfok/fonts-wqy-microhei/blob/master/wqy-microhei.ttc), but I think it's geared more toward Chinese characters specifically. An all-around font could be nice

Re: Linux / Wine: font fallback for extended unicode range?

Reply #8
There is a problem displaying Thai characters in applications running under WINE when the display font doesn't contain the Thai code page characters - for example when using Segoe UI. The Thai characters appear as square boxes. This can be seen when running Notepad using the Thai locale - the menus should be in Thai, but are displayed as square boxes. It can also be seen in foobar2000 with tracks containing Thai characters in the title. When editing the text, the characters do appear correctly such as when editing in Notepad or editing a track title in foobar2000. I have created a workaround which fixes the problem, but any suggestions and discussion for a proper solution are most welcome. I will explain my understanding (open to correction) of the problem below together with the workaround.

WINE isn't using the normal fallback procedure for Thai characters when using fonts without a Thai code page such as Segoe UI (I don't know why). Adding a Thai font to the fallback font stack in the registry key "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink" doesn't make a difference. Instead the fallback always goes to a certain small Thai font (even when no SystemLink key is used at all). This font shows as square boxes except when editing. This problem doesn't occur in Windows 11, only in WINE. If I add a fallback font for another code page that is also not in Segoe UI such as Korean, there is no problem - Korean characters display correctly. As far as  I know, it is only Thai that doesn't following the normal fallback procedure. I haven't been able to find out where this mysterious fallback font is coming from or why it isn't displaying correctly except when editing.

I created a workaround. I edited the Segoe UI font using FontForge and added in the Thai characters from another font (Leelawadee UI font). I replaced the standard Segoe UI font with this modified one and everything looks good: the Segoe UI characters appear fine, the added Thai characters appear fine, and any other fallback font characters appear fine. Here is a link to my modified version of Segoe UI if anyone wants to use it:
Segoe UI font with Thai font Leelawadee UI added
(make a backup copy of your segoeui.ttf font file and then replace it with the one in this zip file.)

I'm sure this workaround will also work for other display fonts that don't include Thai characters. I can supply FontForge instructions if requested.

Using:
WINE: wine-9.0 (Ubuntu 9.0~repack-4build3) [64 bit]
Linux kernel: 6.8.0-47-generic
Distro: Kubuntu 24.04

Any feedback on this issue is most welcome.

Re: Linux / Wine: font fallback for extended unicode range?

Reply #9
Take a look here
https://hydrogenaud.io/index.php/topic,121786.msg1023231.html#msg1023231

With this method you can make segoe UI fallback to others fonts for different languages or icons.

Edit:

I have the same problem with thai fallback, it only shows during edit. And only happens with Thai. Japanese, Chinese, Korean, etc work fine


Re: Linux / Wine: font fallback for extended unicode range?

Reply #10
Edit:

I have the same problem with thai fallback, it only shows during edit. And only happens with Thai. Japanese, Chinese, Korean, etc work fine

Yes, I tested Korean and the fallback works fine for these characters. I use star symbols in foobar2000 for music ratings, so I use a fallback to "Segoe UI Symbol" font. This also works fine. As far I know, it's only Thai that is not using the fallback process.