Hi all Im currently trying to modify the SPTextField and SPBitmapFont to enable autosizing I previously updated the two classes in Sparrow 1 to do the same but Im currently porting my project to Sparrow 2.0 so Im having to modify the new versions of those classes which work significantly differently. So far In addition to adding an autosize argument to
createSpriteWithWidth
fillQuadBatch
arrangeCharsInAreaWithWidth
and a few other minor adjustments Ive added the following code to the "arrangeCharsInAreaWithWidth" in SPBitmapFont
//added new local variables longest line and textheight
//inside the main while loop
if(autoSize && lineFull)
{
textHeight += _lineHeight; //might need to remove excess white space
SPCharLocation *charLocation = [currentLine objectAtIndex:i];
int charID = [text characterAtIndex:i];
SPBitmapChar *bitmapChar = [self charByID:charID];
float thisLine = charLocation.x + bitmapChar.yOffset;
if(thisLine > longestLine) longestLine = thisLine;
}
//outside the main loop
if(autoSize)
{
containerWidth = longestLine;
containerHeight = textHeight;
}
But Im struggling to figure how to pick up the width and height from SPBitmapFont in SPTextField to set the hit area ect Im a little confused as to how SPBitmapFont works in conjunction with SPQuadBatch or indeed what SPBitMapFont actually is, is it an instance of some text or a pooled instance of the font itself if that makes sense, Ive noticed it extends NSObject and not displayObject or displayObjectContainer.
Thanks in advance