uikit icon indicating copy to clipboard operation
uikit copied to clipboard

feat: render synthetic solid blocks for missing glyphs

Open nyan-left opened this issue 3 weeks ago • 4 comments

When user-generated fonts lack the '?' character (used as fallback for missing glyphs), we now create a synthetic glyph that renders as a solid block instead of throwing an error.

We compute synthetic glyph metrics from font's average dimensions, as there's no single character that we can expect to be 'right'. Here's an example of a charset missing t.

Screenshot 2025-11-12 at 15 14 22

nyan-left avatar Nov 12 '25 15:11 nyan-left

Given it some further thought, should we perhaps always render missing as solid blocks and remove the ? fallback? Makes things more consistent.

@bbohlender be good to get your thoughts on this.

nyan-left avatar Nov 13 '25 10:11 nyan-left

@nyan-left I don't like making the shader more complex. Wdyt about just ignoring the character if there is no "?". If combined with your other proposals (event on missing glyph) the app would repair itself either way.

bbohlender avatar Nov 24 '25 20:11 bbohlender

@nyan-left I don't like making the shader more complex. Wdyt about just ignoring the character if there is no "?". If combined with your other proposals (event on missing glyph) the app would repair itself either way.

Agreed that the extra buffer is overkill, but visual cues are important to avoid silent failure.

E.g when rendering Dosage: 100mg with a missing m, we would end up with Dosage: 100g or Dosage: 100 g This is easy to miss and can have catastrophic consiquences. Dosage: 100â–ˆg is a lot easier to catch for both, developers and QA before it reaches end users.

The events are deffo useful, but the issue with relying on events is that not everyone is going to listen to them.

Imo the added complexity is a necessary evil.

We could use something like a negative UV or Alpha to signal "render block here". This removes the extra buffer, but feels more like a hack. I personally prefer the explicit buffer approach.

nyan-left avatar Nov 25 '25 04:11 nyan-left

@nyan-left I understand and agree. If you could make a minimal PR that removes the current question mark behavior and replaces it with the solid blocks behavior, that would be amazing.

bbohlender avatar Nov 25 '25 12:11 bbohlender

@bbohlender should be good. Lmk your thoughts :)

Screenshot 2025-11-26 at 15 41 48

nyan-left avatar Nov 26 '25 06:11 nyan-left