Last Updated: 14 Apr 2016 11:00 by ADMIN
Created on: 30 Mar 2016 11:29
Category: RichTextBox
Type: Bug Report
RichTextBox measures text incorrectly
I have tried to use the RichTextBox, but found that it does not work very well when it comes to measure the text. This results in clipped text and that the caret can be displayed in a different place then expected.
This can easily be seen with a font like Gabriola, which uses complex kerning metrics. Type a text with a lot of "ff" and "fi" and you will soon see that your caret gets out of sync and that text is sometimes clipped.
When I look at the code of RichTextBox it seems to me that it uses its own calculation of text widths and that the this is based on a very simple method using just the kerning information. There is also a hard coded list containing information which fonts that has kerning info and which fonts that are mono spaced. It seems strange to me to have this in a config file since there is a large number of fonts used by the users.
It also seem to look at the Unicode character family in order to determine if ligatures are used or not, which is also quite strange since ligatures can be used for western characters too. The font Gabriola is an example of this. Look at "fi" in a word like "fine".
It can potentially consume a lot of memory since I think that it builds a dictionary of the kerning of all pairs of characters for all fonts that it encounters.
I guess this way of doing things were made for performance, but unfortunately, good performance doesn't help much if it doesn't work.
I am not sure if I should report this as a bug, since it is more of a fatal design issue of the whole control.
Posted on: 14 Apr 2016 10:59

After a further discussion in a support thread, we managed to isolate an issue and logged it here:

Posted on: 31 Mar 2016 14:57
Hi Thomas,

We are aware of this issue, but it is currently considered as a low priority because it could be reproduced in specific cases and according to our tests by far it doesn't have a big impact on the control. 

However, we haven't thoroughly researched it and would much appreciate if you could share more details on the impact this issue has on you and the exact scenario. We will be happy to discuss any suggestions or concerns you may have on this topic as well.

It would be great if you could contact us through our support ticketing system ( as this will facilitate our communication and will allow exchanging different attachments that may help us during our discussion.