| 1 |
#!/usr/bin/env perl |
| 2 |
# |
| 3 |
# |
| 4 |
=pod |
| 5 |
|
| 6 |
=head1 NAME |
| 7 |
|
| 8 |
bookshelf-mkfontsel - a script to populate C<fontsel> directory and create C<pickfont.tex> file for I<bookshelf> package |
| 9 |
|
| 10 |
=head1 SYNOPSIS |
| 11 |
|
| 12 |
bookshelf-mkfontsel FONTFILE |
| 13 |
|
| 14 |
=head1 DESCRIPTION |
| 15 |
|
| 16 |
Create and populate fontsel directory from the file |
| 17 |
produced by L<listallfonts.pl(1)> script, and create |
| 18 |
C<pickfont.tex> file. Used by |
| 19 |
I<bookshelf> package. |
| 20 |
|
| 21 |
=head1 OPTIONS |
| 22 |
|
| 23 |
=over 4 |
| 24 |
|
| 25 |
=item B<-v> |
| 26 |
|
| 27 |
Print version information |
| 28 |
|
| 29 |
=item B<-h> |
| 30 |
|
| 31 |
Print usage information |
| 32 |
|
| 33 |
=item B<-m> |
| 34 |
|
| 35 |
Print manual page |
| 36 |
|
| 37 |
=back |
| 38 |
|
| 39 |
=head1 AUTHOR |
| 40 |
|
| 41 |
Boris Veytsman, 2024 |
| 42 |
|
| 43 |
=head1 LICENSE |
| 44 |
|
| 45 |
LPPL 1.3c |
| 46 |
|
| 47 |
=cut |
| 48 |
|
| 49 |
|
| 50 |
use strict; |
| 51 |
use Getopt::Long; |
| 52 |
use Pod::Usage; |
| 53 |
use open qw( :std :encoding(UTF-8) ); |
| 54 |
my $VERSION = "1.0"; |
| 55 |
|
| 56 |
my $help=0; |
| 57 |
my $man=0; |
| 58 |
my $vrs=0; |
| 59 |
|
| 60 |
GetOptions( |
| 61 |
"help|?" => \$help, |
| 62 |
"man" => \$man, |
| 63 |
"version" => \$vrs |
| 64 |
) or pod2usage(2); |
| 65 |
|
| 66 |
pod2usage(1) if $help; |
| 67 |
pod2usage(-exitval => 0, -verbose=>2) if $man; |
| 68 |
die ("$0, version $VERSION, License: LPPL 1.3c\n") if $vrs; |
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
`mkdir -p fontsel`; |
| 74 |
my $i=1; |
| 75 |
while(<>) { |
| 76 |
chomp; |
| 77 |
if (/^.*#/) { |
| 78 |
next; |
| 79 |
} |
| 80 |
my ($name, $command) = split /\t/; |
| 81 |
open(RES, ">fontsel/$i.tex"); |
| 82 |
print RES "\\font\\SILmfont={$command}\\SILmfont\n"; |
| 83 |
print RES "\\def\\SILmfontname{$name}%\n"; |
| 84 |
close RES; |
| 85 |
$i++; |
| 86 |
} |
| 87 |
$i--; |
| 88 |
open(RES, ">pickfont.tex"); |
| 89 |
print RES "\\setcounter{SIL\@maxfont}{$i}\n"; |
| 90 |
close RES; |
| 91 |
|
| 92 |
|