Setting font in textView not working
Setting font in textView not working
- Subject: Setting font in textView not working
- From: Christoph Gerdes <email@hidden>
- Date: Sun, 20 Oct 2002 22:07:56 +0200
Hi,
I'am trying to change the font in a NSTextView. This is what I do:
NSMutableDictionary attributes = new NSMutableDictionary();
attributes.setObjectForKey(NSFont.systemFontOfSize(16),
NSAttributedString.FontAttributeName);
NSAttributedString s = new NSAttributedString(new
NSData(somehtml.getBytes() ),
new java.net.URL(thisworks),
attributes);
textView.textStorage().appendAttributedString(s);
But this is not working. Strangely the value for
NSAttributedString.FontAttributeName in attributes is null after the AttributedString
is created.
I also tried a lot other variants:
NSMutableAttributedString string = new NSMutableAttributedString(s);
NSRange range = new NSRange(0, string.length() );
string.addAttributeInRange(NSAttributedString.FontAttributeName,
NSFont.systemFontOfSize(16) , range);
textView.textStorage().appendAttributedString(string);
Setting the default font with:
textView.setFont(NSFont.systemFontOfSize(16) ) doesn't work either.
What am I doing wrong?
Tia
Christoph
--
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.