I am using the exact same properties, including the same text, except that I change the input pRect and pClip boundaries slightly.
In one case the returned width is less than the input width (ok), but in another case the returned width is greater than the input width (not ok).
When the returned width is less, the text wraps and produces 5 lines.
When the returned width is greater, the text wraps differently producing 6 lines.
The issue is that the returned height is the same for both text blocks - even though one has 5 lines and the other has 6.
The value returned for 6 lines is correct while the returned value for 5 lines should be less.
Here's some code info:
Code: Select all
IPXC_CharFormat pCharFmt = null;
IPXC_ParaFormat pParaFmt = null;
IPXC_DrawTextCallbacks pCallbacks = null;
PXC_Rect pRect;
PXC_Rect pTextBounds; //will hold returned size of textblock
uint nFlags = (uint)PXC_DrawTextFlags.DTF_RichText | (uint)PXC_DrawTextFlags.DTF_CalcSizeOnly;
string curText = "<body><p style=\"font-family:'Arial'; font-size:12pt; line-height:normal;\"><span style=\"color:#0000ff\">This is html formatted text wrapped with one word in <b>bold</b>.<br/>and a line break plus <i>italic</i> word.</span></p></body>"
//These pRect values return 6 lines and height of 80.42 - Correct
// Also, the returned width = 97.38
pRect.left = 0
pRect.top = 0
pRect.right = 110
pRect.bottom = -5000
//These pRect values return 5 lines and height of 80.42 - Incorrect
// Also, the returned width = 114.06 which is greater than the input width
pRect.left = 0
pRect.top = 0
pRect.right = 111
pRect.bottom = -5000
tmpCreator.ShowTextBlock(curText, pRect, pRect, nFlags, -1, pCharFmt, pParaFmt, pCallbacks, out pTextBounds);
Thanks.