#
# Originally created and donated by Philippe Combes (see STR #2231).
#
+# Copyright 2007 by Apple Inc.
# Copyright 2007 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
-# property of Easy Software Products and are protected by Federal
-# copyright law. Distribution and use rights are outlined in the file
-# "LICENSE.txt" which should have been included with this file. If this
-# file is missing or damaged please contact Easy Software Products
-# at:
-#
-# Attn: CUPS Licensing Information
-# Easy Software Products
-# 44141 Airport View Drive, Suite 204
-# Hollywood, Maryland 20636-3142 USA
-#
-# Voice: (301) 373-9600
-# EMail: cups-info@cups.org
-# WWW: http://www.cups.org
+# property of Apple Inc. and are protected by Federal copyright
+# law. Distribution and use rights are outlined in the file "LICENSE.txt"
+# which should have been included with this file. If this file is
+# file is missing or damaged, see the license at "http://www.cups.org/".
#
#
#
# Usage:
#
-# tools/makebuttons locale buttons.txt
+# tools/makebuttons [--font filename] locale buttons.txt
#
# "Locale" is the locale name, either "ll" or "ll_CC" where "ll" is the
# 2-letter language abbreviation and "CC" is the 2-letter ISO country
# "tools/buttons.txt" for inspiration...
#
+# Bitstream Vera font...
+font="fonts/Vera.ttf"
+
+# Colors
+background="#d4d4a4"
+black="#000000"
+green="#009900"
+red="#cc0000"
+standard="#666633"
+
+
+if test "x$1" == x--font; then
+ shift
+ font="$1"
+ shift
+fi
+
if test $# -lt 2; then
- echo Usage: tools/makebuttons locale buttons.txt
+ echo Usage: tools/makebuttons "[--font filename]" locale buttons.txt
exit 1
elif test ! -d tools; then
echo ERROR: You MUST run the makebuttons script from the main CUPS source directory!
fi
-# Bitstream Vera font...
-font="fonts/Vera.ttf"
-
-# Base image
-base="tools/buttons.gif"
-
-# Colors
-background="#d4d4a4"
-black="#000000"
-green="#009900"
-red="#cc0000"
-standard="#666633"
-
-
# 'generate_button()' - Create a button image.
#
# Arg 1: button filename (WITH .gif extension!)
# First step: generate an image trimmed to the text.
# -> annotate a 40x400 rectangle with the provided text
# -> trim to the text
- convert $base -extent 400x40 -fill "$fgclr" \
+ convert xc:transparent -extent 400x40 -fill "$fgclr" \
-draw "rectangle 0,0 399,39" \
-fill "#ffffff" -encoding Unicode -pointsize 13 -font "$font" \
-gravity Center -annotate 0x0+0+0 "$txt" -trim $tmp_btn
txt_h=`identify -format "%h" $tmp_btn`
txt_w=`identify -format "%w" $tmp_btn`
- if test $txt_h -gt 32; then
+ if test $txt_h -gt 40; then
echo "ERROR: 2 lines maximum for the button text"
exit 1
fi
btn_w=`expr $txt_w + $rad + $rad`
btn_top=`expr $btn_h - 1`
- convert $base \
+ convert xc:transparent \
-extent $btn_w'x'$btn_h -fill "$bgclr" \
-draw "rectangle 0,0 $btn_w,$btn_h" -fill "$fgclr" \
-draw "roundRectangle 0,0 `expr $btn_w - 1`,$btn_top `expr $rad - 1`,$rad" \