Estoy usando CATextLayer, para usar una fuente personalizada en iOS, sé que hay una forma simple de usar fuentes personalizadas con Fonts provided by application
pero esta es una fuente diferente. Me preguntaba si hay alguna forma de cambiar el espacio entre cada personaje. ¡No encontré ninguna propiedad para hacerlo!CATextLayer y tracking/spacing between characters
Editado:
- (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);
}
¿Te refieres al kerning? Puedes intentar usar 'CGContextSetCharacterSpacing'. –
sí, pero no encontré ninguna solución con 'CGContextSetCharacterSpacing' para la clase CATextLayer! –
cualquier respuesta ???? –