7c0h

Articles tagged with "cards"

Making your own Linux game cards

As someone who's constantly fidgeting, I tend to play some Solitaire during online meetings. Note that I didn't say "boring online meetings" because, let's be honest, the meeting can be the most interesting thing ever and yet I still need something to keep my hands busy.

In Linux I use Aisleriot, and I'm really happy with it. The only (frankly, very minor) point I have to object is that I don't like the default card look. This being Linux, this is an issue that can be solved with a single click or two: Click in View, go to Card Style, and then choose a different style. And since I also installed gnome-cards-data, I have 30+ card styles to choose from.

One of those card styles is called "Slavic Costumes", a set based on this beautiful card deck from 1911 that was added to Gnome on May 1, 2022 and removed on August 16, 2022 for being on shaky ground regarding copyright. Lucky for me the change has not made it into Devuan yet, and therefore I get to use it without having to go to this commit and downloading the file myself.

But the problem (well, "problem") is that I'm not familiar with Cyrillic, and having cards with "В, Д, К, Т" instead of "J, Q, K, A" is breaking my brain. So I changed the design using a couple commands and Inkscape:

  1. Find the source deck file, which in my case is stored in the directory /usr/share/aisleriot/cards/.
  2. Copy the card file slavic_costumes.svgz to another directory and rename it to slavic_costumes_2.svg.gz. This is because, while Inkscape can open .svgz files without any issues, I want to edit the file as plain text in step 5.
  3. Decompress the file with gzip: gzip -d slavic_costumes_2.svg.gz.
  4. Edit the file with Inkscape. This is detailed a couple paragraphs down.
  5. Edit the file with a text editor and change the sodipodi:docname property to match the new file name. I'm not sure whether this step is required.
  6. Re-compress and re-rename the file: gzip slavic_costumes_2.svg and then mv slavic_costumes_2.svg.gz slavic_costumes_2.svgz
  7. Moved the new file to the directory ~/.local/share/aisleriot/cards/

As for the edition with Inkscape, you need to do the following:

  1. Select the card you want to edit and double-click on the element you want to change - in my case, that would be (say) the letter "Д" of one of the cards. In modern Inkscape this will allow you to edit a group of objects (which all cards are) without destroying the group itself.
  2. Work on the card until it looks fine. In my case this meant replacing the two card letters with a boring "Q".
  3. Click on another card, then right-click back on your original card and select "Object properties". Make sure that the "ID" and "Label" properties of the finished card have retained their original readable name, which is something like club_queen. Otherwise your card set may not work.
  4. Repeat for all cards until you are happy.

And with that I have tweaked my own card set. I didn't find these steps detailed anywhere, so I thought it would be a good topic for a blog post. I can't promise that I'll look around for different deck designs to contribute (Heraclio Fournier, anyone?), but if you want to do it for your own entertainment, well, now you know how.