{"id":142,"date":"2007-05-12T16:07:28","date_gmt":"2007-05-12T14:07:28","guid":{"rendered":" http:\/\/www.nsonic.de\/blog\/2007\/05\/fonts-rotated-fonts\/"},"modified":"2007-05-12T16:07:29","modified_gmt":"2007-05-12T14:07:29","slug":"fonts-rotated-fonts","status":"publish","type":"post","link":"https:\/\/www.nsonic.de\/blog\/2007\/05\/fonts-rotated-fonts\/","title":{"rendered":"Fonts: Rotated Fonts"},"content":{"rendered":"<p>[code lang=&#8221;delphi&#8221;]\/\/Rotating fonts is a straight forward process, so long as the Windows font<br \/>\n\/\/ mapper can supply a rotated font based on the font you request. Using a\\<br \/>\n\/\/ TrueType font virtually guarantees success.<\/p>\n<p>\/\/ Here is an example of creating a font that is rotated to<br \/>\n\/\/ whatever degree you specify<br \/>\nProcedure TForm1.DrawRotatedText(TheCanvas : TCanvas; TheAngle : Integer; TheText : String);<br \/>\nvar<br \/>\n  lf : TLogFont;<br \/>\n  tf : TFont;<br \/>\nbegin<br \/>\n  with TheCanvas do begin<br \/>\n    Font.Name := &#8216;Arial&#8217;;<br \/>\n    Font.Size := 24;<br \/>\n    Brush.Style := bsClear;<br \/>\n    tf := TFont.Create;<br \/>\n    try<br \/>\n      tf.Assign(Font);<br \/>\n      GetObject(tf.Handle, sizeof(lf), @lf);<br \/>\n      lf.lfEscapement := TheAngle * 10;<br \/>\n      lf.lfOrientation := TheAngle * 10;<br \/>\n      tf.Handle := CreateFontIndirect(lf);<br \/>\n      Font.Assign(tf);<br \/>\n    finally<br \/>\n      tf.Free;<br \/>\n    end;<br \/>\n    TextOut(20, Height div 2, TheText);<br \/>\n  end;<br \/>\nend;<\/p>\n<p>\/\/ Call it like so<br \/>\nprocedure TForm1.RotatedTextClick(Sender: TObject);<br \/>\n Var<br \/>\n  TheAngle : Integer;<br \/>\nbegin<br \/>\nTheAngle := StrToInt(Edit1.Text);<br \/>\n DrawRotatedText(Image2.Canvas, TheAngle, &#8216;Hello&#8217;);<br \/>\nend;<br \/>\n[\/code]<\/p>\n<p>[tags]Dephi, Graphic, Fonts[\/tags]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>[code lang=&#8221;delphi&#8221;]\/\/Rotating fonts is a straight forward process, so long as the Windows font \/\/ mapper can supply a rotated font based on&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":""},"categories":[11],"tags":[102,103,101],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p71Tml-2i","_links":{"self":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts\/142"}],"collection":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/comments?post=142"}],"version-history":[{"count":0,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts\/142\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/media?parent=142"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/categories?post=142"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/tags?post=142"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}