bug fixes for body background & firefox font

This commit is contained in:
Niklas von Hertzen 2012-03-02 14:43:25 +02:00
parent 2dc8b9385e
commit bf994849e0
3 changed files with 12 additions and 4 deletions

View File

@ -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>)

View File

@ -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{
@ -1260,6 +1264,9 @@ html2canvas.Parse = function (element, images, opts) {
parseElement(children[i], stack);
}
stack.backgroundColor = getCSS( body, "backgroundColor" );
return stack;
};

View File

@ -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;