开发者

Is there a trick for word wrapping with non-monospaced fonts?

开发者 https://www.devze.com 2023-02-01 06:08 出处:网络
I\'m having a bit of trouble right now trying to implement word wr开发者_运维技巧apping for non-monospaced fonts (The font can be different). I\'ve tried searching for this everywhere but couldn\'t fi

I'm having a bit of trouble right now trying to implement word wr开发者_运维技巧apping for non-monospaced fonts (The font can be different). I've tried searching for this everywhere but couldn't find a solution. Any tips?


How about this?

  • store length in pixels of every word
  • store pixel-offset of every word
  • when text gets inserted in a line, update the offsets and, if necessary, break the line
0

精彩评论

暂无评论...
验证码 换一张
取 消