Root/
| 1 | #!/bin/sh |
| 2 | # |
| 3 | # normalizeschps - Normalize eeschema Postscript |
| 4 | # |
| 5 | # Written 2010 by Werner Almesberger |
| 6 | # Copyright 2010 Werner Almesberger |
| 7 | # |
| 8 | # This program is free software; you can redistribute it and/or modify |
| 9 | # it under the terms of the GNU General Public License as published by |
| 10 | # the Free Software Foundation; either version 2 of the License, or |
| 11 | # (at your option) any later version. |
| 12 | # |
| 13 | |
| 14 | |
| 15 | usage() |
| 16 | { |
| 17 | cat <<EOF 1>&2 |
| 18 | usage: $0 [options] [in.ps [out.ps]] |
| 19 | |
| 20 | -w points Postscript line width (default: use the original) |
| 21 | EOF |
| 22 | exit 1 |
| 23 | } |
| 24 | |
| 25 | |
| 26 | width= |
| 27 | while true; do |
| 28 | case "$1" in |
| 29 | -w) [ -z "$2" ] && usage |
| 30 | width="$2" |
| 31 | shift 2;; |
| 32 | -*) |
| 33 | usage;; |
| 34 | *) |
| 35 | break;; |
| 36 | esac |
| 37 | done |
| 38 | |
| 39 | [ -z "$3" ] || usage |
| 40 | in=${1:--} |
| 41 | out=${2:-/dev/stdout} |
| 42 | |
| 43 | sed ' |
| 44 | 1c%!PS-Adobe-3.0\ |
| 45 | currentdict /DidNormalize known not { \ |
| 46 | '"`[ -z \"$width\" ] || |
| 47 | echo \"/setlinewidth { $width 2 copy lt { exch } if pop \ |
| 48 | setlinewidth } bind def \"`"' \ |
| 49 | /rectfill { rectstroke } bind def \ |
| 50 | /DidNormalize true def \ |
| 51 | } if \ |
| 52 | gsave |
| 53 | /%%DocumentMedia: A4.*/a-20 -10 translate |
| 54 | /%%DocumentMedia: A3.*/{s/A3/A4/;a-20 -10 translate 0.70 dup scale |
| 55 | } |
| 56 | /%%DocumentMedia: A2.*/{s/A2/A4/;a-18 -12 translate 0.49 dup scale |
| 57 | } |
| 58 | $agrestore' "$in" >"$out" |
| 59 | |
| 60 | # /%%Orientation: Landscape/d' "$n" |
| 61 |
Branches:
master
