uikit
uikit copied to clipboard
feat: render synthetic solid blocks for missing glyphs
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.
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 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.
@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 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 should be good. Lmk your thoughts :)