Sto usando CATextLayer, per utilizzare un carattere personalizzato in iOS, so che c'è un modo semplice per usare un carattere personalizzato con Fonts provided by application
ma questo è un font diverso. Mi stavo chiedendo c'è un modo per cambiare la spaziatura tra ogni personaggio? Non ho trovato nessuna proprietà per farlo!CATextLayer e tracciamento/spaziatura tra caratteri
Modificato:
- (void)viewWillAppear:(BOOL)animated {
CTFontRef font = [self newCustomFontWithName:@"yeki"
ofType:@"ttf"
attributes:[NSDictionary dictionaryWithObject:[NSNumber numberWithFloat:16.f]
forKey:(NSString *)kCTFontSizeAttribute]];
CGRect screenBounds = [[UIScreen mainScreen] bounds];
normalTextLayer_ = [[CATextLayer alloc] init];
normalTextLayer_.font = font;
normalTextLayer_.string = str;
normalTextLayer_.wrapped = YES;
normalTextLayer_.foregroundColor = [[UIColor purpleColor] CGColor];
normalTextLayer_.fontSize = 50.f;
normalTextLayer_.alignmentMode = kCAAlignmentRight;
normalTextLayer_.frame = CGRectMake(0.f,100.f, screenBounds.size.width, screenBounds.size.height /1.f);
[self.view.layer addSublayer:normalTextLayer_];
CFRelease(font);
}
Intendi il kerning? Puoi provare a usare 'CGContextSetCharacterSpacing'. –
sì, ma non ho trovato alcuna soluzione con 'CGContextSetCharacterSpacing' per la classe CATextLayer! –
nessuna risposta ???? –