mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-25 18:55:24 +00:00
newbitmaps: Refine font and text generation.
The bmpblk build scripts used to rely on lots of pre-generated resources, and the HWID font data was fixed to x86 special size & scaling parameters. Since the screens now rely on more platform dependent parameters, this CL refined whole flow so fonts are now generated and processed (ex, re-scale) in the same way as other text messages. BUG=chrome-os-partner:11078 TEST=make # x86 and arm bitmaps both works. Change-Id: I59a4fb31718ef052c6b54cd4642f4fc487893f2b Reviewed-on: https://gerrit.chromium.org/gerrit/29873 Tested-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Ready: Hung-Te Lin <hungte@chromium.org>
This commit is contained in:
7
.gitignore
vendored
7
.gitignore
vendored
@@ -2,7 +2,8 @@
|
|||||||
/build-au
|
/build-au
|
||||||
/build-main
|
/build-main
|
||||||
ID
|
ID
|
||||||
scripts/newbitmaps/lib/*.pyc
|
|
||||||
scripts/newbitmaps/strings/localized_text/*/*.png
|
|
||||||
scripts/newbitmaps/fonts/outdir
|
|
||||||
scripts/newbitmaps/images/out_*
|
scripts/newbitmaps/images/out_*
|
||||||
|
scripts/newbitmaps/lib/*.pyc
|
||||||
|
scripts/newbitmaps/strings/font
|
||||||
|
scripts/newbitmaps/strings/localized_text/*/*.png
|
||||||
|
scripts/newbitmaps/strings/*.png
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ ALL_LOCALES=en es_419 pt_BR en_GB fr es pt_PT ca it de \
|
|||||||
uk tr iw ar fa hi th vi id fil zh_CN zh_TW ko ja
|
uk tr iw ar fa hi th vi id fil zh_CN zh_TW ko ja
|
||||||
|
|
||||||
# Here are the launch locales for Stumpy/Lumpy (issue 6595), same ordering.
|
# Here are the launch locales for Stumpy/Lumpy (issue 6595), same ordering.
|
||||||
DEFAULT_LOCALES=en es_419 pt_BR en_GB fr es it de nl da no sv ko ja
|
LOCALES=en es_419 pt_BR en_GB fr es it de nl da no sv ko ja
|
||||||
|
|
||||||
default: outside_chroot fonts strings x86 arm clean
|
default: outside_chroot strings x86 arm clean
|
||||||
|
|
||||||
outside_chroot:
|
outside_chroot:
|
||||||
@if [ -e /etc/debian_chroot ]; then \
|
@if [ -e /etc/debian_chroot ]; then \
|
||||||
@@ -23,26 +23,19 @@ outside_chroot:
|
|||||||
exit 1; \
|
exit 1; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
fonts:
|
|
||||||
# TODO(hungte) Move fonts generation to its own Makefile.
|
|
||||||
cd fonts && ./make_ascii_bmps.py
|
|
||||||
bmpblk_font --outfile images/hwid_fonts.bin fonts/outdir/*
|
|
||||||
|
|
||||||
strings:
|
strings:
|
||||||
$(MAKE) -C strings/localized_text
|
$(MAKE) -C strings
|
||||||
|
|
||||||
x86:
|
x86:
|
||||||
$(MAKE) -C images $@ DEFAULT_LOCALES="$(DEFAULT_LOCALES)"
|
$(MAKE) -C images $@ LOCALES="$(LOCALES)"
|
||||||
cp -f images/out_$@/bmpblock.bin bmpblock_$@.bin
|
cp -f images/out_$@/bmpblock.bin bmpblock_$@.bin
|
||||||
|
|
||||||
arm:
|
arm:
|
||||||
$(MAKE) -C images $@ DEFAULT_LOCALES="$(DEFAULT_LOCALES)"
|
$(MAKE) -C images $@ LOCALES="$(LOCALES)"
|
||||||
cp -f images/out_$@/bmpblock.bin bmpblock_$@.bin
|
cp -f images/out_$@/bmpblock.bin bmpblock_$@.bin
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf fonts/outdir
|
$(MAKE) -C strings clean
|
||||||
$(MAKE) -C strings/localized_text clean
|
|
||||||
$(MAKE) -C images clean
|
$(MAKE) -C images clean
|
||||||
|
|
||||||
.PHONY: outside_chroot fonts strings x86 arm
|
.PHONY: outside_chroot strings x86 arm clean
|
||||||
|
|||||||
@@ -1,90 +0,0 @@
|
|||||||
#!/usr/bin/python -tt
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
import optparse
|
|
||||||
import os
|
|
||||||
import subprocess
|
|
||||||
import sys
|
|
||||||
import tempfile
|
|
||||||
|
|
||||||
chars = '* 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ{}-_'
|
|
||||||
|
|
||||||
def main():
|
|
||||||
"""Convert a set of text chars into individual BMPs.
|
|
||||||
|
|
||||||
This uses ImageMagick, so don't run it inside the build chroot.
|
|
||||||
Not all characters in the world are supported.
|
|
||||||
"""
|
|
||||||
|
|
||||||
parser = optparse.OptionParser()
|
|
||||||
parser.description = ' '.join(main.__doc__.split())
|
|
||||||
parser.add_option("--foreground", default='#000000',
|
|
||||||
dest="fg", action="store", metavar="COLOR",
|
|
||||||
help="foreground color (%default)")
|
|
||||||
parser.add_option("--background", default='#ffffff',
|
|
||||||
dest="bg", action="store", metavar="COLOR",
|
|
||||||
help="background color (%default)")
|
|
||||||
parser.add_option("--font", default='Helvetica',
|
|
||||||
dest="font", action="store",
|
|
||||||
help="font to use (%default)")
|
|
||||||
parser.add_option("--size", default='15', metavar="POINTSIZE",
|
|
||||||
dest="size", action="store",
|
|
||||||
help="font size (%default)")
|
|
||||||
parser.add_option('--dir', default='./outdir',
|
|
||||||
dest="outdir", action="store",
|
|
||||||
help="output directory (%default)")
|
|
||||||
(options, args) = parser.parse_args()
|
|
||||||
|
|
||||||
|
|
||||||
if not os.path.isdir(options.outdir):
|
|
||||||
os.mkdir(options.outdir)
|
|
||||||
|
|
||||||
# ARM U-Boot is very picky about its BMPs. They have to have exactly 256
|
|
||||||
# colors in their colormap. Imagemagick generally tries to reduce the
|
|
||||||
# colormap when it can, so we have to play some games to force it not to.
|
|
||||||
# We'll create a gradient file with 256 colors, and then make sure that all
|
|
||||||
# our rendered characters use the same colormap. This makes the resulting
|
|
||||||
# images larger, but it also means they'll work on x86 too. Sigh.
|
|
||||||
(handle, gradient_file) = tempfile.mkstemp(".png")
|
|
||||||
os.close(handle)
|
|
||||||
|
|
||||||
cmd = ('convert', '-size', '256x1',
|
|
||||||
'gradient:%s-%s' % (options.fg, options.bg),
|
|
||||||
gradient_file)
|
|
||||||
print ' '.join(cmd)
|
|
||||||
subprocess.call(cmd)
|
|
||||||
|
|
||||||
|
|
||||||
count=0
|
|
||||||
for ascii in chars:
|
|
||||||
outfile = os.path.join(options.outdir,
|
|
||||||
"idx%03d_%x.bmp" % (count,ord(ascii)))
|
|
||||||
# TODO(hungte) Support assigning size & scaling for character images.
|
|
||||||
print outfile
|
|
||||||
cmd = ('convert',
|
|
||||||
'-font', options.font,
|
|
||||||
'-background', options.bg,
|
|
||||||
'-fill', options.fg,
|
|
||||||
'-bordercolor', options.bg,
|
|
||||||
'-border', '0x3',
|
|
||||||
'-gravity', 'Center',
|
|
||||||
'-pointsize', options.size,
|
|
||||||
'-resize', '120%x100', # Yes, magic.
|
|
||||||
'-scale', '59%x78%', # Here, too.
|
|
||||||
'label:%s' % ascii,
|
|
||||||
'-remap', gradient_file,
|
|
||||||
'-compress', 'none',
|
|
||||||
'-alpha', 'off',
|
|
||||||
outfile)
|
|
||||||
print ' '.join(cmd)
|
|
||||||
count += 1
|
|
||||||
subprocess.call(cmd)
|
|
||||||
|
|
||||||
os.unlink(gradient_file)
|
|
||||||
|
|
||||||
|
|
||||||
# Start it all off
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -11,20 +11,16 @@
|
|||||||
# this occasional need.
|
# this occasional need.
|
||||||
|
|
||||||
TARGETS=x86 arm
|
TARGETS=x86 arm
|
||||||
|
# To generate all locales, make from top level.
|
||||||
# These are all the known locales, sorted more-or-less geograpically. We
|
LOCALES=en
|
||||||
# generally don't have room in the BIOS for all of them at once.
|
|
||||||
DEFAULT_LOCALES=en es_419 pt_BR en_GB fr es pt_PT ca it de \
|
|
||||||
el nl da no sv fi et lv lt ru pl cs sk hu sl sr hr bg ro \
|
|
||||||
uk tr iw ar fa hi th vi id fil zh_CN zh_TW ko ja
|
|
||||||
|
|
||||||
default: outside_chroot
|
default: outside_chroot
|
||||||
@echo "Specify a target to build for:"
|
@echo "Specify a target to build for:"
|
||||||
@echo " ${TARGETS}"
|
@echo " ${TARGETS}"
|
||||||
|
|
||||||
outside_chroot:
|
|
||||||
# TODO(hungte) It's now not easy to have bmpblk_utility outside
|
# TODO(hungte) It's now not easy to have bmpblk_utility outside
|
||||||
# chroot... We need some better way to do this.
|
# chroot... We need some better way to do this.
|
||||||
|
outside_chroot:
|
||||||
@if [ -e /etc/debian_chroot ]; then \
|
@if [ -e /etc/debian_chroot ]; then \
|
||||||
echo "ImageMagick is too complex to build inside the chroot."; \
|
echo "ImageMagick is too complex to build inside the chroot."; \
|
||||||
echo "You must be outside the chroot to do this"; \
|
echo "You must be outside the chroot to do this"; \
|
||||||
@@ -35,15 +31,15 @@ outside_chroot:
|
|||||||
${TARGETS}:: outside_chroot
|
${TARGETS}:: outside_chroot
|
||||||
|
|
||||||
x86::
|
x86::
|
||||||
./build_images "$@"
|
LOCALES="$(LOCALES)" ./build_images "$@"
|
||||||
cd "out_$@" && ../make_default_yaml ${DEFAULT_LOCALES}
|
cd "out_$@" && ../make_default_yaml $(LOCALES)
|
||||||
cd "out_$@" && bmpblk_utility -c DEFAULT.yaml bmpblock.bin
|
cd "out_$@" && bmpblk_utility -c DEFAULT.yaml bmpblock.bin
|
||||||
ls -l "out_$@"/bmpblock.bin
|
ls -l "out_$@"/bmpblock.bin
|
||||||
|
|
||||||
|
|
||||||
arm::
|
arm::
|
||||||
./build_images "$@"
|
LOCALES="$(LOCALES)" ./build_images "$@"
|
||||||
cd "out_$@" && ../make_default_yaml ${DEFAULT_LOCALES}
|
cd "out_$@" && ../make_default_yaml $(LOCALES)
|
||||||
cd "out_$@" && bmpblk_utility -c DEFAULT.yaml bmpblock.bin
|
cd "out_$@" && bmpblk_utility -c DEFAULT.yaml bmpblock.bin
|
||||||
ls -l "out_$@"/bmpblock.bin
|
ls -l "out_$@"/bmpblock.bin
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 7.9 KiB |
@@ -12,7 +12,7 @@ BACKGROUND_COLOR=white
|
|||||||
BACKGROUND_IMAGE=Background_white.bmp
|
BACKGROUND_IMAGE=Background_white.bmp
|
||||||
|
|
||||||
die() {
|
die() {
|
||||||
echo "$*" >&2
|
echo "ERROR: $*" >&2
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,12 +85,11 @@ main() {
|
|||||||
|
|
||||||
# Prepare output folder
|
# Prepare output folder
|
||||||
mkdir -p "$output"
|
mkdir -p "$output"
|
||||||
cp hwid_fonts.bin "$output"
|
|
||||||
|
|
||||||
# Prepare images in current folder
|
# Prepare images in current folder
|
||||||
# TODO(hungte) Deprecate arrow*.bmp by markup ◀ and ▶, and
|
# TODO(hungte) Deprecate arrow*.bmp by markup ◀ and ▶, and
|
||||||
# Url.bmp by <span foreground="blue">http://</span>.
|
# Url.bmp by <span foreground="blue">http://</span>.
|
||||||
for X in *.bmp *.png; do
|
for X in $(ls *.bmp *.png); do
|
||||||
if [ "$X" = "$BACKGROUND_IMAGE" ]; then
|
if [ "$X" = "$BACKGROUND_IMAGE" ]; then
|
||||||
convert_to_bmp3 "$X" "$output" "$background_scale_param"
|
convert_to_bmp3 "$X" "$output" "$background_scale_param"
|
||||||
else
|
else
|
||||||
@@ -98,13 +97,38 @@ main() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Prepares localized images. All these images were rendered by pango-view and
|
# Prepares strings and localized images. All these images were rendered by
|
||||||
# should not have transparency, so we specify flatten="" to speed up.
|
# pango-view and should not have transparency, so we specify flatten="" to
|
||||||
|
# speed up.
|
||||||
|
echo "Preparing common strings..."
|
||||||
|
base="../strings"
|
||||||
|
for X in $base/*.png; do
|
||||||
|
convert_to_bmp3 "$X" "$output" "$scale_param" ""
|
||||||
|
done
|
||||||
|
echo "Preparing localized messages... $LOCALES"
|
||||||
base="../strings/localized_text"
|
base="../strings/localized_text"
|
||||||
for X in $base/*/*.png; do
|
if [ -z "$LOCALES" ]; then
|
||||||
locale="$(basename $(dirname $X))"
|
# Collect all locales
|
||||||
|
for X in $(cd $base; ls); do
|
||||||
|
if [ -d "$base/$X" ]; then
|
||||||
|
LOCALES="${LOCALES}${X} "
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "Found locales: $LOCALES"
|
||||||
|
fi
|
||||||
|
for locale in $LOCALES; do
|
||||||
|
# Prepare all locales.
|
||||||
|
for X in $base/$locale/*.png; do
|
||||||
convert_to_bmp3 "$X" "$output/locale/$locale" "$scale_param" ""
|
convert_to_bmp3 "$X" "$output/locale/$locale" "$scale_param" ""
|
||||||
done
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
# Prepare fonts
|
||||||
|
base="../strings/font"
|
||||||
|
for X in $base/*.png; do
|
||||||
|
convert_to_bmp3 "$X" "$output/font" "$scale_param" ""
|
||||||
|
done
|
||||||
|
bmpblk_font --outfile "$output/hwid_fonts.bin" "$output"/font/*.bmp
|
||||||
}
|
}
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|||||||
Binary file not shown.
@@ -248,7 +248,7 @@ add_footer_with_url() {
|
|||||||
local lc=$1
|
local lc=$1
|
||||||
set_centered_y_percent "white_bg" 80
|
set_centered_y_percent "white_bg" 80
|
||||||
insert_centered_below "divider_btm"
|
insert_centered_below "divider_btm"
|
||||||
insert_centered_below "${lc}_for_help_text" "url"
|
insert_centered_below "${lc}_help_left_text" "url" "${lc}_help_right_text"
|
||||||
if echo "$rtol" | grep -q -w "$lc" ; then
|
if echo "$rtol" | grep -q -w "$lc" ; then
|
||||||
insert_centered_below 'hwid' "${lc}_model_text"
|
insert_centered_below 'hwid' "${lc}_model_text"
|
||||||
else
|
else
|
||||||
@@ -269,6 +269,7 @@ add_footer_without_url() {
|
|||||||
echo "" >> "$yaml_file"
|
echo "" >> "$yaml_file"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# TODO(hungte) Remove the unnecessary hwid_*.bmp loop below.
|
||||||
# Generate a new yaml file for each specified hwid_*.bmp file.
|
# Generate a new yaml file for each specified hwid_*.bmp file.
|
||||||
for hwid_bmp in hwid_unknown.bmp; do
|
for hwid_bmp in hwid_unknown.bmp; do
|
||||||
echo "$yaml_file"
|
echo "$yaml_file"
|
||||||
@@ -302,7 +303,7 @@ images:
|
|||||||
# The following strings must be approved by the localization people
|
# The following strings must be approved by the localization people
|
||||||
EOF1
|
EOF1
|
||||||
|
|
||||||
# some global variables matching the yaml definitions
|
# Global variables matching the yaml definitions
|
||||||
arrow_left='arrow_left.bmp'
|
arrow_left='arrow_left.bmp'
|
||||||
arrow_right='arrow_right.bmp'
|
arrow_right='arrow_right.bmp'
|
||||||
chrome_logo='chrome_logo.bmp'
|
chrome_logo='chrome_logo.bmp'
|
||||||
@@ -318,23 +319,7 @@ EOF1
|
|||||||
|
|
||||||
# Enumerate the bitmaps for each locale-specific string.
|
# Enumerate the bitmaps for each locale-specific string.
|
||||||
for lc in $locales; do
|
for lc in $locales; do
|
||||||
cat >>"$yaml_file" <<EOF2
|
# Locale-specific variables matching those in the yaml file.
|
||||||
${lc}_model_text: ${localedir}/$lc/model.bmp
|
|
||||||
${lc}_devmode_text: ${localedir}/$lc/devmode.bmp
|
|
||||||
${lc}_remove_text: ${localedir}/$lc/remove.bmp
|
|
||||||
${lc}_yuck_text: ${localedir}/$lc/yuck.bmp
|
|
||||||
${lc}_insert_text: ${localedir}/$lc/insert.bmp
|
|
||||||
${lc}_language_text: ${localedir}/$lc/language.bmp
|
|
||||||
${lc}_for_help_text: ${localedir}/$lc/for_help.bmp
|
|
||||||
|
|
||||||
${lc}_todev_text: ${localedir}/$lc/todev.bmp
|
|
||||||
${lc}_tonorm_text: ${localedir}/$lc/tonorm.bmp
|
|
||||||
${lc}_back_help_text: ${localedir}/$lc/back_help.bmp
|
|
||||||
${lc}_update_text: ${localedir}/$lc/update.bmp
|
|
||||||
|
|
||||||
EOF2
|
|
||||||
|
|
||||||
# Also define global variables matching those in the yaml file.
|
|
||||||
eval "${lc}_model_text=${localedir}/$lc/model.bmp"
|
eval "${lc}_model_text=${localedir}/$lc/model.bmp"
|
||||||
eval "${lc}_devmode_text=${localedir}/$lc/devmode.bmp"
|
eval "${lc}_devmode_text=${localedir}/$lc/devmode.bmp"
|
||||||
eval "${lc}_remove_text=${localedir}/$lc/remove.bmp"
|
eval "${lc}_remove_text=${localedir}/$lc/remove.bmp"
|
||||||
@@ -342,10 +327,29 @@ EOF2
|
|||||||
eval "${lc}_insert_text=${localedir}/$lc/insert.bmp"
|
eval "${lc}_insert_text=${localedir}/$lc/insert.bmp"
|
||||||
eval "${lc}_language_text=${localedir}/$lc/language.bmp"
|
eval "${lc}_language_text=${localedir}/$lc/language.bmp"
|
||||||
eval "${lc}_for_help_text=${localedir}/$lc/for_help.bmp"
|
eval "${lc}_for_help_text=${localedir}/$lc/for_help.bmp"
|
||||||
|
eval "${lc}_help_left_text=${localedir}/$lc/for_help_left.bmp"
|
||||||
|
eval "${lc}_help_right_text=${localedir}/$lc/for_help_right.bmp"
|
||||||
eval "${lc}_todev_text=${localedir}/$lc/todev.bmp"
|
eval "${lc}_todev_text=${localedir}/$lc/todev.bmp"
|
||||||
eval "${lc}_tonorm_text=${localedir}/$lc/tonorm.bmp"
|
eval "${lc}_tonorm_text=${localedir}/$lc/tonorm.bmp"
|
||||||
eval "${lc}_back_help_text=${localedir}/$lc/back_help.bmp"
|
eval "${lc}_back_help_text=${localedir}/$lc/back_help.bmp"
|
||||||
eval "${lc}_update_text=${localedir}/$lc/update.bmp"
|
eval "${lc}_update_text=${localedir}/$lc/update.bmp"
|
||||||
|
|
||||||
|
cat >>"$yaml_file" <<EOF2
|
||||||
|
${lc}_model_text: $(eval echo \$${lc}_model_text)
|
||||||
|
${lc}_devmode_text: $(eval echo \$${lc}_devmode_text)
|
||||||
|
${lc}_remove_text: $(eval echo \$${lc}_remove_text)
|
||||||
|
${lc}_yuck_text: $(eval echo \$${lc}_yuck_text)
|
||||||
|
${lc}_insert_text: $(eval echo \$${lc}_insert_text)
|
||||||
|
${lc}_language_text: $(eval echo \$${lc}_language_text)
|
||||||
|
${lc}_help_left_text: $(eval echo \$${lc}_help_left_text)
|
||||||
|
${lc}_help_right_text: $(eval echo \$${lc}_help_right_text)
|
||||||
|
${lc}_todev_text: $(eval echo \$${lc}_todev_text)
|
||||||
|
${lc}_tonorm_text: $(eval echo \$${lc}_tonorm_text)
|
||||||
|
${lc}_back_help_text: $(eval echo \$${lc}_back_help_text)
|
||||||
|
${lc}_update_text: $(eval echo \$${lc}_update_text)
|
||||||
|
|
||||||
|
EOF2
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# List the screens. We need to composite four screens for each locale.
|
# List the screens. We need to composite four screens for each locale.
|
||||||
@@ -467,5 +471,6 @@ EOF3
|
|||||||
done
|
done
|
||||||
|
|
||||||
# Now replace the 'hwid' string with '$HWID'.
|
# Now replace the 'hwid' string with '$HWID'.
|
||||||
perl -i -p -e 's/\bhwid\b/\$HWID/g;' "$yaml_file"
|
sed -i 's/\bhwid\b/\$HWID/g' "$yaml_file"
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ class BmpBlock(object):
|
|||||||
print "WARNING: ignoring $HWID font blob"
|
print "WARNING: ignoring $HWID font blob"
|
||||||
if "$HWID.rtol" in images:
|
if "$HWID.rtol" in images:
|
||||||
print "WARNING: ignoring $HWID.rtol font blob"
|
print "WARNING: ignoring $HWID.rtol font blob"
|
||||||
|
# TODO(hungte) Replace this by rendering with font block.
|
||||||
images["$HWID"] = os.path.join(self.libdir,'current_hwid.bmp')
|
images["$HWID"] = os.path.join(self.libdir,'current_hwid.bmp')
|
||||||
images["$HWID.rtol"] = os.path.join(self.libdir, 'current_hwid.bmp')
|
images["$HWID.rtol"] = os.path.join(self.libdir, 'current_hwid.bmp')
|
||||||
|
|
||||||
|
|||||||
27
scripts/newbitmaps/strings/Makefile
Normal file
27
scripts/newbitmaps/strings/Makefile
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# Copyright (c) 2012 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.
|
||||||
|
|
||||||
|
.SUFFIXES: .txt .TXT .png
|
||||||
|
.PHONY: clean all font localized_text
|
||||||
|
|
||||||
|
LOCALEDIR=localized_text
|
||||||
|
|
||||||
|
.TXT.png:
|
||||||
|
./text_to_png $<
|
||||||
|
|
||||||
|
.txt.png:
|
||||||
|
./text_to_png $<
|
||||||
|
|
||||||
|
all: font Url.png localized_text
|
||||||
|
|
||||||
|
localized_text:
|
||||||
|
make -C $(LOCALEDIR)
|
||||||
|
|
||||||
|
font:
|
||||||
|
./build_font $@
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.png
|
||||||
|
rm -rf font
|
||||||
|
make -C $(LOCALEDIR) $@
|
||||||
@@ -1 +1 @@
|
|||||||
http://google.com/chromeos/recovery
|
<span color="blue"><b> http://google.com/chromeos/recovery </b></span>
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
http://google.com/chromeos/recovery
|
|
||||||
41
scripts/newbitmaps/strings/build_font
Executable file
41
scripts/newbitmaps/strings/build_font
Executable file
@@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Copyright (c) 2012 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.
|
||||||
|
|
||||||
|
# Generates font source images.
|
||||||
|
|
||||||
|
SCRIPT="$(readlink -f "$0")"
|
||||||
|
SCRIPT_DIR="$(dirname "$SCRIPT")"
|
||||||
|
GLYPHS='* 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ{}-_'
|
||||||
|
COLOR="#888888"
|
||||||
|
FONT="Droid Sans Bold"
|
||||||
|
|
||||||
|
die() {
|
||||||
|
echo "ERROR: $*" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
[ "$#" = "1" ] || die "Usage: $0 output_dir"
|
||||||
|
local output="$1"
|
||||||
|
mkdir -p "$output"
|
||||||
|
|
||||||
|
local i=1
|
||||||
|
local c=''
|
||||||
|
echo "Generating glyph text source..."
|
||||||
|
while true; do
|
||||||
|
c="$(echo "$GLYPHS" | cut -b $i)"
|
||||||
|
[ -z "$c" ] && break
|
||||||
|
ord="0x$(echo "$c" | od -t x1 -A none | awk '{print $1}')"
|
||||||
|
echo "$c" >"$output/idx$(printf "%03d" $ord)_$(printf "%x" $ord).txt"
|
||||||
|
i=$((i + 1))
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Converting glyph images..."
|
||||||
|
"$SCRIPT_DIR/text_to_png" --margin=0 --font="$FONT" --color="$COLOR" \
|
||||||
|
"$output/*.txt"
|
||||||
|
}
|
||||||
|
|
||||||
|
set -e
|
||||||
|
main "$@"
|
||||||
@@ -1 +0,0 @@
|
|||||||
<<< model name goes here >>>
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
CHROMEOS PROTOTYPE 0001
|
|
||||||
@@ -2,9 +2,9 @@
|
|||||||
# Use of this source code is governed by a BSD-style license that can be
|
# Use of this source code is governed by a BSD-style license that can be
|
||||||
# found in the LICENSE file.
|
# found in the LICENSE file.
|
||||||
|
|
||||||
LOCALES=ar bg ca cs da de el en en_GB es es_419 et fa fi fil fr hi hr hu \
|
LOCALES=ar bg bn ca cs da de el en en_GB es es_419 et fa fi fil fr gu hi hr \
|
||||||
id it iw ja ko lt lv nl no pl pt_BR pt_PT ro ru sk sl sr sv th tr \
|
hu id it iw ja kn ko lt lv ml mr ms nl no pl pt_BR pt_PT ro ru sk sl \
|
||||||
uk vi zh_CN zh_TW
|
sr sv ta te th tr uk vi zh_CN zh_TW
|
||||||
|
|
||||||
DIR_TARGETS=$(foreach DIR,$(LOCALES),$(DIR)-dir)
|
DIR_TARGETS=$(foreach DIR,$(LOCALES),$(DIR)-dir)
|
||||||
|
|
||||||
|
|||||||
@@ -3,17 +3,27 @@
|
|||||||
# Use of this source code is governed by a BSD-style license that can be
|
# Use of this source code is governed by a BSD-style license that can be
|
||||||
# found in the LICENSE file.
|
# found in the LICENSE file.
|
||||||
#
|
#
|
||||||
# Render a text file into a bitmap. Files named '*.txt' are small font, those
|
# Render a text file into a bitmap. Files named '*.txt' are normal text files,
|
||||||
# named '*.TXT' are large font.
|
# while '*.TXT' files may contain markup.
|
||||||
#
|
#
|
||||||
# Options:
|
# Options:
|
||||||
#
|
#
|
||||||
# --lan=LANGUAGE Render language (locale) settings
|
# --lan=LANGUAGE Render language (locale) settings
|
||||||
# --font=FONTNAME Use specified font (instead of Droid Sans)
|
# --font=FONTNAME Use specified font (instead of Droid Sans)
|
||||||
|
# --point=POINT Font size, in points (72dpi)
|
||||||
|
# --margin=MARGIN Set different margin (usually for font bitmaps)
|
||||||
|
# --color=COLOR Override foreground color (in '#ffffff' format)
|
||||||
|
# --markup Render text as pango-view markup file
|
||||||
|
# --align Override align settings
|
||||||
#
|
#
|
||||||
font="Droid Sans"
|
font="Droid Sans"
|
||||||
language=""
|
language=""
|
||||||
point=15
|
pointsize=15
|
||||||
|
margin=3
|
||||||
|
align="center"
|
||||||
|
bgcolor="#ffffff"
|
||||||
|
color="#000000"
|
||||||
|
params=""
|
||||||
|
|
||||||
while true ; do
|
while true ; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@@ -27,8 +37,24 @@ while true ; do
|
|||||||
[ -n "$param" ] && font="$param"
|
[ -n "$param" ] && font="$param"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--align=*)
|
||||||
|
align="${1##*=}"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--color=*)
|
||||||
|
color="${1##*=}"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
--point=*)
|
--point=*)
|
||||||
point="${1##*=}"
|
pointsize="${1##*=}"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--margin=*)
|
||||||
|
margin="${1##*=}"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--markup)
|
||||||
|
params="$params --markup"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@@ -42,42 +68,33 @@ done
|
|||||||
# - New pango-view has --pixel to assign font size in pixel, but that is not
|
# - New pango-view has --pixel to assign font size in pixel, but that is not
|
||||||
# supported by old (ex, 1.24.5 in chroot) so we must assign --dpi 72 for
|
# supported by old (ex, 1.24.5 in chroot) so we must assign --dpi 72 for
|
||||||
# pointsize.
|
# pointsize.
|
||||||
# TODO(hungte) Replace font color & size settings to pango --markup.
|
|
||||||
bg="#ffffff"
|
|
||||||
small_color="#000000"
|
|
||||||
small_font="$font"
|
|
||||||
small_pointsize="$point"
|
|
||||||
large_color="#585858"
|
|
||||||
large_font="$font"
|
|
||||||
large_pointsize="$((point * 8 / 3))"
|
|
||||||
|
|
||||||
for txtfile in $*; do
|
for txtfile in $*; do
|
||||||
# pango-view does not support assigning output format options for bitmap, so
|
# pango-view does not support assigning output format options for bitmap, so
|
||||||
# we must create images in PNG format and then post-process it (ex, convert
|
# we must create images in PNG format and then post-process it (ex, convert
|
||||||
# into BMP by ImageMagick).
|
# into BMP by ImageMagick).
|
||||||
|
|
||||||
pngfile="${txtfile%.*}".png
|
pngfile="${txtfile%.*}".png
|
||||||
|
file_opt=""
|
||||||
case "$txtfile" in
|
case "$txtfile" in
|
||||||
*.txt)
|
*.txt)
|
||||||
pango-view -q $language \
|
file_opt=""
|
||||||
--background "$bg" --foreground "$small_color" \
|
|
||||||
--font "$small_font $small_pointsize" --dpi 72 \
|
|
||||||
--margin=3 --align=center \
|
|
||||||
--output "$pngfile" \
|
|
||||||
"$txtfile"
|
|
||||||
echo "wrote $pngfile"
|
|
||||||
;;
|
;;
|
||||||
*.TXT)
|
*.TXT)
|
||||||
pango-view -q $language \
|
file_opt="--markup "
|
||||||
--background "$bg" --foreground "$large_color" \
|
|
||||||
--font "$large_font $large_pointsize" --dpi 72 \
|
|
||||||
--margin=10 --align=center \
|
|
||||||
--output "$pngfile" \
|
|
||||||
"$txtfile"
|
|
||||||
echo "wrote $pngfile"
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Ignoring $txtfile. Filename should end with .txt or .TXT"
|
echo "Ignoring $txtfile. Filename should end with .txt or .TXT"
|
||||||
|
continue
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
pango-view -q $language \
|
||||||
|
--hinting=full \
|
||||||
|
--background "$bgcolor" --foreground "$color" \
|
||||||
|
--font "$font $pointsize" --dpi 72 \
|
||||||
|
--margin $margin \
|
||||||
|
--align="$align" \
|
||||||
|
$params $file_opt \
|
||||||
|
--output "$pngfile" \
|
||||||
|
"$txtfile"
|
||||||
|
echo "wrote $pngfile"
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user