🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.nativeapi
Article #239

Re: Rotated Text

#239
From: Finn Tolderlund
Date: Mon, 26 Jan 2004 07:32
64 lines
3125 bytes
procedure TextOutAngle(Canvas: TCanvas; X, Y: Integer; Text: String; Angle:
Integer);
var
  OldFont: TFont;
  OldBrush: TBrush;
  NewFont: THandle;
  LogFont: TLogFont;
begin
  Angle := Angle mod 3600;
  if Angle < 0 then
    Angle := Angle + 3600;
  with Canvas do
  begin
    OldFont := TFont.Create;
    OldBrush := TBrush.Create;
    {Save the current form font}
    OldFont.Assign(Font);
    OldBrush.Assign(Brush);
    {Fill in the TLogFont fields}
    with LogFont do
    begin
      lfHeight := Font.Height;                {Srt to Canvas.Font.Height}
      lfWidth := 0;                           {Let font mapper choose width}
      lfEscapement := Angle;                  {Angle of print, in 10ths of
degree}
      lfOrientation := Angle;                 {Ignored by Windows}
      lfWeight := 0;
      if fsBold in OldFont.Style then
        lfWeight := FW_BOLD;
      lfItalic := Ord(fsItalic in OldFont.Style);  {Italics}
      lfUnderline := Ord(fsUnderline in OldFont.Style);  {Underline}
      lfStrikeout := Ord(fsStrikeOut in OldFont.Style);  {No StrikeOut}
      lfCharSet := ANSI_CHARSET;              {Default}
      lfOutPrecision := OUT_TT_ONLY_PRECIS;   {Force True Type fonts}
      lfClipPrecision := CLIP_DEFAULT_PRECIS; {Default}
      lfQuality := PROOF_QUALITY;             {Windows gets a better one if
available}
      lfPitchAndFamily := VARIABLE_PITCH;     {Default}
      StrPCopy(lfFaceName, Font.Name);        {Canvas's font name}
    end;
    {Create and get handle of temporary font}
    NewFont := CreateFontIndirect(LogFont);
    {Assign temporary font to form's Canvas}
    Font.Handle := NewFont;
    {Write text to form's Canvas}
    TextOut(X, Y, Text);
    {Restore form's original font}
    Font.Assign(OldFont);
    Brush.Assign(OldBrush);
    OldFont.Free;
    OldBrush.Free;
  end;
  {Destroy temporary font}
  DeleteObject(NewFont);
end;
-- 
Finn Tolderlund


"Mac Davis" <newsgroups@blindsided.org> skrev i en meddelelse
news:40147132$1@newsgroups.borland.com...
> Uding Delphi, how does one go about printeing rotated text to a printer?
> I want to creade a procedure something like this
> RotatedTextOut (xpos, ypos, angle : integer ; txt : string);
Technical Details
Message-ID: <4014c239@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <40147132$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f94dd,66566a86560020ac
X-Google-Attributes: gidf94dd,public
X-Google-ArrivalTime: 2004-01-25 23:39:24 PST
From: "Finn Tolderlund" <no@spam.dk>
Newsgroups: borland.public.delphi.nativeapi
References: <40147132$1@newsgroups.borland.com>
Subject: Re: Rotated Text
Date: Mon, 26 Jan 2004 08:32:04 +0100
Lines: 66
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 80.164.111.97
Message-ID: <4014c239@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1075102265 80.164.111.97 (25 Jan 2004 23:31:05 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail