1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +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:
Calixte Denizet 2023-04-27 18:01:07 +02:00
parent a24e11a91c
commit 53134c0c0b
12 changed files with 584 additions and 28 deletions

View file

@ -210,7 +210,12 @@ const defaultOptions = {
cMapUrl: {
/** @type {string} */
value:
typeof PDFJSDev === "undefined" ? "../external/bcmaps/" : "../web/cmaps/",
// eslint-disable-next-line no-nested-ternary
typeof PDFJSDev === "undefined"
? "../external/bcmaps/"
: PDFJSDev.test("MOZCENTRAL")
? "resource://pdf.js/web/cmaps/"
: "../web/cmaps/",
kind: OptionKind.API,
},
disableAutoFetch: {
@ -271,8 +276,11 @@ const defaultOptions = {
standardFontDataUrl: {
/** @type {string} */
value:
// eslint-disable-next-line no-nested-ternary
typeof PDFJSDev === "undefined"
? "../external/standard_fonts/"
: PDFJSDev.test("MOZCENTRAL")
? "resource://pdf.js/web/standard_fonts/"
: "../web/standard_fonts/",
kind: OptionKind.API,
},