title: CoreText and right alignment
body: <p>I'm writing a class to generate PDFs, I'll publish as I will finish it!</p>
  
  <p>I'm unable to align text to the right, with the CTParagraphStyle, the text is always on the left. How does it is possible? What I'm getting wrong?</p>
  
  <pre><code>- (void)addText:(NSString *)text color:(UIColor *)color fontSize:(CGFloat)size floating:(BOOL)floating {
  CGContextSaveGState(pdfContext);
  
  // Prepare font
  CTFontRef font = CTFontCreateWithName(CFSTR("Verdana"), size, NULL);
  
  // Font color
  CGColorRef fontColor = [color CGColor];
  
  // Paragraph
  CTTextAlignment alignment = kCTRightTextAlignment;
  
  CTParagraphStyleSetting settings[] = {
      {kCTParagraphStyleSpecifierAlignment, sizeof(alignment), &amp;alignment}
  };
  
  CTParagraphStyleRef paragraphStyle = CTParagraphStyleCreate(settings, sizeof(settings) / sizeof(settings[0]));
  
  // Create an attributed string
  CFStringRef keys[] = { kCTFontAttributeName , kCTParagraphStyleAttributeName, kCTForegroundColorAttributeName};
  CFTypeRef values[] = { font, paragraphStyle, fontColor};
  CFDictionaryRef attr = CFDictionaryCreate(NULL, (const void **)&amp;keys, (const void **)&amp;values,
                                            sizeof(keys) / sizeof(keys[0]), &amp;kCFTypeDictionaryKeyCallBacks, &amp;kCFTypeDictionaryValueCallBacks);
  CFAttributedStringRef attrString = CFAttributedStringCreate(NULL, (CFStringRef)text, attr);
  
  CFRelease(paragraphStyle);
  CFRelease(attr);
  
  // Draw the string
  CTLineRef line = CTLineCreateWithAttributedString(attrString);
  
  CGContextSetTextPosition(pdfContext, xPadding, [self relativeHeight:currentHeight+size]);
  
  
  CTLineDraw(line, pdfContext);
  
  // Clean up
  CFRelease(line);
  CFRelease(attrString);
  CFRelease(font);
  
  CGContextRestoreGState(pdfContext);
  
  if(floating == NO) {
      currentHeight += size;
  }
  </code></pre>
  
  <p>}</p>