mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-24 18:25:10 +00:00
There are lots of new and changed files here, but they're mostly localized text strings and prerendered bitmaps of them. There are a few that still need rendering by hand. These locales don't work with ImageMagick: ar el fa hi iw ja ko th vi zh-CN zh-TW Change-Id: I1777f985460d46d5aedbb3fbc2fd3c159439c454 R=rspangler@chromium.org BUG=chromium-os:13037 TEST=none Review URL: http://codereview.chromium.org/6825032
59 lines
1.7 KiB
Bash
Executable File
59 lines
1.7 KiB
Bash
Executable File
#!/bin/bash -e
|
|
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
#
|
|
# Render a text file into a bitmap. Files named '*.txt' are small font, those
|
|
# nameed '*.TXT' are large font.
|
|
#
|
|
|
|
# Image parameters
|
|
bg='#607c91'
|
|
bluecolor='#9ccaec'
|
|
bluefont="Helvetica-Narrow"
|
|
bluepointsize=19
|
|
whitefont="Helvetica-Narrow"
|
|
whitepointsize=30
|
|
|
|
|
|
tmpdir=$(mktemp -d /tmp/tmp.bmp.XXXXXX)
|
|
trap "rm -rf $tmpdir" EXIT
|
|
label_file="${tmpdir}/label.txt"
|
|
|
|
for txtfile in $*; do
|
|
bmpfile="${txtfile%.*}".bmp
|
|
# Must strip off the leading U+FEFF byte order mark (bytes 0xEF,0xBB,0xBF) of
|
|
# each file before I can pass it to imagemagick. Chomp any leading/trailing
|
|
# whitespace too.
|
|
perl -p -e 'BEGIN{ $/=undef; }' \
|
|
-e 'if (substr($_,0,3) eq "\xef\xbb\xbf") { substr($_, 0, 3) = ""; }' \
|
|
-e 's/^\s+//s;' -e 's/\s+$//s;' \
|
|
"$txtfile" > "$label_file"
|
|
|
|
case "$txtfile" in
|
|
*.txt)
|
|
convert \
|
|
-background "$bg" -fill "$bluecolor" \
|
|
-font "$bluefont" -pointsize "$bluepointsize" \
|
|
-bordercolor "$bg" -border 0x1 -gravity Center \
|
|
label:'@'"$label_file" \
|
|
-colors 256 -compress none -alpha off \
|
|
"$bmpfile"
|
|
echo "wrote $bmpfile"
|
|
;;
|
|
*.TXT)
|
|
convert \
|
|
-background "$bg" -fill "white" \
|
|
-font "$whitefont" -pointsize "$whitepointsize" \
|
|
-bordercolor "$bg" -border 0x10 -gravity Center \
|
|
label:'@'"$label_file" \
|
|
-colors 256 -compress none -alpha off \
|
|
"$bmpfile"
|
|
echo "wrote $bmpfile"
|
|
;;
|
|
*)
|
|
echo "Ignoring $txtfile. Filname should end with .txt or .TXT"
|
|
;;
|
|
esac
|
|
done
|