3 # Copyright (c) 2009 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
7 # Usage: ./test_unmalicious_fonts.sh [ttf_or_otf_file_name]
9 BLACKLIST
=.
/BLACKLIST.txt
12 if [ ! -r "$BLACKLIST" ] ; then
13 echo "$BLACKLIST is not found."
17 if [ ! -x "$CHECKER" ] ; then
18 echo "$CHECKER is not found."
22 if [ $# -eq 0 ] ; then
23 # No font file is specified. Apply this script to all TT/OT files under the
26 # On Ubuntu Linux (>= 8.04), You can install ~1800 TrueType/OpenType fonts
27 # to /usr/share/fonts/truetype by:
28 # % sudo apt-get install ttf-.*[^0]$
29 BASE_DIR
=/usr
/share
/fonts
/truetype
/
30 if [ ! -d $BASE_DIR ] ; then
32 BASE_DIR
="/Library/Fonts/ /System/Library/Fonts/"
34 # TODO(yusukes): Support Cygwin.
36 # Recursively call this script.
37 find $BASE_DIR -type f
-name '*tf' -exec "$0" {} \
;
42 if [ $# -gt 1 ] ; then
43 echo "Usage: $0 [ttf_or_otf_file_name]"
47 # Check the font file using idempotent iff the font is not blacklisted.
49 egrep -i -e "^$base" "$BLACKLIST" > /dev
/null
2>&1 ||
"$CHECKER" "$1" > /dev
/null
2>&1 ||
(echo ; echo "FAIL: $1 (Run $CHECKER $1 for more information.)")