Visual alignment problems when using NSText drawAtPoint:withAttributes
Visual alignment problems when using NSText drawAtPoint:withAttributes
- Subject: Visual alignment problems when using NSText drawAtPoint:withAttributes
- From: John Fox <email@hidden>
- Date: Tue, 27 Sep 2005 20:12:56 -0700
Hello Nice Cocoa Folk:
I'm trying to draw some text that is vertically and horizontally
aligned within an NSBezier path that is itself a circle (I'm making a
label to represent the number of objects being dragged from my view).
Here's a snippet of my code:
myTextSize = [myLabel sizeWithAttributes:myAttributes];
myTextPoint = myCircleRect.origin;
myTextPoint.x += (myCircleRect.size.width / 2);
myTextPoint.y += (myCircleRect.size.height / 2);
myTextPoint.x -= (myTextSize.width / 2);
myTextPoint.y -= (myTextSize.height / 2);
[myLabel drawAtPoint:myTextPoint withAttributes:myAttributes];
The problem I'm seeing is that the visual alignment is not what I'm
hoping for: the text is off center to the left. Am I missing
something? I want my labels to resemble the labels that one sees in
Mail.app dock icon to indicate the number of unread messages. I've
experimented with boundingRectWithSize:options:attributes, and it
seems to work better, but still didn't look exactly right, and, I
need my app to run under 10.3.
Can some kind soul help me out, please?
Many thanks,
John
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden