• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSTypesetter layoutParagraphAtPoint:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTypesetter layoutParagraphAtPoint:


  • Subject: Re: NSTypesetter layoutParagraphAtPoint:
  • From: Aki Inoue <email@hidden>
  • Date: Wed, 13 Aug 2008 16:08:44 -0700

Each glyph should have the location, not shown, draws outside line fragment, and bidi level in order for NSLayoutManager to properly render.
Usually the default values for attributes other than the location is fine.


Please file a bug for documentation enhancement.

Thanks,

Aki

On 2008/08/13, at 14:04, chaitanya pandit wrote:

Thanks Aki, that what exactly what i was looking for.
Is there any documentation that describes other essential attributes that i need to set?
Thanks again,
Chaitanya


On 13-Aug-08, at 12:38 AM, Aki Inoue wrote:

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


References: 
 >NSTypesetter layoutParagraphAtPoint: (From: chaitanya pandit <email@hidden>)
 >Re: NSTypesetter layoutParagraphAtPoint: (From: Aki Inoue <email@hidden>)
 >Re: NSTypesetter layoutParagraphAtPoint: (From: chaitanya pandit <email@hidden>)

  • Prev by Date: Re: Controlling line-breaking in a text view
  • Next by Date: Re: Core Data Bindings. weird behavior.
  • Previous by thread: Re: NSTypesetter layoutParagraphAtPoint:
  • Next by thread: Core Data Bindings. weird behavior.
  • Index(es):
    • Date
    • Thread