Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guess glyph string for placeholder glyphs without code points #2010

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

khaledhosny
Copy link

See the discussion in #2005

This works in the font overview, but I didn’t manage to find the relevant code in editor, so editing such glyphs still does not shows blank placeholder.

@khaledhosny khaledhosny force-pushed the guess-placeholder-string branch from 95a1b50 to 7d8e70c Compare February 7, 2025 15:01
Guess placeholder string from glyph name for glyphs without code points.
Checks for the extensions used for Arabic positional forms and add Zero
Width Joiner as appropriate to force the desired positional form.

The glyph-shape-placeholder div needs dir="auto" as ZWJ gets ignored at
string boundaries if text direction is LTR (which is the default in
HTML). With dir="auto", the direction will be resolved based on the
string, so it will be RTL for Arabic text.
@khaledhosny khaledhosny force-pushed the guess-placeholder-string branch from 7d8e70c to 5b939de Compare February 8, 2025 21:35
@justvanrossum
Copy link
Collaborator

Thank you very much!

I wonder if the same can be achieved with the "associatedCodePoints" feature. This does roughly the same (including the "_" split), except it also takes the font's cmap/glyphMap into account, and only falls back to glyphs-data if the font doesn't define the base glyph name.

I think we can add associatedCodePoints as an (optional?) argument to the GlyphCell constructor.

Alternatively, we could consider decoupling the making of the placeholder string from the GlyphCell completely, and pass the placeholder string as an additional argument to the GlyphCell constructor.

As for the placeholder string in the canvas: let's indeed focus on the GlyphCell first, and I'll try to figure out what we need to do to make it work in the canvas, too.

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