• 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
Attribute Fixing and NSAttachment
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Attribute Fixing and NSAttachment
      • From: "Timothy J. Wood" <email@hidden>
  • Prev by Date: Re: localized compare and SQLite persistent store
  • Next by Date: How best to cache/preload an NSImage?
  • Previous by thread: NSButton's background turning white instead of transparent?
  • Next by thread: Re: Attribute Fixing and NSAttachment
  • Index(es):
    • Date
    • Thread