Skip to content

Instantly share code, notes, and snippets.

@hrpunio hrpunio/fd_gen.pl
Created Oct 26, 2011

Embed
What would you like to do?
#!/usr/bin/perl
# Generuje plik .fd dla maksymalnie o¶miu odmian kroju
# Por.
use Getopt::Long;
my $debug = 0;
GetOptions(
"encoding=s" => \$encoding,
"family=s" => \$family,
"regular=s" => \$Regular,
"italic=s" => \$Italic,
"sc" => \$Sc,
"bold=s" => \$Bold,
"boldit=s" => \$BoldIt,
"boldsc" => \$BoldSc,
"semibold=s" => \$SemiBold,
"semiboldit=s" => \$SemiBoldIt,
"semiboldsc" => \$SemiBoldSc,
"exbold=s" => \$BoldEx,
"exboldit=s" => \$BolExdIt,
"exboldsc" => \$BolExdSc,
);
if ($debug) {
warn "** Parametry do generowania pliku .fd: encoding = $encoding, family = $family **\n" .
"** regular = $Regular, italic = $Italic, sc = $Sc **\n" .
"** bold= $Bold, boldit = $BoldIt, boldsc = $BoldSc **\n" .
"** semibold = $SemiBold, semiboldit = $SemiBoldIt, semiboldsc = $SemiBoldSc **\n" .
"** exbold = $BoldEx, exboldit = $BolExdIt, exboldsc = $BolExdSc.\n";
}
# -----------------------------------------------
my $plik = lc("$encoding$family"); ;
my $Encoding = uc($encoding);
print "% Plik $plik.fd wygenerowany :: http://gnu.univ.gda.pl/~tomasz/prog/scripts/tex/fd_gen.pl\n";
print "\\DeclareFontFamily{$Encoding}{$family}{}\n";
if ($Regular) {
print "\\DeclareFontShape{$Encoding}{$family}{m}{n}{ <-> $Regular--$encoding }{}\n";
if ($Sc) {# Wariant small-caps
print "\\DeclareFontShape{$Encoding}{$family}{m}{sc}{ <-> $Regular--$encoding--fsmcp }{}\n";
}
}
if ($Italic) {
print "\\DeclareFontShape{$Encoding}{$family}{m}{it}{ <-> $Italic--$encoding }{}\n";
}
if ($SemiBold) {
print "\\DeclareFontShape{$Encoding}{$family}{sb}{n}{ <-> $Semibold--$encoding }{}\n";
if ($SemiBoldSc) {#
print "\\DeclareFontShape{$Encoding}{$family}{sb}{sc}{ <-> $Semibold--$encoding--fsmcp }{}\n";
}
}
if ($SemiBoldIt) {
print "\\DeclareFontShape{$Encoding}{$family}{sb}{it}{ <-> $SemiboldIt--$encoding }{}\n";
}
if ($Bold) {
print "\\DeclareFontShape{$Encoding}{$family}{b}{n}{ <-> $Bold--$encoding }{}\n";
if ($BoldSc) { print "\\DeclareFontShape{$Encoding}{$family}{b}{sc}{ <-> $Bold--$encoding--fsmcp }{}\n"; }
}
if ($BoldIt) {
print "\\DeclareFontShape{$Encoding}{$family}{b}{it}{ <-> $BoldIt--$encoding }{}\n";
}
if ($BolEx) {
print "\\DeclareFontShape{$Encoding}{$family}{b}{n}{ <-> $BoldEx--$encoding }{}\n";
if ($BoldExSc) { print "\\DeclareFontShape{$Encoding}{$family}{b}{sc}{ <-> $BoldEx--$encoding--fsmcp }{}\n"; }
}
## Nie ma odmiany extended:
else {
print "\\DeclareFontShape{$Encoding}{$family}{bx}{n}{ <-> ssub * $family/b/n }{}\n";
if ($BolSc) { print "\\DeclareFontShape{$Encoding}{$family}{bx}{sc}{ <-> ssub * $family/b/sc }{}\n"; }
}
if ($BolExdIt) {
print "\\DeclareFontShape{$Encoding}{$family}{bx}{it}{ <-> $BoldExIt--$encoding }{}\n";
} # Nie ma odmiany extended-italic:
else {
print "\\DeclareFontShape{$Encoding}{$family}{bx}{it}{ <-> ssub * $family/b/it }{}\n";
}
##
##
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.