Recent

Author Topic: [SOLVED] fpReport designer on Mac OSX  (Read 2383 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 1913
    • Lazarus and Free Pascal italian community
[SOLVED] fpReport designer on Mac OSX
« on: August 08, 2018, 03:35:47 pm »
I installed trunk version on lazarus and i installed fpreport package. All ok, but when run designer project and add a page header and in this section add a note, the program crash because not found LiberationSans font. I change CreateForm in this mode

Code: Pascal  [Select]
  1. procedure TFPReportDesignerForm.FormCreate(Sender: TObject);
  2.  
  3. var
  4.   F : Text;
  5.   i : Integer;
  6.  
  7. begin
  8.   DesignOptions:=AllReportDesignOptions;
  9.   if PaperManager.PaperCount=0 then
  10.     PaperManager.RegisterStandardSizes;
  11.   if gTTFontCache.SearchPath.Count=0 then
  12.     begin
  13.     {$IFDEF UNIX}
  14.       {$IFDEF DARWIN}
  15.              gTTFontCache.SearchPath.Add(ExtractFilePath(ParamStr(0))+'../../../../demos/fonts/');
  16.              gTTFontCache.SearchPath.Add(GetUserDir + 'Library/Fonts/');
  17.              gTTFontCache.SearchPath.Add('/Library/Fonts/');
  18.              gTTFontCache.SearchPath.Add('/System/Library/Fonts/');
  19.              gTTFontCache.SearchPath.Add('/System/Library/Fonts/');
  20.       {$ELSE}
  21.              gTTFontCache.SearchPath.Add(ExtractFilePath(ParamStr(0))+'../demos/fonts/');
  22.              gTTFontCache.SearchPath.Add(GetUserDir + '.fonts/');
  23.              gTTFontCache.SearchPath.Add('/usr/share/fonts/truetype/ubuntu-font-family/');
  24.              gTTFontCache.SearchPath.Add('/usr/share/fonts/truetype/dejavu/');
  25.       {$ENDIF}
  26.     {$ENDIF}
  27.     end;
  28.   if (gTTFontCache.Count=0) then
  29.     gTTFontCache.ReadStandardFonts;
  30.   {$IFNDEF WINDOWS}
  31.   AssignFile(F,'/tmp/fonts.txt');
  32.   Rewrite(F);
  33.   For I:=0 to gTTFontCache.Count-1 do
  34.      Writeln(F,I,' ',gTTFontCache.Items[i].PostScriptName,' : ',gTTFontCache.Items[i].FamilyName,' : ',gTTFontCache.Items[i].HumanFriendlyName);
  35.   CloseFile(F);
  36.   {$ENDIF}
  37.   FDataParent:=TComponent.Create(nil);
  38.   FreeAndNil(TSDesign); // Remove design-time added page
  39.   FReportDesignData:=TDesignReportDataManager.Create(Self);
  40.   SetBandActionTags;
  41.   FCustomStartIndex:=Madd.Count;
  42.   AddCustomElements;
  43.   // DEMO
  44. {$IFDEF USEDEMOREPORT}
  45.   CreateDemoReport;
  46.   CreateReportData;
  47. {$ENDIF}
  48. // END OF DEMO
  49.   SetFileCaption('');
  50.   FOI.OnSelectElement:=@DoSelectComponent;
  51.   FOI.OnModified:=@DoSelectionModifiedByOI;
  52.   MRUMenuManager1 := TMRUMenuManager.Create(self);
  53.   with MRUMenuManager1 do
  54.     begin
  55.     IniFileName := ChangeFileExt(ParamStr(0), '.ini');
  56.     MenuItem := MIRecent;
  57.     PopupMenu := PMRecent;
  58.     MaxItemLength := 80;
  59.     MenuCaptionMask := '(%d) %s';
  60.     OnRecentFile := @MRUMenuManager1RecentFile;
  61.     LoadRecentFilesFromIni;
  62.     maxRecent := 15;
  63.     end;
  64. end;  

but crash always. Suggestion?
« Last Edit: August 09, 2018, 10:56:36 am by xinyiman »
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

xinyiman

  • Hero Member
  • *****
  • Posts: 1913
    • Lazarus and Free Pascal italian community
Re: fpReport designer on Mac OSX
« Reply #1 on: August 09, 2018, 10:56:24 am »
Fixed, it was easier than I thought. Just go to the sample fonts in the demo folder. Double click and tell them to install the font.
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

valdir.marcos

  • Hero Member
  • *****
  • Posts: 790
Re: fpReport designer on Mac OSX
« Reply #2 on: August 09, 2018, 01:18:25 pm »
Fixed, it was easier than I thought. Just go to the sample fonts in the demo folder. Double click and tell them to install the font.
What will hapen when your application land on an end user Mac OSX computer?

xinyiman

  • Hero Member
  • *****
  • Posts: 1913
    • Lazarus and Free Pascal italian community
Re: [SOLVED] fpReport designer on Mac OSX
« Reply #3 on: August 14, 2018, 10:57:12 am »
I do not know but I think I'll have to install the fonts by hand. However, these days I will do other tests and update you.
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

af0815

  • Sr. Member
  • ****
  • Posts: 343
Re: [SOLVED] fpReport designer on Mac OSX
« Reply #4 on: August 14, 2018, 12:42:27 pm »
The best idea is to create a report using one of th system standardfont.
regards
Andreas