Skip to content

Commit

Permalink
bug fixes for body background & firefox font
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasvh committed Mar 2, 2012
1 parent 2dc8b93 commit bf99484
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ For more information and examples, please visit the <a href="http://html2canvas.

v0.33 -

* SVG taint fix, and additional taint testing options for rendering (<a href="https://github.com/niklasvh/html2canvas/commit/2dc8b9385e656696cb019d615bdfa1d98b17d5d4">niklasvh</a>)
* Added support for CORS images and option to create canvas as tainted (<a href="https://github.com/niklasvh/html2canvas/commit/3ad49efa0032cde25c6ed32a39e35d1505d3b2ef">niklasvh</a>)
* Improved minification saved ~1K! (<a href="https://github.com/cobexer/html2canvas/commit/b82be022b2b9240bd503e078ac980bde2b953e43">cobexer</a>)
* Added integrated support for Flashcanvas (<a href="https://github.com/niklasvh/html2canvas/commit/e9257191519f67d74fd5e364d8dee3c0963ba5fc">niklasvh</a>)
Expand Down
13 changes: 10 additions & 3 deletions src/Parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,13 @@ html2canvas.Parse = function (element, images, opts) {
}

ctx.setVariable("fillStyle", color);
ctx.setVariable("font", font_variant + " " + bold + " " + font_style + " " + size + " " + family);



/*
need to be defined in the order as defined in http://www.w3.org/TR/CSS21/fonts.html#font-shorthand
to properly work in Firefox
*/
ctx.setVariable("font", font_style+ " " + font_variant + " " + bold + " " + size + " " + family);

if (align){
ctx.setVariable("textAlign", "right");
}else{
Expand Down Expand Up @@ -1260,6 +1264,9 @@ html2canvas.Parse = function (element, images, opts) {
parseElement(children[i], stack);
}


stack.backgroundColor = getCSS( body, "backgroundColor" );

return stack;

};
Expand Down
2 changes: 1 addition & 1 deletion src/Renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ html2canvas.Renderer = function(parseQueue, opts){
canvas.height = canvas.style.height = (!usingFlashcanvas) ? options.height || zStack.ctx.height : Math.min(flashMaxSize, (options.height || zStack.ctx.height) );

fstyle = ctx.fillStyle;
ctx.fillStyle = "#fff";
ctx.fillStyle = zStack.backgroundColor;
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = fstyle;

Expand Down

0 comments on commit bf99484

Please sign in to comment.