]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - tools/makebuttons
Load cups into easysw/current.
[thirdparty/cups.git] / tools / makebuttons
index 5723ab42400b80fc184531abff184a237e8add67..0eced24bdb190078d3bfa5a8ef38e72233631224 100755 (executable)
@@ -6,23 +6,14 @@
 #
 #   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/".
 #
 
 #
@@ -34,7 +25,7 @@
 #
 # 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!
@@ -82,20 +90,6 @@ elif test ! -r $list; then
 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!)
@@ -162,7 +156,7 @@ function generate_button()
        # 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
@@ -171,7 +165,7 @@ function generate_button()
        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
@@ -207,7 +201,7 @@ function generate_button()
        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" \