Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - QiuLei

Pages: [1]
1
NGUI 3 Support / bug : UILabel.GetUrlAtCharacterIndex()
« on: October 30, 2017, 03:16:31 AM »
   public string GetUrlAtCharacterIndex (int characterIndex)
   {
      string s = printedText;

      if (characterIndex != -1 && characterIndex < s.Length - 6)
      {
         int linkStart;

         // LastIndexOf() fails if the string happens to begin with the expected text
         if (s[characterIndex] == '[' &&
            s[characterIndex + 1] == 'u' &&
            s[characterIndex + 2] == 'r' &&
            s[characterIndex + 3] == 'l' &&
            s[characterIndex + 4] == '=')
         {
            linkStart = characterIndex;
         }
                        //Awlays return -1 here.
                        //String.LastIndexOf(string value, int startIndex),then second param means "endIndex", not “startIndex”.
                        //Maybe its a C# problem
         else linkStart = s.LastIndexOf("[url=", characterIndex);
         
         if (linkStart == -1) return null;

         ...
      }
      return null;
   }

2
NGUI 3 Support / NGUI Label SpacingX bug v3.9.8 & v3.11.2
« 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 ::)

Pages: [1]