From c678bffccd65fe29bf83f9ac71d34f541f07ad7d Mon Sep 17 00:00:00 2001 From: Severin Meyer Date: Wed, 3 Nov 2021 20:25:52 +0100 Subject: [PATCH] Unify Luma and Luminos menu version builders --- gfx/luma/render-version.sh | 56 -- gfx/menu/luminos_versionbuilder/all2tga.scm | 33 - .../luminos_versionbuilder/background_l2.svg | 689 ------------------ .../luminos_versionbuilder/versionbuilder | 33 - gfx/menu/versionbuilder/background_l2.svg | 69 ++ gfx/menu/versionbuilder/build.sh | 48 ++ 6 files changed, 117 insertions(+), 811 deletions(-) delete mode 100755 gfx/luma/render-version.sh delete mode 100755 gfx/menu/luminos_versionbuilder/all2tga.scm delete mode 100644 gfx/menu/luminos_versionbuilder/background_l2.svg delete mode 100755 gfx/menu/luminos_versionbuilder/versionbuilder create mode 100755 gfx/menu/versionbuilder/background_l2.svg create mode 100755 gfx/menu/versionbuilder/build.sh diff --git a/gfx/luma/render-version.sh b/gfx/luma/render-version.sh deleted file mode 100755 index 6709481..0000000 --- a/gfx/luma/render-version.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh -e -# TASK -# Render menu background layers with VERSION string -# -# NOTES -# It is necessary to have the Xolonium font installed on the system, -# because svg rendering tools cannot handle embedded or linked fonts. -# To compensate for filter rendering errors and to reduce rbg noise, -# the svg files are rendered at a large size and then scaled down. -# -# DEPENDENCIES -# rsvg-convert (librsvg 2.39.0) -# convert (imagemagick 6.8.6-9) -# Xolonium-Regular font -# -# USAGE -# ./render-version.sh [--no-font-check] DATADIR VERSION -# -# USAGE EXAMPLE -# ./render-version.sh ~/.xonotic/data "1.0" - - -# Check for Xolonium font -if [ "$1" = "--no-font-check" ]; then - shift -else - if [ -z "$(fc-list ':family=Xolonium GPL:style=Regular')" ]; then - echo "Cannot find the Xolonium-Regular font." - echo "Please install Xolonium before running this script." - exit 2 - fi -fi - - -# Check for arguments -if [ -z "$1" ] || [ -z "$2" ]; then - echo "Usage: $0 [--no-font-check] INPUTDIR OUTPUTDIR VERSION" - exit 1 -fi - - -input="$1" -output="$2" -version="$3" -svgs="gfx/menu/luma/background_l2.svg - gfx/menu/luma/background_ingame_l2.svg" - - -for svg in $svgs; do - dir="$output/${svg%/*}" - tga="$output/${svg%.*}.tga" - - mkdir -p "$output" - # -auto-orient works around an inversion regression present in imagemagick 6.9.11-60 - sed "s/LUMA/$version/g" "$input/$svg" | rsvg-convert -z 2 | convert - -auto-orient -scale "50%" "$tga" -done diff --git a/gfx/menu/luminos_versionbuilder/all2tga.scm b/gfx/menu/luminos_versionbuilder/all2tga.scm deleted file mode 100755 index 66d0852..0000000 --- a/gfx/menu/luminos_versionbuilder/all2tga.scm +++ /dev/null @@ -1,33 +0,0 @@ -;Converts image files to .tga -;In: FilesIn (wildcard * possible) -; Compress (using RLE algorithm, 0=no, 1=yes) -;Out: tga files with same name as input (overwrites tga input files) - -(define (all2tga filesIn compress) - (let* - ( - (fileList (cadr (file-glob filesIn 1))) - ) - - (while (not (null? fileList)) - (let* - ( - (file (car fileList)) - (image (car (gimp-file-load 1 file file))) - (drawable (car (gimp-image-get-active-layer image))) - ) - - ;Set extension to .tga - (set! file (car (strbreakup file "."))) - (set! file (string-append file ".tga")) - - ;Save image as RLE compressed tga - (set! drawable (car (gimp-image-merge-visible-layers image 1))) - (file-tga-save 1 image drawable file file compress 0) - (gimp-image-delete image) - - (set! fileList (cdr fileList)) - ) - ) - ) -) diff --git a/gfx/menu/luminos_versionbuilder/background_l2.svg b/gfx/menu/luminos_versionbuilder/background_l2.svg deleted file mode 100644 index 0674a04..0000000 --- a/gfx/menu/luminos_versionbuilder/background_l2.svg +++ /dev/null @@ -1,689 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - Xonotic Logo - 2010 - - - Xonotic Community - - - - - - - - - - Xonotic Community - - - - - - - - - - - Xonotic - Phoenix - Logo - - - - The logo of the Xonotic project. - - - - - - - VERSIONPLACEHOLDER - - - - - - - - - diff --git a/gfx/menu/luminos_versionbuilder/versionbuilder b/gfx/menu/luminos_versionbuilder/versionbuilder deleted file mode 100755 index 53dae33..0000000 --- a/gfx/menu/luminos_versionbuilder/versionbuilder +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -#Uses Inkscape, Gimp and sed. -#Requires the provided Gimp script (all2tga.scm) to be present in ~/.gimp*/scripts/. - -#Creates the background_(ingame_)l2.tga images, with a given version string argument. - -#The appearance of the string is defined by the master element in background_l2.svg: -#BlurAll > Version > VersionMaster -#The visible parts (Fill, Border, Glow) are duplicates of the master element. -#If the font or its size is changed, the gradients of the duplicates may need adjustment. - -#Check for valid argument -if [ -z "$1" ] -then - echo "Usage:" - echo "$0 [Version String]" - echo "" - exit 3 -fi - -#Create tmp.svg with version string according to argument -sed -e "s/VERSIONPLACEHOLDER/$1/" background_l2.svg > tmp.svg - -#Create tga files -# TODO: remove old inkscape support (second case). -inkscape --export-dpi=90 --export-filename="background_l2.png" "tmp.svg" ||\ - inkscape -f "tmp.svg" -d 90 -e "background_l2.png" -# -auto-orient works around an inversion regression present in imagemagick 6.9.11-60 -convert -auto-orient background_l2.png background_l2.tga -# gimp -d -f -i -b '(all2tga "background_l2.png" 1)' -b '(gimp-quit 0)' -cp background_l2.tga background_ingame_l2.tga -rm tmp.svg -rm background_l2.png diff --git a/gfx/menu/versionbuilder/background_l2.svg b/gfx/menu/versionbuilder/background_l2.svg new file mode 100755 index 0000000..fb56c7a --- /dev/null +++ b/gfx/menu/versionbuilder/background_l2.svg @@ -0,0 +1,69 @@ + + + + VERSIONPLACEHOLDER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gfx/menu/versionbuilder/build.sh b/gfx/menu/versionbuilder/build.sh new file mode 100755 index 0000000..754d1a1 --- /dev/null +++ b/gfx/menu/versionbuilder/build.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +# Task: +# Build the background_(ingame_)l2.tga images for +# Luma and Luminos, with a given VERSION string argument. +# +# Note about the font: +# To render the string with the Xolonium font, it must be installed +# on the system. Otherwise, the default sans-serif font is used. +# +# Usage: +# ./build.sh SVGDIR OUTDIR VERSION +# +# Dependencies: +# Inkscape +# ImageMagick + +# Check arguments +if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then + echo "Usage: $0 SVGDIR OUTDIR VERSION" + exit 3 +fi + +# File paths +svgSrc="$1/background_l2.svg" +svgTmp="$1/background_l2.tmp.svg" +pngTmp="$1/background_l2.tmp.png" +tgaOut="$2/background_l2.tga" +tgaCopy="$2/background_ingame_l2.tga" + +# Create temp svg file with version string +sed -e "s/VERSIONPLACEHOLDER/$3/" "$svgSrc" > "$svgTmp" + +# Create temp png file +# TODO: Remove legacy Inkscape support (second case) +inkscape --export-filename="$pngTmp" "$svgTmp" || inkscape -f "$svgTmp" -e "$pngTmp" + +# Convert to tga (-auto-orient works around an +# inversion regression present in ImageMagick 6.9.11-60) +convert -auto-orient "$pngTmp" -compress RLE "$tgaOut" + +# Copy tga +rm -f "$tgaCopy" +cp "$tgaOut" "$tgaCopy" + +# Cleanup +rm -f "$svgTmp" +rm -f "$pngTmp" -- 2.39.2