Posts

Post not yet marked as solved
2 Replies
386 Views
I'd like to be able to retrieve a writing direction from an arbitrary string... but how? I have tried getGlyphsInRange:glyphs:properties:characterIndexes:bidiLevels:    NSLayoutManager* layoutManager = [[NSLayoutManager alloc] init];   NSTextStorage* textStorage = [[NSTextStorage alloc] initWithString:@"abc"];   [textStorage addLayoutManager:layoutManager];   NSRange stringRange=NSMakeRange(0,[@"abc" length]);   NSMutableData* glyphData=[NSMutableData dataWithLength:sizeof(CGGlyph)*stringRange.length+1];   CGGlyph* glyphs=(CGGlyph*)[glyphData mutableBytes];       unsigned char *bidiLevelBuffer = calloc([@"abc" length], sizeof(unsigned char));   int glyphCount = (int)[layoutManager getGlyphsInRange:stringRange                           glyphs:glyphs properties:NULL                      characterIndexes:NULL                         bidiLevels:bidiLevelBuffer];       NSLog(@"--- %i, \"%s\"", glyphCount, bidiLevelBuffer); with the result: 2021-12-29 10:39:54.694104+0300 aTypeTrainer4Mac[61412:3479843] --- 3, "" ... any ideas?
Posted Last updated
.