the justification is part of the attributed strings "paragraph style" attribute. Here's a snippet of code that changes the ScrollingRichText plugin to create a center-justified attributed string:
if (textType == kTextType_Simple)
{
NSString* text = nil;
int textSize = 48;
double textRed = 1;
double textGreen = 1;
double textBlue = 1;
// get the simple text parameters: the text itself, the color, size, etc.
[parmsApi getStringParameterValue: &text fromParm: kParamID_Text];
[parmsApi getIntValue: &textSize fromParm: kParamID_Size atTime: renderInfo.frame];
[parmsApi getRedValue: &textRed GreenValue: &textGreen BlueValue: &textBlue fromParm: kParamID_Color atTime: renderInfo.frame];
// create a center-justified paragraph style; we'll use this as the paragraph style of our attributed string
NSMutableParagraphStyle* paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopyWithZone:nil];
[paragraphStyle setAlignment: NSCenterTextAlignment];
// set up text drawing attributes and create the string
NSDictionary* attributes = [NSDictionary dictionaryWithObjectsAndKeys:
[NSColor colorWithCalibratedRed: textRed green: textGreen blue: textBlue alpha: 1.0], NSForegroundColorAttributeName,
[NSFont fontWithName: @"Helvetica" size: textSize], NSFontAttributeName,
paragraphStyle, NSParagraphStyleAttributeName,
nil];
attributedString = [[NSAttributedString alloc] initWithString:text attributes: attributes];
// clean up
[paragraphStyle release];
}
Do not post admin requests to the list. They will be ignored.
Pro-apps-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden