Skip to content
This repository has been archived by the owner on Mar 11, 2020. It is now read-only.

Commit

Permalink
update readme and package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
mapmeld committed Mar 17, 2017
1 parent ea5f439 commit 198ebb1
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 2 deletions.
66 changes: 66 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# js-arabic-reshaper

Text reshaper for Arabic text - ported from <a href='https://github.com/mpcabd/python-arabic-reshaper'>Python</a>
and Java versions.

## Context

Arabic script is very special with two essential features:

1. It is written from right to left.
2. The characters change shape according to their surrounding characters.

So when you try to print text written in Arabic script in an application
– or a library – that doesn’t support Arabic you might end up
with something that looks like this:

![Arabic text written from left to right with no reshaping](http://mpcabd.xyz/wp-content/uploads/2012/05/arabic-1.png)

We have two problems here, first, the characters are in the isolated form,
which means that every character is rendered regardless of its surroundings,
and second is that the text is written from left to right.

***This project does not solve the right-to-left issue, only the reshaping***

Displayed in correct right-to-left order:

![Arabic text written from right to left with no reshaping](http://mpcabd.xyz/wp-content/uploads/2012/05/arabic-6.png)

The only issue left to solve is to reshape those characters and replace them
with their correct shapes according to their surroundings. Using this library
helps with the reshaping so we can get the proper result like this:

![Arabic text written from right to left with reshaping](http://mpcabd.xyz/wp-content/uploads/2012/05/arabic-3.png)

## Install and Use

On the command-line:

```bash
npm install js-arabic-reshaper --save
```

Then in the source code:

```javascript
const Reshaper = require('arabic-reshaper');
Reshaper.reshape(arabicWord);

// options
Reshaper.reshape(arabicWord, {
ligatures: true,
delete_harakat: false
});
```

## Tests

```
npm install
npm install mocha -g
mocha
```

## License

Open source, GPL v3+ (same as Python Arabic Reshaper)
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "arabic-reshaper",
"name": "js-arabic-reshaper",
"version": "1.0.0",
"description": "Replace Arabic text with their presentation forms for situations where there is no automatic text-shaping",
"description": "Replace Arabic letters with their presentation forms for situations where there is no automatic text-shaping",
"main": "index.js",
"scripts": {
"test": "mocha"
Expand Down

0 comments on commit 198ebb1

Please sign in to comment.