title: How to use bold custom font in jspdf
body: <p>I'm trying to use a custom font with <a href="https://github.com/MrRio/jsPDF" rel="nofollow noreferrer">jspdf</a> but i can't get to show the font as bold, I followed the steps specified <a href="https://github.com/MrRio/jsPDF#use-of-utf-8--ttf" rel="nofollow noreferrer">here</a>.</p>
  <p>here is the code:</p>
  <pre><code>require (&quot;./js/Roboto-Regular-normal.js&quot;);
  require (&quot;./js/Roboto-Regular-bold.js&quot;);
  let doc = new jsPDF();
     
  doc.setFont('Roboto-Regular');
  doc.setFontSize(8);
  doc.text(&quot;hello world&quot;, 50 , 50);
  doc.setFontType('bold');
  doc.text(&quot;Hello Bold&quot;, 50, 55);
  
  let blob = doc.output();
  const fs = require('fs');
  fs.writeFile('a5.pdf', blob, 'utf8', function(err){
      //Do something
  });
  </code></pre>
  <p>Roboto-Regular-normal.js</p>
  <pre><code>(function (jsPDFAPI) {
      var font = base64_font; //I didn't include this string because is too large, let me know if I should include it anyways
      
      var callAddFont = function () {
          this.addFileToVFS(&quot;Roboto-Regular-normal.ttf&quot;, font);
          this.addFont(&quot;Roboto-Regular-normal.ttf&quot;, &quot;Roboto-Regular&quot;, &quot;normal&quot;);
      };
      jsPDFAPI.events.push(['addFonts', callAddFont])
  })(jsPDF.API);
  </code></pre>
  <p>Roboto-Regular-bold.js:</p>
  <pre><code>(function (jsPDFAPI) {
          var font = base64_font; //I didn't include this string because is too large, let me know if I should include it anyways
          
          var callAddFont = function () {
              this.addFileToVFS(&quot;Roboto-Regular-bold.ttf&quot;, font);
              this.addFont(&quot;Roboto-Regular-bold.ttf&quot;, &quot;Roboto-Regular&quot;, &quot;bold&quot;);
          };
          jsPDFAPI.events.push(['addFonts', callAddFont])
  })(jsPDF.API)
  </code></pre>
  <p>Nothing in the pdf appears as bold.</p>
  <p>I'm using it in electron, I don't know if that changes anything.</p>