vivliostyle / vivliostyle.js

📖 The power of CSS typesetting, right at your fingertips.
https://vivliostyle.org
GNU Affero General Public License v3.0
600 stars 52 forks source link

Support for embedding otf fonts in pdf? #846

Open Iacobus1983 opened 2 years ago

Iacobus1983 commented 2 years ago

If I generate a pdf with vivliostyle 2.11.2 and use a custom otf font, with a css declaration such as

@font-face {
   font-family: BemboBook;
   src: url("BemboBookMTPro-Regular.otf") format("opentype");
}

what I get is a beautiful pdf; but the font is not embedded in it (it’s substituted with a Type 3 Font), and I cannot search, select or copy the text within the pdf. EDIT: What I’ve said about the text not being recognised as such depends on the software: with Mac Preview the text is not recognised, while with Acrobat Reader it is.

On the contrary, if I use some google font without any @font-face declaration (just a font-family: "EB Garamond", serif;, for example), the font gets embedded, and the text is recognised as such in the pdf (even with Mac Preview).

I guess it’s a known issue (I see something similar mentioned in this old thread).

Is what I have done ok? Or am I missing something?

MurakamiShinyu commented 2 years ago

This is a known problem, hard to solve until Chromium-Skia/PDF fixes it.

Related issues: