Closed ericyangpan closed 9 years ago
Could you also include a test for this in spec?
By the way, would using something like https://www.npmjs.com/package/wcwidth work in this case (or in case of mixed half- and full-width forms)? I don't have any monospace CJK fonts installed, and I don't usually use those I have anyway, so I figured I'd better ask.
I have provisionally merged your commit, but it does not work for halfwidth unicode characters, as, for example ★,☆. I'm still awaiting your comment on my suggestion to use wcwidth, or an example of behavior you're fixing here (in specs or otherwise)
@lierdakil thanks.
There is an example:
code | 描述 | 详细解释 |
---|---|---|
200 | 成功 | 成功 |
400 | 错误请求 | 该请求是无效的,详细的错误信息会说明原因 |
401 | 验证错误 | 验证失败,详细的错误信息会说明原因 |
403 | 被拒绝 | 被拒绝调用,详细的错误信息会说明原因 |
404 | 无法找到★ | 资源不存在 |
429 | 过多的请求★ | 超出了调用频率限制,详细的错误信息会说明原因 |
500 | 内部服务错误 | 服务器内部出错了,请联系我们尽快解决问题 |
504 | 内部服务响应超时 | 服务器在运行,本次请求响应超时,请稍后重试 |
It's really works with ★
I will add to spec and confirm wcwidth later.
So on your font, stars are actually fullwidth. Sigh. There seems to be no silver bullet for this then. To illustrate what I'm talking about, here's an example renderings of exactly same text in two different fonts with exactly same size:
Only a few of fonts is 50% Fixed-Halfwidth, for example, http://mplus-fonts.sourceforge.jp/mplus-outline-fonts/index-en.html others are not 50%.
What I'm getting at, is that in monospace font, stars etc should probably be fixed-halfwidth by unicode spec, if I'm reading it right. But some (most?) CJK fonts don't respect that. Which is a letdown.
I've implemented wcwidth method in #15, so I'll close this PR. We can continue discussion there if needed.
Cool
Miss in just function.