[Lazarus] fpReport -> Lazarus reportdsg.lpr

Andreas Frieß friess at gmx.at
Mon Aug 21 10:09:46 CEST 2017


I think there ara som issues with the fonts.

frmreportdesignermain.pp around line 395

   if gTTFontCache.SearchPath.Count=0 then
     begin
     {$IFDEF UNIX}
gTTFontCache.SearchPath.Add(ExtractFilePath(ParamStr(0))+'../demos/fonts/'); 

     gTTFontCache.SearchPath.Add(GetUserDir + '.fonts/');
gTTFontCache.SearchPath.Add('/usr/share/fonts/truetype/ubuntu-font-family/'); 

gTTFontCache.SearchPath.Add('/usr/share/fonts/truetype/dejavu/');
     {$ENDIF}
     end;
   if (gTTFontCache.Count=0) then
     gTTFontCache.BuildFontCache;  //  calls directly to fpTTF

in fpTTF

procedure TFPFontCacheList.BuildFontCache;
var
   lPath: String;
   i: integer;
begin
   if FSearchPath.Count < 1 then
     raise ETTF.Create(rsNoSearchPathDefined);  // here is the exception 
raised

I think in windows is no searchpath definded by default. The lines in 
should: because its also true for windows.

   if gTTFontCache.SearchPath.Count=0 then
     begin
gTTFontCache.SearchPath.Add(ExtractFilePath(ParamStr(0))+'../demos/fonts/'); 

     gTTFontCache.SearchPath.Add(GetUserDir + '.fonts/');
     {$IFDEF UNIX}
gTTFontCache.SearchPath.Add('/usr/share/fonts/truetype/ubuntu-font-family/'); 

gTTFontCache.SearchPath.Add('/usr/share/fonts/truetype/dejavu/');
     {$ENDIF}
     end;

---------------------------------

If i say create a new report, another issue is, the DPI settings in 
Ruler are not initialised or set. So you get un runtimeerror here

procedure TDrawRuler.RecalcParams;
var I:Integer;
begin
   FPPU:=PixelsPerUnit(DPI,FUnits);    // DPI is zero
   FMajorTicks:=(DPI/FPPU);                  //<- FFPPU is zero -> 
divison by zero!
   I:=Trunc(FMajorTicks);
   case I of

Fix:

constructor TDrawRuler.Create(ACanvas: TCanvas);
begin
   FCanvas:=ACanvas;
   FFont:=TFont.Create;
   Color:=clWhite;
   FTickColor:=cldkGray;
   FType:=rtTop;
   FUnits:=ruCm;
   FZeroOffset:=0;
   FDPI:=96;        //<--- should be an basic value
   RecalcParams;
end;


Andreas

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20170821/b22f3a57/attachment.html>


More information about the Lazarus mailing list