Character problem

After a system update, jabref can’t display Chinese character anymore. The jabref package itself is not changed. How should I debug this problem? Where does jabref get the font?

HI,

Please add some more details on your OS and Desktop environment. Can you provide a screenshot?
By default, JabRef uses the system’s default font. Seems like your font does not support CJK character set.
Alternatively, you could try to set a custom font in the CSS by creating a new custom theme and setting the font family or the font

I’m on NixOS.

Seems like your font does not support CJK character set.

Other programs work well so I guess JabRef picks a different font. I don’t have other javafx program to test though. Is that possible to know which font is used?

I think you can modify the start script under ... JabRef\lib\runtime\bin\JabRef

Add the -Dprism.debugfonts=true in the line like e.g.

`“$DIR/java” $CDS_JVM_OPTS -p “$DIR/…/app” -Dprism.debugfonts=true -m …

this will show some debug information about the fonts loaded etc.
You can find some more info on the font finding here:
Font Setup - Font Setup - OpenJDK Wiki

Thanks! I finally found the problem. JabRef can only use TrueType font. Unifont is the only TrueType CJK font. When updating to 15.1, Unifont doesn’t provide TrueType font anymore so the OpenType font is packaged in NixOS instead. Nowadays it’s difficult to find a TrueType CJK font. Do you know why JabRef can’t use OpenType font? Is it a limitation of JavaFX?

JavaFX supports OpenType fonts. The preferred format is TrueType outlines. Bitmap fonts and Type 1 fonts are not supported.

JavaFX does support OpenType fonts though.

Yes, I stumbled across this as well. maybe the font searching has some issues. in JabRef we don’t specify any font, only the font family, So maybe the first font returned in the search path is no longer the righ one?

I thought it’s not about the order. In the debug messages only the TrueType fonts are found. As long as there is a CJK font found JabRef can fallback to it. But somehow JabRef can’t use OpenType font. Even if there is a CJK font of a different family, as long as it’s a TrueType font JabRef can fallback to it.

I read at the javafx link that javafx uses fontconfig for font discovery on linux. Maybe you can play around with this?

https://www.linuxfromscratch.org/blfs/view/svn/x/tuning-fontconfig.html

Fontconfig always returns the regular weight font. It makes the Chinese characters looks weird since the English characters use maybe the bold weight font.

If I set a otc font as the default font in fontconfig, then JabRef can’t display CJK characters.