• 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: OK, but what do 'attributes' look like?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OK, but what do 'attributes' look like?


  • Subject: Re: OK, but what do 'attributes' look like?
  • From: Denis Stanton <email@hidden>
  • Date: Tue, 9 Mar 2004 19:03:25 +1300

Hi mmalc

Thanks for trying to guide me.

On Tuesday, March 9, 2004, at 05:51 PM, mmalcolm crawford wrote:

>
> On Mar 8, 2004, at 8:11 PM, Denis Stanton wrote:
>
>> can some one help me out with understanding the Cocoa documentation?
>> I
>> think this is one of those things that is considered so obvious that
>> the worthy documenters never bother to write it down.
>>
> Umm, from the class description of NSAttributedString:
> <http://developer.apple.com/documentation/Cocoa/Reference/Foundation/
> ObjC_classic/Classes/NSAttributedString.html>

I'm guessing the "Umm," prefix is shorthand for "this is so obvious.
Why doesn't he read the documentation?"
My problem is that I did read it but the documentation is not as
obvious to me as it was to the person who wrote it.

> "Constants
> An attributed string identifies attributes by name, storing a value
> under the name in an NSDictionary. You can assign any attribute
> name/value pair you wish to a range of characters, in addition to the
> standard attributes described in the Constants section of
> NSAttributedString Additions."

This appears to tell me that I am free to think up any name value pair
I want to. "You can assign any attribute name/value pair you wish ".
This doesn't make sense to me. Surely for the text to appear in a
certain font I have to identify that font using a name that the
compiler will recognise. Making up my own key value pair will not
communicate anything useful. What I'm looking for is the key value for
"font name". (No, it isn't "Font name".) and even some suggested names
of fonts, so that I will know how the compiler would like to see them
punctuated or capitalized (or is that "cased"?)

> Clicking on the link to Constants takes you to:
>
> <http://developer.apple.com/documentation/Cocoa/Reference/
> ApplicationKit/ObjC_classic/Classes/NSAttributedString.html>

Yes, I went there. I found:
Attribute Identifier NSFontAttributeName
Default Value Helvetica 12-point

so I wrote:
[myString drawInRect: myRect with attributes: [NSDictionary
dictionaryWithObject @"Helvetica 12-point" forKey:
NSFontAttributeName]];

The compiler was happy, but at run time I get an error:

*** -[NSConstantString pointsize]: selector not recognized

Unfortunately at that point (no pun intended) I became lost. Which
string is the NSConstantString? and who asked for its "pointsize"

What would be really nice would be just one example that works,.

Elsewhere in my code I am able to define the font for printing an
NSCell with
[self setFont: [NSFont fontWithName: @"Geneva" size: 9]];
That works well, but in the case I'm stuck on I don't want to print the
whole cell, just a selection of NSStrings within the NSCell.

Sorry if this sounds grumpy. I'm just finding it hard to explain.

Denis
_______________________________________________
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.


  • Follow-Ups:
    • Re: OK, but what do 'attributes' look like?
      • From: Dave Rosborough <email@hidden>
    • Re: OK, but what do 'attributes' look like?
      • From: mmalcolm crawford <email@hidden>
References: 
 >Re: OK, but what do 'attributes' look like? (From: mmalcolm crawford <email@hidden>)

  • Prev by Date: Re: OK, but what do 'attributes' look like?
  • Next by Date: Re: Encapsulate C struct/toll-free bridging?
  • Previous by thread: Re: OK, but what do 'attributes' look like?
  • Next by thread: Re: OK, but what do 'attributes' look like?
  • Index(es):
    • Date
    • Thread