harfbuzz / harfbuzz

HarfBuzz text shaping engine
http://harfbuzz.github.io/
Other
3.66k stars 591 forks source link

[subset] If repacking fails for GSUB/GPOS retry with extension promotion. #4672

Closed garretrieger closed 1 month ago

garretrieger commented 1 month ago

In rare cases a subsetting operation may have expanded the non-extension space data enough to make it unable to be repacked. So if we encounter a case that does not repack successfully retry the operation with extension promotion recalculation enabled.

We don't do extension promotion by default since it's rarely needed and it will slow down repacking + increase the repacking size when enabled and not needed.

behdad commented 1 month ago

I dislike the option. I think we should just do what's right. I'm fine with promoting all lookups to extension if packing fails...

garretrieger commented 1 month ago

I dislike the option. I think we should just do what's right. I'm fine with promoting all lookups to extension if packing fails...

Alright, in that case I could do something like this: if repacking fails with overflows in space 0, then re-run the entire operation but with extension promotion enabled. How does that sound?

The downside is it will approx double repacking times in the rare cases which hit this scenario.

behdad commented 1 month ago

Sounds good. Thanks.

garretrieger commented 1 month ago

Sounds good. Thanks.

Ok, I'll rework this.

garretrieger commented 1 month ago

Sounds good. Thanks.

Ok, I'll rework this.

Done, please take another look.

behdad commented 1 month ago

I don't fully understand but I trust you know what you are doing. :)