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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/raqm.c
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,29 @@ raqm_add_font_feature (raqm_t *rq,
if (!new_features)
return false;

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.

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.

}
else if (rq->text_utf16)
{
fea.start = _raqm_u16_to_u32_index (rq, fea.start);
}
}
if (fea.end != HB_FEATURE_GLOBAL_END)
{
if (rq->text_utf8)
{
fea.end = _raqm_u8_to_u32_index (rq, fea.end);
}
else if (rq->text_utf16)
{
fea.end = _raqm_u16_to_u32_index (rq, fea.end);
}
}

rq->features = new_features;
rq->features[rq->features_len] = fea;
rq->features_len++;
Expand Down