Can't use custom font

Created on 15 October 2023, about 1 year ago

After couple (dozens of) attempts I still can't figure out how to use custom font for PDF.
I have attached custom css file via views UI, and it works well, but no matter how I'm trying to connect custom font, it's not applying.

For example I have locally stored font, and this is how I connect it in css:

@font-face {
  font-family: APhont;
  font-weight: bold;
  src: url('aphont-bold.ttf') format("truetype");
}
span {
  font-family: APhont, DejaVu Sans, sans-serif;
  font-weight: bold;
}

But all spans still have DejaVu Sans font applied.

Am I missing something here? Or there is some kind of workaround?

💬 Support request
Status

Fixed

Version

2.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Etzesty
  • 🇪🇸Spain jncruces Sevilla

    Hi,

    Te url of the font must be a local path or a global domain, for example:

    font-face {
    font-family: APhont;
    font-weight: bold;
    src: url('https://www.yourdomain.com/.../aphont-bold.ttf') format("truetype");
    }
    span {
    font-family: APhont, DejaVu Sans, sans-serif;
    font-weight: bold;
    }

    The path can be a local path of the server, for example:

    font-face {
    font-family: APhont;
    font-weight: bold;
    src: url('/home/youruser/.../aphont-bold.ttf') format("truetype");
    }
    span {
    font-family: APhont, DejaVu Sans, sans-serif;
    font-weight: bold;
    }

    Try both.

    Greetings.

  • Status changed to Fixed about 1 year ago
  • Yeah, got it working after specifying absolute path with domain. Thank you for fast response.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024