Questions tagged [catextlayer]

A CATextLayer is a Core Animation layer for showing text. It allows the displaying of simple and attributed strings as well.

A CATextLayer is a Core Animation layer for showing text. It allows the displaying of simple and attributed strings as well by assigning a CFString or CFAttributedStringto its property string.

Documentation:

140 questions
2
votes
1 answer

CATextLayer on the top of CALayer?

I am trying to get this CATextLayer on top of my CALayer using zPosition, but the CATextLayer seems to always be behind the CALayer? CALayer *sublayer = [CALayer layer]; sublayer.backgroundColor = [UIColor colorWithRed:0/255.0 green:156.0/255.0…
user1017058
2
votes
1 answer

Characters in a wrapped CATextLayer are partially cut off

I have this code that creates a CATextLayer and draws it onto a UIView: - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. CGRect viewRect = CGRectMake(50.0f, 50.0f, 345.0f, 120.0f); …
d-squared
  • 107
  • 2
  • 9
1
vote
2 answers

How to get CATextLayer’s wrapping count in order to calculate height

I am adding text incrementally to a wrapping CATextLayer in a UIScrollView. Each time I add text, I need to add height to the textLayer and to the scrollView’s contentSize, and adjust the scrollView’s contentOffset. (The user should be able to use…
Wienke
  • 3,723
  • 27
  • 40
1
vote
1 answer

Use CATextLayer with CGContext

I need to draw text into a CGContext and want to use CATextLayer to set the text. Can anyone give me some steps as to how it'll be done. I've written some code for it, but don't know the correctness of it (since I'm new to iPhone Development). Some…
nikj
  • 13
  • 5
1
vote
1 answer

extract the structure of a letter

Say I have the letter 'a'. My objective is to redraw the letter using 'little colored flowers'. How do I extract the path/structure/blueprint of a letter in order to use it as a path for my custom draw?
Alex Tau
  • 2,639
  • 4
  • 26
  • 30
1
vote
1 answer

Animate CATextLayer based on UISlider action

I am having some problems getting this animation to execute. I have a feeling there are probably a few problems with it, but am having trouble finding the right direction. I would like to pulse (scale up and down) a CATextLayer while the user is…
taylormade201
  • 696
  • 2
  • 9
  • 25
1
vote
1 answer

Scaled preview: use NSTextView, NSTextField, CATextLayer, or drawInRect?

I'm programming a cocoa app that presents text (vertically and horizontally) centered on a projector screen. I'd like to have a small preview of what I see on the "wall" in a cocoa window on the computer's screen (in a NSCollectionView). Just like…
user950473
  • 409
  • 4
  • 4
1
vote
1 answer

How to rotate the text in a CATextLayer?

I'm displaying some text in a CATextLayer but its to large to fit in the defined rect. I would like to have the text rotate slowly so it can all be read. I have no idea how to do that though. I'm hoping there is a relatively easy way to do this and…
Justin808
  • 20,859
  • 46
  • 160
  • 265
1
vote
0 answers

CATextLayer is blurry on non-retina display

On a non-retina display (Mac), my CATextLayer instances produce text that is blurrier than what I get with NSAttributedString's -drawAtPoint: See for yourself: At the top, a CATextLayer instance (contentsScale property is 1.0, which corresponds to…
jeanlain
  • 382
  • 1
  • 3
  • 13
1
vote
1 answer

Different font output for same NSAttributedString with CATextLayer and NSTextView

In macOS using the same NSMutableAttributedString for a CATextLayer and a NSTextView seems to give different rendering results. The NSTextView has a slightly larger font than a CATextLayer. This behavior seems to occur with any type of font…
1
vote
1 answer

Is it possible to draw strings with custom paragraph styles in CATextLayer?

I want to draw a list like this: 1. List item 1 2. List item 2 3. List item 3 Here is my code: NSTextList *list = [[NSTextList alloc] initWithMarkerFormat:@"{decimal}" options:0]; NSMutableParagraphStyle *paragraph = [[NSParagraphStyle…
Kentzo
  • 3,881
  • 29
  • 54
1
vote
0 answers

Insert CATextLayer inside UIBezierPath and rotate

In the following example I'm trying to insert a CATextLayer inside a UIBezierPath and rotate it -45 degrees. class DiagonalView: UIView { override func draw(_ rect: CGRect) { let path = UIBezierPath() path.move(to: .init(x:…
Konstantinos Natsios
  • 2,874
  • 9
  • 39
  • 74
1
vote
0 answers

Issue while assigning UITextView frame to CATextLayer

I'm retrieving subviews(UITextView) from the UIImageView and with the content of the UITextView I'm creating CATextLayer to add in the video file because I need to show each frame for a particular timeframe. I was able to copy most of the attributes…
Hemant Singh Rathore
  • 2,153
  • 1
  • 24
  • 38
1
vote
1 answer

Is it possible to add a UILabel or CATextLayer to a CGPath in Swift, similar to Photoshop's type to path feature?

I would like to add text, whether it be a UILabel or CATextLayer to a CGPath. I realize that the math behind this feature is fairly complicated but wondering if Apple provides this feature out of the box or if there is an open-source SDK out there…
John Martz
  • 49
  • 2
1
vote
0 answers

How can I vertically center multiple lines of text in a CATextLayer?

I'm trying to vertically align text that has multiple lines inside a CATextLayer. I'm working off the code from this answer (which is for one line), and adding in a calculation for the number of lines, but the text is getting moved out of the frame.…
brontea
  • 555
  • 4
  • 14