simoncozens / fontFeatures

Python library for manipulating OpenType font features
BSD 3-Clause "New" or "Revised" License
72 stars 9 forks source link

Deshaper #49

Open m4rc1e opened 3 years ago

m4rc1e commented 3 years ago

Still heavy wip.

This PR adds the ability to reverse a shaped buffer e.g

Buffer: الله After deshaping: ا ل ل ه

It basically does the reverse of the shaperLib/HB by applying the features/shaping steps in reverse order.

So far, I have a functioning Arabic deshaper. I plan to add a shaper each week so this may take a while. Whilst adding them, I'll definitely encounter edge cases I haven't considered. Once I have all niggles are sorted, I'll do a refactor so ignore the copy pasta for now.

My testing strategy is to take an unshaped buffer, shape it, deshape it and then check if the deshaped buffer resembles the original state.

This PR will deprecate #29

If anyone can think of a better name than deshaper, feel free. Perhaps simply calling it revert is better?

behdad commented 3 years ago

cc @khaledhosny