Questions tagged [ctlineref]

7 questions
26
votes
1 answer

What does it mean for a CTLine to have "string access"?

I'm trying to solve a hairy problem with UILabel, and I've gotten most of it figured out, except for one thing: I'm having a challenge understanding what it means for a CTLine to have "string access". The method that I'd like to use is…
bryanjclark
  • 6,247
  • 2
  • 35
  • 68
2
votes
0 answers

CTLineGetTypographicBounds in iOS -- ascent and descent are always coming back as zero

In an iOS category on NSAttributedString, I have the following: CTLineRef line = CTLineCreateWithAttributedString((CFAttributedStringRef)self); CGFloat ascent; CGFloat descent; double length = CTLineGetTypographicBounds(line, &ascent, &descent,…
William Jockusch
  • 26,513
  • 49
  • 182
  • 323
2
votes
3 answers

Does CTLineRef own attributed string?

I'm just getting started with programming GUIs on apple (so far the framework seems fine, but I find the documentation far less informative than others...Qt, .Net, java, etc). One of the issues I have had is understanding who owns what. For…
user1574591
  • 129
  • 1
  • 5
1
vote
1 answer

Objective C - Core Text Find index at position?

I am trying to get the index of the closest character to a point. The code below works perfectly fine as ling as my text alignment is set to left, as soon as I chage it to right or center it gives me the wrong index. What would be the solution to…
aryaxt
  • 76,198
  • 92
  • 293
  • 442
0
votes
4 answers

CTLine or NSAttributedString -- get image bounds without a graphics context?

Is this possible? Basically, I have a bunch of NSAttributedString objects and corresponding CTLine objects. I want to get the image bounds before the drawRect stage. So at this point, there is nothing to draw into. I will then use these image…
William Jockusch
  • 26,513
  • 49
  • 182
  • 323
0
votes
1 answer

Objective C - Core Text, number of characters in a line?

Given an index for current character, how can I determine the number of line that the selected character is at? Given a CTLine how can I determine the number of characters in it?
aryaxt
  • 76,198
  • 92
  • 293
  • 442
0
votes
1 answer

How to extract text string from a CTlineRef?

How to extract text string from a CTlineRef ? i know for example that i can do CTLineGetStringRange(aLine) and i have the AttributedString (ie: CFAttributedStringRef) that was used to generate the line. how to extract the text string from the…
zeus
  • 12,173
  • 9
  • 63
  • 184