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.


Messages - 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 / Re: NGUI Label SpacingX bug v3.9.8 & v3.11.2
« on: April 17, 2017, 08:30:54 AM »
 Thanks ;D

3
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 ::)

4
I finally got the answer here,thank you all :)

5
NGUI 3 Support / Re: Dynamic font are missing sometimes.
« on: March 05, 2014, 12:43:42 AM »
I wonder that whether the dynamic font missing problem has been fixed by ngui or unity by now :-\
Thanks, ArenMook,
I found a problem of my code regarding the UILocalize.cs KEY assignment by empty KEY may have condition cause Localization warning from Unity Editor log that may cause BMFont missing character as well. After I update fixed KEY for warning elimination, then the BMFont character missing issue disappeared.
So I had confirm the BMFont has no such problem at all. Sorry for confusion. :P

I think that should be Unity's problem from Unity RequestCharactersInTexture API, then I will submit a bug to Unity.

Besides, do you think Unity need to have a algorithm to avoid re-draw the same character from different times of requests.
Or that should be controlled by script, like an additional look up table to decide usage of existing character texture or request new?   ???

Pages: [1]