Author Topic: Getting the size of a UILabel in pixels even if it is line width limited.  (Read 5523 times)

jimt

  • Guest
Hello I am using NGUIMath.CalculateRelativeWidgetBounds() along with scale to find the width of a UILabel in pixels. This works fine unless I have a line width set in the UILabel. In that case I get the size of the UILabel text line width instead of the actual text.

Is there a clever way of getting only the actual text width in pixels of a UILabel with a line width that is non-zero? (it works when the line width is 0 or unbounded)




ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
UIFont.CalculatePrintedSize will tell you what you want to know.