Clarifying variable role

This commit is contained in:
Artur Adib 2012-01-20 15:20:25 -05:00
parent 66eff7a5cb
commit 357f4cc665

View File

@ -703,12 +703,12 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
if (textSelection) if (textSelection)
text.geom = this.getTextGeometry(); text.geom = this.getTextGeometry();
var width = 0; var x = 0;
for (var i = 0; i < glyphsLength; ++i) { for (var i = 0; i < glyphsLength; ++i) {
var glyph = glyphs[i]; var glyph = glyphs[i];
if (glyph === null) { if (glyph === null) {
// word break // word break
width += wordSpacing; x += wordSpacing;
continue; continue;
} }
@ -719,28 +719,28 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
default: // other unsupported rendering modes default: // other unsupported rendering modes
case TextRenderingMode.FILL: case TextRenderingMode.FILL:
case TextRenderingMode.FILL_ADD_TO_PATH: case TextRenderingMode.FILL_ADD_TO_PATH:
ctx.fillText(char, width, 0); ctx.fillText(char, x, 0);
break; break;
case TextRenderingMode.STROKE: case TextRenderingMode.STROKE:
case TextRenderingMode.STROKE_ADD_TO_PATH: case TextRenderingMode.STROKE_ADD_TO_PATH:
ctx.strokeText(char, width, 0); ctx.strokeText(char, x, 0);
break; break;
case TextRenderingMode.FILL_STROKE: case TextRenderingMode.FILL_STROKE:
case TextRenderingMode.FILL_STROKE_ADD_TO_PATH: case TextRenderingMode.FILL_STROKE_ADD_TO_PATH:
ctx.fillText(char, width, 0); ctx.fillText(char, x, 0);
ctx.strokeText(char, width, 0); ctx.strokeText(char, x, 0);
break; break;
case TextRenderingMode.INVISIBLE: case TextRenderingMode.INVISIBLE:
break; break;
} }
width += charWidth; x += charWidth;
text.str += glyph.unicode === ' ' ? '\u00A0' : glyph.unicode; text.str += glyph.unicode === ' ' ? '\u00A0' : glyph.unicode;
text.length++; text.length++;
text.canvasWidth += charWidth; text.canvasWidth += charWidth;
} }
current.x += width * textHScale2; current.x += x * textHScale2;
ctx.restore(); ctx.restore();
} }