1

I am trying to use right to left language in CesiumJS label, but the result is reverse ordered. What can I do?

 viewer.entities.add({
        position : Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883),
        point : {
            pixelSize : 10,
            color : Cesium.Color.YELLOW
        },
        label : {text : "מה המצב" }
    });

Yields image: enter image description here

1 Answer 1

0

Reversing the string order did the trick:

viewer.entities.add({
  position : Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883),
  point : {
      pixelSize : 10,
      color : Cesium.Color.YELLOW
  },
  label : {text : reverse("מה המצב") }
});

Where reverse is something like

function reverse(s) {
  var o = [];
  for (var i = 0, len = s.length; i <= len; i++)
    o.push(s.charAt(len - i));
  return o.join('');
}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.