Skip to content

Don't draw incorrect placeholder strings for empty unencoded glyphs#2486

Merged
justvanrossum merged 1 commit intomainfrom
no-placeholder-for-empty-zerowidth-glyphs
Mar 10, 2026
Merged

Don't draw incorrect placeholder strings for empty unencoded glyphs#2486
justvanrossum merged 1 commit intomainfrom
no-placeholder-for-empty-zerowidth-glyphs

Conversation

@justvanrossum
Copy link
Copy Markdown
Member

This removes some unnecessary and distracting placeholder glyphs when rendering Noto Nastaliq Urdu (for example).

Before:

image

After:

image

@khaledhosny, I wonder if there could be more cases where we don't want to show the guessed placeholder string in the canvas. At least for Noto Nastaliq Urdu, the rendered advance is a good indicator it seems.

@justvanrossum
Copy link
Copy Markdown
Member Author

Hm, wait, the problem may be different: these are empty glyphs, but they are also unencoded, so there should be no placeholder string to begin with. I need to look deeper.

@justvanrossum justvanrossum force-pushed the no-placeholder-for-empty-zerowidth-glyphs branch from f14217e to fbb8b59 Compare March 10, 2026 10:26
@justvanrossum
Copy link
Copy Markdown
Member Author

Hm, wait, the problem may be different: these are empty glyphs, but they are also unencoded, so there should be no placeholder string to begin with. I need to look deeper.

Yes, that was the better analysis. I've adjusted the change accordingly.

@justvanrossum justvanrossum changed the title Don't draw the guessed placeholder string if the rendered glyph has zero width Don't draw guessed placeholder strings for unencoded glyphs Mar 10, 2026
@justvanrossum justvanrossum changed the title Don't draw guessed placeholder strings for unencoded glyphs Don't draw incorrect placeholder strings for unencoded glyphs Mar 10, 2026
@justvanrossum justvanrossum merged commit 35da21c into main Mar 10, 2026
4 checks passed
@justvanrossum justvanrossum deleted the no-placeholder-for-empty-zerowidth-glyphs branch March 10, 2026 10:31
@justvanrossum justvanrossum changed the title Don't draw incorrect placeholder strings for unencoded glyphs Don't draw incorrect placeholder strings for empty unencoded glyphs Mar 10, 2026
@khaledhosny
Copy link
Copy Markdown
Contributor

I’m not sure I follow the change here, but a glyph returned from the shaper must exist in the font, no?

@justvanrossum
Copy link
Copy Markdown
Member Author

but a glyph returned from the shaper must exist in the font, no?

The placeholder glyph is also drawn for existing glyphs that are empty. The previous code accidentally assigned a placeholder string to unencoded glyphs based on the input string, which was nonsensical.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants