]> git.pld-linux.org Git - packages/t1lib.git/blob - t1lib-t1libconfig.patch
tool to generate FontDatabase
[packages/t1lib.git] / t1lib-t1libconfig.patch
1 --- t1lib-1.3.1.orig/debian/t1libconfig.8
2 +++ t1lib-1.3.1/debian/t1libconfig.8
3 @@ -0,0 +1,57 @@
4 +.TH T1LIBCONFIG 8
5 +.SH NAME
6 +.B t1libconfig
7 +\- create the t1lib.config and FontDataBase files for t1lib
8 +.SH SYNOPSIS
9 +.B t1libconfig
10 +[
11 +.BR \-v\fP, \fB\-\-version
12 +]
13 +[
14 +.BR \-h\fP, \fB\-\-help
15 +]
16 +.B \-\-force
17 +]
18 +[
19 +.B fontdirectory...
20 +]
21 +.SH DESCRIPTION
22 +.B t1libconfig
23 +scans a list of directories for Type 1 fonts and font metric files,
24 +and generates a configuration file and font database file for the
25 +.B t1lib
26 +rasterizer library accordingly.  By default, it looks in all
27 +subdirectories of /usr/X11R6/lib/X11/fonts, and in
28 +/usr/lib/ghostscript.  Extra directories to search may be specified on 
29 +the command line.  The
30 +.B t1libconfig
31 +script tries not to scan the same directory twice (this is, however,
32 +not foolproof, since /usr/X11R6/lib/X11/fonts and /usr/lib/X11/fonts
33 +typically point to the same directory on GNU/Linux systems).
34 +.SH OPTIONS
35 +.TP
36 +.BR \-v\fP, \fB\-\-version
37 +Print the version of
38 +.B t1libconfig
39 +and exit.
40 +.TP
41 +.BR \-h\fP, \fB\-\-help
42 +Print help about usage and exit.
43 +.TP
44 +.B \-\-force
45 +Force the generation of new configuration files even if these files
46 +already exist on the system.
47 +.SH FILES
48 +.TP 25
49 +.B /etc/t1lib/t1lib.config
50 +Contains configuration information for t1lib, including
51 +colon-separated lists of paths to Type 1 font files and font metrics
52 +files, and the location of the default font database file
53 +.TP 25
54 +.B /etc/t1lib/FontDataBase
55 +Contains a list of the names of Type 1 font files to be used by t1lib.
56 +.SH AUTHOR
57 +David Huggins-Daines <dhd@debian.org>
58 +.SH SEE ALSO
59 +.BR FontDataBase (5)
60 +
61 --- t1lib-1.3.1.orig/debian/t1libconfig
62 +++ t1lib-1.3.1/debian/t1libconfig
63 @@ -0,0 +1,158 @@
64 +#!/bin/sh -e
65 +
66 +# to test POSIX-correctness, change hash-bang to /bin/bash and uncomment
67 +# the following line:
68 +
69 +# set -o posix
70 +
71 +# Very simple configuration script for t1lib.  Checks a couple of
72 +# directories that might contain fonts, and if they exist, adds
73 +# anything ending in .pfa or pfb to the font database.  A few things
74 +# borrowed from paperconfig, (C) 1996, Yves Arrouye
75 +# <arrouye@debian.org>
76 +
77 +# note that this creates the "minimal" font database accepted by t1lib,
78 +# and doesn't look in every possible place for fonts.  It is mostly
79 +# provided so that xglyph will work out of the box...
80 +
81 +# Written by David Huggins-Daines <dhd@debian.org>
82 +
83 +usage() {
84 +    if [ "$1" = -h ]
85 +    then
86 +       exec 1>&2
87 +       echo -n U
88 +    else
89 +       echo -n u
90 +    fi
91 +
92 +    echo "sage: `basename $0` [ -v, --version ] [ -h, --help ] [ --force ]"
93 +    echo "                   [ fontdirs... ]"
94 +
95 +    if [ "$1" = -h ]
96 +    then
97 +       cat <<EOF
98 +
99 +Options: -v, --verbose          print version information and exit
100 +         -h, --help             print this help and exit
101 +         --force                force configuration
102 +EOF
103 +       exit 0
104 +    else
105 +       exit 1
106 +    fi
107 +}
108 +
109 +version=0.2
110 +x11fontdirs="$(find /usr/X11R6/lib/X11/fonts -type d -printf "%p " || true) $(find /usr/share/fonts -type d -printf "%p " || true)"
111 +fontdirs="/usr/lib/ghostscript/fonts $x11fontdirs"
112 +conffile=/etc/t1lib/t1lib.config
113 +confdir=/etc/t1lib/
114 +dbase=/etc/t1lib/FontDatabase
115 +temp=/etc/t1lib/FontDatabase.tmp
116 +
117 +force=0
118 +
119 +while [ $# -ne 0 ]
120 +do
121 +    case "$1" in
122 +       -v|--version)
123 +           echo "`basename $0` version $version" \
124 +               "by David Huggins-Daines <dhd@debian.org>"
125 +           exit 0
126 +           ;;
127 +       -h|--help)
128 +           usage -h
129 +           ;;
130 +       --force)
131 +           force=1
132 +           ;;
133 +       *)
134 +           # hairy way to remove a trailing backslash (should use perl)
135 +           pat=`expr $1 : "\(.*\)\/\$" || echo $1`
136 +           # hairier way to find a string anywhere in another string
137 +           # should really use perl.
138 +           if ! grep $pat <<EOF >/dev/null 2>&1
139 +$fontdirs
140 +EOF
141 +           then
142 +               fontdirs="$fontdirs $1"
143 +           fi
144 +           ;;
145 +    esac
146 +    shift
147 +done
148 +
149 +# We presume that if the database exists, then so does the
150 +# configuration file.  Hopefully this won't break anything.
151 +
152 +if [ $force -eq 1 ] || [ ! -e $dbase ]; then
153 +    fontpath=""
154 +    afmpath=""
155 +
156 +    mkdir -p $confdir || true
157 +
158 +    echo -n "Searching for Type 1 fonts and AFM files..."
159 +
160 +    for i in $fontdirs
161 +    do
162 +       if [ -d $i ] && ls $i/*.pf[ab] > /dev/null 2>&1; then
163 +           if [ -n "$fontpath" ]; then
164 +               fontpath="$fontpath:$i"
165 +           else
166 +               fontpath="$i"
167 +           fi
168 +           
169 +           if ls $i/*.afm > /dev/null 2>&1; then
170 +               if [ -n "$afmpath" ]; then
171 +                   afmpath="$afmpath:$i"
172 +               else
173 +                   afmpath="$i"
174 +               fi
175 +           fi
176 +           # get a listing of all the fonts in each dir
177 +           find $i -name *.pf[ab] -maxdepth 1 -printf '%f\n' >> $temp
178 +       fi
179 +    done
180 +    if [ -z "$fontpath" ]; then
181 +       cat <<EOF
182 +
183 +No Type 1 fonts were found in the expected locations.
184 +If you want t1lib to be aware of your fonts, you should run
185 +/usr/sbin/t1libconfig with the names of your local font directories as
186 +arguments, or you should edit the /etc/t1lib/FontDatabase file manually.
187 +See the FontDatabase(5) manual page for more information.
188 +
189 +Press [return] to continue.
190 +EOF
191 +        read foo || true
192 +       rm -f $temp
193 +    else
194 +        echo "done."
195 +        echo -n "Building font database..."
196 +        fontcount=`wc -l $temp || true`
197 +        echo $fontcount > $dbase
198 +        cat $temp >> $dbase
199 +        rm -f $temp
200 +        echo "done."
201 +    fi
202 +
203 +    # now set the paths in the config file
204 +    cat <<EOF >$conffile
205 +t1lib.config - global configuration file for t1lib.
206 +It was created automatically on `date`
207 +by the t1libconfig script.
208 +
209 +Run /usr/sbin/t1libconfig --force to rebuild it.
210 +    
211 +ENCODING=.
212 +AFM=$afmpath
213 +TYPE1=$fontpath
214 +FONTDATABASE=$dbase
215 +EOF
216 +else
217 +    echo "Configuration and font database files already exist."
218 +    echo "Run /usr/sbin/t1libconfig --force to rebuild them."
219 +fi
220 +
221 +exit 0
This page took 0.243096 seconds and 3 git commands to generate.