• 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: Newbie: NSGlyph <-> unicode ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie: NSGlyph <-> unicode ?


  • Subject: Re: Newbie: NSGlyph <-> unicode ?
  • From: "Anabelle Masour" <email@hidden>
  • Date: Tue, 08 Jan 2002 23:49:28 +0000

Thanks you to Raphaele.Sebbe and AndyT. I got the information, that I needed to use NSLayoutManager! I am sure now that NSFont does not have the methods, which is strange.

I was able to write a method now to converst a NSString to NSGlyph data. I still have a problem to convert from NSGlyph to unichar. But I think I can avoid it.


Thank you very much. You were very helpful.


@implementation NSFont ( AMGlyph)


- (NSMutableData *) glyphsForString:(NSString *) string {
NSTextStorage *textStorage;
NSLayoutManager *layoutManager;
NSMutableData *glyphs;
NSDictionary *attributes;
unsigned int numberOfGlyphs;

attributes = [NSDictionary dictionaryWithObject:self forKey:NSFontAttributeName];
textStorage = [[[NSTextStorage alloc] initWithString:string attributes:attributes] autorelease];

layoutManager = [[NSLayoutManager alloc] init];
[textStorage addLayoutManager:layoutManager];
[layoutManager release];

numberOfGlyphs = [layoutManager numberOfGlyphs];

glyphs = [NSMutableData dataWithLength:sizeof( NSGlyph) * numberOfGlyphs];
[layoutManager getGlyphs:(NSGlyph *) [glyphs mutableBytes] range:NSMakeRange( 0, numberOfGlyphs)];
return( glyphs);
}


<Anabelle
.........
Rien ne sert de courir si on n'est pas pressi
et rien ne sert de marcher si on n'est pas foutu de tenir debout.


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


  • Prev by Date: Re: iPhoto plugins?
  • Next by Date: Re: Newbie: NSGlyph <-> unicode ?
  • Previous by thread: Re: iPhoto plugins?
  • Next by thread: Re: Newbie: NSGlyph <-> unicode ?
  • Index(es):
    • Date
    • Thread