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

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

Issue 6825032: Add the latest localized text strings, update scripts to support them. (Closed) Base URL: ssh://gitrw.chromium.org:9222/vboot_reference.git@master
Patch Set: Created 9 years, 8 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
1 #!/bin/bash -e 1 #!/bin/bash -e
2 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. 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 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 # 5 #
6 # Render a text file into a bitmap. 6 # Render a text file into a bitmap. Files named '*.txt' are small font, those
7 # nameed '*.TXT' are large font.
7 # 8 #
8 9
9 # Image parameters 10 # Image parameters
10 bg='#607c91' 11 bg='#607c91'
11 bluecolor='#9ccaec' 12 bluecolor='#9ccaec'
12 bluefont="Helvetica-Narrow" 13 bluefont="Helvetica-Narrow"
13 bluepointsize=19 14 bluepointsize=19
14 whitefont="Helvetica-Narrow" 15 whitefont="Helvetica-Narrow"
15 whitepointsize=30 16 whitepointsize=30
16 17
17 18
18 tmpdir=$(mktemp -d /tmp/tmp.bmp.XXXXXX) 19 tmpdir=$(mktemp -d /tmp/tmp.bmp.XXXXXX)
19 trap "rm -rf $tmpdir" EXIT 20 trap "rm -rf $tmpdir" EXIT
20 label_file="${tmpdir}/label.txt" 21 label_file="${tmpdir}/label.txt"
21 22
22 for txtfile in $*; do 23 for txtfile in $*; do
23 bmpfile="${txtfile%.*}".bmp 24 bmpfile="${txtfile%.*}".bmp
25 # Must strip off the leading U+FEFF byte order mark (bytes 0xEF,0xBB,0xBF) of
26 # each file before I can pass it to imagemagick. Chomp any leading/trailing
27 # whitespace too.
24 perl -p -e 'BEGIN{ $/=undef; }' \ 28 perl -p -e 'BEGIN{ $/=undef; }' \
29 -e 'if (substr($_,0,3) eq "\xef\xbb\xbf") { substr($_, 0, 3) = ""; }' \
25 -e 's/^\s+//s;' -e 's/\s+$//s;' \ 30 -e 's/^\s+//s;' -e 's/\s+$//s;' \
26 "$txtfile" > "$label_file" 31 "$txtfile" > "$label_file"
27 32
28 case "$txtfile" in 33 case "$txtfile" in
29 *.txt) 34 *.txt)
30 convert \ 35 convert \
31 -background "$bg" -fill "$bluecolor" \ 36 -background "$bg" -fill "$bluecolor" \
32 -font "$bluefont" -pointsize "$bluepointsize" \ 37 -font "$bluefont" -pointsize "$bluepointsize" \
33 -bordercolor "$bg" -border 0x1 -gravity Center \ 38 -bordercolor "$bg" -border 0x1 -gravity Center \
34 label:'@'"$label_file" \ 39 label:'@'"$label_file" \
35 -colors 256 -compress none -alpha off \ 40 -colors 256 -compress none -alpha off \
36 "$bmpfile" 41 "$bmpfile"
37 echo "wrote $bmpfile" 42 echo "wrote $bmpfile"
38 ;; 43 ;;
39 *.TXT) 44 *.TXT)
40 convert \ 45 convert \
41 -background "$bg" -fill "white" \ 46 -background "$bg" -fill "white" \
42 -font "$whitefont" -pointsize "$whitepointsize" \ 47 -font "$whitefont" -pointsize "$whitepointsize" \
43 -bordercolor "$bg" -border 0x10 -gravity Center \ 48 -bordercolor "$bg" -border 0x10 -gravity Center \
44 label:'@'"$label_file" \ 49 label:'@'"$label_file" \
45 -colors 256 -compress none -alpha off \ 50 -colors 256 -compress none -alpha off \
46 "$bmpfile" 51 "$bmpfile"
47 echo "wrote $bmpfile" 52 echo "wrote $bmpfile"
48 ;; 53 ;;
49 *) 54 *)
50 echo "Ignoring $txtfile. Filname should end with .txt or .TXT" 55 echo "Ignoring $txtfile. Filname should end with .txt or .TXT"
51 ;; 56 ;;
52 esac 57 esac
53 done 58 done
OLDNEW
« no previous file with comments | « scripts/newbitmaps/strings/localized_text/zh-TW/yuck.txt ('k') | scripts/newbitmaps/strings/url.TXT » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698