For the fonts like sans serif, FX just asks fontconfig for the list of fonts that make it up for the current locale. Garbled text isn't likely to be due to a font selection difference. More likely a bug in mapping to the correct font
so I am not sure API methods on Font will help.

Also canDisplay() is a tricky one as I've discussed this recently on the client-libs list.
It was designed to report what glyphs *that physical font* supports.
Reporting pseudo-glyphs, and glyphs from fall backs distort it.

-phil.

On 5/12/25 8:44 AM, Glavo wrote:
I hope this issue gets more attention. Can anyone take a look at this email?

Glavo

On Sun, May 4, 2025 at 4:18 PM Glavo <zjx001...@gmail.com> wrote:

    Hi,

    We have noticed that JavaFX's strategy for selecting default fonts
    can sometimes be quite odd,
    and at times it doesn't properly follow the fontconfig
    configuration. As a result,
    we frequently receive feedback from Linux users reporting that all
    Chinese characters appear as garbled text.
    This[1] is one piece of the feedback that contains useful information.

    We are not sure whether these problems can be solved. However,
    we've noticed that unlike AWT,
    javafx.scene.text.Font API lacks most useful methods. For example,
    it does not provide
    canDisplay/canDisplayUpTo methods, making it impossible to
    determine whether
    a font can render a given text. I found that CharToGlyphMapper
    actually contains
    the corresponding method, but it is not exposed through the Font API.

    So is it possible to add more useful API methods to Font, like AWT
    does?
    This will be of great help to us.

    Glavo

    [1]: https://github.com/HMCL-dev/HMCL/issues/3104

Reply via email to