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

Fix font feature range #172

Merged
merged 1 commit into from
May 5, 2022

Conversation

therahedwig
Copy link
Contributor

This fixes #170, applies on to of #169 and #171

I was wrong, it's not per run, just an issue of the encoding being different between the text and the harfbuzz buffer, which makes this fix a lot simpler. This should mean that ranges used for font_feature won't need to be converted to UTF32 beforehand.

The documentation says that every syntax supported by harfbuzz is
accepted, but the harfbuzz buffer raqm builds is always in UTF32,
while raqm itself keeps track of UTF8 or UTF16 ranges.

This converts the range from the other encoding to UTF32, like
is done for every other range-based function.
@therahedwig
Copy link
Contributor Author

Also rebased this one into a single commit, so it's easier to review.

if (fea.start != HB_FEATURE_GLOBAL_START)
{
if (rq->text_utf8)
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The curly brackets should be dropped for one line body.

Copy link
Collaborator

@khaledhosny khaledhosny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

{
if (rq->text_utf8)
{
fea.start = _raqm_u8_to_u32_index (rq, fea.start);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably need a helper function or a macro that encapsulates this logic, something like _rq_encoding_to_u32_index() that would check the encoding and do the mapping if necessary.

@khaledhosny khaledhosny merged commit efdc253 into HOST-Oman:master May 5, 2022
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.

Range for add_font_feature
2 participants