• 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
How can I get attributed string info in a form I can save?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How can I get attributed string info in a form I can save?


  • Subject: How can I get attributed string info in a form I can save?
  • From: Dave Camp <email@hidden>
  • Date: Tue, 8 Mar 2005 11:59:32 -0800

I'm working on a cross platform chat application. In the text entry area, the user can change text attributes (e.g. bold. italics, font, etc) we you would expect. I need to be able to capture the ranges of various attributes and encode them into something I can send over the network.

My first attempt that this used [NSAttributedString attributesAtIndex:effectiveRange:] to get the range for each set of attributes. However, it appears that changes like bold, italics, etc, are encoded into a single key/value pair like:

NSFont = "CGS Helvetica-Bold 12.00 pt. P [] (0x0035d6b0) fobj=0x0033b9c0, spc=3.33";
NSParagraphStyle = Alignment 4, LineSpacing 0, ParagraphSpacing 0, ParagraphSpacingBefore 0, HeadIndent 0, TailIndent 0, FirstLineHeadIndent 0, LineHeight 0/0, LineHeightMultiple 0, LineBreakMode 0, Tabs (28L, 56L, 84L, 112L, 140L, 168L, 196L, 224L, 252L, 280L, 308L, 336L), DefaultTabInterval 0;


I need to be able to encode the style information into some custom XML (very much like converting the text into HTML). I was hoping Cocoa would give me something broken down into more detail like:
font = Helvetica
bold = yes
size = 12.00 pt
etc...


How can I get more useful style information about the text? Am I really expected to be able to parse strings like those shown above? There must be another way of doing this.

Thanks,
Dave
---
You are in a maze of testy little Java VMs, all subtly different.

_______________________________________________
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: How can I get attributed string info in a form I can save?
      • From: Douglas Davidson <email@hidden>
  • Prev by Date: Enabling certain menus while in modal dialog
  • Next by Date: Re: NSEnumerator retaining objects?
  • Previous by thread: Re: Enabling certain menus while in modal dialog
  • Next by thread: Re: How can I get attributed string info in a form I can save?
  • Index(es):
    • Date
    • Thread