Skip to content

Commit

Permalink
Use Resources Alire crate to locate font file.
Browse files Browse the repository at this point in the history
  • Loading branch information
SMerrony committed Jul 27, 2022
1 parent 057da40 commit 0ec5d97
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions alire.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ maintainers-logins = ["SMerrony"]
executables = ["dashera"]
[[depends-on]]
gtkada = "^21.0.0"
[[depends-on]]
resources = "~0.1.0"
File renamed without changes.
4 changes: 2 additions & 2 deletions src/bdf_font.adb
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ package body BDF_Font is
end case;

begin
Open (File => Font_File, Mode => In_File, Name => File_Name);
Open (File => Font_File, Mode => In_File, Name => Dashera_Resources.Resource_Path & "/" & File_Name);

exception
when others =>
raise OPEN_FAILURE with "ERROR: Cannot open the file '" & File_Name &
raise OPEN_FAILURE with "ERROR: Cannot open the file '" & Dashera_Resources.Resource_Path & "/" & File_Name &
"'. Does it exist?";
end;

Expand Down
4 changes: 4 additions & 0 deletions src/bdf_font.ads
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@
with Gdk.Pixbuf; use Gdk.Pixbuf;
with Glib; use Glib;

with Resources;

package BDF_Font is

package Dashera_Resources is new Resources ("dashera");

Max_Chars : constant Positive := 128;
BPP : constant Positive := 8;
-- raw font dimensions
Expand Down

0 comments on commit 0ec5d97

Please sign in to comment.