Return list of fonts#24
Return list of fonts#24Elizavetaseluykovich wants to merge 1 commit intocustomizations-for-tagged-pdffrom
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| const subtypeStr = | ||
| // eslint-disable-next-line no-nested-ternary | ||
| subtype instanceof Name | ||
| ? subtype.name | ||
| : typeof subtype === "string" | ||
| ? subtype | ||
| : null; |
There was a problem hiding this comment.
Similar getters for names or strings are used in several other places, so it's better to move this logic into a separate function.
| if (fontObj.has("BaseFont")) { | ||
| const baseFont = fontObj.get("BaseFont"); | ||
| if (baseFont instanceof Name) { | ||
| fontInfo.baseFont = baseFont.name; | ||
| } else if (typeof baseFont === "string") { | ||
| fontInfo.baseFont = baseFont; | ||
| } | ||
| } | ||
|
|
||
| if (fontObj.has("Encoding")) { | ||
| const encoding = fontObj.get("Encoding"); | ||
| if (encoding instanceof Name) { | ||
| fontInfo.encoding = encoding.name; | ||
| } else if (typeof encoding === "string") { | ||
| fontInfo.encoding = encoding; | ||
| } | ||
| } | ||
|
|
||
| if (descriptor instanceof Dict) { | ||
| const fontFile = | ||
| descriptor.get("FontFile") || | ||
| descriptor.get("FontFile2") || | ||
| descriptor.get("FontFile3"); | ||
| fontInfo.isEmbedded = !!fontFile; | ||
| } | ||
|
|
||
| fontInfo.isSubset = fontInfo.baseFont | ||
| ? /^[A-Z0-9]{1,6}\+/.test(fontInfo.baseFont) | ||
| : false; |
There was a problem hiding this comment.
Is there any reason why this can't be calculated directly in resolveFontInfo?
Closes 707-add-fonts-pop-up
GUI PR: https://github.com/duallab/pdf4wcag-webapp-gui/pull/189