Paragraph.Add(new Chunk("\xf096", fontawesomeFont)) Paragraph.Add(new Chunk("\xf046", fontawesomeFont)) Paragraph.Add(new Chunk("\xf0c8", fontawesomeFont)) Paragraph.Add(new Chunk("\xf14a", fontawesomeFont)) Paragraph.Add(new Chunk("\xf118", fontawesomeFont)) Paragraph.Add(new Chunk("Hello world! ")) The use the function: Paragraph paragraph = new Paragraph() Return FontFactory.GetFont(fontName, BaseFont.IDENTITY_H, BaseFont.EMBEDDED, FontSize, FontStyle, FontColour ) Int FontStyle = // optionalįloat FontSize = // optional Var FontColour = new BaseColor(0, 0, 0) // optional. Var fontPath = .MapPath("\\") "fonts\\fontawesome-webfont.ttf" įontFactory.Register(fontPath, fontName) Use: .MapPath("\")Īlso note that 'ttf' font file has been placed in the 'fonts' folder of my Project: Instead of 'Environment.GetEnvironmentVariable("SystemRoot")' But, if you had tied the font permanently to your Project via this solution, it's one less hassle. is the font you need already in the fonts folder of your Windows file system? If so, great. But is it guaranteed to stay in the same place in the next version of Windows? Plus if you load your Project onto a new computer because your hard drive crashed, and you are using a Project backup. Side-note: The fonts folder of the Windows file system shouldn't change. Please vary the arguments of 'FontFactory.GetFont()' as needed for your Project. This is not generally needed for all Projects (see other answers on this page). Please note that I need 'BaseFont.EMBEDDED' to be true for my particular Project. which may change the next time Windows develops a new operating system, the fonts are all in your Project. So rather than trying to find the fonts folder on your Windows operating system. This makes for a more self-contained (and potentially more 'portable') Visual Studio project. In this solution, you can use (at least on our filesystem) the fonts in the fonts folder of Visual Studio.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |