0.1.4 • Published 3 years ago
gameface-arabic-rtl2 v0.1.4
gameface-arabic-rtl2
This is a helper function for Arabic language support in Coherent Gameface. Since it does not support Arabic out of the box at the moment.
Installation
npm i gameface-arabic-rtl2Example
Without gameface-arabic-rtl

With gameface-arabic-rtl

Dependencies
I use Abdulla Saeed's code. But had to manually rewrite it for ES5 due to the fact that on some platforms for the babel-loader, conversion to ES5 for node_modules is disabled.
Usage
gameface-arabic-rtl is declared as a Universal Module (UMD), meaning it can be used with all conventional Javascript module systems:
ES6
import { process } from 'gameface-arabic-rtl';
const text = 'مرحبا بالعالم';
const translateNumbers = true;
const convertedText = process(text, translateNumbers);CommonJS
const GamefaceArabicRtl = require('gameface-arabic-rtl/dist/gameface-arabic-rtl.min.js');
const text = 'مرحبا بالعالم';
const translateNumbers = true;
const convertedText = process(text, translateNumbers);RequireJS
require(['GamefaceArabicRtl'], (GamefaceArabicRtl) => {
    const text = 'مرحبا بالعالم';
    const translateNumbers = true;
    const convertedText = process(text, translateNumbers);
});HTML5 <script> tag
<script src="gameface-arabic-rtl.min.js"></script>
<script>
    const text = 'مرحبا بالعالم';
    const translateNumbers = true;
    const convertedText = process(text, translateNumbers);
</script>Known issues
Since Coherent Gameface does not support OpenType GSUB Table lookup, the required glyphs must be present in the font. For example:
'ﺖ'.codePointAt(0); // must NOT return undefinedScript was tested on Tahoma font.