On Jan 4, 2014, at 3:03 AM, Leonardo <mac.iphone....@gmail.com> wrote:

> I'm trying to export the content of my NSTextView to an HTML page.
> I get the HTML code using
> 
> NSDictionary      *attributes = [NSDictionary
> dictionaryWithObjectsAndKeys:NSHTMLTextDocumentType,
> NSDocumentTypeDocumentAttribute, nil];
> NSData              *htmlData = [textView dataFromRange:editedRange
> attributes error:NULL];

There’s no such method on NSTextView, and the last line isn’t even 
syntactically correct. I think you’re referring to the NSAttributedString method

- (NSData *)dataFromRange:(NSRange)range documentAttributes:(NSDictionary 
*)dict error:(NSError **)error;

which you’re probably calling on textView.textStorage.

Can  you show us some of the generated HTML with the incorrect font names?

> - if I use the font name Helvetica-LightOblique, it returns 'Helvetica
> Light'. And I get a different font look, as Times.

Yeah, that sounds wrong. By default CSS wants the font’s PostScript name, which 
is like “Helvetica-LightOblique”. It’s possible to reassign font names using 
@-directives in the CSS, but that seems like an unlikely thing for AppKit to be 
generating.

—Jens
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to