I'm trying to make a snap package to my sdl2-based program,the program works perfectly and it uses two fonts: cruft.ttf
and GraffitiPaintBrush.tff
. My problem is that I don't know how to pack/include the fonts in my snap package.
I read the documentation and didn't find anything useful, except the enviroment variables. But it only talked about where things should be placed and not how to do that.
Also, I'm not able to use variables (things like $HOME
or $SNAP_COMMON
) since SDL2 is unable to read and interpret them. SDL2 can handle only with litteral directories, for example, TTF_OpenFont( "home/user_name/fonts/cruft.ttf", 50 );
Here is my snapcraft.yaml file
grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots
apps:
tic-tac-toe-game:
command: bin/tic-tac-toe-game
parts:
my-part:
source: .
organize:
bin/tic-tac-toe-game: bin/
font/cruft.ttf: bin/
font/GraffitiPaintBrush.tff: bin/
font/README-font: bin/
plugin: dump
stage-packages:
- libsdl2-2.0-0
- libsdl2-image-2.0-0
- libsdl2-ttf-2.0-0
Edit:
I tried to put everything in the same directory, as one can see in my snapcraft.yaml file, but it didn't worked. SDL2 keeps complainning about not being able to open the font (SDL2: Couldn't open cruft.ttf
)
I also added this line in my program, std::cout << SDL_GetBasePath() << "\n";
, it is supposed to print in the terminal the directory from where my binary is being executed.
here's the output: tic-tac-toe-game_1.0_amd64.snap