]> de.git.xonotic.org Git - xonotic/mediasource.git/blob - gfx/luma/render-version.sh
First batch of Luma theme sourcefiles
[xonotic/mediasource.git] / gfx / luma / render-version.sh
1 #!/bin/sh -e
2 # TASK
3 #   Render menu background layers with VERSION string
4 #
5 # NOTES
6 #   It is necessary to have the Xolonium font installed on the system,
7 #   because svg rendering tools cannot handle embedded or linked fonts.
8 #   To compensate for filter rendering errors and to reduce rbg noise,
9 #   the svg files are rendered at a large size and then scaled down.
10 #
11 # DEPENDENCIES
12 #   librsvg
13 #   imagemagick
14 #   Xolonium-Regular font
15 #
16 # USAGE
17 #   ./render-version.sh [--no-font-check] DATADIR VERSION
18
19
20 # Check for Xolonium font
21 if [ "$1" = "--no-font-check" ]; then
22         shift
23 else
24         if [ -z "$(fc-list ':family=Xolonium:style=Regular')" ]; then
25                 echo "Cannot find the Xolonium-Regular font."
26                 echo "Please install Xolonium before running this script."
27                 exit 2
28         fi
29 fi
30
31
32 # Check for arguments
33 if [ -z "$1" ] || [ -z "$2" ]; then
34         echo "Usage: $0 [--no-font-check] DATADIR VERSION"
35         exit 1
36 fi
37
38
39 data="$1"
40 version="$2"
41 layers="gfx/menu/luminos/background_l2.svg
42         gfx/menu/luminos/background_ingame_l2.svg"
43
44
45 for svg in $layers; do
46         dir="$data/${svg%/*}"
47         tga="$data/${svg%.*}.tga"
48
49         mkdir -p "$dir"
50         sed "s/LUMINOS/$version/g" "$svg" | rsvg-convert -z 2 |\
51                 convert - -scale "50%" -gaussian-blur "4x0.7" "$tga"
52 done