• 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
Re: Setting NSTextView's Font
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting NSTextView's Font


  • Subject: Re: Setting NSTextView's Font
  • From: Ramesh <email@hidden>
  • Date: Wed, 31 Mar 2004 15:06:02 +0530

I would like my NSTextView to only use one font, Monaco 10-pt. In the
awakeFromNib method I have:


[[self textStorage] addAttribute:NSFontAttributeName value:[NSFont
fontWithName:@"Monaco" size:10.0] range:NSMakeRange(0, [[[self
textStorage] mutableString] length])];


But this does not work. My first thought was simply to set the font in
the nib itself, but it only works if the field also has text in it,
otherwise it defaults to Helvetica 12.

Is there something I'm missing?

Yes.Its works only if some text already exits. Otherwise the font is not applied. Because an attribute gets added only if text exits in that range exists. Since there is not text in the beginning the font does not apply.


If you want to apply default font , i think use should use setFont: in NSTextView class.
------------------------------------------------------------------------ --
Ramesh PVK
Programmer
effigent India Pvt. Ltd.
ⅱ Home : 040 27227830
: 040 31148951
------------------------------------------------------------------------ --
In a world without walls and fences, who does still need Windows and Gates ?
_______________________________________________
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.


  • Prev by Date: Re: Changing subviews during drawing
  • Next by Date: Re: Distributed Objects pitfalls and strategies
  • Previous by thread: Re: Setting NSTextView's Font
  • Next by thread: Incompatible types error using vImage
  • Index(es):
    • Date
    • Thread