I loaded a custom font (.ttf file) with the FontManager and got it working properly with a CCLabel except the bottom 1/4th of the longer letters (j, y, q, ect...) is getting cutoff. Is there a way I can prevent this from occurring?
Custom font being cut off
(5 posts) (4 voices)-
Posted 2 years ago #
-
I see this too with a rather tall font. I havent figured it out yet.
Posted 2 years ago # -
Are you sure this can't be solved by using the more verbose convenience method that takes a "dimension" property? Then make sure the vertical dimension is sufficient for the font.
Posted 2 years ago # -
Yeah but then its not dynamic. You have to know the size of every label ahead of time.
Posted 2 years ago # -
Adding to this thread, may help someone with who has a similar issue.
I was getting clipping using a custom font with CCLabel using this method:+ (id) labelWithString:(NSString*)string dimensions:(CGSize)dimensions alignment:(UITextAlignment)alignment fontName:(NSString*)name fontSize:(CGFloat)sizewith a multi-line (4 lines) sentence with dimensions of (260, 210).
So I hacked CCTexture2D.m where I added some padding to the dimensions and moved the origin over (3,9).#if CC_FONT_LABEL_SUPPORT uiFont = [[FontManager sharedManager] zFontWithName:name pointSize:size]; if (uiFont != nil) [string drawInRect:CGRectMake(3, 9, dimensions.width + 4, dimensions.height + 7) withZFont:uiFont lineBreakMode:UILineBreakModeWordWrap alignment:alignment];So this worked for me. You may also have to adjust the labels positioning after this to compensate.
Posted 1 year ago #
Reply
You must log in to post.