64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
}
method StartPrint {} {
# Page size
lassign [$pdf getDrawableArea] width height
# Header metrics
$pdf setFont $options(-headsize) EskilFont
set headoffset [expr {$options(-headsize) + [$pdf getFontMetric bboxy]}]
set hoy $headoffset
# 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}]
|
|
|
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
}
method StartPrint {} {
# Page size
lassign [$pdf getDrawableArea] width height
# Header metrics
$pdf setFont $options(-headsize) $::eskil(printFont)
set headoffset [expr {$options(-headsize) + [$pdf getFontMetric bboxy]}]
set hoy $headoffset
# 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}]
|
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
$pdf rectangle 0 $options(-headsize) \
$width [- $height $options(-headsize)]
# Center line
$pdf line [/ $width 2.0] $options(-headsize) \
[/ $width 2.0] $height
# Header
$pdf setFont $options(-headsize) EskilFont
$pdf text $options(-headleft) -x 0 -y $hoy
$pdf text "Page $page of $options(-headnpages)" \
-x [expr {$width / 2.0}] -y $hoy -align center
$pdf text $options(-headright) -x $width -y $hoy -align right
# Normal font
$pdf setFont $fontsize EskilFont
}
method setHalf {half} {
if {$half eq "left"} {
$pdf setTextPosition $ox1 $oy
} else {
$pdf setTextPosition $ox2 $oy
|
|
|
|
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
$pdf rectangle 0 $options(-headsize) \
$width [- $height $options(-headsize)]
# Center line
$pdf line [/ $width 2.0] $options(-headsize) \
[/ $width 2.0] $height
# Header
$pdf setFont $options(-headsize) $::eskil(printFont)
$pdf text $options(-headleft) -x 0 -y $hoy
$pdf text "Page $page of $options(-headnpages)" \
-x [expr {$width / 2.0}] -y $hoy -align center
$pdf text $options(-headright) -x $width -y $hoy -align right
# Normal font
$pdf setFont $fontsize $::eskil(printFont)
}
method setHalf {half} {
if {$half eq "left"} {
$pdf setTextPosition $ox1 $oy
} else {
$pdf setTextPosition $ox2 $oy
|