Skip to content
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

Hindi characters are not rendered properly #330

Open
Grom-S opened this issue Jan 29, 2014 · 6 comments
Open

Hindi characters are not rendered properly #330

Grom-S opened this issue Jan 29, 2014 · 6 comments
Labels

Comments

@Grom-S
Copy link
Contributor

Grom-S commented Jan 29, 2014

Some letters are missing. Any ideas what might cause this problem?

http://jsfiddle.net/7A9UY/1/

@niklasvh
Copy link
Owner

Probably related: #150

@Grom-S
Copy link
Contributor Author

Grom-S commented Jan 29, 2014

Seems like the problem is somewhere here:
https://github.com/niklasvh/html2canvas/blob/master/build/html2canvas.js#L1364
Hindi characters doesn't work well when letterRendering is true.

if i change this:

textList = (!options.letterRendering && /^(left|right|justify|auto)$/.test(textAlign) && noLetterSpacing(getCSS(el, "letterSpacing"))) ?
      textNode.nodeValue.split(/(\b| )/)
      : textNode.nodeValue.split("");

to this:

      textList = true ?
      textNode.nodeValue.split(/(\b| )/)
      : textNode.nodeValue.split("");

It seems like working ok. I wonder is it really needed? aligment seems to work..

@niklasvh niklasvh added this to the 0.5.0 milestone Aug 29, 2014
@nitinks78
Copy link

I am using your code inside PhoneGap/Cordova and testing on Android Nexus 7 kitkat 4.4.4

I tried to implement Hindi Fonts which show correctly in HTML but it does not render properly in Canvas:
HTML Output
hindihtml

CANVAS Output
hindicanvas

Check my code below:

<style> th { font-family: Arial; font-size: 20pt; } td { font-family: Arial; font-size: 14pt; width: 50% } </style>
txt

Report No: 111

Date: 16 अक्टूबर 2014

Type: Open / открыт

Seriousness: Medium / મધ્યમ

Incident From: 2014年10月16日

Incident To: 2014年10月16日

Amount of Loss: 1234

Peculiarity of Date: (None) / कोई नहीं

Peculiarity of Time: Early morning / эрт Өглөөний

Location: Society Premises / સમાજ જગ્યા Location: Society Premises / સમાજ જગ્યા Location: Society Premises / સમાજ જગ્યા Location: Society Premises / સમાજ જગ્યા Location: Society Premises / સમાજ જગ્યા

Peculiarity: Near Boundary Wall / 附近的邊界牆

Category: theft / চুরি

Peculiarity: Watchman\'s Carelessness

Reported By: txtname

Reported To: Administrator / સંચાલક

@nitinks78
Copy link

Thanks! Grom-S's solution worked for older version (0.4)

Can you suggest a solution for 0.5 version?

@AnandBhandari1
Copy link

can you please provide solution for .5 version.. because in .4 version it is working. but .4 version does not support smiley..

@parshavshah
Copy link

Thanks ! @Grom-S. It worked for me.

ishaans added a commit to ishaans/HTML2CANVAS that referenced this issue Jul 7, 2020
Set the word rendering function to true by default.
This allows textLimit to processes text from other languages without problems in rendering. 

Solves niklasvh/html2canvas#330
@niklasvh niklasvh removed this from the 0.5.0 milestone Jul 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants