mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
Introduce more optional chaining in the src/core/
folder
After PR 12563 we're now free to use optional chaining in the worker-thread as well. (This patch also fixes one previously "missed" case in the `web/` folder.) For the MOZCENTRAL build-target this patch reduces the total bundle-size by `1.6` kilobytes.
This commit is contained in:
parent
c20c1b3362
commit
1b4a7c5965
27 changed files with 90 additions and 137 deletions
|
@ -55,7 +55,7 @@ class CFFFont {
|
|||
|
||||
if (properties.composite) {
|
||||
let invCidToGidMap;
|
||||
if (cidToGidMap && cidToGidMap.length > 0) {
|
||||
if (cidToGidMap?.length > 0) {
|
||||
invCidToGidMap = Object.create(null);
|
||||
for (let i = 0, ii = cidToGidMap.length; i < ii; i++) {
|
||||
const gid = cidToGidMap[i];
|
||||
|
@ -74,7 +74,7 @@ class CFFFont {
|
|||
const cid = charsets[glyphId];
|
||||
charCode = cMap.charCodeOf(cid);
|
||||
|
||||
if (invCidToGidMap && invCidToGidMap[charCode] !== undefined) {
|
||||
if (invCidToGidMap?.[charCode] !== undefined) {
|
||||
// According to the PDF specification, see Table 117, it's not clear
|
||||
// that a /CIDToGIDMap should be used with any non-TrueType fonts,
|
||||
// however it's necessary to do so in order to fix issue 15559.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue