Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Font does not support non-latin scripts #272

Open
redhead opened this issue Jun 6, 2024 · 0 comments
Open

Font does not support non-latin scripts #272

redhead opened this issue Jun 6, 2024 · 0 comments

Comments

@redhead
Copy link

redhead commented Jun 6, 2024

We use the library to generate reports for various customers, one uses Korean script for the report text. Although the text in Korean renders in the browser fine with an HTML report, it fails to render Korean text in PDF.

The issue comes down most probably to the use of the font called Source Sans Pro which is shipped with the library. It seems that the browser falls back to some default font which renders the Korean script fine, but when PDF is generated, it forces the Source Sans Pro, and renders blank space instead.

Now, what would be the best way to sort this issue out? Should the library come with a more feature-rich font? Or what would be the way to change the font?

I tried embedding a new font in the CSS file for the report, and overwriting the font-family, but for some reason, it renders the whole PDF document in a totally different font (DejaVu Serif), and neither Source Sans Pro nor my new font is part of the PDF document. HTML file however worked just fine.

@font-face {
    font-family: 'Noto Sans';
    font-style: normal;
    font-weight: 400;
    font-stretch: 100%;
    font-display: swap;
    src: url(data:font/woff2;base64, ... THE WHOLE EMBEDDED FONT DATA...) format('woff2');
}

@font-family-base:  'Noto Sans';

* {
  font-family: "Noto Sans";
}
body {
  font-family: "Noto Sans" !important;
}
strong {
  font-family: "Noto Sans";
}
h1 {
  font-family: "Noto Sans" !important;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant