• 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: Drawing text with specifying font
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drawing text with specifying font


  • Subject: Re: Drawing text with specifying font
  • From: Don Messerli <email@hidden>
  • Date: Fri, 06 Jul 2001 16:28:37 -0400

Hi Candide,

Here is how I do it:

NSString *label;
NSFont *font = [NSFont systemFontOfSize: 18];
NSColor *color = [NSColor yellowColor];
NSMutableDictionary *attrs = [NSMutableDictionary dictionary];

[attrs setObject: font forKey: NSFontAttributeName];
[attrs setObject: color forKey: NSForegroundColorAttributeName];

label = [NSString stringWithFormat: @"%s", rowLabels[y]];
[label drawAtPoint: NSMakePoint(20, 49 + (y*40)) withAttributes: attrs];


Don


On 7/6/01 1:52 PM, "Candide Kemmler" <email@hidden> wrote:

> Hi !
>
> I'm trying to draw text with various transformations and a font.
>
> The transformations work, but I can't specify the font.
>
> I tried [ NSFont set ] (you know what I mean), but when I do
>
> [NSString drawAtPoint:p withDictionary:nil ],
>
> the font remains to a default value.
>
> Perhaps I should consider the dictionary to be provided. But in the
> absence of any doc, I just set it to nil.
>
> Does anyone know how to handle this ?
>
> Candide
>
> PS: it seems to me that specifying a dictionary at every drawString is a
> huge overhead...
> _______________________________________________
> cocoa-dev mailing list
> email@hidden
> http://www.lists.apple.com/mailman/listinfo/cocoa-dev


References: 
 >Drawing text with specifying font (From: Candide Kemmler <email@hidden>)

  • Prev by Date: Re: Let's hope XP doesn't keep this "one-up" on OS X!
  • Next by Date: Draw firstResponder status
  • Previous by thread: Re: Drawing text with specifying font
  • Next by thread: NSTableView Drag & Drop again...
  • Index(es):
    • Date
    • Thread