Created
April 27, 2019 11:56
-
-
Save dehmer/c38ae6e537b8b30f7797497196a6970d to your computer and use it in GitHub Desktop.
Configurable PostScript grid for writing Kanji
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%!PS | |
/ppi 72 def | |
/inch {ppi mul} def | |
/a 0.72 inch def %% edge length (1 inch) | |
/offset 5 def | |
%% A5 - 420 x 595 | |
/columns 420 offset sub a div cvi def | |
/rows 595 offset sub a div cvi def | |
%% A4 - 595 x 842 | |
/box { | |
moveto | |
%% store current point (x/y) for later use: | |
currentpoint /y exch def /x exch def | |
[] 0 setdash | |
1 setlinewidth | |
0 setgray | |
a 0 rlineto | |
0 a rlineto | |
a neg 0 rlineto | |
closepath | |
stroke | |
[5 1] 0 setdash | |
0.2 setlinewidth | |
%% diagonals: | |
x y moveto a a rlineto | |
x y a add moveto a a neg rlineto | |
%% horizontal/vertical: | |
/xd x a 2 div add def | |
/yd y a 2 div add def | |
x yd moveto a 0 rlineto | |
xd y moveto 0 a rlineto | |
stroke | |
} def | |
/row { | |
/y exch def | |
0 1 columns 1 sub { | |
a mul offset add y box | |
} for | |
} def | |
/grid { | |
0 1 rows 1 sub { | |
a mul offset add row | |
} for | |
} def | |
grid showpage |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment