arabic-reshaper

Reshapes Arabic words to work in non-supported environments.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
arabic-reshaper
1.1.07 years ago8 years agoMinified + gzip package size for arabic-reshaper in KB

Readme

Javascript-Arabic-Reshaper
Circle CI Codecov Codacy NPM VersionEye
Reshapes Arabic words to work in non-supported environments and with custom web fonts.
Meant to be used in the browser, but can also be used in server-side environments for things such as generating PDF files. This script mainly converts characters in the Arabic block to Arabic Presentation Forms-A/B — something that rendering engines should do by themselves but sometimes fail to do so. This solves the issue of disconnected Arabic letters which can be seen while using a custom font in almost all platforms (Web, Android, iOS, ...)
For more details, check these articles on Wikipedia:
  • https://en.wikipedia.org/wiki/Complextextlayout
  • https://en.wikipedia.org/wiki/ArabicscriptinUnicode

This script is inspired by the following projects:
  • https://github.com/agawish/Better-Arabic-Reshaper/
  • https://github.com/mpcabd/python-arabic-reshaper/

Installation

npm i --save arabic-reshaper

Usage

var ArabicReshaper = require('arabic-reshaper');
document.write(ArabicReshaper.convertArabic('السلام عليكم')); // outputs ﺍﻟﺴﻼﻡ ﻋﻠﻴﻜﻢ