Get “actual” length of string in Unicode characters

后端 未结 2 916
悲哀的现实
悲哀的现实 2021-02-08 04:42

given a character like \"\" (\\xe2\\x9c\\xae), for example, can be others like \"Σ\", \"д\" or \"Λ\") I want to

2条回答
  •  死守一世寂寞
    2021-02-08 04:54

    My answer to a similar question:

    You are looking for the rendering width from the current output context. For graphical UIs, there is usually a method to directly query this information; for text environments, all you can do is guess what a conformant rendering engine would probably do, and hope that the actual engine matches your expectations.

提交回复
热议问题