Browse Source

Merge pull request #7726 from Snuffleupagus/remove-remaining-preprocessor-statement-core-fonts

Remove a remaining old-style preprocessor from `src/core/fonts.js` (PR 7322 follow-up)
Jonas Jenwald 9 years ago committed by GitHub
parent
commit
f209030b99
  1. 28
      src/core/fonts.js

28
src/core/fonts.js

@ -505,15 +505,15 @@ var ProblematicCharRanges = new Int32Array([
0xFFF0, 0x10000 0xFFF0, 0x10000
]); ]);
//#if !PRODUCTION if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('PRODUCTION')) {
/** /**
* Used to validate the entries in `ProblematicCharRanges`, and to ensure that * Used to validate the entries in `ProblematicCharRanges`, and to ensure that
* its total number of characters does not exceed the PUA (Private Use Area) * its total number of characters does not exceed the PUA (Private Use Area)
* length. * length.
* @returns {Object} An object with {number} `numChars`, {number} `puaLength`, * @returns {Object} An object with {number} `numChars`, {number} `puaLength`,
* and {number} `percentage` parameters. * and {number} `percentage` parameters.
*/ */
function checkProblematicCharRanges() { var checkProblematicCharRanges = function checkProblematicCharRanges() {
function printRange(limits) { function printRange(limits) {
return '[' + limits.lower.toString('16').toUpperCase() + ', ' + return '[' + limits.lower.toString('16').toUpperCase() + ', ' +
limits.upper.toString('16').toUpperCase() + ')'; limits.upper.toString('16').toUpperCase() + ')';
@ -523,7 +523,7 @@ function checkProblematicCharRanges() {
if (numRanges % 2 !== 0) { if (numRanges % 2 !== 0) {
throw new Error('Char ranges must contain an even number of elements.'); throw new Error('Char ranges must contain an even number of elements.');
} }
var previousLimits, numChars = 0; var prevLimits, numChars = 0;
for (var i = 0; i < numRanges; i += 2) { for (var i = 0; i < numRanges; i += 2) {
var limits = { var limits = {
lower: ProblematicCharRanges[i], lower: ProblematicCharRanges[i],
@ -542,17 +542,17 @@ function checkProblematicCharRanges() {
throw new Error('Range must contain at least one element: ' + throw new Error('Range must contain at least one element: ' +
printRange(limits)); printRange(limits));
} }
if (previousLimits) { if (prevLimits) {
if (limits.lower < previousLimits.lower) { if (limits.lower < prevLimits.lower) {
throw new Error('Ranges must be sorted in ascending order: ' + throw new Error('Ranges must be sorted in ascending order: ' +
printRange(limits) + ', ' + printRange(previousLimits)); printRange(limits) + ', ' + printRange(prevLimits));
} }
if (limits.lower < previousLimits.upper) { if (limits.lower < prevLimits.upper) {
throw new Error('Ranges must not overlap: ' + throw new Error('Ranges must not overlap: ' +
printRange(limits) + ', ' + printRange(previousLimits)); printRange(limits) + ', ' + printRange(prevLimits));
} }
} }
previousLimits = { prevLimits = {
lower: limits.lower, lower: limits.lower,
upper: limits.upper, upper: limits.upper,
}; };
@ -568,10 +568,11 @@ function checkProblematicCharRanges() {
puaLength: puaLength, puaLength: puaLength,
percentage: 100 * (numChars / puaLength), percentage: 100 * (numChars / puaLength),
}; };
} };
exports.checkProblematicCharRanges = checkProblematicCharRanges; exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
//#endif exports.checkProblematicCharRanges = checkProblematicCharRanges;
}
/** /**
* 'Font' is the class the outside world should use, it encapsulate all the font * 'Font' is the class the outside world should use, it encapsulate all the font
@ -3434,7 +3435,6 @@ var CFFFont = (function CFFFontClosure() {
} }
})(); })();
exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
exports.ErrorFont = ErrorFont; exports.ErrorFont = ErrorFont;
exports.Font = Font; exports.Font = Font;
exports.FontFlags = FontFlags; exports.FontFlags = FontFlags;

Loading…
Cancel
Save