Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

107
Visualizações
Trouble adding the shaddah diacritic to an Arabic letter (JavaScript)

I am having some issues with the Arabic diacritic 'shaddah' in my code.

this.nfpp = this.pastTenseStem + this.roots[2] + "تُنَّ";

(I appologize the characters are so small, I'm not sure how to make it any bigger. You can see here that the shaddah is a little 'w' shaped character that sits on top of Arabic letters. In my code it is sitting on the ن in "تُنَّ", the second letter of the string, because Arabic is read right to left.)

This code should assign to the variable nfpp the value of the string pastTenseStem plus a character string plus the string "تُنَّ". However, when the code executes, instead of تُنَّ being added, تُّنَ is added (the shaddah changes which letter it is on). I've repeated the process for other different types of diacritical markings and they all behave as expected, except for this one. If I remove the shaddah, and just add تُنَ, then things work again as expected. Furthermore, experimenting in the console produces the expected result.

"فَعَل" + "ْتُنَّ"
>>'فَعَلْتُنَّ'

I'm really stumped here so I'd appreciate any help. Thank you!

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

After doing a little more digging I seem to have found the cause of the error, albeit with no explanation as to why that may be causing the issue. The issue was the font. I could see by looking at the string split into an array of characters that everything was as I expected it to be. Changing the font proved this.

Default font

Arial font

That is to say, the string was always correct, but the font was rendering it incorrectly.

In case anyone has the same issue that I had, my best guess is that the issue was in the way the default font rendered the combination of the ت and the ن. Other letters inserted between the two behave as they should and are rendered correctly.

Example

Even lengthening the connection between the two letters stops the font from rendering in the way that causes the bug. Example

Furthermore, the problem also exists with ب and ن, and with other vowel markings than just fathah, dammah, and kasrah, although not with sukun.

To summarize, to the best of my finding, when a word ends in either a ن with a shaddah and fathah, kasrah, or dammah preceded by either a ت, a ث, a ب, or a ن with a fathah, kasrah, or dammah, but not sukun, the shaddah moves from the ن to whatever letter proceeds it. I have no idea why, or how to fix it, but changing fonts was a fine workaround for me.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda