Hey guys, I've seen this issue opened before, however I can't get it to work properly for a custom Arabic font.
Here is how the HTML looks: http://prntscr.com/ckxcp3
And how the html2canvas 0.5.0-alpha1
looks: http://prnt.sc/ckxd1v
As you can see, the characters are all tangled up. Any ideas?
Update:
On line 2321 I replaced !hasUnicode
with hasUnicode
, which works almost perfect:
http://prnt.sc/ckxnjo
Now the font looks perfect, but normal characters "!" and "(" have wrong direction.
Update2:
Managed to find a fix based on n-a-g-r-o-m' solution [https://github.com/niklasvh/html2canvas/issues/686]
For version 0.5.0-beta3
Change:
var textList = (!this.options.letterRendering || noLetterSpacing(container)) && !hasUnicode(container.node.data) ? getWords(characters) : characters.map(function(character)
To:
var textList = (!this.options.letterRendering || noLetterSpacing(container)) || !hasUnicode(container.node.data) ? getWords(characters) : characters.map(function(character)
Change the && to ||
And it works perfect for Arabic without any CSS modifications
I recently tried to draw arabic/persian html to canvas and it rendered correctly
can someone else verify that it is solved?
sounds like the problem is fixed,
just beware of word-wrap : break-word
style too, it still splits the Arabic/Persian words into separate characters.
For version 0.5.0-beta3
Change:
var textList = (!this.options.letterRendering || noLetterSpacing(container)) && !hasUnicode(container.node.data) ? getWords(characters) : characters.map(function(character)To:
var textList = (!this.options.letterRendering || noLetterSpacing(container)) || !hasUnicode(container.node.data) ? getWords(characters) : characters.map(function(character)Change the && to ||
And it works perfect for Arabic without any CSS modifications
Worked for me along with letter-spacing: normal
don't use word-break: break-word;
Most helpful comment
Worked for me along with
letter-spacing: normal