mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-10 02:05:37 +02:00
[api-minor] Use a local font or fallback on an embedded one (if it exists) for non-embedded fonts (bug 1766039)
- Replace FoxitSans with LiberationSans: LiberationSans is already there (for XFA) and we can use it as a good replacement of FoxitSans. - For now we just try to substitue standard fonts, the strategy is the following: * we try to find a font locally from a hardcoded list; * if it fails then we use Liberation as fallback (only for Helvetica for the moment); * else we just fallback on the system serif/sansserif/monospace font.
This commit is contained in:
parent
a24e11a91c
commit
53134c0c0b
12 changed files with 584 additions and 28 deletions
|
@ -1950,6 +1950,8 @@ class CanvasGraphics {
|
|||
}
|
||||
|
||||
const name = fontObj.loadedName || "sans-serif";
|
||||
const typeface =
|
||||
fontObj.systemFontInfo?.css || `"${name}", ${fontObj.fallbackName}`;
|
||||
|
||||
let bold = "normal";
|
||||
if (fontObj.black) {
|
||||
|
@ -1958,7 +1960,6 @@ class CanvasGraphics {
|
|||
bold = "bold";
|
||||
}
|
||||
const italic = fontObj.italic ? "italic" : "normal";
|
||||
const typeface = `"${name}", ${fontObj.fallbackName}`;
|
||||
|
||||
// Some font backends cannot handle fonts below certain size.
|
||||
// Keeping the font at minimal size and using the fontSizeScale to change
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue