Use lowercase in function names.

This alleviates the confusion which functions can be instantiated with new.
This commit is contained in:
Kalervo Kujala 2011-09-28 22:00:12 +03:00
parent cc5fbab7f9
commit 800fc131b8
4 changed files with 166 additions and 166 deletions

View File

@ -493,16 +493,16 @@ var CipherTransformFactory = (function cipherTransformFactory() {
function constructor(dict, fileId, password) { function constructor(dict, fileId, password) {
var filter = dict.get('Filter'); var filter = dict.get('Filter');
if (!IsName(filter) || filter.name != 'Standard') if (!isName(filter) || filter.name != 'Standard')
error('unknown encryption method'); error('unknown encryption method');
this.dict = dict; this.dict = dict;
var algorithm = dict.get('V'); var algorithm = dict.get('V');
if (!IsInt(algorithm) || if (!isInt(algorithm) ||
(algorithm != 1 && algorithm != 2 && algorithm != 4)) (algorithm != 1 && algorithm != 2 && algorithm != 4))
error('unsupported encryption algorithm'); error('unsupported encryption algorithm');
this.algorithm = algorithm; this.algorithm = algorithm;
var keyLength = dict.get('Length') || 40; var keyLength = dict.get('Length') || 40;
if (!IsInt(keyLength) || if (!isInt(keyLength) ||
keyLength < 40 || (keyLength % 8) != 0) keyLength < 40 || (keyLength % 8) != 0)
error('invalid key length'); error('invalid key length');
// prepare keys // prepare keys

View File

@ -1217,7 +1217,7 @@ var Font = (function Font() {
encoding[i] = { encoding[i] = {
unicode: i <= 0x1f || (i >= 127 && i <= 255) ? unicode: i <= 0x1f || (i >= 127 && i <= 255) ?
i + kCmapGlyphOffset : i, i + kCmapGlyphOffset : i,
width: IsNum(width) ? width : properties.defaultWidth width: isNum(width) ? width : properties.defaultWidth
}; };
} }
} else { } else {
@ -2207,7 +2207,7 @@ CFF.prototype = {
var cmd = map[command]; var cmd = map[command];
assert(cmd, 'Unknow command: ' + command); assert(cmd, 'Unknow command: ' + command);
if (IsArray(cmd)) if (isArray(cmd))
charstring.splice(i++, 1, cmd[0], cmd[1]); charstring.splice(i++, 1, cmd[0], cmd[1]);
else else
charstring[i] = cmd; charstring[i] = cmd;
@ -2333,7 +2333,7 @@ CFF.prototype = {
continue; continue;
var value = properties.private[field]; var value = properties.private[field];
if (IsArray(value)) { if (isArray(value)) {
data += self.encodeNumber(value[0]); data += self.encodeNumber(value[0]);
for (var i = 1; i < value.length; i++) for (var i = 1; i < value.length; i++)
data += self.encodeNumber(value[i] - value[i - 1]); data += self.encodeNumber(value[i] - value[i - 1]);
@ -2492,7 +2492,7 @@ var Type2CFF = (function type2CFF() {
var width = mapping.width; var width = mapping.width;
properties.glyphs[glyph] = properties.encoding[index] = { properties.glyphs[glyph] = properties.encoding[index] = {
unicode: code, unicode: code,
width: IsNum(width) ? width : defaultWidth width: isNum(width) ? width : defaultWidth
}; };
charstrings.push({ charstrings.push({

316
pdf.js
View File

@ -2378,57 +2378,57 @@ var RefSet = (function refSet() {
return constructor; return constructor;
})(); })();
function IsBool(v) { function isBool(v) {
return typeof v == 'boolean'; return typeof v == 'boolean';
} }
function IsInt(v) { function isInt(v) {
return typeof v == 'number' && ((v | 0) == v); return typeof v == 'number' && ((v | 0) == v);
} }
function IsNum(v) { function isNum(v) {
return typeof v == 'number'; return typeof v == 'number';
} }
function IsString(v) { function isString(v) {
return typeof v == 'string'; return typeof v == 'string';
} }
function IsNull(v) { function isNull(v) {
return v === null; return v === null;
} }
function IsName(v) { function isName(v) {
return v instanceof Name; return v instanceof Name;
} }
function IsCmd(v, cmd) { function isCmd(v, cmd) {
return v instanceof Cmd && (!cmd || v.cmd == cmd); return v instanceof Cmd && (!cmd || v.cmd == cmd);
} }
function IsDict(v, type) { function isDict(v, type) {
return v instanceof Dict && (!type || v.get('Type').name == type); return v instanceof Dict && (!type || v.get('Type').name == type);
} }
function IsArray(v) { function isArray(v) {
return v instanceof Array; return v instanceof Array;
} }
function IsStream(v) { function isStream(v) {
return typeof v == 'object' && v != null && ('getChar' in v); return typeof v == 'object' && v != null && ('getChar' in v);
} }
function IsRef(v) { function isRef(v) {
return v instanceof Ref; return v instanceof Ref;
} }
function IsPDFFunction(v) { function isPDFFunction(v) {
var fnDict; var fnDict;
if (typeof v != 'object') if (typeof v != 'object')
return false; return false;
else if (IsDict(v)) else if (isDict(v))
fnDict = v; fnDict = v;
else if (IsStream(v)) else if (isStream(v))
fnDict = v.dict; fnDict = v.dict;
else else
return false; return false;
@ -2437,13 +2437,13 @@ function IsPDFFunction(v) {
var EOF = {}; var EOF = {};
function IsEOF(v) { function isEOF(v) {
return v == EOF; return v == EOF;
} }
var None = {}; var None = {};
function IsNone(v) { function isNone(v) {
return v == None; return v == None;
} }
@ -2477,7 +2477,7 @@ var Lexer = (function lexer() {