Skip navigation.
 
mlcontrolling width of space character
FROM : Jae Ho Lee
DATE : Sun Jul 09 18:14:59 2006

Hi everyone,

I am using Cocoa Text System in my application and I need to
control the width of space character.

I read NSTypetter's document which tells me below and I am figuring I 
could map space character
to NSControlGlyph to control width of space character.

"NSTypesetter's document says boundingBoxForControlGlyphAtIndex: 
method returns the bounding
rectangle for the control glyph and the typesetter calls this method 
when it encounterr an NSControlGlyph.
And NSGlyphGenerator can choose whether or not to map control 
characters to NSControlGlyph."

What I don't understand is how to use NSGlyphGenerator to map space 
character to NSControlGlyph.
I tried to subclass NSGlyphGenerator and override 
generateGlyphsForGlyphStorage: method and then called
NSLayoutManager's setGlyphGenerator: method.

- (void)generateGlyphsForGlyphStorage:(id <NSGlyphStorage>)
glyphStorage desiredNumberOfCharacters:(unsigned int)nChars 
glyphIndex:(unsigned int *)glyphIndex characterIndex:(unsigned int *)
charIndex {
   NSLog(@"generateg glyphs:%d atGlyphIndex:%d atCharacterIndex:%d", 
nChars, *glyphIndex, *charIndex);
   [super generateGlyphsForGlyphStorage:glyphStorage 
desiredNumberOfCharacters:nChars glyphIndex:glyphIndex 
characterIndex:charIndex];
}

All I did is to pass the method call to super, but I am getting error 
message.

What am I doing wrong here?

Thanks in advance,

Jaeho

Related mailsAuthorDate
No related mails found.