Questions tagged [ctframe]
9 questions
3
votes
2 answers
CTFrame clipping first line of text
I am running into a problem while using Core Text, where the first line of the text I display in a CTFrame is cut off at the top, as seen in the screenshot below, with the character "B":
I think I'm doing something wrong while setting the leading…

Dominic Mortlock
- 284
- 3
- 11
1
vote
1 answer
Setting line spacing in a CTFrame
I'm working in a kind of QR Code generator, it's a Mac app.
I know how draw the text, but I don't know how I can set line spacing.
My code:
// Prepare font
CTFontRef font = CTFontCreateWithName(CFSTR("LucidaSansUnicode"), 16, NULL);
//…

PabloLerma
- 620
- 5
- 12
1
vote
1 answer
How do I determine the origin of a CGPath?
I'm drawing text within a CGPath, in order to do hit-testing on the text, I'm using CTFrameGetLineOrigins. Here's what the documentation says:
Each CGPoint is the origin of the corresponding line in the array of lines returned by CTFrameGetLines,…

kubi
- 48,104
- 19
- 94
- 118
1
vote
1 answer
Get previous CTFrame object from given text position with CoreText
Here's example code block
let attrString = NSAttributedString(string: "very long string goes here...") // very long string
var currentTextPos = 400 // current text position. ex. 400
let framesetter =…

Igor Prusyazhnyuk
- 133
- 2
- 14
- 29
1
vote
2 answers
How do you satisfy the 'lineOrigins' argument in CTFrameGetLineOrigins() in Swift?
I'm trying to figure out CTFrameGetLineOrigins from here: CTFrameGetLineOrigins Got Incorrect Origins, and trying to convert the ObjC to Swift.
Obj-C:
CFArrayRef lines = CTFrameGetLines(frame);
size_t numOfLines = CFArrayGetCount(lines);
CGPoint…

Kevin Wang
- 644
- 1
- 8
- 20
0
votes
1 answer
NSObliquenessAttributeName ignored by CTFrameDraw()
Something strange is going on. I was working with NSAttributedString for some formatting, including slants and skews. NSObliquenessAttributeName did the trick. But then I wanted to expand into CoreText to take control of the frame the text is…

Ryan Poolos
- 18,421
- 4
- 65
- 98
0
votes
2 answers
CTFrameGetLineOrigins return frong Y coordinates
All x coordinates are correct, but all y coordinates are incorrect - always 3.40282e+38.
How to get correct y for each CTLine?
CTFramesetterRef framesetter =…

7foots
- 21
- 1
- 3
0
votes
1 answer
How to add CTFrame to UIViewController?
The goal is to format and show text as like as iBooks style pages.
For this I take UIPageViewController, specify transition for needed animation and generate UIViewController collection and etc.
To show text I place UITextView into each…

RomanVD
- 25
- 1
- 2
- 7
0
votes
1 answer
CTFrameGetVisibleStringRange() returns 0
I have this code that generates an array of viewController while reading an NSAttributedString. After the first cycle, the function CTFrameGetVisibleStringRange() returns 0 even if there is more text to display.
- (void)buildFrames
{
/*here we do…

Lolloz89
- 2,809
- 2
- 26
- 41