<div dir="ltr"><div><div><div><div><div><div><div><div><div><div>Hi folks!<br><br></div>This is my second post. If this is not the correct list please let me know.<br><br></div>I am trying to compile a Delphi project with Lazarus.<br>
<br></div>The project is an Image Generation Program, a console program.<br><br></div>The error ocurr when I call the method TextHeight of the Canvas property of TBitmap.<br><br></div>The error message is (my translation):<br>
<br> 'Project TextHeight raised exception "External SIGSEGV" in file '.\include\lclintf.inc' at line 184.'<br><br></div>Could someone help me?<br><br></div>Thanks in advance,<br><br></div>Edilson.<br>
<br></div>Here is a sample code that reproduces the error:<br><br></div>program TextHeightTest;<br><br>{$mode objfpc}{$H+}<br><br>uses<br>  {$IFDEF UNIX}{$IFDEF UseCThreads}<br>  cthreads,<br>  {$ENDIF}{$ENDIF}<br>  Classes, SysUtils, CustApp, Graphics<br>
  { you can add units after this };<br><br>type<br><br>  { TTextHeight }<br><br>  TTextHeight = class(TCustomApplication)<br>  protected<br>    procedure DoRun; override;<br>  public<br>    constructor Create(TheOwner: TComponent); override;<br>
    destructor Destroy; override;<br>    procedure WriteHelp; virtual;<br>  end;<br><br>{ TTextHeight }<br><br>procedure TTextHeight.DoRun;<br>var<br>  ErrorMsg, x: String;<br>  bmp: TBitmap;<br>begin<br>  // quick check parameters<br>
  ErrorMsg:=CheckOptions('h','help');<br>  if ErrorMsg<>'' then begin<br>    ShowException(Exception.Create(ErrorMsg));<br>    Terminate;<br>    Exit;<br>  end;<br><br>  // parse parameters<br>
  if HasOption('h','help') then begin<br>    WriteHelp;<br>    Terminate;<br>    Exit;<br>  end;<br><br>  { add your program here }<br><br>  // Criando a imagem...<br>  bmp := TBitmap.Create;<br>  <a href="http://bmp.Canvas.Font.Name">bmp.Canvas.Font.Name</a> := 'Tahoma';<br>
  bmp.Canvas.Font.Size := 20;<br>  bmp.Canvas.Font.Color := clBlue;<br>  bmp.Canvas.Font.Style := [fsBold, fsItalic];<br>  writeln('Textheight:');<br>  readln(x);<br>  writeln(IntToStr(bmp.Canvas.TextHeight('T')));<br>
  readln(x);<br><br>  // stop program loop<br>  Terminate;<br>end;<br><br>constructor TTextHeight.Create(TheOwner: TComponent);<br>begin<br>  inherited Create(TheOwner);<br>  StopOnException:=True;<br>end;<br><br>destructor TTextHeight.Destroy;<br>
begin<br>  inherited Destroy;<br>end;<br><br>procedure TTextHeight.WriteHelp;<br>begin<br>  { add your help code here }<br>  writeln('Usage: ',ExeName,' -h');<br>end;<br><br>var<br>  Application: TTextHeight;<br>
begin<br>  Application:=TTextHeight.Create(nil);<br>  Application.Title:='Text Height';<br>  Application.Run;<br>  Application.Free;<br>end.<br><br></div>