[Lazarus] fpReport -> Lazarus reportdsg.lpr

Andreas Frieß friess at gmx.at
Mon Aug 21 14:00:19 CEST 2017


Is is not better to call the standard fonts of the system in 
TFPReportDesignerForm.FormCreate(Sender: TObject); ?

   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 (gTTFontCache.Count=0) then
     gTTFontCache.BuildFontCache;
   if (gTTFontCache.Count=0) then                // <-------
     gTTFontCache.ReadStandardFonts;        // <-------

Because the standardfonts are not read in the designer.

Andreas



Am 21.08.2017 um 11:58 schrieb Andreas Frieß via Lazarus:
> At first this should for the visual part (Designer eg.)
>
> And should for windows this not added ? Because in windows the fonts 
> should reside in %windir%\Fonts (see MS documentation)
>
>   function GetWinDirFonts: string;
>   var
>     dir: array [0..MAX_PATH] of Char;
>   begin
>     GetWindowsDirectory(dir, MAX_PATH);
>     Result :=  StrPas(dir)+DirectorySeparator+'Fonts';
>   end;
>
> and
>
>   {$ifdef mswindows}
>   SearchPath.Add(GetWinDir);
>   SearchPath.Add(GetWinDirFonts);
>   {$endif}
>
> in fpttf.pp around line 560
>
> Andreas
>
> Am 21.08.2017 um 11:49 schrieb Graeme Geldenhuys via Lazarus:
>> On 2017-08-21 10:35, Andreas Frieß via Lazarus wrote:
>>> It is possible to use a standard font and give a warning instead of 
>>> fire
>>> an exception.
>>>
>>> Eg. Font xxxx not found, using standardfont instead .... ?
>>
>> I don't like that. First, how are you going to display the warning? 
>> Remember fpReport was designed to be able to run from console or 
>> headless servers too, not just desktop apps. Secondly, how are you 
>> going to substitute the font? Which font will you choose, and how 
>> will you make that choice? Using equivalent font metrics values, 
>> simply by name, some random standard font that might make your report 
>> look crap? My personal opinion - I like to see a report the way I 
>> designed it or not at all (until I fixed what was missing or broken).
>>
>> Regards,
>>   Graeme
>>
>



More information about the Lazarus mailing list