Author Topic: Question about pixel - perfect in UILabel  (Read 2375 times)

galuodo

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 65
    • View Profile
Question about pixel - perfect in UILabel
« on: July 21, 2013, 10:36:20 PM »
I find texts sometimes show inappropriate. So I used Make pixel -perfect in the root node. However, some labels added 0.5 on local position x or y axis , others are not. As the result, most uilabel works well, however, rests display the text a little stretched. I manually add or remove the 0.5 on their local position then the problem solved. So I want to know however the pixel - perfect works, and what should I do to fix this problem.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Question about pixel - perfect in UILabel
« Reply #1 on: July 22, 2013, 04:44:14 AM »
0.5 is needed when the label is centered and has an odd size (not dividable by two, such as 31, 17, 23, etc). As I recall it was only like that in an earlier version in any case. What version of NGUI are you using?

galuodo

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 65
    • View Profile
Re: Question about pixel - perfect in UILabel
« Reply #2 on: July 22, 2013, 10:26:45 PM »
0.5 is needed when the label is centered and has an odd size (not dividable by two, such as 31, 17, 23, etc). As I recall it was only like that in an earlier version in any case. What version of NGUI are you using?

NGUI 2.6.2

  1.         if (cachedTransform.localRotation == Quaternion.identity)
  2.                         {
  3.                                 if ((x % 2 == 1) && (pivot == Pivot.Top || pivot == Pivot.Center || pivot == Pivot.Bottom)) pos.x += 0.5f;
  4.                                 if ((y % 2 == 1) && (pivot == Pivot.Left || pivot == Pivot.Center || pivot == Pivot.Right)) pos.y += 0.5f;
  5.                         }
  6.  

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Question about pixel - perfect in UILabel
« Reply #3 on: July 23, 2013, 05:11:22 AM »
That would explain it. That functionality was removed in 2.6.3. You always need to update to the latest before posting about issues :)