- Copy the font file(*.ttf) in the attachment to the font file directory of your system
- Run the sample program I uploaded
- You can dynamically switch locales in my application
- When you switch to Chinese or English language environment, you can see that the characters in the text input box have ellipsis
- But when you switch to Tibetan, the ellipsis does not appear
- The above link is the implementation of the elidedtext function. From the marked area, it can be seen that this function will call glyphindex() to obtain the index of the character '...', but there is no font related to '.' or '...' in the Tibetan ttf file, so the return value is 0.
- This ttf file is provided by Qt. As for the processing logic here, Qt thinks that if the index cannot be found, the ellipsis will not be displayed. However, I think it can be slightly improved. Even if there are no relevant characters in the ttf file, the text omission function can be realized.