Remove some useless var

This commit is contained in:
Vivien Nicolas 2011-06-24 01:37:54 +02:00
parent e953f2363c
commit df406d43a1

View File

@ -649,7 +649,7 @@ var Font = (function () {
/** CMAP */ /** CMAP */
var charstrings = font.charstrings; var charstrings = font.charstrings;
cmap = createCMapTable(font.charstrings); cmap = createCMapTable(charstrings);
createTableEntry(otf, offsets, "cmap", cmap); createTableEntry(otf, offsets, "cmap", cmap);
/** HEAD */ /** HEAD */
@ -1403,17 +1403,11 @@ CFF.prototype = {
wrap: function wrap(name, charstrings, subrs, properties) { wrap: function wrap(name, charstrings, subrs, properties) {
// Starts the conversion of the Type1 charstrings to Type2 // Starts the conversion of the Type1 charstrings to Type2
var charstringsCount = 0; var glyphs = charstrings.slice();
var charstringsDataLength = 0; var glyphsCount = glyphs.length;
var glyphs = []; for (var i = 0; i < glyphs.length; i++) {
for (var i = 0; i < charstrings.length; i++) { var charstring = glyphs[i];
var charstring = charstrings[i].charstring; glyphs[i] = this.flattenCharstring(charstring.glyph, charstring.charstring, subrs);
var glyph = charstrings[i].glyph;
var flattened = this.flattenCharstring(glyph, charstring, subrs);
glyphs.push(flattened);
charstringsCount++;
charstringsDataLength += flattened.length;
} }
// Create a CFF font data // Create a CFF font data
@ -1448,10 +1442,10 @@ CFF.prototype = {
// Fill the charset header (first byte is the encoding) // Fill the charset header (first byte is the encoding)
var charset = [0x00]; var charset = [0x00];
for (var i = 0; i < glyphs.length; i++) { for (var i = 0; i < glyphsCount; i++) {
var index = CFFStrings.indexOf(charstrings[i].glyph); var index = CFFStrings.indexOf(charstrings[i].glyph);
if (index == -1) if (index == -1)
index = CFFStrings.length + strings.indexOf(glyph); index = CFFStrings.length + strings.indexOf(charstrings[i].glyph);
var bytes = FontsUtils.integerToBytes(index, 2); var bytes = FontsUtils.integerToBytes(index, 2);
charset.push(bytes[0]); charset.push(bytes[0]);
charset.push(bytes[1]); charset.push(bytes[1]);
@ -1483,7 +1477,7 @@ CFF.prototype = {
topDictIndex = topDictIndex.concat([28, 0, 0, 16]) // Encoding topDictIndex = topDictIndex.concat([28, 0, 0, 16]) // Encoding
var charstringsOffset = charsetOffset + (charstringsCount * 2) + 1; var charstringsOffset = charsetOffset + (glyphsCount * 2) + 1;
topDictIndex = topDictIndex.concat(this.encodeNumber(charstringsOffset)); topDictIndex = topDictIndex.concat(this.encodeNumber(charstringsOffset));
topDictIndex.push(17); // charstrings topDictIndex.push(17); // charstrings