Remove unnecessary MissingDataException
check from getHeaderBlock
It shouldn't be possible for the `getBytes`-call to throw a `MissingDataException`, since all resources are loaded *before* e.g. font-parsing ever starts; seef0817015bd/src/core/object_loader.js (L111-L126)
Furthermore, even if we'd *somehow* re-throw a `MissingDataException` here that still won't help considering where the `Type1Font`-instance is created. Note how in the `Font`-constructor we simply catch any errors and fallback to a standard font, which means that a `MissingDataException` would just lead to rendering errors anyway; seef0817015bd/src/core/fonts.js (L648-L691)
All-in-all, it's not possible for a `MissingDataException` to be thrown in `getHeaderBlock` and this code-path can thus be removed.
This commit is contained in:
parent
b487edd05d
commit
5e5daca407
@ -24,8 +24,8 @@ import {
|
||||
CFFStrings,
|
||||
CFFTopDict,
|
||||
} from "./cff_parser.js";
|
||||
import { isWhiteSpace, MissingDataException } from "./core_utils.js";
|
||||
import { SEAC_ANALYSIS_ENABLED, type1FontGlyphMapping } from "./fonts_utils.js";
|
||||
import { isWhiteSpace } from "./core_utils.js";
|
||||
import { Stream } from "./stream.js";
|
||||
import { Type1Parser } from "./type1_parser.js";
|
||||
import { warn } from "../shared/util.js";
|
||||
@ -68,9 +68,6 @@ function getHeaderBlock(stream, suggestedLength) {
|
||||
headerBytes = stream.getBytes(suggestedLength);
|
||||
headerBytesLength = headerBytes.length;
|
||||
} catch (ex) {
|
||||
if (ex instanceof MissingDataException) {
|
||||
throw ex;
|
||||
}
|
||||
// Ignore errors if the `suggestedLength` is huge enough that a Uint8Array
|
||||
// cannot hold the result of `getBytes`, and fallback to simply checking
|
||||
// the entire stream (fixes issue3928.pdf).
|
||||
|
Loading…
x
Reference in New Issue
Block a user