revery-ui / revery

:zap: Native, high-performance, cross-platform desktop apps - built with Reason!
https://www.outrunlabs.com/revery/
MIT License
8.06k stars 196 forks source link

fix(text wrap): make UTF-8 aware #948

Closed zbaylin closed 4 years ago

zbaylin commented 4 years ago

Now that we have @OhadRau's revery-text-wrap in the monorepo, we need to make it UTF-8/Unicode aware so that we dont split on arbitrary byte boundaries. This was a big pain point when I was writing font-fallback, and this PR should fix it 👍

zbaylin commented 4 years ago

I should also note I made the measuring much faster because before we were iterating over each character in a string and measuring it, rather than measuring the whole string itself. This is much better from a caching point of view since we arent measuring the same string twice but in different ways. For measuring characters, I just create a singleton using Zed, which should be constant time.

github-actions[bot] commented 4 years ago

I have updated your lock dirs and formatted the code. Please @zbaylin pull the last commit before pushing any more changes.

OhadRau commented 4 years ago

Awesome! Changes look great