Skip to content

Fix for sales PDFs to support more characters#13016

Merged
magento-engcom-team merged 3 commits intomagento:2.2-developfrom
rossmc:bugfix/pdf-font-to-support-more-characters
Apr 14, 2018
Merged

Fix for sales PDFs to support more characters#13016
magento-engcom-team merged 3 commits intomagento:2.2-developfrom
rossmc:bugfix/pdf-font-to-support-more-characters

Conversation

@rossmc
Copy link
Copy Markdown
Contributor

@rossmc rossmc commented Jan 6, 2018

Description

The sales PDFs use the Libertine font which is not a unicode font and therefore it does not have full support of characters. It does not support Arabic, Russian, Greek, Indian or Thai alphabets and many more. For example it does not support the Indian ruppe currency symbol ( ₹ ) and displays tofu boxes instead, which makes the PDF invoice totals illegible.

It's better if we use a unicode font to support more languages and characters. So I've added the open source Noto-Serif font to fix this issue.

Fixed Issues (if relevant)

  1. Magento 2.1.6 - Invoice PDF doesn't support Thai #9666: Magento 2.1.6 - Invoice PDF doesn't support Thai
  2. Magento 2.1.3 - Invoice and shipment PDF doesn't support Arabic #12323: Magento 2.1.3 - Invoice and shipment PDF doesn't support Arabic

Manual testing scenarios

  1. Set the store currency to use the ruppe currency symbol ( ₹ ) .
  2. Print an invoice.

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@magento-cicd2
Copy link
Copy Markdown
Contributor

magento-cicd2 commented Jan 6, 2018

CLA assistant check
All committers have signed the CLA.

@magento-engcom-team magento-engcom-team added bugfix Component: Translation Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Component: Sales labels Jan 6, 2018
@miguelbalparda
Copy link
Copy Markdown
Contributor

Hi @rossmc! Thanks for your contribution. I really like the PR, let me check internally about the font you choose and I'll report back!

@rossmc
Copy link
Copy Markdown
Contributor Author

rossmc commented Jan 7, 2018

Thanks @miguelbalparda

Actually, I don't think the Noto font I chose is the best. Noto doesn't support all writing systems with a single font file, but rather with a collection of different font files. Their docs point out...

A single file is not possible, because there are many more glyphs in Noto than can fit into a single font.

I think a better alternative is GNU Free Font which supports much more writing systems. There could be others, like Arial. But GNU Free Font is the best I could find.

I updated this PR to use the GNU Free Font instead.

@sidolov
Copy link
Copy Markdown
Contributor

sidolov commented Mar 13, 2018

Hi @rossmc , I will request information regarding font license and come back with updates.
Thank you for the contribution!

@mgomma
Copy link
Copy Markdown

mgomma commented Apr 2, 2018

Arabic chars separated 2.1.5

@magento-engcom-team
Copy link
Copy Markdown
Contributor

@rossmc thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository.

@mgomma
Copy link
Copy Markdown

mgomma commented Apr 11, 2018

I think we should remove Zen_pdf totally as it'not supported and replace it with other php libraries that creates pdf from html/css.

The still exist with Unicode languages especially Arabic letters are displayed separated and reversed

@magento-engcom-team
Copy link
Copy Markdown
Contributor

Hi @rossmc. Thank you for your contribution.
Changes from your Pull Request will be available with the upcoming 2.2.5 release.

@rossmc
Copy link
Copy Markdown
Contributor Author

rossmc commented Apr 15, 2018

Hi @magento-engcom-team,

I submitted similar PRs for 2.3-develop (#14710) and 2.1-develop (#14711).

Thanks,
Ross

@rossmc rossmc changed the title Fix for sales PDFs to support all characters Fix for sales PDFs to support more characters Apr 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Component: Sales Component: Translation Progress: accept Release Line: 2.2 Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants