The style of chinese characters


#1

I insert chinese characters into PDF files via aspose.pdf.when I change the style of chinese characters into "segment2.TextInfo.IsTrueTypeFontBold=true; segment2.TextInfo.IsTrueTypeFontItalic=true;",the style of chinese characters is not changed.how to deal with it?

my test code:

Pdf pdf = new Pdf();
Section sec1=pdf.Sections.Add();
Text text2 = new Text(sec1);
text2.Margin.Top = 30;

Segment segment2 = text2.Segments.Add("this is a中国人民 test");

segment2.TextInfo.TruetypeFontFileName="C:\\WINDOWS\\Fonts\\STZHONGS.TTF";
segment2.TextInfo.IsUnicode=true;
segment2.TextInfo.RenderingMode=new RenderingMode();
segment2.TextInfo.FontSize = 80;
segment2.TextInfo.Color = new Aspose.Pdf.Color("Red");
segment2.TextInfo.IsTrueTypeFontBold=true;
segment2.TextInfo.IsTrueTypeFontItalic=true;
segment2.TextInfo.IsOverline=true;
sec1.Paragraphs.Add(text2);
pdf.Save("test.pdf",SaveType.OpenInAcrobat,Response);


#2

Hi,

Thank you for considering Aspose.

Sorry for not making it clear in the documents. Currently Aspose.Pdf has some limitation for TrueType font. If you want to set the font to be bold, their must be a bold font installed in the system, e.g., arialbd.ttf for arial. If you have the font installed, you can set font style with the following two method:

1) Specify the bold and italic font file directly. segment2.TextInfo.TruetypeFontFileName="C:\\WINDOWS\\Fonts\\arialbi.ttf";
The "IsTrueTypeFontBold" and "IsTrueTypeFontItalic" is not need to set.

2) Specify the font name instead of font file and set the "IsTrueTypeFontBold" and "IsTrueTypeFontItalic".

I found there is no bold and italic font for STZHONGS.TTF in my system. So if you can't get the font file, Aspose.Pdf can't support it.