[Lazarus] fpReport -> Lazarus reportdsg.lpr
Michael Van Canneyt
michael at freepascal.org
Mon Aug 21 10:18:43 CEST 2017
On Mon, 21 Aug 2017, Andreas Frieß via Lazarus wrote:
> 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;
>
> ---------------------------------
I will look at this.
The '../demos/fonts' and other hardcoded values are maybe not really a good idea :)
>
> 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;
VERY strange, I never had this error. I patched the code.
Michael.
More information about the Lazarus
mailing list