aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2019-06-16 11:48:53 +0200
committerElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2019-06-16 11:48:53 +0200
commitaaa5e07435fb161255f053182aba1ca97cd5ff3f (patch)
tree6bc04a8fd5f586c61b024497be61e6da4c65cc0d
parent1861a9afed1e113482f9cb9eb342e715d1ec2f4a (diff)
ruled paper: print vertical lines
-rw-r--r--src/ruled-paper.ps.j252
1 files changed, 50 insertions, 2 deletions
diff --git a/src/ruled-paper.ps.j2 b/src/ruled-paper.ps.j2
index e13cad3..8e20934 100644
--- a/src/ruled-paper.ps.j2
+++ b/src/ruled-paper.ps.j2
@@ -57,12 +57,23 @@
/PageWidth {{ page_width }} def
/PageHeight {{ page_height }} def
+{% if hor_distances %}
% Horizontal lines
/HorLinPat {{ hor_distances | length }} array def
{% for d in hor_distances %}
HorLinPat {{ loop.revindex0 }} {{ d }} put
{% endfor %}
/HorLinSpac {{ hor_spacing }} def % spacing between groups
+{% endif %}
+
+{% if ver_distances %}
+% Vertical lines
+/VerLinPat {{ ver_distances | length }} array def
+{% for d in ver_distances %}
+ VerLinPat {{ loop.revindex0 }} {{ d }} put
+{% endfor %}
+/VerLinSpac {{ ver_spacing }} def % spacing between groups
+{% endif %}
% line width and color for thin lines
/LineSizeThin {{ thin_line_size }} def
@@ -90,8 +101,15 @@
% From here on you shouldn't worry about changing or configuring anything
% ------ Variables ------------------------------------------------------------
+{% if hor_distances %}
/HorGrouHeig 0 HorLinPat { add } forall def
/HorGrouNumb PageHeight BorderBottom sub BorderTop sub HorGrouHeig HorLinSpac add div def
+{% endif %}
+
+{% if ver_distances %}
+/VerGrouHeig 0 VerLinPat { add } forall def
+/VerGrouNumb PageHeight BorderBottom sub BorderTop sub VerGrouHeig VerLinSpac add div def
+{% endif %}
% ------ Procedures -----------------------------------------------------------
@@ -105,6 +123,7 @@
closepath
} def
+{% if hor_distances %}
/PrintHorGroup { % stk: y
gsave
0 exch translate
@@ -117,11 +136,32 @@
dup BorderLeft exch moveto
dup PageWidth BorderRight sub exch lineto
} forall
- LineSizeThin setlinewidth
+ LineSizeThin setlinewidth
+ LineColoThin setrgbcolor
+ stroke
+ grestore
+} def
+{% endif %}
+
+{% if ver_distances %}
+/PrintVerGroup { % stk: x
+ gsave
+ 0 translate
+ newpath
+ 0 BorderRight moveto
+ 0 PageHeight BorderTop sub lineto
+ 0
+ VerLinPat { % forall
+ add
+ dup BorderBottom moveto
+ dup PageHeight BorderTop sub lineto
+ } forall
+ LineSizeThin setlinewidth
LineColoThin setrgbcolor
stroke
grestore
} def
+{% endif %}
%%EndProlog
%%Page: 1
@@ -133,11 +173,19 @@ UsedArea clip
BackColo setrgbcolor
UsedArea fill
+{% if hor_distances %}
% print horizontal lines
-
0 1 HorGrouNumb { % for
HorGrouHeig HorLinSpac add mul BorderBottom add PrintHorGroup
} for
+{% endif %}
+
+{% if ver_distances %}
+% print vertical lines
+0 1 VerGrouNumb { % for
+ VerGrouHeig VerLinSpac add mul BorderBottom add PrintVerGroup
+} for
+{% endif %}
% print border (if WillPrintBorder is not 0 )
WillPrintBorder 0 ne {