Mastodon
Programmierung

Fonts: Rotate Font

> I was wondering if anyone knows how to draw curved or wavy text.
>I’d like to be able to draw some text that following the outside curve
>of a circle or similar and I’d like the letters to hug the specified
>curve line.

You have to position each character explicitly. If you want to rotate
the individual letters, you can do this using code like the following
to rotate a font:

[code lang=”delphi”] var
LogFont: TLogFont;

with MyCanvas do begin
Font.Name := ‘Arial’;
Font.Size := 24;
Font.Style := [fsBold];
GetObject(Font.Handle, @LogFont, SizeOf(LogFont));
with LogFont do begin
lfOrientation := 450; // set to 45 degrees
lfEscapement := lfOrientation end;
Font.Handle := CreateFontIndirect(LogFont);
// at this point, the font has been rotated, and you can draw as
// many characters you want at the specified angle; repeat the
// process of setting lfOrientation and lfEscapement and calling
// CreateFontIndirect as many times as required to draw all of
// the letters
[/code]
-Steve

[tags]Delphi, Graphic, Fonts[/tags]

0 Kommentare zu “Fonts: Rotate Font

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht.