1

I know I can use: CGSize R = [myString sizeWithFont:uiFont]; But the problem is that I do not have UIFont, I use Core Text. So I have CTFontRef. Any way to get the string size with the givet CTFontRef? I also have font size in double.

Thank you

exebook
  • 32,014
  • 33
  • 141
  • 226

1 Answers1

0

you can create a CTFramesetter then use CTFramesetterSuggestFrameSizeWithConstraints to measure the dimensions of a string when rendered as text -- using the additional context you provide.

of course, you could create a function which reduces the variables to font+size from there.

justin
  • 104,054
  • 14
  • 179
  • 226