30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
+
|
delegate method * to pdf
delegate option -margin to pdf
delegate option -paper to pdf
option -cpl -default 80
option -cpln -default 5
option -lnsp -default 1.0
option -headsize -default 8
option -headleft -default "Header Text Left"
option -headright -default "Header Text Right"
option -headnpages -default 10
option -file -default exp.pdf
variable width
|
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
-
+
|
# Figure out font size from number of chars per line
set charwidthHead [$pdf getCharWidth "0"]
set charwidth [expr {$width / 2.0 / ($options(-cpl) + $options(-cpln) + 1)}]
set fontsize [expr {$options(-headsize) * $charwidth / $charwidthHead}]
$pdf setFont $fontsize
# Text metrics
set linesize [$pdf getFontMetric height] ;# $fontsize
set linesize [expr {[$pdf getFontMetric height] * $options(-lnsp)}]
set spacing [expr {$linesize / $fontsize}]
$pdf setLineSpacing $spacing
set offset [expr {$fontsize + [$pdf getFontMetric bboxy]}]
set charwidth [$pdf getCharWidth "0"]
set nlinesf [expr {($height - $options(-headsize)) / $linesize}]
# Number of lines per page
set nlines [expr {int($nlinesf - 1.0)}]
|