Re: NSHTMLTextDocumentType returns wrong font names
Re: NSHTMLTextDocumentType returns wrong font names
- Subject: Re: NSHTMLTextDocumentType returns wrong font names
- From: Leonardo <email@hidden>
- Date: Sun, 05 Jan 2014 22:06:44 +0100
- Thread-topic: NSHTMLTextDocumentType returns wrong font names
Here¹s the repository containing my HTML pages
https://github.com/leonardodev/htmlpages
Regards
-- Leonardo
Da: Jens Alfke <email@hidden>
Data: Sat, 4 Jan 2014 13:40:09 -0800
A: Leonardo <email@hidden>
Cc: <email@hidden>
Oggetto: Re: NSHTMLTextDocumentType returns wrong font names
On Jan 4, 2014, at 3:03 AM, Leonardo <email@hidden> 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 (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