Assuming there is only one paragraph (no carriage returns), and only one text style being used, I have tried:
Code: Select all
function TMyControl.GetPlainText: WideString;
begin
Convert RVF to widestring...
end;
function TMyControl.GetFontHeight: Integer;
begin
Get the current font height...
end;
procedure TMyControl.BeforeDraw;
var
PlainText: string;
TextWidth, TextHeight: Integer;
begin
Canvas.Font.Assign(Font);
PlainText := RVU_GetRawUnicode(GetPlainText);
TextHeight := GetFontHeight;
TextWidth := RVU_TextWidth(PlainText, Canvas, [rvioUnicode]);
//
// Set the canvas height
//
Height := TextHeight * Ceil(TextWidth / Width);
end;
Thanks in advance,
Brandon