I have Arabic content, which is a compound word like ضضضضضضض . I want to get the width of the first letter of the word (which does not match the width of the independent letter ie ض ).
I used the getBoundingClientRect() method and tried to get the width, but it gives the width of the independent character, not the compound one, which is less than the returned value by getBoundingClientRect
In the above word, the width ض (first letter) specified by getBoundingClientRect() is 16.109375, but the character is compound, that is, apparently, it is truncated, as you see. This is less than the set value.
I tried and got the EXACT (visible) width of the first letter, subtracting the width indicated by getBoundingClientRect() , the first two characters and the width of the first character, which would be 12 pixels correct.
Is there any better way than this so that I can get the exact visible width of each character like this in any word?
source share