"Fossies" - the Fresh Open Source Software Archive

Member "hevea-2.35/imagen.std" (16 Jan 2021, 2447 Bytes) of package /linux/www/hevea-2.35.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 LATEX=latex
    3 DVIPS=dvips
    4 GS=gs
    5 RESOLUTION=100 # resolution in dpi
    6 PNMCROP="pnmcrop -white"
    7 PNMEXTRA=""
    8 PNMMARGIN="pnmmargin -white 1"
    9 PPMQUANT=""
   10 #PPMTOEXT="pnmtopng -transparent '#ffffff'"
   11 #EXT=png
   12 PPMTOEXT="ppmtogif -transparent '#ffffff'"
   13 EXT=gif
   14 TODIR="."
   15 RM="/bin/rm -f"
   16 
   17 
   18 while true
   19 do
   20     case $1 in
   21      -todir)
   22        shift
   23        TODIR="$1"
   24        mkdir -p ${TODIR} 2> /dev/null || :
   25        ;;
   26      -gif)
   27     PPMTOEXT="ppmtogif -transparent '#ffffff'"
   28         EXT=gif
   29         ;;
   30      -png)
   31         PPMTOEXT="pnmtopng -transparent '#ffffff'"
   32         EXT=png
   33         ;;
   34      -pnm)
   35         PPMTOEXT=cat
   36         EXT=pnm
   37         ;;  
   38      -quant)
   39         shift
   40         PPMQUANT="ppmquant $1 2>/dev/null |"
   41         ;;
   42     -extra)
   43         shift
   44         PNMEXTRA="$1 |"
   45         ;;
   46     -mag)
   47         shift
   48     RESOLUTION="$( expr '(' "$1" '*' 72 '+' 999 ')' '/' 1000)"
   49         ;;
   50     -res)
   51         shift
   52         RESOLUTION="$1"
   53         ;;
   54     -t)
   55         shift
   56         TPAPER="-t $1"
   57         ;;
   58      -pdflatex|-pdf)
   59          LATEX=pdflatex
   60          DVIPS=cat
   61        ;;
   62     *)
   63         break
   64         ;;
   65     esac
   66     shift
   67 done
   68 echo "RESOLUTION: $RESOLUTION"
   69 #always quantize for gifs (ppmtogif ouputs non valid files when colors >= 256)
   70 if [ "$EXT" = "gif" -a -z "$PPMQUANT" ]
   71 then
   72   PPMQUANT="ppmquant 255 2>/dev/null |"
   73 fi
   74 
   75 case $1 in
   76   '')
   77    BASE=image
   78    ;;
   79   *)
   80    BASE=$1
   81   ;;
   82 esac
   83 NAME=${BASE}.image
   84 
   85 trap "${RM} ${NAME}.dvi ${NAME}.pdf `basename ${NAME}.log` `basename ${NAME}.aux` head.tmp body.tmp ; exit 2" 1 2 3 8 10 13 15
   86 
   87 DVIPSOPTS="-Z $TPAPER"
   88 GSOPTS="-q -dNOPAUSE -dBATCH -DNOPROMPT -sDEVICE=ppmraw \
   89     -r$RESOLUTION -dAutoRotatePages=/None \
   90         -dTextAlphaBits=4 -dGraphicsAlphaBits=4"
   91 if [ "${TODIR}" = "." ]
   92 then
   93   FINAL=${BASE}%03d.${EXT}
   94 else
   95   FINAL=${TODIR}/${BASE}%03d.${EXT}
   96 fi
   97 test -f  ${NAME}.tex ||\
   98 { echo "Failure: no ${NAME}.tex file!" 2>&1 ; exit 2 ; }
   99 ${LATEX} ${NAME}.tex
  100 NAMEDIR=`dirname ${NAME}`
  101 if [ "${LATEX}" = "pdflatex" ]
  102 then
  103   if [ ${NAMEDIR} != "." ]
  104   then
  105     mv `basename ${NAME}.pdf` ${NAME}.pdf
  106   fi
  107   cat ${NAME}.pdf
  108 else
  109  if [ ${NAMEDIR} != "." ]
  110   then
  111     mv `basename ${NAME}.dvi` ${NAME}.dvi
  112   fi
  113   ${DVIPS} ${DVIPSOPTS} -o - ${NAME}.dvi
  114 fi |\
  115 ${GS} ${GSOPTS} -sOutputFile="|\
  116     ${PNMCROP} | ${PNMEXTRA} \
  117     ${PNMMARGIN} | ${PPMQUANT} \
  118     ${PPMTOEXT} 2>/dev/null > ${FINAL}" -
  119 ${RM} ${NAME}.dvi ${NAME}.pdf   head.tmp body.tmp
  120 ${RM} `basename ${NAME}.log` `basename ${NAME}.aux`