简体   繁体   English

html2canvas无法正确显示带有修饰符的表情符号

[英]html2canvas not rendering emojis with modifiers properly

Html2canvas can't render elements which contain emojis with modfiers such as skin color. Html2canvas无法渲染包含表情符号(如肤色)的元素。 For example: 👩🏿 turns into: 例如:👩🏿变成: 在此处输入图片说明 in Firefox. 在Firefox中。

Code example: 代码示例:

HTML: HTML:

<div id="target">&#128105;&#127999;</div>
<button onclick="takeScreenShot()">to image</button>

JS: JS:

window.takeScreenShot = function() {
    html2canvas(document.getElementById("target"), {
        onrendered: function (canvas) {
            document.body.appendChild(canvas);
        }
    });
}

http://jsfiddle.net/uLw7ozya/1/ http://jsfiddle.net/uLw7ozya/1/

Anyone know of a way to fix this? 有人知道解决此问题的方法吗? Or will I just have to find a way to remove all the modifiers before rendering? 还是我只需要找到一种方法在渲染之前删除所有修改器?

As noted here , this is something that is currently in the works to be developed. 如前所述这里 ,这一点是目前在作品中得到发展。

The accepted solution there is: 公认的解决方案是:

FYI the latest beta version of html2canvas supports emoji. 仅供参考,最新的html2canvas beta版本支持表情符号。 I've just tested using https://github.com/niklasvh/html2canvas/releases/tag/v0.5.0-beta4 and it seems to work. 我刚刚使用https://github.com/niklasvh/html2canvas/releases/tag/v0.5.0-beta4进行了测试,它似乎可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM