Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: scripts/newbitmaps/strings/text_to_bmp

Issue 6598046: Add stuff to support new bitmap format. (Closed) Base URL: http://git.chromium.org/git/vboot_reference.git@master
Patch Set: Agree to all changes. PTAL. Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 #!/bin/bash -e
2 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5 #
6 # Render a text file into a bitmap.
7 #
8
9 # Image parameters
10 bg='#607c91'
11 bluecolor='#9ccaec'
12 bluefont="Helvetica-Narrow"
13 bluepointsize=19
14 whitefont="Helvetica-Narrow"
15 whitepointsize=30
16
17
18 tmpdir=$(mktemp -d /tmp/tmp.bmp.XXXXXX)
19 trap "rm -rf $tmpdir" EXIT
20 label_file="${tmpdir}/label.txt"
21
22 for txtfile in $*; do
23 bmpfile="${txtfile%.*}".bmp
24 perl -p -e 'BEGIN{ $/=undef; }' \
25 -e 's/^\s+//s;' -e 's/\s+$//s;' \
26 "$txtfile" > "$label_file"
27
28 case "$txtfile" in
29 *.txt)
30 convert \
31 -background "$bg" -fill "$bluecolor" \
32 -font "$bluefont" -pointsize "$bluepointsize" \
33 -bordercolor "$bg" -border 0x1 -gravity Center \
34 label:'@'"$label_file" \
35 -colors 256 -compress none -alpha off \
36 "$bmpfile"
37 echo "wrote $bmpfile"
38 ;;
39 *.TXT)
40 convert \
41 -background "$bg" -fill "white" \
42 -font "$whitefont" -pointsize "$whitepointsize" \
43 -bordercolor "$bg" -border 0x10 -gravity Center \
44 label:'@'"$label_file" \
45 -colors 256 -compress none -alpha off \
46 "$bmpfile"
47 echo "wrote $bmpfile"
48 ;;
49 *)
50 echo "Ignoring $txtfile. Filname should end with .txt or .TXT"
51 ;;
52 esac
53 done
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698