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

Sync with 2.8.2 #82

Merged
merged 14 commits into from
Oct 5, 2023
Merged

Conversation

bluebear94
Copy link
Collaborator

@bluebear94 bluebear94 commented Oct 5, 2023

Troublesome commits so far:

  • harfbuzz/harfbuzz@4f1e8d2, mostly because the upstream code is structured differently from ours
  • harfbuzz/harfbuzz@5585ea0 – the in_house::cluster_004 test fails:
    thread 'in_house::cluster_004' panicked at tests/shaping/in_house.rs:532:5:
    assertion `left == right` failed
      left: "uni0D4E=0+0|uni25CC=0+418|uni0D4D=1+0|space=2+0"
     right: "uni0D4E=0+0|uni25CC=0+418|uni0D4D=0+0|space=0+0"
    
    Could this be another rounding error? Not likely, the things that are wrong are the cluster indices.

@bluebear94
Copy link
Collaborator Author

It seems that the if (indic_plan->is_old_spec || end - start > 127) branch in initial_reordering_consonant_syllable is taken by HarfBuzz in the cluster_004 test, but the equivalent branch in RustyBuzz is not.

@bluebear94
Copy link
Collaborator Author

In HB’s data_create_indic, plan->map.chosen_script[0] turns out to be 0xFFFF. Why this value, I don’t know, but changing line 479 of our complex/indic.rs to

.map_or(true, |tag| tag.to_bytes()[3] != b'2');

makes cluster_004 pass.

… None

For some reason, HarfBuzz sometimes has this set to a concerning
0xFFFF. This will pass the `(plan->map.chosen_script[0] & 0x000000FFu) != '2'`
check.
@RazrFalcon
Copy link
Collaborator

RazrFalcon commented Oct 5, 2023

In HB’s data_create_indic, plan->map.chosen_script[0] turns out to be 0xFFFF.

0xFFFF is a special value in GSUB/GPOS. Maybe this.

@RazrFalcon
Copy link
Collaborator

Also:

/**
 * HB_OT_LAYOUT_NO_SCRIPT_INDEX:
 *
 * Special value for script index indicating unsupported script.
 */
#define HB_OT_LAYOUT_NO_SCRIPT_INDEX		0xFFFFu

@RazrFalcon
Copy link
Collaborator

RazrFalcon commented Oct 5, 2023

In rustybuzz we use None instead of 0xFFFF. Which leads to this confusion.
But also, I have no idea what (plan->map.chosen_script[0] & 0x000000FFu) != '2' suppose to check.

@RazrFalcon
Copy link
Collaborator

@behdad Would you mind clarifying this line of code? I know it's 11 years old, but still.

(plan->map.get_chosen_script (0) & 0x000000FF) != '2'

https://github.com/harfbuzz/harfbuzz/blob/f3584d3a3a627e38dfd7769975a670db340d2a48/src/hb-ot-shape-complex-indic.cc#L332

Why we're checking the last byte and why it must not be '2'/0x32?

@RazrFalcon
Copy link
Collaborator

RazrFalcon commented Oct 5, 2023

@bluebear94 harfbuzz/harfbuzz@855a3f4 doesn't affect us, right?

Or you haven't finished 2.8.2 yet?

@bluebear94
Copy link
Collaborator Author

@bluebear94 harfbuzz/harfbuzz@855a3f4 doesn't affect us, right?

I don’t believe it does.

Or you haven't finished 2.8.2 yet?

No, I still have some commits to go through.

@bluebear94
Copy link
Collaborator Author

I think these cover all the relevant changes.

@bluebear94 bluebear94 marked this pull request as ready for review October 5, 2023 09:14
@RazrFalcon RazrFalcon merged commit 4df182b into harfbuzz:master Oct 5, 2023
1 check passed
@RazrFalcon
Copy link
Collaborator

All good. Thanks!

@RazrFalcon
Copy link
Collaborator

5257 commits left...

@khaledhosny
Copy link
Contributor

khaledhosny commented Oct 5, 2023

@behdad Would you mind clarifying this line of code? I know it's 11 years old, but still.

(plan->map.get_chosen_script (0) & 0x000000FF) != '2'

https://github.com/harfbuzz/harfbuzz/blob/f3584d3a3a627e38dfd7769975a670db340d2a48/src/hb-ot-shape-complex-indic.cc#L332

Why we're checking the last byte and why it must not be '2'/0x32?

This is checking for old Indic script tags (deva vs dev2) the old tags trigger an old (and obsolete) processing model for backward compatibility with fonts designed against the old OpenType Indic spec.

@RazrFalcon
Copy link
Collaborator

Thanks. Not it makes sense.

@behdad
Copy link
Member

behdad commented Oct 5, 2023

(plan->map.get_chosen_script (0) & 0x000000FF) != '2'

The Indic scripts have two tags. Old and new. The old tag for Devanagari is deva whereas the new tag is dev2. All the new tags end with 2.

@RazrFalcon
Copy link
Collaborator

@behdad Thanks!

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.

4 participants