When setting my font size, if my TextFragment is on two lines, the first line does not get the correct font size that I set in the code below? Notice how in my attachment my heading is font size 22, and the second line is much smaller while the third line is font size 18?
Untitled.png (11.7 KB)
var font = FontRepository.FindFont("Helvetica");
if (message.Heading.Length > 0)
{
TextFragment heading = new TextFragment();
heading.Text = message.Heading + Environment.NewLine;
heading.Position = new Position(x, y);
heading.TextState.Font = font;
heading.TextState.FontSize = 22;
TextFragment textMessage = new TextFragment();
textMessage.Text = message.Name;
textMessage.Position = new Position(x, y);
textMessage.TextState.Font = font;
textMessage.TextState.FontSize = 18;
//create TextParagraph object
TextParagraph par1 = new TextParagraph();
par1.HorizontalAlignment = HorizontalAlignment.Center;
//set paragraph position
par1.Position = new Position(heading.Position.XIndent, heading.Position.YIndent);
//add new TextFragment to paragraph
par1.AppendLine(heading);
par1.AppendLine(textMessage);
//add the TextParagraph using TextBuilder
TextBuilder textBuilder1 = new TextBuilder(pdfPage);
textBuilder1.AppendParagraph(par1);
}