/usr/share/perl5/Tk/Pod/Styles.pm is in libtk-pod-perl 0.9942-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | require 5;
use strict;
package Tk::Pod::Styles;
use vars qw($VERSION);
$VERSION = '5.06';
sub init_styles {
my $w = shift;
if (!defined $w->{'style'}{'base_font_size'}) {
$w->set_base_font_size($w->standard_font_size);
}
}
sub standard_font_size {
my $w = shift;
my $std_font = $w->optionGet('font', 'Font');
my $std_font_size;
if (!defined $std_font || $std_font eq '') {
my $l = $w->Label;
$std_font = $l->cget(-font);
$std_font_size = $l->fontActual($std_font, '-size');
$l->destroy;
} else {
$std_font_size = $w->fontActual($std_font, '-size');
}
$std_font_size;
}
sub adjust_font_size {
my($w, $new_size) = @_;
my $delta = $new_size - $w->base_font_size;
$w->set_base_font_size($new_size);
for my $tag ($w->tagNames) {
my $fontsize = $w->{'style_fontsize'}{$tag};
my $f = $w->tagCget($tag, '-font');
if ($f) {
my %f = $w->fontActual($f);
if (!defined $fontsize) {
$fontsize = $f{-size};
}
$fontsize += $delta;
$w->{'style_fontsize'}{$tag} = $fontsize;
$f{-size} = $fontsize;
my $new_f = $w->fontCreate(%f);
$w->tagConfigure($tag, -font => $new_f);
}
}
}
sub set_base_font_size { $_[0]{'style'}{'base_font_size'} = $_[1] }
sub base_font_size { return $_[0]{'style'}{'base_font_size'} ||= 10 }
sub font_sans_serif {
my $w = shift;
$w->optionGet("sansSerifFont", "SansSerifFont") || "helvetica";
}
sub font_serif {
my $w = shift;
$w->optionGet("serifFont", "SerifFont") || "times";
}
sub font_monospace {
my $w = shift;
$w->optionGet("monospaceFont", "MonospaceFont") || "courier";
}
sub style_over_bullet {
$_[0]->{'style'}{'over_bullet'} ||=
[ 'indent' => $_[1]->attr('indent') || 4, @{ $_[0]->style_Para } ]
}
sub style_over_number {
$_[0]->{'style'}{'over_number'} ||=
[ 'indent' => $_[1]->attr('indent') || 4, @{ $_[0]->style_Para } ]
}
sub style_over_text {
$_[0]->{'style'}{'over_text'} ||=
[ 'indent' => $_[1]->attr('indent') || 4, @{ $_[0]->style_Para } ]
}
sub style_item_text {
$_[0]->{'style'}{'item_text'} ||=
[ 'indent' => -1, @{ $_[0]->style_Para } ] # for back-denting
}
sub style_item_bullet {
$_[0]->{'style'}{'item_bullet'} ||=
[ 'indent' => -1, @{ $_[0]->style_Para } ] # for back-denting
}
sub style_item_number {
$_[0]->{'style'}{'item_number'} ||=
[ 'indent' => -1, @{ $_[0]->style_Para } ] # for back-denting
}
sub style_Para {
$_[0]->{'style'}{'Para'} ||=
[ 'family' => $_[0]->font_serif,
'size' => $_[0]->base_font_size,
]
}
sub style_Verbatim {
$_[0]->{'style'}{'Verbatim'} ||=
[ 'family' => $_[0]->font_monospace,
'size' => $_[0]->base_font_size,
'wrap' => 'none',
# background => '#cccccc',
# borderwidth => 1,
# relief => "solid",
# lmargin1 => 10,
# rmargin => 10,
]
}
sub style_head1 {
$_[0]->{'style'}{'head1'} ||=
[ 'family' => $_[0]->font_sans_serif,
'size' => int(1 + 1.75 * $_[0]->base_font_size),
'underline' => 'true',
]
}
sub style_head2 {
$_[0]->{'style'}{'head2'} ||=
[ 'family' => $_[0]->font_sans_serif,
'size' => int(1 + 1.50 * $_[0]->base_font_size),
'underline' => 'true',
]
}
sub style_head3 {
$_[0]->{'style'}{'head3'} ||=
[ 'family' => $_[0]->font_sans_serif,
'size' => int(1 + 1.25 * $_[0]->base_font_size),
'underline' => 'true',
]
}
sub style_head4 {
$_[0]->{'style'}{'head4'} ||=
[ 'family' => $_[0]->font_sans_serif,
'size' => int(1 + 1.10 * $_[0]->base_font_size),
'underline' => 'true',
]
}
# ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
sub style_C {
$_[0]->{'style'}{'C'} ||= [ 'family' => $_[0]->font_monospace, ] }
sub style_B {
$_[0]->{'style'}{'B'} ||= [ 'weight' => 'bold', ] }
sub style_I {
$_[0]->{'style'}{'I'} ||= [ 'slant' => 'italic' , ] }
sub style_F {
$_[0]->{'style'}{'F'} ||= [ 'slant' => 'italic' , ] }
#sub style_S {
# $_[0]->{'style'}{'C'} ||= [ 'wrap' => 'none' ] }
# ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
1;
__END__
### Local Variables:
### cperl-indent-level: 2
### End:
|