mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 17:30:09 +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
|
@ -126,11 +126,8 @@ function parseCff(data, start, end, seacAnalysisEnabled) {
|
|||
const cff = parser.parse();
|
||||
return {
|
||||
glyphs: cff.charStrings.objects,
|
||||
subrs:
|
||||
cff.topDict.privateDict &&
|
||||
cff.topDict.privateDict.subrsIndex &&
|
||||
cff.topDict.privateDict.subrsIndex.objects,
|
||||
gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects,
|
||||
subrs: cff.topDict.privateDict?.subrsIndex?.objects,
|
||||
gsubrs: cff.globalSubrIndex?.objects,
|
||||
isCFFCIDFont: cff.isCIDFont,
|
||||
fdSelect: cff.fdSelect,
|
||||
fdArray: cff.fdArray,
|
||||
|
@ -452,7 +449,7 @@ function compileCharString(charStringCode, cmds, font, glyphId) {
|
|||
if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
|
||||
const fontDict = font.fdArray[fdIndex];
|
||||
let subrs;
|
||||
if (fontDict.privateDict && fontDict.privateDict.subrsIndex) {
|
||||
if (fontDict.privateDict?.subrsIndex) {
|
||||
subrs = fontDict.privateDict.subrsIndex.objects;
|
||||
}
|
||||
if (subrs) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue