Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: QiuLei on April 09, 2017, 11:23:13 PM
-
Hi, Tasharen.I recently upgrade my project from v3.9.8 to v3.11.2, and run into a Label SpacingX problem which I have fixed in v3.9.8. The problem in v3.9.8 is, when you input some Thai characters like "ยืนยัน" in a label, set Overflow to Resize Freely,and the label's SpacingX to 1,then it shows like:
ยืนยั
น
I tried to modify v3.9.8 NGUIText.cs at line 1610:
Original:
// Advance the position
x += (subscriptMode == 0) ? finalSpacingX + glyph.advance :
(finalSpacingX + glyph.advance) * sizeShrinkage;
Modified:
//Modify NGUI by Qiulei [2017-3-9] : 解决泰语ยืนยัน在有spacingX时,显示错位的bug。原因:计算逻辑宽度时去掉了不占宽度的space,但绘制时没有去掉对应的space
float charWidth = GetGlyphWidth(ch, prev);
float realSpacingX = 0;
if (charWidth != 0f)
{
realSpacingX = finalSpacingX;
prev = ch;
}
// Advance the position
x += (subscriptMode == 0) ? realSpacingX + glyph.advance :
(realSpacingX + glyph.advance) * sizeShrinkage;
But when I try to find out if v3.11.2 has soved this issue, I got a headache :(,the Label's SpacingX display is totally wrong:
If you want a Label show "abc" with Overflow Resize Freely,the SpacingX 10,it shows like:" abc" but not "a b c", apparently its a new bug.
I try to solve this by modifying v3.9.8 NGUIText.cs line 1015 and 1644."if (finalSpacingX < 0f) w += finalSpacingX;" to "w += finalSpacingX;",but it show " a b c " but not "a b c".
I don't want try to modify anything any more, and I hope you can solve this problem in next version :'(.
And hope Thai characters like "ยืนยัน" shows normally too ::)
-
I tried it on my end and the label was shown correctly. Perhaps it's part of something I fixed since the last release? I'll put up a new NGUI version within a week.
-
Thanks ;D
-
Similar problem in v3.11.4
If the text is longer than the size, it might display wrong like the attachment.
The input is "กฏขั้นพื้นฐานเกมส์" with spacing and shrink content.
I modify the code like QiuLei said, and it works.
(v3.11.4 NGUIText.cs at line 1015, line 1647)