mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2025-04-21 12:27:27 +03:00
Split gitsch2ppm into its constituents.
- scripts/gitsch2ps: generate PS files for KiCad schematics in git - scripts/normalizeschps: normalize eeschema Postscript - scripts/schps2ppm: generate PPM files from normalized Eeschema Postscript - scripts/gitsch2ppm: wrapper and cache manager for the above scripts
This commit is contained in:
59
scripts/normalizeschps
Executable file
59
scripts/normalizeschps
Executable file
@@ -0,0 +1,59 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# normalizeschps - Normalize eeschema Postscript
|
||||
#
|
||||
# Written 2010 by Werner Almesberger
|
||||
# Copyright 2010 Werner Almesberger
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
|
||||
|
||||
LINEWIDTH=120
|
||||
|
||||
|
||||
usage()
|
||||
{
|
||||
cat <<EOF 1>&2
|
||||
usage: $0 [options] file ...
|
||||
|
||||
-w points Postscript line width (default: $LINEWIDTH)
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
while true; do
|
||||
case "$1" in
|
||||
-w) [ -z "$2" ] && usage
|
||||
LINEWIDTH="$2"
|
||||
shift 2;;
|
||||
-*)
|
||||
usage;;
|
||||
*)
|
||||
break;;
|
||||
esac
|
||||
done
|
||||
|
||||
for n in "$@"; do
|
||||
sed -i '
|
||||
1c%!PS-Adobe-3.0\
|
||||
currentdict /DidNormalize known not { \
|
||||
/setlinewidth { '$LINEWIDTH' 2 copy lt { exch } if pop \
|
||||
setlinewidth } bind def \
|
||||
/rectfill { rectstroke } bind def \
|
||||
/DidNormalize true def \
|
||||
} if \
|
||||
gsave
|
||||
/%%DocumentMedia: A4.*/a-20 -10 translate
|
||||
/%%DocumentMedia: A3.*/{s/A3/A4/;a-20 -10 translate 0.70 dup scale
|
||||
}
|
||||
/%%DocumentMedia: A2.*/{s/A2/A4/;a-18 -12 translate 0.49 dup scale
|
||||
}
|
||||
$agrestore' "$n"
|
||||
done
|
||||
|
||||
# /%%Orientation: Landscape/d' "$n"
|
||||
Reference in New Issue
Block a user