Rightpoint / BonMot

Beautiful, easy attributed strings in Swift
MIT License
3.54k stars 196 forks source link

Consider emoji when removing kerning from last character #360

Closed LorDisturbia closed 5 years ago

LorDisturbia commented 5 years ago

The current implementation of removeKerningFromLastCharacter and restoreKerningOnLastCharacter start from the assumption that the last character range always has length 1. This however is not true for more complex characters, such as emojis. The consequence of this was a bug in which applying a style to a string that ended with an emoji, while keeping the flag stripTrailingKerning to its default value of true, would result in the emoji not being shown at all.

ZevEisenberg commented 5 years ago

@LorDisturbia thank you so much for reporting this! I'd love to have it get fixed and stay fixed. Would you mind adding some tests?

LorDisturbia commented 5 years ago

@ZevEisenberg PR updated with the test :)

LorDisturbia commented 5 years ago

@ZevEisenberg Let me know if need anything else from me in order to merge the PR. :)

ZevEisenberg commented 5 years ago

@LorDisturbia will do - I'll need a little time to review it, which I haven't had yet. Is this blocking you? Can you point your project at the branch? I'll try to get it landed when I've got some time. Thanks for adding tests!

LorDisturbia commented 5 years ago

@ZevEisenberg No worries, just wanted to check if you needed anything else. We already implemented a workaround in our project. :)

ZevEisenberg commented 5 years ago

Thanks! We've got a new co-op who is clearing some of the dust off BonMot and getting it building properly in the latest Xcode. Once we do that, we'll hopefully have some time to merge in some of the PRs that have been piling up. I'm excited to land this one!

LorDisturbia commented 5 years ago

I don't mind at all! I'm happy to know my fix is going to be included :)