title: How to get text extent of RichEdit in Delphi
body: <p>Does anyone know how to get the width and height of text in a TRichEdit control, in the same way that you would use TextWidth and TextHeight on a TCanvas?</p>
  
  <p>The reason I need to know this doing this is I have a RichEdit on a non-visible form that I copy the contents of to a canvas using  Richedit.Perform(EM_FORMATRANGE, ...).  The problem is that the EM_FORMATRANGE requires a parameter of type TFormatRange in which the target rect  is specified, but I don't know what the rect should be because I don't know in advance the size of the contents in the RichEdit.  Hope that makes sense.</p>