@@ -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!!!'); |