Re: NSTypesetter layoutParagraphAtPoint:
Re: NSTypesetter layoutParagraphAtPoint:
- Subject: Re: NSTypesetter layoutParagraphAtPoint:
- From: Aki Inoue <email@hidden>
- Date: Tue, 12 Aug 2008 21:38:09 -0700
You need to specify all essential glyph attributes for NSLayoutManager.
In this case, you're not specifying the "not shown" attribute for the
attachment. Attachment glyph should not be shown.
Aki
On 2008/08/12, at 19:54, chaitanya pandit wrote:
Hello,
Well i've been struggling with this for quite a while and would
appreciate if anyone could point me in the right direction.
I am trying to implement a custom NSTypesetter, to start with i just
want to lay 2 characters, an "A" and an inline image, thats it.
The character "A" gets drawn properly, but there is some problem
with the inLine image. I see a small square besides the inLine image.
Here is what i am doing in my custom NSTypesetter class, which i
have hard coded to draw just the two glyphs:
- (NSUInteger)layoutParagraphAtPoint:(NSPointPointer)
lineFragmentOrigin
{
// Begin para
[self beginParagraph];
// Begin Line
[self beginLineWithGlyphAtIndex:0];
// Start at 0,0 (the size of the inLine image is (53, 57))
NSRect r = NSMakeRect(0, 0, 100, 57);
NSPoint loc = NSMakePoint(0, 0);
// Set the line fragment rectangle for the entire glyph range
[super setLineFragmentRect:r forGlyphRange:NSMakeRange(0, 2)
usedRect:r baselineOffset:57];
// Set the location for "A"
[super setLocation:loc withAdvancements:0
forStartOfGlyphRange:NSMakeRange(0, 1)];
// Set the attachment size for the inLine image
[super setAttachmentSize:NSMakeSize(53, 57)
forGlyphRange:NSMakeRange(1, 1)];
// Position the image a bit further on the right of "A"
loc = NSMakePoint(21, 0);
[super setLocation:loc withAdvancements:0
forStartOfGlyphRange:NSMakeRange(1, 1)];
// End line
[self endLineWithGlyphRange:NSMakeRange(0, 2)];
// End para
[self endParagraph];
return 2;
}
Thanks,
Chaitanya
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden