New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unicode font problem #226
Comments
@ramesh-git It seems to be really a BUG html2canvas even. I did a test with "fillText" and had no problems, but when using the "html2canvas". There were some characters were replaced by a strange drawing (a circle to be exact). The only quick fix that you can specify:
fillText example: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
body{
background:#ccc;
}
canvas{
background:#fff;
}
</style>
<canvas id="e" width="600" height="200"></canvas>
<h1 id="a1">தமிழ் ஊடகங்கள் கூடுமிடம்-பொங்குதமிழ்- World of Tamilconverters</h1>
<script>
var canvas = document.getElementById("e");
var a1 = document.getElementById("a1");
var context = canvas.getContext("2d");
context.fillStyle = "#000";
context.font = "bold 16px Arial";
context.fillText(a1.innerHTML, 10, 20);
</script> bug html2cavans example: |
I discovered the reason for the failure: For the "unicode text" you need to add the property
Try: <h1 id="a1"><span style="text-align:justify;">தமிழ் ஊடகங்கள் கூடுமிடம்-பொங்குதமிழ்- World of Tamilconverters</span></h1>
<script>
var a1 = document.getElementById("a1");
html2canvas(a1,{
"onrendered":function(canvas){
document.body.appendChild(canvas);
}
});
</script> |
very much thanks to brcontainer. textList = (!options.letterRendering && /^(left|right|justify|auto)$/.test(textAlign) && noLetterSpacing(getCSS(el, "letterSpacing"))) with: textList = (!options.letterRendering || /^(left|right|justify|auto)$/.test(textAlign) || noLetterSpacing(getCSS(el, "letterSpacing"))) notice at (&&) sign which is replaced by (||). |
@BENYAZ it works for me (Pashto & Urdu) languages. Thank you |
@BENYAZ it also works for me in persian language |
@BENYAZ yea, I also confirm it working in Arabic and Persian. |
It working in Dari |
@BENYAZ It's working in Bangla language. Thanks |
@rafiul ভাই আপনি কেমনে এই সমস্যা সলভ করলেন একটু খুলে বলেবেন? অর্থাৎ কোন ফাইলে গিয়ে লাইনগুলো বদলাতে হবে? html2canvas.js এর বেশ কয়েকটা ভার্শনে ট্রাই করেছি, কোনো জায়গাতেই রিপ্লেস হওয়া (যেগুলো রিপ্লেস করে নতুন লাইন বসাবো) লাইনগুলো পেলাম না। |
@IbnAhmed html2canvas.js ফাইলে নিচের লাইনটা খুজে বের করেন Replace with: textList = (!options.letterRendering || /^(left|right|justify|auto)$/.test(textAlign) || noLetterSpacing(getCSS(el, "letterSpacing"))) ** && এর জায়গায় ।। হবে। |
@rafiul, ভাই আপনি আমার কথা গুলো বুঝতে পারেননি। আমার কাছে html2canvas.js নামে যে ফাইলটা আছে সেটাতে এই লাইনটাই নেই " textList = (!options.letterRendering && /^(left|right|justify|auto)$/.test(textAlign) && noLetterSpacing(getCSS(el, "letterSpacing")))" |
@IbnAhmed Download from here: http://3rwebtech.com/html2canvas.js |
@rafiul, অসংখ্য ধন্যবাদ ভাই :) |
@rafiul Would you pls share html2canvas.js file. Thanks |
@rafiul Would you pls share html2canvas.js file. Previous link not working. Thanks |
@hiroksarker download it from here, https://www.dropbox.com/s/20hk1qcbm0d7far/html2canvas.js?dl=0 |
same problem with me .... any help please ? |
setting css : letter-spacing: 0; |
in new version should change this line: var wordRendering = (!this.options.letterRendering || noLetterSpacing(container)) && !hasUnicode(container.node.data); with this: |
I fixed this problem use css like |
This works like wonder. |
Hi All,
In my HTML code some UNICODE content exists. If I try to convert from HTML to Canvas, it is generating junk characters. I used tamil UNICODE data.
find the screen shot of my HTML content.
Can you please give any solution. I needs this urgent.
Please respond anyone ASAP.
Thanks&Regards,
Ramesh
The text was updated successfully, but these errors were encountered: