twitter-archive / twui

A UI framework for Mac based on Core Animation
Other
2.74k stars 268 forks source link

TUIAttributtedString: CTParagraphStyle not kept #86

Open erndev opened 12 years ago

erndev commented 12 years ago

I am using a TUIAttributted string, and i found a problem. When i set the lineheight, the Alignment/linebreak properties i previously defined are ignored, and the text is drawn using the default properties.

I located the problem in these functions:

In those methods, a new CTParagraphStyle object is created, but each method only sets the values for the values received, ignoring the values previously set.

The solution would be to recreate the CTParagrahStyleRef object with all the expected properties. I could fix it, but my doubt is how to implement it . The easiest way seemed to keep ivars for those values and recreate the CTParagraphStyle object, but currently, those methods belong to the NSMutableAttributedString (TUIAdditions) category, and categories cannot have ivars.

I can see other options:

any suggestion?