chinese word rendering

This commit is contained in:
Niklas von Hertzen
2013-01-04 23:47:59 +02:00
parent a313524aa4
commit 6d29cc5df3
3 changed files with 52 additions and 1 deletions

View File

@ -170,6 +170,16 @@ _html2canvas.Parse = function (images, options) {
metrics = setTextVariables(ctx, el, textDecoration, color);
if (options.chinese) {
textList.forEach(function(word, index) {
if (/.*[\u4E00-\u9FA5].*$/.test(word)) {
word = word.split("");
word.unshift(index, 1)
textList.splice.apply(textList, word);
}
});
}
textList.forEach(function(text, index) {
var bounds = getTextBounds(state, text, textDecoration, (index < textList.length - 1));
if (bounds) {

View File

@ -18,10 +18,10 @@ window.html2canvas = function(elements, opts) {
ignoreElements: "IFRAME|OBJECT|PARAM",
useOverflow: true,
letterRendering: false,
chinese: false,
// render options
flashcanvas: undefined, // path to flashcanvas
width: null,
height: null,
taintTest: true, // do a taint test with all images before applying to canvas