[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-user: PCB italics and reverse italics text script




Maciej Pijanka just helped me come up with the attached script for converting the text SymbolLines to italicized.

This script uses 1:4 as the slanting factor which your welcome to change, as well as the sign of it for forward slanting.

It's pretty simple but might be useful as a starting point for others wishing to modify the PCB default fonts.

Good luck, Phil Taylor

----------------------------------------------------------------------

#!/usr/bin/perl
# I am grateful to Maciej Pijanka for helping me write this script.
use strict;


my $state = 0;

while (not eof STDIN) {
	my $line = <STDIN>;
	my $printed = 0;

	chomp $line;

	if ($line =~ /^Symbol/) {
		$state = 1;
	}

	if ($state == 1 && $line =~ /^\($/) {
		$state ++;
	}

	if ($state == 2) {
		if ($line =~ /(^[ 	]*SymbolLine)\((\d+) (\d+) (\d+) (\d+) (\d+)\)(.*)$/) {
my ($prefix, $x1, $y1, $x2, $y2, $thickness, $suffix) = ($1, $2, $3, $4, $5, $6, $7);
			$x1 += $y1/4;
			$x2 += $y2/4;
printf "%s[%d %d %d %d %d]%s\n", $prefix, $x1 * 100, $y1 * 100, $x2 * 100, $y2 * 100, $thickness * 100, $suffix;
			$printed = 1;
} elsif ($line =~ /(^[ ]*SymbolLine)\[(\d+) (\d+) (\d+) (\d+) (\d+)\](.*)$/) { my ($prefix, $x1, $y1, $x2, $y2, $thickness, $suffix) = ($1, $2, $3, $4, $5, $6, $7);
			$x1 += $y1/4;
			$x2 += $y2/4;
printf "%s[%d %d %d %d %d]%s\n", $prefix, $x1, $y1, $x2, $y2, $thickness, $suffix;
			$printed = 1;
		}
	}

	if ($printed == 0) {
		printf "%s\n", $line;
	}
}



_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user