commit b0a74b6d793e79811467d714a042609027c3c816 Author: Arlo Breault arlolra@gmail.com Date: Sat May 4 22:36:47 2013 -0700
Automatic export of localized badge graphics
See #8830 --- proxy/Makefile | 14 +++++++++++++- proxy/export_badges.scm | 27 +++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-)
diff --git a/proxy/Makefile b/proxy/Makefile index e34df0c..9fad8e5 100644 --- a/proxy/Makefile +++ b/proxy/Makefile @@ -4,4 +4,16 @@ all: test: ./flashproxy-test.js
-.PHONY: all test +LANGS = de en ru +badges: $(addprefix badge-, $(addsuffix .png, $(LANGS))) link + +link: + ln -s badge-en.png badge.png + +badge-%.png: badge.xcf + gimp -i -b '$(shell cat export_badges.scm) (eb "$*") (exit)' + +clean: + rm badge*.png + +.PHONY: all test badges link clean diff --git a/proxy/export_badges.scm b/proxy/export_badges.scm new file mode 100644 index 0000000..3a2aece --- /dev/null +++ b/proxy/export_badges.scm @@ -0,0 +1,27 @@ +(define (exit) + (gimp-quit 0)) + +(define file "badge.xcf") + +(define (find_layer_by_name image layers name) + (define (loop ls) + (cond + ((null? ls) (error "Could not find layer?")) + ((string=? (car (gimp-drawable-get-name (car ls))) name) (car ls)) + (else (loop (cdr ls))) + )) + (loop (vector->list layers))) + +(define (eb lang) + (let* ( + (image (car (gimp-file-load RUN-NONINTERACTIVE file file))) + (layers (cadr (gimp-image-get-layers image))) + (layer (find_layer_by_name image layers (string-append "text-" lang))) + (filename (string-append "badge-" lang ".png")) + ) + (gimp-drawable-set-visible layer TRUE) + (gimp-image-merge-visible-layers image CLIP-TO-IMAGE) + (file-png-save RUN-NONINTERACTIVE image + (car (gimp-image-get-active-layer image)) + filename filename FALSE 9 FALSE FALSE FALSE FALSE FALSE) + )) \ No newline at end of file
tor-commits@lists.torproject.org