Commit 8da8ee5

Nick Faro committed on
Update fontconfig stuff to happen for all unix systems
commit 8da8ee58a6d5a30b7b1a7fb67d7306f25eee3262 parent 8d73982
4 changed files +9−38
Deletedfontconfig.pas +0−22
@@ -1,22 +0,0 @@
1 unit FontConfig;
2
3 {$mode objfpc}{$H+}
4
5 interface
6
7 uses
8 Classes, SysUtils;
9
10 type
11 FcBool = Integer;
12
13 function FcConfigAppFontAddFile(Config: Pointer; _File: PChar): FcBool; cdecl; external 'libfontconfig.so';
14
15 function PangoCairoFontMapGetDefault: Pointer; cdecl; external 'libpangocairo-1.0.so' name 'pango_cairo_font_map_get_default';
16
17 procedure PangoFcFontMapConfigChanged(FcFontMap: Pointer); cdecl; external 'libpangoft2-1.0.so' name 'pango_fc_font_map_config_changed';
18
19 implementation
20
21 end.
22
ModifiedhUGETracker.lpr +9−9
@@ -10,9 +10,6 @@ uses
10 {$ifdef UNIX} 10 {$ifdef UNIX}
11 cthreads, 11 cthreads,
12 {$endif} 12 {$endif}
13 {$ifdef LINUX}
14 fontconfig,
15 {$endif}
16 {$ifdef MSWINDOWS} 13 {$ifdef MSWINDOWS}
17 Windows, 14 Windows,
18 {$endif} 15 {$endif}
@@ -33,10 +30,13 @@ uses
33 30
34 {$ifdef MSWINDOWS} 31 {$ifdef MSWINDOWS}
35 // https://forum.lazarus.freepascal.org/index.php?topic=39124.0 32 // https://forum.lazarus.freepascal.org/index.php?topic=39124.0
36 function AddFont (Dir : PAnsiChar; 33 function AddFontResourceExA(Dir: PAnsiChar; Flag: DWORD): LongBool; StdCall; External GDI32;
37 Flag: DWORD): LongBool; StdCall; 34 {$endif}
38 External GDI32 35
39 Name 'AddFontResourceExA'; 36 {$ifdef UNIX}
37 function FcConfigAppFontAddFile(Config: Pointer; _File: PChar): Integer; cdecl; External 'libfontconfig.so';
38 function PangoCairoFontMapGetDefault: Pointer; cdecl; External 'libpangocairo-1.0.so' Name 'pango_cairo_font_map_get_default';
39 procedure PangoFcFontMapConfigChanged(FcFontMap: Pointer); cdecl; External 'libpangoft2-1.0.so' Name 'pango_fc_font_map_config_changed';
40 {$endif} 40 {$endif}
41 41
42 begin 42 begin
@@ -59,11 +59,11 @@ begin
59 59
60 {$ifdef MSWINDOWS} 60 {$ifdef MSWINDOWS}
61 // $10 is FR_PRIVATE which uninstalls the font when the process ends 61 // $10 is FR_PRIVATE which uninstalls the font when the process ends
62 if not AddFont(PChar('PixeliteTTF.ttf'), $10) then 62 if not AddFontResourceExA(PChar('PixeliteTTF.ttf'), $10) then
63 Writeln(StdErr, '[ERROR] Couldn''t load Pixelite!!!'); 63 Writeln(StdErr, '[ERROR] Couldn''t load Pixelite!!!');
64 {$endif} 64 {$endif}
65 65
66 {$ifdef LINUX} 66 {$ifdef UNIX}
67 // https://gitlab.gnome.org/GNOME/gtk/-/issues/3886 67 // https://gitlab.gnome.org/GNOME/gtk/-/issues/3886
68 if FcConfigAppFontAddFile(nil, PChar('PixeliteTTF.ttf')) = 0 then 68 if FcConfigAppFontAddFile(nil, PChar('PixeliteTTF.ttf')) = 0 then
69 Writeln(StdErr, '[ERROR] Couldn''t load Pixelite!!!'); 69 Writeln(StdErr, '[ERROR] Couldn''t load Pixelite!!!');
Modifiedtracker.pas +0−7
@@ -1363,13 +1363,6 @@ var
1363 MenuItem: TMenuItem; 1363 MenuItem: TMenuItem;
1364 I: Integer; 1364 I: Integer;
1365 begin 1365 begin
1366 {if Screen.Fonts.IndexOf('PixeliteTTF') = -1 then
1367 MessageDlg('Warning', 'You don''t have the Pixelite font installed. '+
1368 'On Windows, this probably means you didn''t extract hUGETracker before running it, '+
1369 'so please extract the .zip and run again! On Linux, you need to manually install the '+
1370 'font file, so please install PixeliteTTF.ttf and relaunch. Thanks!',
1371 mtWarning, [mbOk], 0);}
1372
1373 if (not FileExists('PixeliteTTF.ttf')) 1366 if (not FileExists('PixeliteTTF.ttf'))
1374 or (not FileExists('halt.gb')) 1367 or (not FileExists('halt.gb'))
1375 or (not FileExists('halt.sym')) 1368 or (not FileExists('halt.sym'))