THTMLHint

How to calculate width of text displayed in THTMLHint window ? No matter what I try, the calculated value is always wrong by 10 to 15 % from real value. Whats wrong this difference depends on exact text being displayed. I have tried three different methods, none of which gives correct result:


1. TCanvas::TextWidth
2. Gdiplus::Graphics::MeasureCharacterRanges
3. Gdiplus::Graphics::MeasureString

I need to calculate exact width of string to be able to format content of html hint as table (using <IND> marks). In the following screenshot you can see text "Expected no. of pulses(derived from Reference Standard)" displayed by THTMLHint and MS Word. You can see MS Word version is around 20 pixels narrower.

Sorry but I am not able to upload image.

In THTMLHint, the text is drawn with our mini HTML engine, so the calculation of the size also needs to be done via this engine. At this time, access to this engine is no exposed in the THTMLHint component, so we would need to extend this component to enable access.