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
[buffer] Add hb_buffer_set_not_found_variation_selector_glyph() #4529
base: main
Are you sure you want to change the base?
Conversation
0f44cc9
to
bdfd77c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for adding that so quickly. Some comments below, but these are merely questions for discussing functional aspects to deepen my understanding.
If possible, could you add a test with VS codepoint sequence and and a glyph output with replacement glyph configured and left at default so that the test covers the difference?
* in the font during shaping. | ||
* | ||
* The not-found-variation-selector glyph defaults to #HB_CODEPOINT_INVALID, | ||
* in which case it will be removed from the glyph string during shaping. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in which case it will be removed from the glyph string during shaping.
I don't fully understand this part of the sentence. HB_CODEPOINT_INVALID
is used as an indicator for a not-found glyph, not a codepoint, right? - When/why would HB_CODEPOINT_INVALID
be removed? Wouldn't usually the shape result be a 0 gid, .notdef glyph? Or would variation selectors usually be ignored and hence not show up in the shape result?
In any case, perhaps this could be elaborated on in this doc comment a bit?
(void) buffer->next_glyph (); | ||
if (buffer->not_found_variation_selector != HB_CODEPOINT_INVALID) | ||
{ | ||
_hb_glyph_info_clear_default_ignorable (&buffer->cur()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious: So this line removes the DEFAULT_IGNORABLE flag from the glyph, so that it's not eventually ignored but output with the glyph id that's configured using the new API?
@@ -377,6 +379,9 @@ shape_options_t::add_options (option_parser_t *parser) | |||
{"remove-default-ignorables",0, 0, G_OPTION_ARG_NONE, &this->remove_default_ignorables, "Remove Default-Ignorable characters", nullptr}, | |||
{"invisible-glyph", 0, 0, G_OPTION_ARG_INT, &this->invisible_glyph, "Glyph value to replace Default-Ignorables with", nullptr}, | |||
{"not-found-glyph", 0, 0, G_OPTION_ARG_INT, &this->not_found_glyph, "Glyph value to replace not-found characters with", nullptr}, | |||
{"not-found-variation-selector-glyph", | |||
0, 0, G_OPTION_ARG_INT, &this->not_found_variation_selector_glyph, | |||
"Glyph value to replace not-found variation-selector characters with", nullptr}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which do get replaced: the base glyph/cluster + VS both, or only the VS so that the VS triggers the insertion of a not-found-vs-glyph in the glyph buffer, but the base glyph may be shaped?
* @buffer: An #hb_buffer_t | ||
* @not_found_variation_selector: the not-found-variation-selector #hb_codepoint_t | ||
* | ||
* Sets the #hb_codepoint_t that replaces variation-selector characters not resolved |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, only the VS gets replaced, but the base glyph may be shaped? So our "is cluster shaped?" analysis can detect the cluster as potentially incompletely shaped and do something about it or choose to ignore?
Fixes #4398