Created an extension/category that allows bitmap-only SPTextFields to be justified in varies ways:
http://wiki.sparrow-framework.org/users/shilo/extensions/sptextfield_justify
Alignment property values:
#define SPVAlignJustify SPVAlignBottom+1
#define SPHAlignJustify SPHAlignRight+1
#define SPHAlignJustifyLastLineLeft SPHAlignJustify+1
#define SPHAlignJustifyLastLineCenter SPHAlignJustifyLastLineLeft+1
#define SPHAlignJustifyLastLineRight SPHAlignJustifyLastLineCenter+1
Example:
Summarized code (Complete code in link above):
[SPTextField registerBitmapFontFromFile:@"Helvetica.fnt"];
for (SPHAlign hAlign=SPHAlignLeft; hAlign<=SPHAlignJustifyLastLineRight; hAlign++) {
for (SPVAlign vAlign=SPVAlignTop; vAlign<=SPVAlignJustify; vAlign++) {
NSString *hText = [NSString stringWithFormat:@"hAlign:\n%@\n\n", [self hAlignToString:hAlign]];
NSString *vText = [hText stringByAppendingFormat:@"vAlign:\n%@\n\n", [self vAlignToString:vAlign]];
SPTextField *textField = [SPTextField textFieldWithText:[vText stringByAppendingString:text]];
textField.fontName = @"Helvetica";
textField.fontSize = 11;
textField.width = stageWidth/7;
textField.height = stageHeight/4;
textField.x = hAlign*textField.width;
textField.y = vAlign*textField.height;
textField.hAlign = hAlign;
textField.vAlign = vAlign;
textField.border = YES;
if (vAlign >= SPVAlignJustify || hAlign >= SPHAlignJustify)
textField.color = 0x0000ff;
[self addChild:textField];
}
}