summaryrefslogtreecommitdiff
path: root/Master/texmf-doc/doc/english/free-math-font-survey/source/fixepsbbox
blob: 08e977932b3b57fb4fd5c6ae91fc46fc31304ff7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash

# fixepsbbox (filename) (left x target) (tolerance)

EPSFile=$1
TargetX=$2
Tolerance=$3

LeftX=`grep BoundingBox $EPSFile | cut -d' ' -f 2`

TestVal=$(( ( $LeftX < ( $TargetX - $Tolerance ) ) || ( $LeftX > ( $TargetX + $Tolerance ) ) ))

if [ $TestVal -ne 0 ]
then
  echo "Changing left edge of $EPSFile from $LeftX to $TargetX."
  TmpFile="tmp_`date +%Y-%m-%d-%H-%M-%S`.eps"
  sed -e 's/BoundingBox: [-]*[[:digit:]]* /BoundingBox: '$TargetX' /g' $EPSFile > $TmpFile
  mv $TmpFile $EPSFile
fi