Three.js: Right to left support for texts

Created on 4 Jul 2017  路  3Comments  路  Source: mrdoob/three.js

I need to show some text in Persian/Arabic language. I loaded a font including characters and I used TextGeometry to create a text on the scene:

var loader = new THREE.FontLoader();
loader.load('B Zar_Regular.js', function (font) {
    var textGeo = new THREE.TextGeometry('爻賱丕賲!', {
        font: font,
        size: 1,
        height: 0.05,
        curveSegments: 12,
    });
    var material = new THREE.MeshNormalMaterial();
    var textMesh = new THREE.Mesh(textGeo, material);
    textMesh.position.x = 15;
    scene.add(textMesh);
});

I was expecting to see 爻賱丕賲! but the output was:
three rtl
letters are separated and order of characters is reversed mistakenly. After all it seems threejs do not support rtl languages. Am I right or I missed something? Is there any workaround as a quick solution? Thanks.

Enhancement

Most helpful comment

I answered the SO question it may help some people.

All 3 comments

Is there any workaround as a quick solution?

raster text with fancy shader maybe? just drawing arabic into canvas works ootb.

I answered the SO question it may help some people.

Was this page helpful?
0 / 5 - 0 ratings