Files
OpenCellular/scripts/newbitmaps/strings/text_to_bmp
Bill Richardson f1282d321f Use the correct fonts for BIOS screens.
We should have been using Droid Sans, not Helvetica, and some of the
non-Roman locales need special handling to render clearly and correctly. We
also get better results if we avoid scaling after rendering the text.

Added scripts/newbitmaps/Makefile to regenerate it all, updated the READMEs.
Since Hung-Te figured out how to use pango-view to render the UTF-8
reliably, we don't need to keep all the pre-rendered locale images anymore
either.

This provides the x86 bmpblock for Stumpy PVT. We may need some more
tweaking for Lumpy and/or ARM.

BUG=chrome-os-partner:6595
TEST=manual

Put the new screens into the bios:

  gbb_utility -s --flags=0 -b bmpblock_x86.bin OLDBIOS NEWBIOS
  flashrom -w NEWBIOS

Then reboot and look at the BIOS screens. The lettering is much clearer.

Change-Id: Icb07bc6d131920730f41348c7de9151e42cc9518
Reviewed-on: https://gerrit.chromium.org/gerrit/11007
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
2011-11-02 18:18:18 -07:00

85 lines
2.1 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
# named '*.TXT' are large font.
#
# Options:
#
# --rtl Render right-to-left languages
# --font=FONTNAME Use specified font (instead of Helvetica)
#
font="Droid Sans"
rtl=""
point=22
while true ; do
case "$1" in
--rtl)
rtl="--rtl"
shift
;;
--font=*)
font="${1##*=}"
shift
;;
--point=*)
point="${1##*=}"
shift
;;
*)
break
;;
esac
done
# Image parameters
# - 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
# pointsize.
bg='#607c91'
small_color='#9ccaec'
small_font="$font"
small_pointsize="$point"
large_color="white"
large_font="$font"
large_pointsize=40
for txtfile in $*; do
# pango-view does not support assigning output format options for bitmap, so
# we first create the images in PNG format and then convert into BMP by
# ImageMagick.
pngfile="${txtfile%.*}".png
bmpfile="${txtfile%.*}".bmp
case "$txtfile" in
*.txt)
pango-view -q $rtl --no-auto-dir \
--background "$bg" --foreground "$small_color" \
--font "$small_font $small_pointsize" --dpi 72 \
--margin=3 --align=center \
--output "$pngfile" \
"$txtfile"
convert -colors 256 -compress none -alpha off "$pngfile" BMP3:"$bmpfile"
rm -f "$pngfile"
echo "wrote $bmpfile"
;;
*.TXT)
pango-view -q $rtl --no-auto-dir \
--background "$bg" --foreground "$large_color" \
--font "$large_font $large_pointsize" --dpi 72 \
--margin=10 --align=center \
--output "$pngfile" \
"$txtfile"
convert -colors 256 -compress none -alpha off "$pngfile" BMP3:"$bmpfile"
rm -f "$pngfile"
echo "wrote $bmpfile"
;;
*)
echo "Ignoring $txtfile. Filename should end with .txt or .TXT"
;;
esac
done