title: Itext New Font with Bold and Underline
body: <p>I am trying to add new font to my pdf which I need to make it bold and underlined..</p>
  
  <p>I can add the new Font, but cannot make it bold and underlined at same time.</p>
  
  <p>I tried the following way..</p>
  
  <pre><code>public class PdfGenerator {
  
      private static final String BASE_FONT = "Trebuchet MS";
      private static final String BASE_FONT_BOLDITALIC = "Trebuchet MS BI";
      private static final String BASE_FONT_BOLD = "Trebuchet MS B";
  
      private static final Font titlefontSmall = FontFactory.getFont(
              BASE_FONT_BOLD, 10, Font.UNDERLINE);
  
      static {
          String filePath = "..my font directory";
          String fontPath = filePath + "\\" + "trebuc.ttf";
          String fontPathB = filePath + "\\" + "TREBUCBD.TTF";
          String fontPathBI = filePath + "\\" + "TREBUCBI.TTF";
  
          FontFactory.register(fontPath, BASE_FONT);
          FontFactory.register(fontPathB, BASE_FONT_BOLD);
          FontFactory.register(fontPathBI, BASE_FONT_BOLDITALIC);
      }
  
      public void genMyPdf(String filePath) {
          try {
              Document document = new Document();
              PdfWriter writer = PdfWriter.getInstance(document,
                      new FileOutputStream(filePath));
              document.open();
  
              Paragraph p = new Paragraph("This should be bold &amp; underline",
                      titlefontSmall);
              document.add(p);
              document.close();
          } catch (FileNotFoundException e) {
              e.printStackTrace();
          } catch (DocumentException e) {
              e.printStackTrace();
          }
  
      }
  
  }
  </code></pre>
  
  <p>What am I doing wrong ?</p>