Skip to content

Instantly share code, notes, and snippets.

@amamama
Last active December 23, 2015 12:57
Show Gist options
  • Save amamama/5cc64371817b18c8b3f4 to your computer and use it in GitHub Desktop.
Save amamama/5cc64371817b18c8b3f4 to your computer and use it in GitHub Desktop.
%!PS-Adobe-3.0 ESPF-3.0
%%BoundingBox: 0 0 1536 1536
/D-body {
newpath
1 14 moveto
6 16 6 24 4 32 rcurveto
3 2 rlineto
3 -15 -8 -24 -27 -22 14 2 18 -2 20 -12 rcurveto2
closepath
12 21 moveto
1 -6 -2 -10 -10 -13 4 -1 6 -2 7 -8 2 4 4 8 3 21 rcurveto3
closepath
gsave
1.0 0.0 0.0 setrgbcolor
eofill
grestore
16 43 moveto
1 -6 -1 -10 -12 -14 4 -1 7 -2 8 -8 rcurveto2
5 17 moveto
6 16 6 24 3 31 rcurveto
5 17 moveto
15 -1 18 2 20 4 rcurveto
1 14 moveto
4 3 rlineto
stroke
} def
/D-eye {
newpath
11 42 moveto
0 -5 -6 -6 -6 -1 0 6 6 6 6 1 rcurveto2
closepath
18 40 moveto
0 -4 -5 -7 -5 -2 0 6 5 7 5 2 rcurveto2
closepath
gsave
1.0 1.0 1.0 setrgbcolor
fill
grestore
stroke
newpath
13 40 moveto
-1 -1 -3 -2 -3 0 1 0 2 -2 0 -4 0 2 1 4 3 4 rcurveto3
closepath
19 39 moveto
-1 -2 -3 -2 -3 0 1 0 1 -2 0 -4 0 2 1 4 3 4 rcurveto3
closepath
fill
} def
/D-rhand { 0 -3 -4 -3 -4 0 1 0 1 0 1 -3 0 3 3 3 3 3 } def
/D-lhand { 2 0 2 5 0 5 0 -1 0 -3 1 -3 -1 0 -1 -1 -1 -2 } def
/D-rhand_open { -1 -3 -5 -3 -5 0 1 0 3 -1 2 -4 0 3 2 3 3 3 } def
/D-lhand_open { 2 0 2 5 0 5 0 -1 0 -3 2 -3 -1 0 -2 -1 -2 -2 } def
/D-rhand_bend { -1 -3 -4 -3 -4 0 1 0 2 0 1 -3 0 3 3 3 3 3 } def
/D-lhand_bend { 2 0 2 5 0 5 0 -1 0 -3 1 -3 -1 0 -1 -1 -1 -2 } def
/D-lfoot { -1 0 -2 2 -1 3 -5 -1 4 2 8 0 6 -2 0 0 0 0 0 0 } def
/D-lfoot_rot { 0 -1 -2 -2 -3 -1 1 -5 -2 4 0 8 2 6 0 0 0 0 0 0 } def
/D-rfoot { 1 0 2 0 2 2 4 0 -1 0 -3 -1 -1 -3 -2 0 -3 1 -5 1 } def
/D-rfoot_rot { 0 -1 0 -2 2 -2 0 -4 0 1 -1 3 -3 1 0 2 1 3 1 5 } def
/D-rarm_normal { 0 1 11 11 -7 8 8 39 } def
/D-larm_normal { -1 3 -13 12 4 9 27 39 } def
/D-rleg_normal { 0 0 4 -6 -3 -6 11 15 } def
/D-lleg_normal { 0 0 -4 -6 3 -6 16 16 } def
/D-rarm_open { -2 2 2 14 -7 4 8 39 } def
/D-larm_open { 0 4 -4 15 4 4 27 39 } def
/D-rleg_open { 0 0 0 0 -3 -12 11 15 } def
/D-lleg_open { 0 0 0 0 3 -12 16 16 } def
/D-rarm_bend { -2 -1 4 -3 -7 -8 8 39 } def
/D-larm_bend { -1 3 -2 -2 4 -9 27 39 } def
/D-rleg_close { 0 0 0 0 0 -12 11 15 } def
/D-lleg_close { 0 0 0 0 0 -12 16 16 } def
/D-rleg_hori { 0 0 -8 0 0 0 11 15 } def
/D-lleg_hori { 0 0 0 0 12 0 16 16 } def
/D-rleg_step { 0 0 4 -4 -3 -4 11 15 } def
/D-lleg_step { 0 0 -4 -4 3 -4 16 16 } def
/rlineto2 {rlineto rlineto} def
/rcurveto2 {rcurveto rcurveto} def
/rcurveto3 {rcurveto2 rcurveto} def
/D-print {
gsave
newpath
moveto
rlineto2
rmoveto
0.75 setlinewidth
currentpoint
stroke
grestore
newpath
moveto
{
rcurveto2
rlineto
rcurveto
} {
rcurveto3
} ifelse
closepath
gsave
1.0 1.0 1.0 setrgbcolor
fill
grestore
stroke
} def
/case {
2 dict begin
/block exch cvlit def
/exp exch def
0 2 block length 1 sub {
/i exch def
block i get exp eq
block i get /else eq or {
block i 1 add get exec exit
} if
} for
end
} def
/printlimb {
7 dict begin
/y exch def
/x exch def
/rot exch def
/ll exch def
/rl exch def
/la exch def
/ra exch def
rot { x 32 add y 64 add translate 180 rotate } { x y translate } ifelse
la {
0 { D-lhand D-larm_normal }
1 { D-lhand_open D-larm_open }
2 { D-lhand_bend D-larm_bend }
} case
-1 la ne { false 9 1 roll D-print } if
D-body
D-eye
ra {
0 { D-rhand D-rarm_normal }
1 { D-rhand_open D-rarm_open }
2 { D-rhand_bend D-rarm_bend }
} case
-1 ra ne { false 9 1 roll D-print } if
rl {
0 { D-rfoot D-rleg_normal }
1 { D-rfoot D-rleg_open }
2 { D-rfoot D-rleg_close }
3 { D-rfoot D-rleg_step }
4 { D-rfoot_rot D-rleg_hori }
} case
true 9 1 roll D-print
ll {
0 { D-lfoot D-lleg_normal }
1 { D-lfoot D-lleg_open }
2 { D-lfoot D-lleg_close }
3 { D-lfoot D-lleg_step }
4 { D-lfoot_rot D-lleg_hori }
} case
true 9 1 roll D-print
rot { -180 rotate x 32 add neg y 64 add neg translate} {x neg y neg translate } ifelse
end
} def
/printalpha {
/y exch def
/x exch def
{
0 { 0 0 2 0 false }
1 { -1 -1 3 0 false }
2 { 0 -1 3 0 false }
3 { 0 -1 1 1 true }
4 { 0 0 1 1 false }
5 { 0 -1 1 1 false }
6 { -1 0 1 1 true }
7 { 0 0 2 2 false }
8 { 0 0 4 2 false }
9 { 1 1 4 2 false }
10 { 1 1 2 4 false }
11 { 1 2 3 0 false }
12 { 0 0 3 0 false }
13 { 2 0 3 0 false }
14 { 0 0 3 2 false }
15 { -1 -1 4 2 false }
16 { -1 -1 2 4 false }
17 { 0 0 2 4 false }
18 { 1 1 3 0 false }
19 { 0 0 1 1 true }
20 { -1 1 3 0 false }
21 { 1 -1 3 0 false }
22 { 1 1 1 1 false }
23 { 2 0 1 1 false }
24 { -1 0 3 0 false }
25 { -1 0 1 1 false }
} case
x y printlimb
} def
0 0 0 setrgbcolor
1 setlinecap
1 setlinejoin
0.5 setlinewidth
0.6 0.6 scale
/x 0 def
/y 1920 def
%0 1 12 { dup 32 mul 64 printalpha} for
%13 1 25 { dup 13 sub 32 mul 0 printalpha} for
%(hello world\n\ndo you know dancing man\nof sherlock holmes\n\nnow d man is dancing\n\ni am very sorry\nto keep you waiting a few days\n\nwriting article takes more time\ni have expected)
( do you know dancing man of sherlock holmes\n i wrote eps script that presents dancing d men\n each man means an character of alphabet\n of cource the gesuture is same as his dancing man\n the script is divided by three parts\n first is data of alphabet\n second is print d man\n third is decode string\n \n unfortunately i have not finish draw a flag that represents capital letter\n it shows string as small letter\n i am against some obstacle for writing eps script\n now i almost finished\n \n full script will be coming soon\n have fun) {
dup dup ==
{
10 {pop /y y 64 sub store /x 0 store }
32 {pop}
/else {
97 sub x y printalpha
}
} case
/x x 32 add store
} forall
%%EOF
/+{}def
(+/ string a=q{)(/case {
2 dict begin
/block exch cvlit def
/exp exch def
0 2 block length 1 sub {
/i exch def
block i get exp eq
block i get /else eq or {
block i 1 add get exec exit
} if
} for
end
} def
/s ( ) def
/p {
s 0 40 put s print
{
dup {
/else {s exch 0 exch put s print}
} case
} forall
s 0 41 put s print
} def
2 index = 7 -1 roll p 6 -1 roll p 5 -1 roll dup cvx exec p 4 -1 roll p 3 -1 roll p)(
/m{moveto}def
/l{rlineto}def
/t{rcurveto}def
/r{t t}def
/e{m t}def
/w{m r closepath}def
/q{m r t closepath}def
/D-print {
gsave newpath
m l l
rmoveto
0.75 setlinewidth
currentpoint
stroke
grestore
newpath
3 -1 roll
{
m r l t
closepath
} {
q
} ifelse
gsave
1 1 1 setrgbcolor
fill
grestore
stroke
} def
/printlimb {
7 dict begin
/y exch def
/x exch def
/rot exch def
/ll exch def
/rl exch def
/la exch def
/ra exch def
rot { x 32 add y 64 add translate 180 rotate } { x y translate } ifelse
la {
0 { 2 0 2 5 0 5 0 -1 0 -3 1 -3 -1 0 -1 -1 -1 -2 -1 3 -13 12 4 9 27 39 }
1 { 2 0 2 5 0 5 0 -1 0 -3 2 -3 -1 0 -2 -1 -2 -2 0 4 -4 15 4 4 27 39 }
2 { 2 0 2 5 0 5 0 -1 0 -3 1 -3 -1 0 -1 -1 -1 -2 -1 3 -2 -2 4 -9 27 39 }
} case
-1 la ne { false 9 1 roll D-print } if
newpath
6 16 6 24 4 32 1 14 e
3 2 l
3 -15 -8 -24 -27 -22 14 2 18 -2 20 -12 r
closepath
1 -6 -2 -10 -10 -13 4 -1 6 -2 7 -8 2 4 4 8 3 21 12 21 q
gsave
1 0 0 setrgbcolor
eofill
grestore
16 43 m
1 -6 -1 -10 -12 -14 4 -1 7 -2 8 -8 r
6 16 6 24 3 31 5 17 e
15 -1 18 2 20 4 5 17 e
1 14 m
4 3 l
stroke
newpath
0 -5 -6 -6 -6 -1 0 6 6 6 6 1 11 42 w
0 -4 -5 -7 -5 -2 0 6 5 7 5 2 18 40 w
gsave
1 1 1 setrgbcolor
fill
grestore
stroke
newpath
-1 -1 -3 -2 -3 0 1 0 2 -2 0 -4 0 2 1 4 3 4 13 40 q
-1 -2 -3 -2 -3 0 1 0 1 -2 0 -4 0 2 1 4 3 4 19 39 q
fill
ra {
0 { 0 -3 -4 -3 -4 0 1 0 1 0 1 -3 0 3 3 3 3 3 0 1 11 11 -7 8 8 39 }
1 { -1 -3 -5 -3 -5 0 1 0 3 -1 2 -4 0 3 2 3 3 3 -2 2 2 14 -7 4 8 39 }
2 { -1 -3 -4 -3 -4 0 1 0 2 0 1 -3 0 3 3 3 3 3 -2 -1 4 -3 -7 -8 8 39 }
} case
-1 ra ne { false 9 1 roll D-print } if
rl 3 le { 1 0 2 0 2 2 4 0 -1 0 -3 -1 -1 -3 -2 0 -3 1 -5 1 }
{ 0 -1 0 -2 2 -2 0 -4 0 1 -1 3 -3 1 0 2 1 3 1 5 } ifelse
rl {
0 { 0 0 4 -6 -3 -6 11 15 }
1 { 0 0 0 0 -3 -12 11 15 }
2 { 0 0 0 0 0 -12 11 15 }
3 { 0 0 4 -4 -3 -4 11 15 }
4 { 0 0 0 0 -8 0 11 15 }
} case
true 9 1 roll D-print
ll 3 le { -1 0 -2 2 -1 3 -5 -1 4 2 8 0 6 -2 0 0 0 0 0 0 }
{ 0 -1 -2 -2 -3 -1 1 -5 -2 4 0 8 2 6 0 0 0 0 0 0 } ifelse
ll {
0 { 0 0 -4 -6 3 -6 16 16 }
1 { 0 0 0 0 3 -12 16 16 }
2 { 0 0 0 0 0 -12 16 16 }
3 { 0 0 -4 -4 3 -4 16 16 }
4 { 0 0 0 0 8 0 16 16 }
} case
true 9 1 roll D-print
rot { -180 rotate x 32 add neg y 64 add neg translate} {x neg y neg translate } ifelse
end
} def
/printalpha {
/y exch def
/x exch def
{
0 { 0 0 2 0 false }
1 { -1 -1 3 0 false }
2 { 0 -1 3 0 false }
3 { 0 -1 1 1 true }
4 { 0 0 1 1 false }
5 { 0 -1 1 1 false }
6 { -1 0 1 1 true }
7 { 0 0 2 2 false }
8 { 0 0 4 2 false }
9 { 1 1 4 2 false }
10 { 1 1 2 4 false }
11 { 1 2 3 0 false }
12 { 0 0 3 0 false }
13 { 2 0 3 0 false }
14 { 0 0 3 2 false }
15 { -1 -1 4 2 false }
16 { -1 -1 2 4 false }
17 { 0 0 2 4 false }
18 { 1 1 3 0 false }
19 { 0 0 1 1 true }
20 { -1 1 3 0 false }
21 { 1 -1 3 0 false }
22 { 1 1 1 1 false }
23 { 2 0 1 1 false }
24 { -1 0 3 0 false }
25 { -1 0 1 1 false }
} case
x y printlimb
} def
0 0 0 setrgbcolor
1 setlinecap
1 setlinejoin
0.5 setlinewidth
1 1 scale
/x 0 def
/y 256 def
("abcdefghijklmn\nopqrstuvwxyz") dup length 1 exch 1 sub getinterval {
dup {
10 {pop /y y 64 sub store /x -32 store }
32 {pop}
64 {pop /x x 32 sub store}
/else {
dup dup 96 gt exch 123 lt and
{97 sub x y printalpha} {pop}ifelse
}
} case
/x x 32 add store
} forall
)(}, b=q{
import std.stdio;
import std.string;
void main(string[] args){
if(args.length>1) a=replace(a, c, `"`~args[1]~'"'),c=`"`~args[1]~`"`;
writefln("/+{}def");
writefln("(+/ string a=q{%s}, b=q{%s}, c=`%s`;",a,b,c);
writefln("%s/+)(/+{}def)(dup 5 index cvx exec == = +/)",b);
writefln("dup 5 index cvx exec == = +/");
}
}, c=`"abcdefghijklmn\nopqrstuvwxyz"`;
import std.stdio;
import std.string;
void main(string[] args){
if(args.length>1) a=replace(a, c, `"`~args[1]~'"'),c=`"`~args[1]~`"`;
writefln("/+{}def");
writefln("(+/ string a=q{%s}, b=q{%s}, c=`%s`;",a,b,c);
writefln("%s/+)(/+{}def)(dup 5 index cvx exec == = +/)",b);
writefln("dup 5 index cvx exec == = +/");
}
/+)(/+{}def)(dup 5 index cvx exec == = +/)
dup 5 index cvx exec == = +/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment