[Qt] QT patch

Jesus Reyes jesusrmx at yahoo.com.mx
Tue Jan 9 23:10:13 CET 2007


--- Felipe Monteiro de Carvalho <felipemonteiro.carvalho at gmail.com>
escribió:

> Here is test code for a rotated text app (put on a app with only 1
> form and no controls on it):
> 
> 
> function CreateRotatedFont(F : TFont; Angle : Integer) : hFont;
>  {-create a rotated font based on the font object F}
> var
>  LF : TLogFont;
> begin
>  FillChar(LF, SizeOf(LF), #0);
>  with LF do begin
>    lfHeight           := F.Height;
>    lfWidth            := 0;
>    lfEscapement       := Angle*10;
>    lfOrientation      := 0;
>    if fsBold in F.Style then
>      lfWeight         := FW_BOLD
>    else
>      lfWeight         := FW_NORMAL;
>    lfItalic           := Byte(fsItalic in F.Style);
>    lfUnderline        := Byte(fsUnderline in F.Style);
>    lfStrikeOut        := Byte(fsStrikeOut in F.Style);
>    lfCharSet          := DEFAULT_CHARSET;
>    StrPCopy(lfFaceName, F.Name);
>    lfQuality          := DEFAULT_QUALITY;
>    {everything else as default}
>    lfOutPrecision     := OUT_DEFAULT_PRECIS;
>    lfClipPrecision    := CLIP_DEFAULT_PRECIS;
>    case F.Pitch of
>      fpVariable : lfPitchAndFamily := VARIABLE_PITCH;
>      fpFixed    : lfPitchAndFamily := FIXED_PITCH;
>    else
>      lfPitchAndFamily := DEFAULT_PITCH;
>    end;
>  end;
>  Result := CreateFontIndirect(LF);
> end;
> 
> 
> procedure TForm2.FormCreate(Sender: TObject);
> begin
>  MyFont := CreateRotatedFont(Canvas.Font, 45);
> end;
> 
> procedure TForm2.FormPaint(Sender: TObject);
> begin
>  SelectObject(Canvas.Handle, MyFont);
>  Canvas.TextOut(200, 200, 'Texto para ser escrito');
> end;
> 

Thanks, I made some experiments, see the attached screenshot.
I yet don't know what is supposed to be the right result, I have
little experience with rotated text, and a screenshot was not
provided :P

What is the right result, the upper or the lower, I would think the
upper one but the code in DC.DrawText draws the lower one.

Jesus Reyes A.

__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! 
Regístrate ya - http://correo.yahoo.com.mx/ 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lazqtrotatedtext.png
Type: image/png
Size: 10919 bytes
Desc: 2836318157-lazqtrotatedtext.png
URL: <http://lists.lazarus-ide.org/pipermail/qt/attachments/20070109/7736acab/attachment-0001.png>


More information about the Qt mailing list