minor fix for text positioning

This commit is contained in:
MoyuScript
2011-07-18 19:21:55 +03:00
parent efe27ebd29
commit d8d560e9e8
3 changed files with 14 additions and 9 deletions

View File

@ -40,16 +40,17 @@ html2canvas.prototype.newText = function(el,textNode,ctx){
text_align = text_align.replace(["-webkit-auto"],["auto"])
if (this.opts.letterRendering == false && /^(left|right|justify|center|auto)$/.test(text_align) && /^(normal|none)$/.test(letter_spacing)){
if (this.opts.letterRendering == false && /^(left|right|justify|auto)$/.test(text_align) && /^(normal|none)$/.test(letter_spacing)){
// this.setContextVariable(ctx,"textAlign",text_align);
renderWords = true;
renderList = textNode.nodeValue.split(/\b/);
renderList = textNode.nodeValue.split(/(\b| )/);
}else{
this.setContextVariable(ctx,"textAlign","left");
// this.setContextVariable(ctx,"textAlign","left");
renderList = textNode.nodeValue.split("");
}
this.setContextVariable(ctx,"fillStyle",color);
this.setContextVariable(ctx,"font",font);
@ -59,6 +60,8 @@ html2canvas.prototype.newText = function(el,textNode,ctx){
var oldTextNode = textNode;
for(var c=0;c<renderList.length;c++){
// TODO only do the splitting for non-range prints
var newTextNode = oldTextNode.splitText(renderList[c].length);