Post

Replies

Boosts

Views

Activity

how to retrieve a writing direction?
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?
2
0
906
Jan ’22
how to retrieve a writing direction?
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?
Replies
2
Boosts
0
Views
906
Activity
Jan ’22