Posted by a ceTe Software moderator
Hello,
Yes, you can add more than one font face to a FormattedTextArea. Here is a code sample:
Document doc = new Document();
Page page = new Page(PageSize.Letter);
doc.Pages.Add(page);
Font fontHelvetica = Font.Helvetica;
FontFamily helveticaFamily = new FontFamily("HeveticaFont", fontHelvetica);
OpenTypeFont fontTimes = new OpenTypeFont(@"times.ttf");
FontFamily timesFamily = new FontFamily("TimesFont", fontTimes);
OpenTypeFont fontWindings = new OpenTypeFont(@"WINGDNG2.TTF");
FontFamily wingDingsFamily = new FontFamily("WingdingsFont", fontWindings);
string formattedText = "<p><font face='TimesFont'> Times font face, </font><font " +
"<font face='HeveticaFont'>Helvetica font face, </font><font face='WingdingsFont'> WingDingss font face, </font></p>";
FormattedTextAreaStyle ftaStyle=new FormattedTextAreaStyle(FontFamily.Courier,12,true);
FormattedTextArea area = new FormattedTextArea(formattedText, 0, 0, 512, 400, ftaStyle);
area.FontFaces.Add(helveticaFamily);
area.FontFaces.Add(timesFamily);
area.FontFaces.Add(wingDingsFamily);
page.Elements.Add(area);
doc.Draw("C:\\Temp\\FTAtest.pdf");
You can also achieve something similar using an HtmlArea. With that, you can specify the font in the HTML source. For more information, please refer to the documentation on HtmlArea
here.
Thanks,
ceTe Software Support Team