Attribute Fixing and NSAttachment
Attribute Fixing and NSAttachment
- Subject: Attribute Fixing and NSAttachment
- From: Steve Shepard <email@hidden>
- Date: Thu, 11 Aug 2005 13:21:53 -0700
The NSTextStorage attribute fixing code appears to be stripping NSFont
attributes from NSAttachments (see below). This is unfortunate because
it means that the text view uses the font from the default typing
attributes when the cursor is placed after an attachment.
Is there a better way to to work around the problem than subclassing
NSTextView and overriding setTypingAttributes: or (in 10.4)
implementing textView:shouldChangeTypingAttributes:toAttributes: and
special-casing attachments?
Example:
An NSAttributedString that is initialized like this:
Section {
NSFont = "Georgia-Bold 12.00 pt. P [] (0x003b6690)
fobj=0x003b4d50, spc=3.05";
NSParagraphStyle = Alignment 2, LineSpacing 0, ParagraphSpacing
12, ParagraphSpacingBefore 324, HeadIndent 0, TailIndent 0,
FirstLineHeadIndent 36, LineHeight 0/0, LineHeightMultiple 2,
LineBreakMode 0, Tabs (28L, 56L, 84L, 112L, 140L, 168L, 196L, 224L,
252L, 280L, 308L, 336L), DefaultTabInterval 0, Blocks (null), Lists
(null), BaseWritingDirection -1, HyphenationFactor 0, TighteningFactor
0.05, HeaderLevel 0;
}?{
NSAttachment = <NSTextAttachment: 0x3b5040>;
NSBaselineOffset = -3;
NSFont = "Georgia-Bold 12.00 pt. P [] (0x003b6690)
fobj=0x003b4d50, spc=3.05";
NSParagraphStyle = Alignment 2, LineSpacing 0, ParagraphSpacing
12, ParagraphSpacingBefore 324, HeadIndent 0, TailIndent 0,
FirstLineHeadIndent 36, LineHeight 0/0, LineHeightMultiple 2,
LineBreakMode 0, Tabs (28L, 56L, 84L, 112L, 140L, 168L, 196L, 224L,
252L, 280L, 308L, 336L), DefaultTabInterval 0, Blocks (null), Lists
(null), BaseWritingDirection -1, HyphenationFactor 0, TighteningFactor
0.05, HeaderLevel 0;
}:{
NSFont = "Georgia-Bold 12.00 pt. P [] (0x003b6690)
fobj=0x003b4d50, spc=3.05";
NSParagraphStyle = Alignment 2, LineSpacing 0, ParagraphSpacing
12, ParagraphSpacingBefore 324, HeadIndent 0, TailIndent 0,
FirstLineHeadIndent 36, LineHeight 0/0, LineHeightMultiple 2,
LineBreakMode 0, Tabs (28L, 56L, 84L, 112L, 140L, 168L, 196L, 224L,
252L, 280L, 308L, 336L), DefaultTabInterval 0, Blocks (null), Lists
(null), BaseWritingDirection -1, HyphenationFactor 0, TighteningFactor
0.05, HeaderLevel 0;
}
becomes the following when inserted in an NSTextStorage:
Section {
NSFont = "Georgia-Bold 12.00 pt. P [] (0x003b6690)
fobj=0x003b4d50, spc=3.05";
NSParagraphStyle = Alignment 2, LineSpacing 0, ParagraphSpacing
12, ParagraphSpacingBefore 324, HeadIndent 0, TailIndent 0,
FirstLineHeadIndent 36, LineHeight 0/0, LineHeightMultiple 2,
LineBreakMode 0, Tabs (28L, 56L, 84L, 112L, 140L, 168L, 196L, 224L,
252L, 280L, 308L, 336L), DefaultTabInterval 0, Blocks (null), Lists
(null), BaseWritingDirection -1, HyphenationFactor 0, TighteningFactor
0.05, HeaderLevel 0;
}?{
NSAttachment = <NSTextAttachment: 0x3b5040>;
NSBaselineOffset = -3;
NSParagraphStyle = Alignment 2, LineSpacing 0, ParagraphSpacing
12, ParagraphSpacingBefore 324, HeadIndent 0, TailIndent 0,
FirstLineHeadIndent 36, LineHeight 0/0, LineHeightMultiple 2,
LineBreakMode 0, Tabs (28L, 56L, 84L, 112L, 140L, 168L, 196L, 224L,
252L, 280L, 308L, 336L), DefaultTabInterval 0, Blocks (null), Lists
(null), BaseWritingDirection -1, HyphenationFactor 0, TighteningFactor
0.05, HeaderLevel 0;
}:
{
NSFont = "Georgia-Bold 12.00 pt. P [] (0x003b6690)
fobj=0x003b4d50, spc=3.05";
NSParagraphStyle = Alignment 2, LineSpacing 0, ParagraphSpacing
12, ParagraphSpacingBefore 324, HeadIndent 0, TailIndent 0,
FirstLineHeadIndent 36, LineHeight 0/0, LineHeightMultiple 2,
LineBreakMode 0, Tabs (28L, 56L, 84L, 112L, 140L, 168L, 196L, 224L,
252L, 280L, 308L, 336L), DefaultTabInterval 0, Blocks (null), Lists
(null), BaseWritingDirection -1, HyphenationFactor 0, TighteningFactor
0.05, HeaderLevel 0;
}
-Steve
_______________________________________________
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