Font fallback mechanisms have more counterintuitive quirks than one might think. For example: I needed a few pictograms to mark land and sea access for some UI element. The obvious solution — using Unicode mountain and anchor glyphs — led to an interesting adventure. The font I use (DIN1451 for Latin), of course, lacked the needed glyphs. Not a problem, you might say: just add them to the font file and be done with it. Turns out it’s not that straightforward. While the mountain “letter” (U+26F0) worked fine, the font engine stubbornly refused to use my anchor (U+2693) glyph. The eventual solution was to move both glyphs from their standard codepoints (26F0 and 2693) to the so-called Private Use Area (U+Exxx). After that, the font engine started using whatever the font actually has.

Still not sure whether this is a Godot quirk, a system font engine quirk, or a Unicode nuance.

  • insomniac_lemon@lemmy.cafe
    link
    fedilink
    English
    arrow-up
    4
    ·
    edit-2
    8 days ago

    Not-an-anything but tinkered with custom fonts a bit. I didn’t have any issue replacing a couple of (grayscale) glyphs (fire / U+1F525, and upwards arrow / U+2191 ). So I wonder if it’s something else for you.

    I did have an issue with double glyphs (and this gave an error too) but it was at higher ranges (with eye / U+1F441) and not even with a custom glyph.

    I don’t know if it makes a difference, but the fallback font I made with FontForge. Also I did a few normal letters, too:

    Low-poly, freeform text in 3 forms: 2D, Textmesh, and label3D. They each say "Look" with a single-color fire icon, though the label3D has an outline and the 2D text has stacked outlines/shadows which add color (also, a default eye emoji on the 2D text).

    Also, I made a color override script (e.g. turn the upwards arrow green) but that only works for 2D text (uses RichTextEffects, a bit clunky IMO). That, and also color emojis are a bit wonky too, only 2D and outlines a bit off but that may be a font issue.

    EDIT: Technically it wasn’t a fallback font because the letters are part of it. But I just tested it as one (with Cantarell as the SystemFont) and the fire glyph still works.