Show Calibri font in Rails PDF

  Kiến thức lập trình

I am generating a PDF inside my rails app and want to use calibri font but it doesnt’work.

  1. I downloaded the file
  2. Created a folder /fonts in /assets
  3. I put the font in that folder as calibri.ttf
  4. changed the application.rb to include config.assets.paths << Rails.root.join('app', 'assets', 'fonts')
  5. Put //= link_tree ../fonts in manifest.js according to some tip in the internet
  6. Changed newsletter.scss to include:
@font-face {
  font-family: "NL Calibri";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: font-url("calibri.ttf") format('truetype');
  1. Rebooted the server after rails assets:precompile
  2. Generating the Newsletter via wicked PDF inside the app


Trying to do inline font-family changes via style changes: font-family: 'NL Calibri' to the elements but the font doesn’t change on the newsletter.