我对HTML2Canvas有一个非常奇怪的问题。如果i在chrome中跟随f且将f大写,则不会呈现字母i。 Firefox中没有问题。
我不想更改字体,它是嵌入式字体(Ubuntu),也许是问题所在?
<script type="text/javascript">
var $loading = $('#loader').hide();
$('#carddownload').on('click', function() {
showimage();
});
$(document)
.ajaxStart(function () {
$loading.show();
})
.ajaxStop(function () {
$loading.hide();
});
function showimage(){
html2canvas([document.getElementById('card')], {
onrendered: function(canvas)
{
var name = $(".tcgnamecell").html();
var n = name.indexOf("<br>");
var data = {};
data['name'] = name.substr(0);
data['img'] = canvas.toDataURL();
var n = data['name'].indexOf("<br>");
$.post("save.php", {image: data}, function (file) {
window.location.href ="download.php?path=" + file;
});
}
});
}
</script>
最佳答案
无论使用的是Google字体还是嵌入式字体,某些字体都无法在HTML2Canvas中正确呈现。我使用了不同的字体。蓝色高速公路rg.ttf与Ubuntu类似。
关于javascript - 如果跟随f,HTML2Canvas无法在Chrome中呈现“i”,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/48236249/