TextSegment bold and italic

How can I create a text segment which is bold and italic?

var seg1 = new TextSegment(“test”);
seg1.TextState.FontStyle = FontStyles.Bold; //??
seg1.TextState.FontStyle = FontStyles.Italic; //??
seg1.TextState.Font = FontRepository.FindFont(fontName);
seg1.TextState.FontSize = fontSize;
text.Segments.Add(seg1);

@CCTechnology

Thank you for contacting support.

Your code snippet includes setting of bold and italic font already. In case you are facing any problem then please share SSCCE code along with source and generated files, if any, so that we may try to reproduce and investigate it in our environment. Before sharing requested data, please ensure using Aspose.PDF for .NET 19.6.

But in given example setting FontStyles.Italic overrides FontStyles.Bold. I want to set both. Is it possible

@CCTechnology

Yes it is possible, kindly share requested code and respective files so that we may investigate and assist you accordingly.

OK, thanks. I missed that we can now use FlagsAttribute.

It can be now closed.

@CCTechnology

Thank you for your kind feedback.

Please feel free to contact us if you need any further assistance.