[Mono-osx] CoreText Paragraph Alignment

tspad1960 thelasthope4U at gmail.com
Thu Sep 6 03:21:25 UTC 2012


I am trying to develop an application with CoreText.  I can successfully
render text to my frame but cannot figure out how to set paragraph style
attribute for text alignment.  I am working from CoreTextArcMonoMac example. 
I have made modifications to draw text into a frame instead of an arc.  Now
I want to set the alignment to Center.  I may be missing something obvious
but I can't seem to figure out how to set the paragraph style attributes. 
The code below is creates my attributed string.

private NSAttributedString AttributedString {
      get {
        NSParagraphStyle style = new NSParagraphStyle();
	NSObject[] objects = new NSObject[] { Font, (NSNumber)0, style};
        NSObject[] keys = new NSObject[] {
NSAttributedString.FontAttributeName,         
NSAttributedString.LigatureAttributeName,
NSAttributedString.ParagraphStyleAttributeName};

        NSDictionary attributes = NSDictionary.FromObjectsAndKeys (objects,
keys);
                                
        NSAttributedString attrString = new NSAttributedString (Title,
attributes);
			
        return attrString;
       }
}

What I can't work out is how to set the alignment of the paragram style?

Any help appreciated.



--
View this message in context: http://mono.1490590.n4.nabble.com/CoreText-Paragraph-Alignment-tp4656504.html
Sent from the Mono - OSX mailing list archive at Nabble.com.


More information about the Mono-osx mailing list