agathazeren / cuneiforbits

𒆩𒀩𒂷𒂷𒂷𒀖
1 stars 1 forks source link

How to determine cuneiform width #9

Closed agathazeren closed 4 years ago

agathazeren commented 4 years ago

unicode_width does not support getting the proper display width of cuneiform characters. I have searched for some code that does this, but cannot find any, nor does it seem that there is any standardization on this. I think that the only option would be to create our own library to do this.

yvnat commented 4 years ago

The width of the cuneiforms is strictly a display problem, and by good practice should be dealt with only by the struct responsible for display. That said, there also needs to be awareness of character width in the UI.

I suggest having the display deal with single-width characters (with wider characters obscuring the characters after them), and having the UI struct handle cuneiform width by means of a dictionary containing the approximate width of every cuneiform. That way, only dictionary of cuneiform widths needs to be maintained.

agathazeren commented 4 years ago

Yes, it would just be a dictionary (probably using a binary search). However, since this functionality is so orthogonal, I would factor it out into a separate crate. I think I'm going to do that.

agathazeren commented 4 years ago

I have successfully implemented this functionality in another crate: [github.com/asa-z/cuneiform_widths]