diff --git a/src/core/cmap.js b/src/core/cmap.js index 7cf8567ef3fce..5e7040c6d2a4e 100644 --- a/src/core/cmap.js +++ b/src/core/cmap.js @@ -13,13 +13,8 @@ * limitations under the License. */ -import { - CMapCompressionType, - FormatError, - unreachable, - warn, -} from "../shared/util.js"; import { Cmd, EOF, isCmd, Name } from "./primitives.js"; +import { FormatError, unreachable, warn } from "../shared/util.js"; import { BaseStream } from "./base_stream.js"; import { BinaryCMapReader } from "./binary_cmap.js"; import { Lexer } from "./parser.js"; @@ -687,19 +682,16 @@ async function createBuiltInCMap(name, fetchBuiltInCMap) { throw new Error("Built-in CMap parameters are not provided."); } - const { cMapData, compressionType } = await fetchBuiltInCMap(name); + const { cMapData, isCompressed } = await fetchBuiltInCMap(name); const cMap = new CMap(true); - if (compressionType === CMapCompressionType.BINARY) { + if (isCompressed) { return new BinaryCMapReader().process(cMapData, cMap, useCMap => extendCMap(cMap, fetchBuiltInCMap, useCMap) ); } - if (compressionType === CMapCompressionType.NONE) { - const lexer = new Lexer(new Stream(cMapData)); - return parseCMap(cMap, lexer, fetchBuiltInCMap, null); - } - throw new Error(`Invalid CMap "compressionType" value: ${compressionType}`); + const lexer = new Lexer(new Stream(cMapData)); + return parseCMap(cMap, lexer, fetchBuiltInCMap, null); } class CMapFactory { diff --git a/src/core/evaluator.js b/src/core/evaluator.js index eae2f8c1f7f25..27ba453fd441c 100644 --- a/src/core/evaluator.js +++ b/src/core/evaluator.js @@ -17,7 +17,6 @@ import { AbortException, assert, - CMapCompressionType, FONT_IDENTITY_MATRIX, FormatError, IDENTITY_MATRIX, @@ -392,7 +391,7 @@ class PartialEvaluator { } data = { cMapData: new Uint8Array(await response.arrayBuffer()), - compressionType: CMapCompressionType.BINARY, + isCompressed: true, }; } else { // Get the data on the main-thread instead. diff --git a/src/display/base_factory.js b/src/display/base_factory.js index 2cf132129eaef..7d72ac49ab267 100644 --- a/src/display/base_factory.js +++ b/src/display/base_factory.js @@ -13,7 +13,7 @@ * limitations under the License. */ -import { CMapCompressionType, unreachable } from "../shared/util.js"; +import { unreachable } from "../shared/util.js"; class BaseFilterFactory { constructor() { @@ -129,12 +129,7 @@ class BaseCMapReaderFactory { const url = this.baseUrl + name + (this.isCompressed ? ".bcmap" : ""); return this._fetch(url) - .then(cMapData => ({ - cMapData, - compressionType: this.isCompressed - ? CMapCompressionType.BINARY - : CMapCompressionType.NONE, - })) + .then(cMapData => ({ cMapData, isCompressed: this.isCompressed })) .catch(reason => { throw new Error( `Unable to load ${this.isCompressed ? "binary " : ""}CMap at: ${url}` diff --git a/src/pdf.js b/src/pdf.js index c90244e8abcfe..c78d27e14524d 100644 --- a/src/pdf.js +++ b/src/pdf.js @@ -27,7 +27,6 @@ import { AnnotationEditorParamsType, AnnotationEditorType, AnnotationMode, - CMapCompressionType, createValidAbsoluteUrl, FeatureTest, ImageKind, @@ -96,7 +95,6 @@ export { AnnotationLayer, AnnotationMode, build, - CMapCompressionType, ColorPicker, createValidAbsoluteUrl, DOMSVGFactory, diff --git a/src/shared/util.js b/src/shared/util.js index de0abe5796e4a..eccd578974b92 100644 --- a/src/shared/util.js +++ b/src/shared/util.js @@ -240,11 +240,6 @@ const VerbosityLevel = { INFOS: 5, }; -const CMapCompressionType = { - NONE: 0, - BINARY: 1, -}; - // All the possible operations for an operator list. const OPS = { // Intentionally start from 1 so it is easy to spot bad operators that will be @@ -1119,7 +1114,6 @@ export { BaseException, BASELINE_FACTOR, bytesToString, - CMapCompressionType, createValidAbsoluteUrl, DocumentActionEventType, FeatureTest, diff --git a/test/unit/pdf_spec.js b/test/unit/pdf_spec.js index 0a93ced31859f..269a26ff7c60e 100644 --- a/test/unit/pdf_spec.js +++ b/test/unit/pdf_spec.js @@ -18,7 +18,6 @@ import { AnnotationEditorParamsType, AnnotationEditorType, AnnotationMode, - CMapCompressionType, createValidAbsoluteUrl, FeatureTest, ImageKind, @@ -74,7 +73,6 @@ const expectedAPI = Object.freeze({ AnnotationLayer, AnnotationMode, build, - CMapCompressionType, ColorPicker, createValidAbsoluteUrl, DOMSVGFactory, diff --git a/web/pdfjs.js b/web/pdfjs.js index ccd6b9b6d15e3..e9b956dbdf401 100644 --- a/web/pdfjs.js +++ b/web/pdfjs.js @@ -22,7 +22,6 @@ const { AnnotationLayer, AnnotationMode, build, - CMapCompressionType, ColorPicker, createValidAbsoluteUrl, DOMSVGFactory, @@ -69,7 +68,6 @@ export { AnnotationLayer, AnnotationMode, build, - CMapCompressionType, ColorPicker, createValidAbsoluteUrl, DOMSVGFactory,