
It is strange that you ask the phrase object for its font, as this will only return one font, whereas the different chunks in the phrase can have different fonts. This phrase object will be a collection of Chunk objects that will have different fonts. You are creating a Phrase using FontSelector. To make them look bold, we change the render mode so that they aren't merely filled, but also stroked. By default, glyphs are shapes that are filled with color. This is demonstrated in the SayPeace example of my book. There usually aren't any bold versions of Chinese fonts, so if you need a Chinese font to be bold, you should change the render mode of the Chunk with the Chinese text to mimic a bold font.įor instance, if you have a Chunk object chunk with text in a regular font, you can do this to make the bold look as if it's bold: tTextRenderMode(PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE) Phrase phrase = _fontSelector.Process(text) Public static BaseFont GetBaseFont(string text) Return FontFactory.GetFont(fontDir + file, BaseFont.IDENTITY_H, BaseFont.EMBEDDED) Private static Font Tr圜reateFontEmbedded(string fontDir, string file) Return FontFactory.GetFont(fontDir + file, BaseFont.IDENTITY_H, fontSizeforSelector) Private static Font Tr圜reateFont(string fontDir, string file) _fontSelector.AddFont(TraditionalArabic) Simhei = Tr圜reateFontEmbedded(fontDir, "simhei.ttf") //!-! Simpbdo = Tr圜reateFontEmbedded(fontDir, "simpbdo.ttf") //!-!

Simsun = Tr圜reateFontEmbedded(fontDir, "simsun.ttc,1") //!-!ĪrialUni = Tr圜reateFontEmbedded(fontDir, "arialuni.ttf") //!-! Simpo = Tr圜reateFontEmbedded(fontDir, "simpo.ttc") //!-!īatang = Tr圜reateFontEmbedded(fontDir, "batang.ttc") //!-! Tahoma = Tr圜reateFontEmbedded(fontDir, "tahoma.ttf") TraditionalArabic = Tr圜reateFont(fontDir,"trado.ttf") SimplifiedArabic = Tr圜reateFont(fontDir,"simpo.ttf") Īndalus = Tr圜reateFont(fontDir,"andlso.ttf") String fontDir = winDir + "\\Fonts\\" //!-!Īrial = Tr圜reateFont(fontDir, "arial.ttf") String winDir = Environment.GetEnvironmentVariable("WINDIR") //!-!

Should I choose different font for bold? And how? const int fontSizeforSelector = 12 I don't understand chinese fonts too much, but I suppose that there is no bold font in simsun.ttc and the simhei.ttf could be choose for bold font instead (correct me if I am wrong). But the font selector does not have parametres for bold.

I would like to use iTextSharp FontSelector, but I expect that the correct font could be different for bold and normal font. When printing PDF on windows, I need to choose font according to characters in the text.
