"Fossies" - the Fresh Open Source Software Archive

Member "usr/share/Ted/fontsdocs/checkfontsdocs.sh" (1 Feb 2013, 829 Bytes) of package /linux/misc/old/ted-2.23-linux-amd64.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/sh
    2 
    3 ####
    4 ####    Test the output of Ted --FontsDocuments
    5 ####    For all documents, we check whether the correct font has 
    6 ####    been selected, and whether it can be converted to PDF
    7 ####
    8 
    9 TMP=/tmp/$$.txt
   10 trap "rm -f $TMP" 0
   11 
   12 for rtf in *.rtf
   13 do
   14     base=`basename $rtf .rtf`
   15     ps=$base.ps
   16     pdf=$base.pdf
   17 
   18     rtf2ps.sh $rtf $ps
   19 
   20     sed -n                      \
   21     -e  '/^%%BeginProlog:/{q}'          \
   22     -e  '/^%%DocumentSuppliedFonts:/{q}'    \
   23     -e  's/^%%DocumentFonts: *//p'      \
   24     -e  's/^%%+ *//p'               \
   25         $ps > $TMP
   26     read used < $TMP
   27 
   28     if grep -q -x "$base" $TMP
   29     then
   30     echo $rtf: Uses font $base
   31     else
   32     echo $rtf: '##' Does not use $base. Fonts: `cat $TMP`
   33     fi
   34 
   35     # gs produces error output on stdout
   36     if  ps2pdf $ps $pdf 1>&2
   37     then
   38     : ok
   39     else
   40     echo $rtf: '##' Cound not convert $ps to $pdf
   41     rm -f $pdf
   42     fi
   43 done