bleeptrack / wikidata-generator

4 stars 3 forks source link

South Asian scripts do not render properly #2

Open mahir256 opened 4 years ago

mahir256 commented 4 years ago

I was interested in creating a custom image in Bengali, and I adjusted the font from Noto Sans to Noto Sans Bengali on my end (and modified the blob and main texts) in an attempt to make this happen, but the output does not render the vowel diacritics and consonant conjuncts properly:

image

The expected output for each of the three text elements should resemble the following:

Untitled

I suspect that this is caused by a lack of support for such fonts from opentype.js (opentypejs/opentype.js#390), and a suggestion was made on that issue to use fontkit instead for rendering such text.

ranjithsiji commented 4 years ago

I think it is the problem with opentype.js. We need to try fontkit from pdfkit project. It will render the complex script layout. If we drop the svg option and use only on png then we can go for html2canvas. Anyway we need an option to choose language and need to change the fonts according to it. I hope notofonts from google font repo is the best bet for rendering other languages than latin scripts.

Working on the project just to create a prototype. If anyone can help or give more good suggessions then that is best. Happy to collaborate.

bleeptrack commented 4 years ago

Hey mahir256 and ranjithsijt! I checked fontkit and sadly it has no direct support for browsers, only for serverside node.js. I did a quick test with browserify and was not successful, though I'm no expert on converting node packages to the web. I'm very open to pull requests :)

I won't drop support for SVG as it was a main feature request from Wikimedia to be able to print the generated images on merch and vector graphics are often needed to do so.

ranjithsiji commented 4 years ago

OK. Let's search for other kind of utilities or scripts which can handle this issue. Happy to help.

bleeptrack commented 3 years ago

Some people asked what the fastest workaround is: sadly, as long as there is nothing to replace opentype.js with, the quickest way is to generate a logo and fix errors in a tool like Inkscape. I'm sorry that this is no good solution. I'm still very open to pull requests. Though the overall best solution would be to fix the rendering issues in directly in Opentype :)