• 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: Cocoa doesn't use my fonts - all fonts are system fonts
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa doesn't use my fonts - all fonts are system fonts


  • Subject: Re: Cocoa doesn't use my fonts - all fonts are system fonts
  • From: Stefan <email@hidden>
  • Date: Fri, 4 Aug 2006 20:24:07 +0200


Am 04.08.2006 um 20:16 schrieb Shawn Erickson:

On 8/4/06, Stefan <email@hidden> wrote:
I created a NSView subclass and use

 >>
NSFont* font1= [NSFont fontWithName:@"Times-Roman" size:20.0];
<<

to create a font. Then, during (void)drawRect:(NSRect)rect, I set the
font using

 >>>
[font1 set];
<<<

I get the correct line line-height of the font, but all fonts appear
on screen
and on print as system fonts of default size.

Can you outline what you are drawing in your drawRect: and how you are drawing it?

With that said I have a feeling that you may not be retaining the font
you create correctly based on the code you have so far listed (however
I would expect a crash not a silent failure).

No, nothing crashed. In fact,

>>>
	[font1 set];
<<<

seems to be a no-op. I used

>>>
	[@"Sample" drawAtPoint:aPoint withAttributes:nil];
<<<

Now, I tried adding a dictionary using withAttributes: and define its
properties using

>>>
drawDict2 = [NSDictionary dictionaryWithObject:font2 forKey:NSFontAttributeName];
<<<


which immediately succeeded. Not sure, but this feels like a bug. I really wonder,
why accessing font metrics worked, while drawing the font failed....


Anyway, I managed to make it work.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Cocoa doesn't use my fonts - all fonts are system fonts
      • From: Douglas Davidson <email@hidden>
References: 
 >Cocoa doesn't use my fonts - all fonts are system fonts (From: Stefan <email@hidden>)
 >Re: Cocoa doesn't use my fonts - all fonts are system fonts (From: "Shawn Erickson" <email@hidden>)

  • Prev by Date: Re: Cocoa doesn't use my fonts - all fonts are system fonts
  • Next by Date: Re: File changed notification
  • Previous by thread: Re: Cocoa doesn't use my fonts - all fonts are system fonts
  • Next by thread: Re: Cocoa doesn't use my fonts - all fonts are system fonts
  • Index(es):
    • Date
    • Thread