question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Arabic font rendering

See original GitHub issue

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]

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

8reactions
vslipchenkocommented, Oct 27, 2020

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

2reactions
S4Micommented, Sep 10, 2018

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Arabic "joined up" text in Freetype - fonts
It is indeed possible to do a simplified implementation of arabic text rendering. First you need to split the UTF8 text into Unicode...
Read more >
Text Layout Requirements for the Arabic Script
The above examples use the Arabic Typesetting font. ... Rendering of letters depends not only on their place in the word (initial, medial, ......
Read more >
Text Rendering - Globalization
Text rendering is the process of converting a string to a format that ... A typical example is the ligature of Arabic Lam...
Read more >
Arabic font rendering The critics (see Figure 6)
This model is based on the layering composition. The combination of diacritics with letters requires a basic layering to combine any diacritics in...
Read more >
How To Render Arabic Font Correctly?
i Tried To import Ariel Font,But it didnt Work either i Heard Something in Another Topic About manual glyph substitution
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found