Explicit bidirectional control characters: RLO, LRO, RLE, LRE, PDF (in place of hex codes)
Consider the following string: RLO This is just a test string PDF
str.append(QChar(0x202e)); // RLO
str.append("This is just a test string");
str.append(QChar(0x202c)); // PDF
Possibly modify the attached test app to verify.
If you use QFontMetrics::elideText to elide from left, you get something like as follows:
...is just a test string PDF
So RLO is lost and that visual appearance is drastically different.
Even with elide from right, problems may happens - then result text string is as follows:
RLO This is just ...
RLO is not termined as it was in original string and visual appearance is incorrect if you
insert this result of elideText to another string.
Based on these examples, it should be clear that similar problems happen with all explicit
bidirectional control characters & left, right and middle elide modes.
Suggested solutions: preserve control characters unless both override/embedding and
corresponding pop are removed in truncation.