| 1 |
#! /usr/bin/env perl |
| 2 |
|
| 3 |
=begin COPYRIGHT |
| 4 |
|
| 5 |
---------------------------------------------------------------------------- |
| 6 |
|
| 7 |
Copyright (C) 2005-2026 Marc Penninga. |
| 8 |
|
| 9 |
This program is free software; you can redistribute it and/or |
| 10 |
modify it under the terms of the GNU General Public License |
| 11 |
as published by the Free Software Foundation, either version 2 |
| 12 |
of the License, or (at your option) any later version. |
| 13 |
|
| 14 |
This program is distributed in the hope that it will be useful, |
| 15 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 |
GNU General Public License for more details. |
| 18 |
|
| 19 |
You should have received a copy of the GNU General Public License |
| 20 |
along with this program; if not, write to |
| 21 |
Free Software Foundation, Inc., |
| 22 |
59 Temple Place, |
| 23 |
Suite 330, |
| 24 |
Boston, MA 02111-1307, |
| 25 |
USA |
| 26 |
|
| 27 |
---------------------------------------------------------------------------- |
| 28 |
|
| 29 |
=end COPYRIGHT |
| 30 |
|
| 31 |
=cut |
| 32 |
|
| 33 |
use strict; |
| 34 |
use warnings; |
| 35 |
|
| 36 |
use Cwd (); |
| 37 |
use File::Basename (); |
| 38 |
use File::Path (); |
| 39 |
use File::Spec (); |
| 40 |
use Getopt::Long (); |
| 41 |
use Pod::Usage (); |
| 42 |
use POSIX (); |
| 43 |
|
| 44 |
my $VERSION = '20260210'; |
| 45 |
|
| 46 |
my ($d, $m, $y) = (localtime time)[3 .. 5]; |
| 47 |
my $TODAY = sprintf "%04d/%02d/%02d", $y + 1900, $m + 1, $d; |
| 48 |
|
| 49 |
my $RUNNING_AS_MAIN = (__PACKAGE__ eq 'main'); |
| 50 |
|
| 51 |
|
| 52 |
=begin Comment |
| 53 |
|
| 54 |
---------------------------------------------------------------------------- |
| 55 |
|
| 56 |
Autoinst consists of a number of parts: |
| 57 |
|
| 58 |
main Contains just the main() routine. |
| 59 |
|
| 60 |
Options Parses the command-line options. |
| 61 |
Note that the *processing* of the user's choices |
| 62 |
is mostly taken care of by the `Tables` package, |
| 63 |
since this processing involves adapting those tables. |
| 64 |
|
| 65 |
Log Logs the font parsing and creation process. |
| 66 |
|
| 67 |
Attr Contains tables and routines that represent |
| 68 |
font attributes (weight, width, shape). |
| 69 |
|
| 70 |
Font Parses an OpenType font's metadata. |
| 71 |
|
| 72 |
Tables Contains tables that drive the font creation process |
| 73 |
(especially the decisions which fonts to create). |
| 74 |
|
| 75 |
Work Generates all font files, driven by data from `Tables`. |
| 76 |
|
| 77 |
LaTeX Creates LaTeX support (.sty and .fd files). |
| 78 |
|
| 79 |
Otftotfm Drives `otftotfm` to actually generate the fonts. |
| 80 |
|
| 81 |
Util Some miscellaneous utility functions. |
| 82 |
|
| 83 |
---------------------------------------------------------------------------- |
| 84 |
|
| 85 |
=end Comment |
| 86 |
|
| 87 |
=cut |
| 88 |
|
| 89 |
|
| 90 |
sub main { |
| 91 |
print "autoinst, version $VERSION\n"; |
| 92 |
|
| 93 |
Options::parse_options(); |
| 94 |
Tables::process_options(); |
| 95 |
|
| 96 |
my %fontfamily; |
| 97 |
for my $fontfile (@ARGV) { |
| 98 |
my $font = Font::parse($fontfile); |
| 99 |
my $family = $font->{family}; |
| 100 |
push @{$fontfamily{$family}}, $font; |
| 101 |
} |
| 102 |
|
| 103 |
while (my ($family, $fontlist) = each %fontfamily) { |
| 104 |
|
| 105 |
local %ARGV = %ARGV; |
| 106 |
Tables::process_family_dependent_options($fontlist); |
| 107 |
|
| 108 |
my $log = Log->new($ARGV{logfile}); |
| 109 |
$log->log_options(); |
| 110 |
$log->log_parsing($fontlist); |
| 111 |
|
| 112 |
# We defer asserting that all fonts were parsed in a unique way |
| 113 |
# until after the results of the parsing have been logged. |
| 114 |
Font::assert_unique($log, $fontlist); |
| 115 |
|
| 116 |
my $mappings = Attr::map_nfss_codes($fontlist); |
| 117 |
my ($from_nfss, $to_nfss) = @{$mappings}; |
| 118 |
$log->log_nfss_mapping($from_nfss); |
| 119 |
|
| 120 |
my @workitems = Work::generate_worklist($fontlist); |
| 121 |
$log->log_worklist(\@workitems); |
| 122 |
|
| 123 |
my $targetdirs = Otftotfm::get_targetdirs($family, $fontlist); |
| 124 |
my @commands = map { Otftotfm::create_command($_, $targetdirs) } |
| 125 |
@workitems; |
| 126 |
$log->log_commands(\@commands) if $ARGV{verbose} >= 1; |
| 127 |
|
| 128 |
if (!$ARGV{dryrun}) { |
| 129 |
LaTeX::create_support_files(\@workitems, $family, $to_nfss); |
| 130 |
Otftotfm::run_commands(\@commands, $family, $log); |
| 131 |
|
| 132 |
if (!$ARGV{manual}) { |
| 133 |
if ($ARGV{t1suffix}) { |
| 134 |
Work::modify_fontnames($family, $fontlist); |
| 135 |
} |
| 136 |
|
| 137 |
print <<"END_MESSAGE_UPDMAP"; |
| 138 |
[INFO] Done generating fonts! |
| 139 |
Please update TeX's databases (by calling 'texhash' and 'updmap' |
| 140 |
or their equivalents on your system) before using these fonts. |
| 141 |
END_MESSAGE_UPDMAP |
| 142 |
} |
| 143 |
} |
| 144 |
|
| 145 |
$log->close(); |
| 146 |
} |
| 147 |
|
| 148 |
return; |
| 149 |
} |
| 150 |
|
| 151 |
|
| 152 |
############################################################################ |
| 153 |
|
| 154 |
|
| 155 |
package Attr; |
| 156 |
|
| 157 |
=begin Comment |
| 158 |
|
| 159 |
Some fontnames contain abbreviated words for width, weight and/or shape; |
| 160 |
we unabbreviate these using the following table. |
| 161 |
|
| 162 |
=end Comment |
| 163 |
|
| 164 |
=cut |
| 165 |
|
| 166 |
my %FULL_FORM = ( |
| 167 |
cmp => 'compressed', |
| 168 |
comp => 'compressed', |
| 169 |
cond => 'condensed', |
| 170 |
demi => 'demibold', |
| 171 |
extcond => 'extracondensed', |
| 172 |
hair => 'hairline', |
| 173 |
incline => 'inclined', |
| 174 |
it => 'italic', |
| 175 |
ita => 'italic', |
| 176 |
md => 'medium', |
| 177 |
slant => 'slanted', |
| 178 |
smbold => 'semibold', |
| 179 |
smcond => 'semicondensed', |
| 180 |
smexp => 'semiexpanded', |
| 181 |
ultra => 'ultrablack', |
| 182 |
); |
| 183 |
|
| 184 |
# Auxiliary table that reverses FULL_FORM; maps full forms to abbrevs. |
| 185 |
my %abbrev; |
| 186 |
while (my ($k, $v) = each %FULL_FORM) { |
| 187 |
push @{$abbrev{$v}}, $k; |
| 188 |
} |
| 189 |
|
| 190 |
# Add full forms as known abbreviations of themselves. |
| 191 |
for my $full (keys %abbrev) { |
| 192 |
push @{$abbrev{$full}}, $full; |
| 193 |
} |
| 194 |
|
| 195 |
# Internal helper: returns a list of known abbreviations of its argument. |
| 196 |
sub _get_abbreviated_forms { |
| 197 |
my $key = shift; |
| 198 |
|
| 199 |
return @{ $abbrev{$key} // [$key] }; |
| 200 |
} |
| 201 |
|
| 202 |
|
| 203 |
=begin Comment |
| 204 |
|
| 205 |
LaTeX's NFSS contains a number of standard codes for weight and width: |
| 206 |
- weight: ul, el, l, sl, m, sb, b, eb, ub |
| 207 |
- width: uc, ec, c, sc, m, sx, x, ex, ux |
| 208 |
|
| 209 |
These codes are not always a perfect match with the weights and widths |
| 210 |
present in a font family; some families (especially many sans serif ones) |
| 211 |
contain more or different weights and widths, and the naming of those |
| 212 |
weights and widths isn't always consistent between font families. |
| 213 |
To handle this situation, we use a two-tiered approach: |
| 214 |
1. We install all fonts using a "series" name that is the concatenation |
| 215 |
of whatever the font designer has chosen to call the weight and width |
| 216 |
(but in all *lower*case). |
| 217 |
2. We add "alias" rules to the .fd files that map the standard NFSS codes |
| 218 |
to actual fonts. |
| 219 |
|
| 220 |
In step 1, we follow NFSS in leaving out any occurrence of |
| 221 |
the word "regular" unless *both* weight and width are Regular; |
| 222 |
in that case, the 'series' attribute becomes "regular". |
| 223 |
|
| 224 |
The two tables WEIGHT and WIDTH are used to control step 2. |
| 225 |
It contains several entries of the form |
| 226 |
|
| 227 |
sc => [ qw( semicondensed narrow ) ], |
| 228 |
|
| 229 |
This should be read as follows: the NFSS code "sc" is mapped to |
| 230 |
the *first* width on the right hand side present in the current family. |
| 231 |
|
| 232 |
Please note that the tables contain empty keys instead of "m" for the |
| 233 |
regular weight and width. NFSS actually combines weight and width into |
| 234 |
a single "series" attribute; a weight or width of "m" is left out of |
| 235 |
this combination (unless *both* weight and width are equal to "m"; then |
| 236 |
the series becomes "m", but that's a special case we deal with later on). |
| 237 |
|
| 238 |
In addition to the mapping of NFSS codes, the two mentioned tables are |
| 239 |
also used in parsing the font's metadata to determine its weight and |
| 240 |
width: any string that occurs on the right hand side is considered a |
| 241 |
possible name to be searched for. |
| 242 |
|
| 243 |
These tables can be extended to teach autoinst about new weights or |
| 244 |
widths. Suppose your font family contains a "Hemibold" weight, that |
| 245 |
you want mapped to the "sb" code. Then add the name "hemibold" to |
| 246 |
the right hand side of the "sb" entry in the WEIGHT table: |
| 247 |
|
| 248 |
sb => [ qw( semibold demibold medium hemibold ) ], |
| 249 |
|
| 250 |
In this case, since it's in last position, it's only mapped to "sb" |
| 251 |
if none of the other fonts are present. Put it earlier in the list |
| 252 |
to give it higher priority. |
| 253 |
|
| 254 |
Note that autoinst converts all metadata to lowercase to avoid |
| 255 |
inconsistent capitalization; so all entries in these tables should |
| 256 |
be *lowercase* as well. |
| 257 |
|
| 258 |
Technical notes: |
| 259 |
- We define WEIGHT and WIDTH first as arrays |
| 260 |
and then as hashtables; this allows us to use the array-variants |
| 261 |
as an *ordered* (by weight/width) list of values (in the routines |
| 262 |
get_all_nfss_weights and get_all_nfss_widths). |
| 263 |
|
| 264 |
=end Comment |
| 265 |
|
| 266 |
=cut |
| 267 |
|
| 268 |
my @WEIGHT = ( |
| 269 |
ul => [ qw( ultralight thin 100 hairline ) ], |
| 270 |
el => [ qw( extralight 200 ) ], |
| 271 |
l => [ qw( light 300 ) ], |
| 272 |
sl => [ qw( semilight blond ) ], |
| 273 |
'' => [ qw( regular normal text book 400 normallight normaldark plain ) ], |
| 274 |
sb => [ qw( semibold demibold 600 medium 500 ) ], |
| 275 |
b => [ qw( bold 700 ) ], |
| 276 |
eb => [ qw( extrabold 800 ) ], |
| 277 |
ub => [ qw( ultrabold black heavy extrablack ultrablack 900 fatface |
| 278 |
ultraheavy poster super 1000 ) ], |
| 279 |
); |
| 280 |
|
| 281 |
my @WIDTH = ( |
| 282 |
uc => [ qw( ultracondensed extracompressed ultracompressed ) ], |
| 283 |
ec => [ qw( extracondensed compressed compact ) ], |
| 284 |
c => [ qw( condensed ) ], |
| 285 |
sc => [ qw( semicondensed narrow ) ], |
| 286 |
'' => [ qw( regular ) ], |
| 287 |
sx => [ qw( semiextended semiexpanded wide ) ], |
| 288 |
x => [ qw( extended expanded ) ], |
| 289 |
ex => [], |
| 290 |
ux => [], |
| 291 |
); |
| 292 |
|
| 293 |
my %WEIGHT = @WEIGHT; |
| 294 |
@WEIGHT = grep { !ref } @WEIGHT; |
| 295 |
# Add abbreviated forms of weight names. |
| 296 |
for my $code (@WEIGHT) { |
| 297 |
$WEIGHT{$code} |
| 298 |
= [ map { _get_abbreviated_forms($_) } @{$WEIGHT{$code}} ]; |
| 299 |
} |
| 300 |
|
| 301 |
my @allweights = grep { $_ !~ m/ medium | regular | text /xms } |
| 302 |
map { @{$_} } values %WEIGHT; |
| 303 |
@allweights = ( |
| 304 |
Util::sort_desc_length(@allweights), |
| 305 |
qw(medium regular text) |
| 306 |
); |
| 307 |
|
| 308 |
|
| 309 |
my %WIDTH = @WIDTH; |
| 310 |
@WIDTH = grep { !ref } @WIDTH; |
| 311 |
# Add abbreviated forms. |
| 312 |
for my $code (@WIDTH) { |
| 313 |
$WIDTH{$code} |
| 314 |
= [ map { _get_abbreviated_forms($_) } @{$WIDTH{$code}} ]; |
| 315 |
} |
| 316 |
|
| 317 |
my @allwidths = grep { $_ ne 'regular' } map { @{$_} } values %WIDTH; |
| 318 |
@allwidths = Util::sort_desc_length(@allwidths); |
| 319 |
|
| 320 |
|
| 321 |
=begin Comment |
| 322 |
|
| 323 |
The next two tables, DEFAULT_WEIGHT and DEFAULT_WIDTH, map |
| 324 |
weight_class and width_class indicators (from a font's OS/2 table) |
| 325 |
to default weight and width names. We use these names as a last resort |
| 326 |
if font metadata parsing fails. |
| 327 |
|
| 328 |
The mapping from weight_class and width_class to weight or width names |
| 329 |
is taken from the OpenType specification (see 5.2.8.3 and 5.2.8.4). |
| 330 |
|
| 331 |
=end Comment |
| 332 |
|
| 333 |
=cut |
| 334 |
|
| 335 |
my %DEFAULT_WEIGHT = ( |
| 336 |
100 => 'thin', |
| 337 |
200 => 'extralight', |
| 338 |
300 => 'light', |
| 339 |
400 => 'regular', |
| 340 |
500 => 'medium', |
| 341 |
600 => 'semibold', |
| 342 |
700 => 'bold', |
| 343 |
800 => 'extrabold', |
| 344 |
900 => 'black', |
| 345 |
); |
| 346 |
|
| 347 |
sub get_default_weight { |
| 348 |
my $weight_class = shift; |
| 349 |
|
| 350 |
return $DEFAULT_WEIGHT{$weight_class}; |
| 351 |
} |
| 352 |
|
| 353 |
my %DEFAULT_WIDTH = ( |
| 354 |
1 => 'ultracondensed', |
| 355 |
2 => 'extracondensed', |
| 356 |
3 => 'condensed', |
| 357 |
4 => 'semicondensed', |
| 358 |
5 => 'regular', |
| 359 |
6 => 'semiexpanded', |
| 360 |
7 => 'expanded', |
| 361 |
8 => 'extraexpanded', |
| 362 |
9 => 'ultraexpanded', |
| 363 |
); |
| 364 |
|
| 365 |
sub get_default_width { |
| 366 |
my $width_class = shift; |
| 367 |
|
| 368 |
return $DEFAULT_WIDTH{$width_class}; |
| 369 |
} |
| 370 |
|
| 371 |
|
| 372 |
=begin Comment |
| 373 |
|
| 374 |
The SHAPE table maps various shape names to NFSS codes. |
| 375 |
|
| 376 |
Like in the other * tables, entries may be added to teach autoinst |
| 377 |
about new shapes. Note that this table is "the other way around" |
| 378 |
compared to WEIGHT and WIDTH; those map NFSS codes to names, |
| 379 |
this one maps names to NFSS codes. That's because the data from |
| 380 |
this table is used in a slightly different way; notably, it isn't |
| 381 |
used in the map_nfss_codes routine. |
| 382 |
|
| 383 |
=end Comment |
| 384 |
|
| 385 |
=cut |
| 386 |
|
| 387 |
my %SHAPE = ( |
| 388 |
roman => 'n', |
| 389 |
upright => 'n', |
| 390 |
italic => 'it', |
| 391 |
inclined => 'sl', |
| 392 |
oblique => 'sl', |
| 393 |
slanted => 'sl', |
| 394 |
romani => 'n', # Silentium has two roman shapes, but no italic; |
| 395 |
romanii => 'it', # so we cheat by mapping the second roman to 'it' |
| 396 |
); |
| 397 |
|
| 398 |
# Add abbreviated forms. |
| 399 |
for my $full (keys %abbrev) { |
| 400 |
if (defined $SHAPE{$full}) { |
| 401 |
for my $abbrev (_get_abbreviated_forms($full)) { |
| 402 |
$SHAPE{$abbrev} = $SHAPE{$full}; |
| 403 |
} |
| 404 |
} |
| 405 |
} |
| 406 |
|
| 407 |
my @allshapes = Util::sort_desc_length(keys %SHAPE); |
| 408 |
|
| 409 |
|
| 410 |
# -------------------------------------------------------------------------- |
| 411 |
# Returns the unabbreviated form of its argument, |
| 412 |
# or its argument itself if no unabbreviated form is known. |
| 413 |
# -------------------------------------------------------------------------- |
| 414 |
sub unabbreviate { |
| 415 |
my $key = shift; |
| 416 |
|
| 417 |
return $FULL_FORM{$key} // $key; |
| 418 |
} |
| 419 |
|
| 420 |
|
| 421 |
# -------------------------------------------------------------------------- |
| 422 |
# Prepends weight names to the WEIGHT table for a given NFSS code. |
| 423 |
# -------------------------------------------------------------------------- |
| 424 |
sub set_weight { |
| 425 |
my ($key, @values) = @_; |
| 426 |
|
| 427 |
$WEIGHT{$key} = [ @values ]; |
| 428 |
return; |
| 429 |
} |
| 430 |
|
| 431 |
|
| 432 |
# -------------------------------------------------------------------------- |
| 433 |
# Returns a list of NFSS weight names, sorted by weight. |
| 434 |
# -------------------------------------------------------------------------- |
| 435 |
sub get_all_nfss_weights { |
| 436 |
return @WEIGHT; |
| 437 |
} |
| 438 |
|
| 439 |
|
| 440 |
# -------------------------------------------------------------------------- |
| 441 |
# Returns a list of all known weights, in an order suitable for searching. |
| 442 |
# -------------------------------------------------------------------------- |
| 443 |
sub get_all_weights { |
| 444 |
return @allweights; |
| 445 |
} |
| 446 |
|
| 447 |
|
| 448 |
# -------------------------------------------------------------------------- |
| 449 |
# Prepends weight names to the WIDTH table for a given NFSS code. |
| 450 |
# -------------------------------------------------------------------------- |
| 451 |
sub set_width { |
| 452 |
my ($key, @values) = @_; |
| 453 |
|
| 454 |
$WIDTH{$key} = [ @values ]; |
| 455 |
return; |
| 456 |
} |
| 457 |
|
| 458 |
|
| 459 |
# -------------------------------------------------------------------------- |
| 460 |
# Returns a list of NFSS width names, sorted by width. |
| 461 |
# -------------------------------------------------------------------------- |
| 462 |
sub get_all_nfss_widths { |
| 463 |
return @WIDTH; |
| 464 |
} |
| 465 |
|
| 466 |
|
| 467 |
# -------------------------------------------------------------------------- |
| 468 |
# Returns a list of all known widths, in an order suitable for searching. |
| 469 |
# -------------------------------------------------------------------------- |
| 470 |
sub get_all_widths { |
| 471 |
return @allwidths; |
| 472 |
} |
| 473 |
|
| 474 |
|
| 475 |
# -------------------------------------------------------------------------- |
| 476 |
# Returns the NFSS code for the given shape. |
| 477 |
# -------------------------------------------------------------------------- |
| 478 |
sub to_nfss { |
| 479 |
my $key = shift; |
| 480 |
|
| 481 |
return $SHAPE{$key}; |
| 482 |
} |
| 483 |
|
| 484 |
|
| 485 |
# -------------------------------------------------------------------------- |
| 486 |
# Returns a list of all known shapes, in an order suitable for searching. |
| 487 |
# -------------------------------------------------------------------------- |
| 488 |
sub get_all_shapes { |
| 489 |
return @allshapes; |
| 490 |
} |
| 491 |
|
| 492 |
|
| 493 |
# -------------------------------------------------------------------------- |
| 494 |
# Returns mappings of NFSS codes to weight and width, and vice versa. |
| 495 |
# -------------------------------------------------------------------------- |
| 496 |
sub map_nfss_codes { |
| 497 |
my $fontlist = shift; |
| 498 |
|
| 499 |
my (%weight, %width); |
| 500 |
for my $font (@{$fontlist}) { |
| 501 |
$weight{ $font->{weight} } //= $font->{weight_class}; |
| 502 |
$width{ $font->{width} } //= $font->{width_class}; |
| 503 |
} |
| 504 |
|
| 505 |
my $from_nfss = { |
| 506 |
weight => {}, |
| 507 |
width => {}, |
| 508 |
}; |
| 509 |
|
| 510 |
for my $nfssweight (get_all_nfss_weights()) { |
| 511 |
$from_nfss->{weight}{$nfssweight} |
| 512 |
= [ grep { $weight{$_} } @{$WEIGHT{$nfssweight}} ]; |
| 513 |
} |
| 514 |
|
| 515 |
# Some trickery to handle the case where the ul/ub codes are mapped |
| 516 |
# but the el/eb codes are still empty. We try two things: |
| 517 |
# 1. if there is a Thin (Heavy) weight and this is less extreme |
| 518 |
# than the weight mapped to ul (ub), we map Thin (Heavy) to ul (ub) |
| 519 |
# 2. otherwise we move the ul/ub weight to the el/eb position, |
| 520 |
# unless that weight is the Ultralight/Ultrabold weight |
| 521 |
if (!$ARGV{el} and !$ARGV{ul}) { |
| 522 |
if (@{$from_nfss->{weight}{ul}} |
| 523 |
and !@{$from_nfss->{weight}{el}}) { |
| 524 |
if ($weight{thin} |
| 525 |
and $weight{thin} |
| 526 |
> $weight{$from_nfss->{weight}{ul}[0]}) { |
| 527 |
$from_nfss->{weight}{el} = ['thin',]; |
| 528 |
} |
| 529 |
elsif ($from_nfss->{weight}{ul}[0] ne 'ultralight') { |
| 530 |
$from_nfss->{weight}{el} |
| 531 |
= [ shift @{$from_nfss->{weight}{ul}} ]; |
| 532 |
} |
| 533 |
} |
| 534 |
} |
| 535 |
if (!$ARGV{eb} and !$ARGV{ub}) { |
| 536 |
if (@{$from_nfss->{weight}{ub}} |
| 537 |
and !@{$from_nfss->{weight}{eb}}) { |
| 538 |
if ($weight{heavy} |
| 539 |
and $weight{heavy} |
| 540 |
< $weight{$from_nfss->{weight}{ub}[0]}) { |
| 541 |
$from_nfss->{weight}{eb} = ['heavy',] |
| 542 |
unless @{$from_nfss->{weight}{b}} |
| 543 |
and $weight{$from_nfss->{weight}{b}[0]} |
| 544 |
> $weight{heavy}; |
| 545 |
} |
| 546 |
elsif ($from_nfss->{weight}{ub}[0] ne 'ultrabold') { |
| 547 |
$from_nfss->{weight}{eb} |
| 548 |
= [ shift @{$from_nfss->{weight}{ub}} ]; |
| 549 |
} |
| 550 |
} |
| 551 |
} |
| 552 |
|
| 553 |
# Special case: if we don't have Regular but we *do* have Medium, |
| 554 |
# move Medium from the "sb" list to the "m" (i.e., Regular) one. |
| 555 |
if (!@{$from_nfss->{weight}{''}}) { |
| 556 |
my $alternate = ( grep { $weight{$_} } qw(medium 500) )[0]; |
| 557 |
if ($alternate) { |
| 558 |
$from_nfss->{weight}{''} = [$alternate]; |
| 559 |
$from_nfss->{weight}{sb} |
| 560 |
= [ grep { $_ ne $alternate } @{$from_nfss->{weight}{sb}} ]; |
| 561 |
} |
| 562 |
} |
| 563 |
|
| 564 |
# Some more trickery to map the sl code to Book or Text (but of course |
| 565 |
# only if sl is empty and Book/Text is lighter than Regular) |
| 566 |
if (!@{$from_nfss->{weight}{sl}}) { |
| 567 |
$from_nfss->{weight}{sl} |
| 568 |
= [ grep { $weight{$_} < $weight{$from_nfss->{weight}{''}[0]} } |
| 569 |
@{$from_nfss->{weight}{''}} ]; |
| 570 |
} |
| 571 |
|
| 572 |
NFSSWIDTH: |
| 573 |
for my $nfsswidth (get_all_nfss_widths()) { |
| 574 |
for my $width ( @{$WIDTH{$nfsswidth}} ) { |
| 575 |
if ($width{$width}) { |
| 576 |
$from_nfss->{width}{$nfsswidth} = [$width]; |
| 577 |
next NFSSWIDTH; |
| 578 |
} |
| 579 |
} |
| 580 |
$from_nfss->{width}{$nfsswidth} = []; |
| 581 |
} |
| 582 |
|
| 583 |
# Warn if we (still) don't have a regular weight or width |
| 584 |
if (!@{$from_nfss->{weight}{''}}) { |
| 585 |
warn <<"END_NO_REGULAR_WEIGHT"; |
| 586 |
[WARNING] I could not find a 'Regular' weight; |
| 587 |
consider using the '-nfssweight=m=...' option |
| 588 |
(see the documentation). |
| 589 |
END_NO_REGULAR_WEIGHT |
| 590 |
} |
| 591 |
if (!@{$from_nfss->{width}{''}}) { |
| 592 |
warn <<"END_NO_REGULAR_WIDTH"; |
| 593 |
[WARNING] I could not find a 'Regular' width; |
| 594 |
consider using the '-nfsswidth=m=...' option |
| 595 |
(see the documentation). |
| 596 |
END_NO_REGULAR_WIDTH |
| 597 |
} |
| 598 |
|
| 599 |
# Reverse the %from_nfss mapping to get %to_nfss |
| 600 |
my %to_nfss; |
| 601 |
NFSSWEIGHT: |
| 602 |
for my $nfssweight (get_all_nfss_weights()) { |
| 603 |
next unless @{$from_nfss->{weight}{$nfssweight}}; |
| 604 |
my $weight = $from_nfss->{weight}{$nfssweight}[0]; |
| 605 |
$weight = "" if $weight eq 'regular'; |
| 606 |
|
| 607 |
NFSSWIDTH: |
| 608 |
for my $nfsswidth (get_all_nfss_widths()) { |
| 609 |
my $nfssseries = ($nfssweight . $nfsswidth) || 'm'; |
| 610 |
|
| 611 |
next unless @{$from_nfss->{width}{$nfsswidth}}; |
| 612 |
my $width = $from_nfss->{width}{$nfsswidth}[0]; |
| 613 |
$width = "" if $width eq 'regular'; |
| 614 |
my $series = ($weight . $width) || 'regular'; |
| 615 |
$to_nfss{$series} = $nfssseries; |
| 616 |
} |
| 617 |
} |
| 618 |
|
| 619 |
return [ $from_nfss, \%to_nfss ]; |
| 620 |
} |
| 621 |
|
| 622 |
|
| 623 |
############################################################################ |
| 624 |
|
| 625 |
|
| 626 |
package Font; |
| 627 |
|
| 628 |
# -------------------------------------------------------------------------- |
| 629 |
# Constructor: returns a new Font object. |
| 630 |
# -------------------------------------------------------------------------- |
| 631 |
sub _new { |
| 632 |
my ($class, $filename) = @_; |
| 633 |
|
| 634 |
my $self = { |
| 635 |
filename => $filename, |
| 636 |
width => 'regular', |
| 637 |
weight => undef, |
| 638 |
shape => 'roman', |
| 639 |
minsize => 0, |
| 640 |
maxsize => 0, |
| 641 |
is_smallcaps => 0, |
| 642 |
weight_class => 0, |
| 643 |
width_class => 0, |
| 644 |
nfss => 'rm', |
| 645 |
}; |
| 646 |
|
| 647 |
return bless $self, $class; |
| 648 |
} |
| 649 |
|
| 650 |
|
| 651 |
# -------------------------------------------------------------------------- |
| 652 |
# Factory function: parses a font's metadata and creates a Font object. |
| 653 |
# -------------------------------------------------------------------------- |
| 654 |
sub parse { |
| 655 |
my $filename = shift; |
| 656 |
|
| 657 |
my $self = __PACKAGE__->_new($filename); |
| 658 |
|
| 659 |
my $metadata = _get_metadata($filename); |
| 660 |
|
| 661 |
$self->_get_missing_metadata($filename); |
| 662 |
|
| 663 |
$self->_parse_metadata($metadata) |
| 664 |
->_parse_featuredata() |
| 665 |
->_parse_sizedata() |
| 666 |
->_parse_nfss_classification() |
| 667 |
->_parse_fonttype() |
| 668 |
; |
| 669 |
|
| 670 |
return $self; |
| 671 |
} |
| 672 |
|
| 673 |
|
| 674 |
# -------------------------------------------------------------------------- |
| 675 |
# Returns the output of otfinfo -i as a list of key-value pairs. |
| 676 |
# -------------------------------------------------------------------------- |
| 677 |
sub _get_metadata { |
| 678 |
my $filename = shift; |
| 679 |
|
| 680 |
my $cmd = qq(otfinfo --info "$filename"); |
| 681 |
open my $otfinfo, '-|', $cmd |
| 682 |
or die "[ERROR] Could not run '$cmd': $!"; |
| 683 |
my %data = map { my ($k,$v) = m/\A\s* ([^:]+?) \s*:\s* ([^\r\n]+)/xms; |
| 684 |
$k =~ s/\s+//xmsg; |
| 685 |
(lc $k => $v); |
| 686 |
} |
| 687 |
grep { m/\A\s* [^:]+? \s*:\s* [^\r\n]+/xms } <$otfinfo>; |
| 688 |
close $otfinfo |
| 689 |
or die "[ERROR] '$cmd' failed"; |
| 690 |
|
| 691 |
return \%data; |
| 692 |
} |
| 693 |
|
| 694 |
|
| 695 |
# -------------------------------------------------------------------------- |
| 696 |
# Get some missing metadata from the font file. |
| 697 |
# |
| 698 |
# otfinfo doesn't extract all the metadata we need, so we parse some of |
| 699 |
# the raw tables from the font file ourselves to get the missing metadata. |
| 700 |
# -------------------------------------------------------------------------- |
| 701 |
sub _get_missing_metadata { |
| 702 |
my ($self, $filename) = @_; |
| 703 |
|
| 704 |
my $tables; |
| 705 |
eval { |
| 706 |
my $cmd = qq(otfinfo --tables "$filename"); |
| 707 |
open my $otfinfo, '-|:raw', $cmd |
| 708 |
or die "could not fork(): $!"; |
| 709 |
$tables = do { local $/; <$otfinfo> }; |
| 710 |
close $otfinfo |
| 711 |
or die "'$cmd' failed"; |
| 712 |
} or warn "[WARNING] $@"; |
| 713 |
|
| 714 |
# We need the cff_name because cfftot1 uses that instead of |
| 715 |
# the font's PostScript name. |
| 716 |
$self->{cff_name} = ''; |
| 717 |
if (index($tables, 'CFF') > -1) { |
| 718 |
my $cff_table; |
| 719 |
eval { |
| 720 |
my $cmd = qq(otfinfo --dump-table "CFF" "$filename"); |
| 721 |
open my $otfinfo, '-|:raw', $cmd |
| 722 |
or die "could not fork(): $!"; |
| 723 |
$cff_table = do { local $/; <$otfinfo> }; |
| 724 |
close $otfinfo |
| 725 |
or die "'$cmd' failed"; |
| 726 |
} or warn "[WARNING] $@"; |
| 727 |
|
| 728 |
my ($name_index) = unpack '@8C/Z', $cff_table; |
| 729 |
|
| 730 |
$self->{cff_name} = $name_index; |
| 731 |
} |
| 732 |
|
| 733 |
# WeightClass and WidthClass contain (numerical) indications |
| 734 |
# of the font's weight and width |
| 735 |
$self->{weight_class} = 400; |
| 736 |
$self->{width_class} = 5; |
| 737 |
if (index($tables, 'OS/2') > -1) { |
| 738 |
my $os2_table; |
| 739 |
eval { |
| 740 |
my $cmd = qq(otfinfo --dump-table "OS/2" "$filename"); |
| 741 |
open my $otfinfo, '-|:raw', $cmd |
| 742 |
or die "could not fork(): $!"; |
| 743 |
$os2_table = do { local $/; <$otfinfo> }; |
| 744 |
close $otfinfo |
| 745 |
or die "'$cmd' failed"; |
| 746 |
} or warn "[WARNING] $@"; |
| 747 |
|
| 748 |
my ($weight_class, $width_class) = unpack '@4n @6n', $os2_table; |
| 749 |
|
| 750 |
$self->{weight_class} = $weight_class; |
| 751 |
$self->{width_class} = $width_class; |
| 752 |
} |
| 753 |
|
| 754 |
# isFixedPitch does (or at least should) indicate whether |
| 755 |
# the font is fixed-pitch (i.e., monospaced). |
| 756 |
if (index($tables, 'post') > -1) { |
| 757 |
my $post_table; |
| 758 |
eval { |
| 759 |
my $cmd = qq(otfinfo --dump-table "post" "$self->{filename}"); |
| 760 |
open my $otfinfo, '-|:raw', $cmd |
| 761 |
or die "could not fork(): $!"; |
| 762 |
$post_table = do { local $/; <$otfinfo> }; |
| 763 |
close $otfinfo |
| 764 |
or die "'$cmd' failed"; |
| 765 |
} or warn "[WARNING] $@"; |
| 766 |
|
| 767 |
my $is_fixed_pitch = unpack '@12N', $post_table; |
| 768 |
|
| 769 |
$self->{is_fixed_pitch} = $is_fixed_pitch; |
| 770 |
} |
| 771 |
|
| 772 |
return $self; |
| 773 |
} |
| 774 |
|
| 775 |
|
| 776 |
# -------------------------------------------------------------------------- |
| 777 |
# Processes the basic metadata for this font. |
| 778 |
# -------------------------------------------------------------------------- |
| 779 |
sub _parse_metadata { |
| 780 |
my ($self, $data) = @_; |
| 781 |
|
| 782 |
$self->{originalfamily} = $data->{family}; |
| 783 |
|
| 784 |
for my $key (keys %{$data}) { |
| 785 |
$data->{$key} =~ s/\s+//xmsg; |
| 786 |
} |
| 787 |
|
| 788 |
for my $item (qw(family subfamily fullname)) { |
| 789 |
if (!$data->{$item}) { |
| 790 |
die <<"END_ERR_METADATA_MISSING" |
| 791 |
[ERROR] Parsing font metadata failed for $self->{filename}: |
| 792 |
could not find '$item' metadata item |
| 793 |
END_ERR_METADATA_MISSING |
| 794 |
} |
| 795 |
} |
| 796 |
|
| 797 |
$data->{family} = $data->{preferredfamily} || $data->{family}; |
| 798 |
$data->{subfamily} = $data->{preferredsubfamily} || $data->{subfamily}; |
| 799 |
$data->{fullname} =~ s/\A$data->{family}//xms; |
| 800 |
$data->{fullname} = lc $data->{fullname}; |
| 801 |
|
| 802 |
# clean up family name (it's used in LaTeX command names) |
| 803 |
my @DIGITS = qw(Zero One Two Three Four Five Six Seven Eight Nine); |
| 804 |
$data->{family} =~ s/(?: LT | MT)(?: Std | Pro )//xms; |
| 805 |
$data->{family} =~ s/(\d)/$DIGITS[$1]/xmsge; |
| 806 |
$data->{family} =~ s/[^A-Za-z]+//xmsg; |
| 807 |
|
| 808 |
if ($data->{family} =~ s/\A DTL//xms) { |
| 809 |
$data->{subfamily} =~ s/\A (?: ST | T | SD | D)//xms; |
| 810 |
} |
| 811 |
|
| 812 |
# Some extended font families, especially from Adobe, |
| 813 |
# include the optical master in the family name. |
| 814 |
# We don't want this, as all these fonts should be part of the same family, |
| 815 |
# with different values for the optical size range. |
| 816 |
# We therefore move the optical master name from the family to the subfamily. |
| 817 |
# We don't discard this information entirely, since we need it later on |
| 818 |
# in _parse_sizedata(). |
| 819 |
# This hack causes problems with Libertinus Serif Display, |
| 820 |
# so we skip it for that font. |
| 821 |
if ($data->{family} !~ m/Libertinus/xmsi) { |
| 822 |
for my $optical (qw(Caption SmText SmallText Subhead Display)) { |
| 823 |
if ($data->{family} =~ s/$optical\z//xms) { |
| 824 |
$data->{subfamily} .= $optical; |
| 825 |
last; |
| 826 |
} |
| 827 |
} |
| 828 |
} |
| 829 |
|
| 830 |
# Sometimes the relevant info is in Fullname, sometimes in Subfamily; |
| 831 |
# so we need to test against both |
| 832 |
my $fullinfo = lc "$data->{subfamily} | $data->{fullname}"; |
| 833 |
|
| 834 |
# remove Adobe's SmallText size, to avoid mistaking it for Text weight |
| 835 |
$fullinfo =~ s/(?: SmallText | SmText )//gxmsi; |
| 836 |
|
| 837 |
# remove the word 'TypeWriter' from the info, to avoid it matching |
| 838 |
# against the "It" shape |
| 839 |
$fullinfo =~ s/typewriter//gxmsi; |
| 840 |
|
| 841 |
# We need to be careful when parsing the font info; in particular |
| 842 |
# we must parse strings like 'UltraCondensed' as 'Regular' weight |
| 843 |
# and 'UltraCondensed' width, not as 'Ultra' weight and 'Condensed' width. |
| 844 |
# The following rules should prevent accidents: |
| 845 |
# 1. Search for matching widths before matching weights |
| 846 |
# (as none of the widths is a proper substring of some weight) |
| 847 |
# 2. Remove any recognised search string from the 'fullinfo' |
| 848 |
# 3. Test the weights 'medium' and 'regular' *last*, since these strings |
| 849 |
# may also occur in Subfamily without indicating the weight; |
| 850 |
# so we only take them to mean weight if we find no other hit. |
| 851 |
my @widths = Attr::get_all_widths(); |
| 852 |
for my $width (@widths) { |
| 853 |
if ($fullinfo =~ m/$width/xms) { |
| 854 |
$self->{width} = $width; |
| 855 |
my $widths = join '|', @widths; |
| 856 |
$fullinfo =~ s/$widths//gxmsi; |
| 857 |
last; |
| 858 |
} |
| 859 |
} |
| 860 |
|
| 861 |
my @weights = Attr::get_all_weights(); |
| 862 |
for my $weight (@weights) { |
| 863 |
if ($fullinfo =~ m/$weight/xms) { |
| 864 |
$self->{weight} = $weight; |
| 865 |
my $weights = join '|', @weights; |
| 866 |
$fullinfo =~ s/$weights//gxmsi; |
| 867 |
last; |
| 868 |
} |
| 869 |
} |
| 870 |
|
| 871 |
unless ($self->{weight}) { |
| 872 |
$self->{weight} = $DEFAULT_WEIGHT{$self->{weight_class}}; |
| 873 |
} |
| 874 |
$self->{weight} //= 'regular'; |
| 875 |
|
| 876 |
my @shapes = Attr::get_all_shapes(); |
| 877 |
for my $shape (@shapes) { |
| 878 |
if ($fullinfo =~ m/$shape/xms) { |
| 879 |
$self->{shape} = $shape; |
| 880 |
my $shapes = join '|', @shapes; |
| 881 |
$fullinfo =~ s/$shapes//gxmsi; |
| 882 |
last; |
| 883 |
} |
| 884 |
} |
| 885 |
|
| 886 |
# In many font families, each font is in a subfamily of its own; |
| 887 |
# so we remove width, weight and shape from the 'subfamily' value. |
| 888 |
$data->{subfamily} =~ s/$self->{width}//xmsi; |
| 889 |
$data->{subfamily} =~ s/$self->{weight}//xmsi; |
| 890 |
$data->{subfamily} =~ s/$self->{shape}//xmsi; |
| 891 |
|
| 892 |
$self->{name} = $data->{postscriptname}; |
| 893 |
$self->{family} = $data->{family}; |
| 894 |
$self->{subfamily} = $data->{subfamily}; |
| 895 |
|
| 896 |
# Take care to unabbreviate weight and width; CondensedUltra fonts |
| 897 |
# might end up as 'ultracondensed' instead of 'ultrablackcondensed'! |
| 898 |
$self->{width} = Attr::unabbreviate($self->{width}); |
| 899 |
$self->{weight} = Attr::unabbreviate($self->{weight}); |
| 900 |
$self->{shape} = Attr::unabbreviate($self->{shape}); |
| 901 |
|
| 902 |
# Handle the (semi)condensed widths of the Thesis family. |
| 903 |
# Doing this in the WIDTH table is tricky (i.e., TheSansCd might be |
| 904 |
# parsed as the SCd width of the TheSan family), so we treat it as |
| 905 |
# a special case instead. |
| 906 |
if ($self->{family} =~ m/\A (The (?: Sans | Serif | Mix)) (S? Cd) \z/xms |
| 907 |
and $self->{width} eq 'regular') { |
| 908 |
$self->{family} = $1; |
| 909 |
$self->{width} |
| 910 |
= $2 eq 'Cd' ? 'condensed' |
| 911 |
: $2 eq 'SCd' ? 'semicondensed' |
| 912 |
: die '[ERROR] Internal error, please report!' |
| 913 |
; |
| 914 |
} |
| 915 |
|
| 916 |
# Some font families put small caps into separate families; |
| 917 |
# we merge these into the 'main' family. |
| 918 |
# We have to test both 'family', 'subfamily' and 'name' for hints |
| 919 |
# that this is a small caps font, as some fonts (e.g., Dolly) |
| 920 |
# only mention this in their name. |
| 921 |
my $shapes = join '|', Util::sort_desc_length(qw(smallcaps sc smcp caps)); |
| 922 |
if ($self->{family} =~ m/(.+?) (?: $shapes) \z/xmsi) { |
| 923 |
$self->{family} = $1; |
| 924 |
$self->{is_smallcaps} = 1; |
| 925 |
} |
| 926 |
if ($self->{subfamily} =~ m/(.+?) (?: $shapes) \z/xmsi) { |
| 927 |
$self->{subfamily} = $1; |
| 928 |
$self->{is_smallcaps} = 1; |
| 929 |
} |
| 930 |
if ($self->{name} =~ m/\A DTL/xms && $self->{subfamily} =~ s/Caps//xms) { |
| 931 |
$self->{is_smallcaps} = 1; |
| 932 |
} |
| 933 |
if ($self->{name} =~ m/(.+?) (?: $shapes) \z/xmsi) { |
| 934 |
$self->{is_smallcaps} = 1; |
| 935 |
} |
| 936 |
# Some font families put italic shapes into separate families; |
| 937 |
# we merge these into the 'main' family. |
| 938 |
$shapes = join '|', Util::sort_desc_length(qw(it italic)); |
| 939 |
if ($self->{family} =~ m/(.+?) ($shapes) \z/xmsi |
| 940 |
and ($self->{shape} eq 'regular' |
| 941 |
or $self->{shape} eq Attr::unabbreviate(lc($2)))) { |
| 942 |
$self->{family} = $1; |
| 943 |
$self->{shape} = Attr::unabbreviate(lc($2)); |
| 944 |
} |
| 945 |
|
| 946 |
# Some font families put different widths into separate families; |
| 947 |
# we merge these into the 'main' font family. |
| 948 |
my $widths = join '|', Attr::get_all_widths(); |
| 949 |
if ($self->{family} =~ m/(.+?) ($widths) \z/xmsi |
| 950 |
and ($self->{width} eq 'regular' |
| 951 |
or $self->{width} eq Attr::unabbreviate(lc($2)))) { |
| 952 |
$self->{family} = $1; |
| 953 |
$self->{width} = Attr::unabbreviate(lc($2)); |
| 954 |
} |
| 955 |
|
| 956 |
# Some font families put unusual weights into separate families; |
| 957 |
# we merge these into the 'main' font family. But we have to be |
| 958 |
# careful with the word 'Text': this might be part of the family name |
| 959 |
# (i.e., Libre Caslon Text) and should not be mistaken for a weight. |
| 960 |
my $weights = join '|', Attr::get_all_weights(); |
| 961 |
if ($self->{family} =~ m/text \z/xmsi) { |
| 962 |
$weights =~ s/[|]? text//xms; |
| 963 |
} |
| 964 |
if ($self->{family} =~ m/(.+?) ($weights) \z/xmsi |
| 965 |
and ($self->{weight} eq 'regular' |
| 966 |
or $self->{weight} eq Attr::unabbreviate(lc($2)))) { |
| 967 |
$self->{family} = $1; |
| 968 |
$self->{weight} = Attr::unabbreviate(lc($2)); |
| 969 |
} |
| 970 |
|
| 971 |
$self->{basicshape} = Attr::to_nfss($self->{shape}); |
| 972 |
|
| 973 |
# Work around a bug(?) in League Mono: the Regular width has |
| 974 |
# a WidthClass of 6 instead of 5; that would cause our test below |
| 975 |
# to (mis)classify it as SemiCondensed. |
| 976 |
if ($self->{family} eq 'LeagueMono' |
| 977 |
and $self->{width} eq 'regular' |
| 978 |
and $self->{width_class} == 6) { |
| 979 |
$self->{width_class} = 5; |
| 980 |
} |
| 981 |
|
| 982 |
# A last-resort approach: if we couldn't parse weight or width, |
| 983 |
# we use the WeightClass and WidthClass indicators to derive |
| 984 |
# a default value for weight or width. |
| 985 |
# The reason we only use this as a last resort is that some fonts |
| 986 |
# contain non-standard or otherwise non-meaningful values |
| 987 |
# for these indicators. |
| 988 |
if ($self->{weight} eq 'regular' |
| 989 |
and $self->{weight_class} != 400) { |
| 990 |
$self->{weight} = Attr::get_default_weight($self->{weight_class}) // 'regular'; |
| 991 |
} |
| 992 |
|
| 993 |
if ($self->{width} eq 'regular' |
| 994 |
and $self->{width_class} != 5) { |
| 995 |
$self->{width} = Attr::get_default_width($self->{width_class}) // 'regular'; |
| 996 |
} |
| 997 |
|
| 998 |
# We define 'series' as 'weight + width'. This matches NFSS, |
| 999 |
# but contradicts how most fonts are named (which is 'width + weight'). |
| 1000 |
$self->{series} |
| 1001 |
= ($self->{width} eq 'regular') ? $self->{weight} |
| 1002 |
: ($self->{weight} eq 'regular') ? $self->{width} |
| 1003 |
: $self->{weight} . $self->{width} |
| 1004 |
; |
| 1005 |
|
| 1006 |
$self->{cff_name} ||= $self->{name}; |
| 1007 |
|
| 1008 |
return $self; |
| 1009 |
} |
| 1010 |
|
| 1011 |
|
| 1012 |
# -------------------------------------------------------------------------- |
| 1013 |
# Returns a list of features that this font supports. |
| 1014 |
# We include 'kern' in this list even if there is only a 'kern' table |
| 1015 |
# (but no feature), since otftotfm can also use the (legacy) table. |
| 1016 |
# -------------------------------------------------------------------------- |
| 1017 |
sub _parse_featuredata { |
| 1018 |
my $self = shift; |
| 1019 |
|
| 1020 |
my $cmd = qq(otfinfo --features "$self->{filename}"); |
| 1021 |
open my $otfinfo, '-|', $cmd |
| 1022 |
or die "[ERROR] Could not run '$cmd': $!"; |
| 1023 |
my @data = map { substr $_, 0, 4 } <$otfinfo>; |
| 1024 |
close $otfinfo |
| 1025 |
or die "[ERROR] '$cmd' failed"; |
| 1026 |
|
| 1027 |
$cmd = qq(otfinfo --tables "$self->{filename}"); |
| 1028 |
open $otfinfo, '-|', $cmd |
| 1029 |
or die "[ERROR] Could not run '$cmd': $!"; |
| 1030 |
my $data = do { local $/; <$otfinfo> }; |
| 1031 |
close $otfinfo |
| 1032 |
or die "[ERROR] '$cmd' failed"; |
| 1033 |
|
| 1034 |
if ($data =~ m/\d+ \s+ kern/xms) { |
| 1035 |
push @data, 'kern'; |
| 1036 |
} |
| 1037 |
|
| 1038 |
%{$self->{feature}} = map { $_ => 1 } @data; |
| 1039 |
|
| 1040 |
return $self; |
| 1041 |
} |
| 1042 |
|
| 1043 |
|
| 1044 |
# -------------------------------------------------------------------------- |
| 1045 |
# Extracts 'minsize' and 'maxsize' from the optical design size info. |
| 1046 |
# -------------------------------------------------------------------------- |
| 1047 |
sub _parse_sizedata { |
| 1048 |
my $self = shift; |
| 1049 |
|
| 1050 |
my $cmd = qq(otfinfo --optical-size "$self->{filename}"); |
| 1051 |
open my $otfinfo, '-|', $cmd |
| 1052 |
or die "[ERROR] Could not run '$cmd': $!"; |
| 1053 |
my $data = do { local $/; <$otfinfo> }; |
| 1054 |
close $otfinfo |
| 1055 |
or die "[ERROR] '$cmd' failed"; |
| 1056 |
|
| 1057 |
my ($minsize, $maxsize) |
| 1058 |
= $data =~ m/[([] ([\d.]+) (?:\s* pt)?, \s* |
| 1059 |
([\d.]+) (?:\s* pt)? \s* [])]/xms; |
| 1060 |
|
| 1061 |
$minsize //= 0; |
| 1062 |
$maxsize //= 0; |
| 1063 |
|
| 1064 |
# fix some known bugs |
| 1065 |
if ($self->{name} eq 'GaramondPremrPro-It' |
| 1066 |
&& $minsize == 6 && $maxsize == 8.9) { |
| 1067 |
($minsize, $maxsize) = (8.9, 14.9); |
| 1068 |
} |
| 1069 |
elsif ($self->{family} eq 'KeplerStd' |
| 1070 |
&& $self->{subfamily} =~ m/Caption/xms |
| 1071 |
&& $minsize == 8.9 && $maxsize == 13.9) { |
| 1072 |
($minsize, $maxsize) = (6, 8.9); |
| 1073 |
} |
| 1074 |
elsif ($self->{family} eq 'KeplerStd' |
| 1075 |
&& $self->{subfamily} =~ m/Subhead/xms |
| 1076 |
&& $minsize == 8.9 && $maxsize == 13.9) { |
| 1077 |
($minsize, $maxsize) = (13.9, 23); |
| 1078 |
} |
| 1079 |
elsif ($self->{family} eq 'KeplerStd' |
| 1080 |
&& $self->{subfamily} =~ m/Display/xms |
| 1081 |
&& $minsize == 8.9 && $maxsize == 13.9) { |
| 1082 |
($minsize, $maxsize) = (23, 72); |
| 1083 |
} |
| 1084 |
# Adobe's Source Serif 4 follows a recent version of the OpenType |
| 1085 |
# spec and keeps its optical size info as a `size` feature rather |
| 1086 |
# than in the OS/2 table. This isn't (yet?) supported by otfinfo, |
| 1087 |
# so we add the missing size info here. |
| 1088 |
elsif ($self->{family} eq 'SourceSerifFour' |
| 1089 |
&& $minsize == 0 && $maxsize == 0) { |
| 1090 |
if ($self->{subfamily} eq 'Caption') { |
| 1091 |
($minsize, $maxsize) = (0, 6); |
| 1092 |
} |
| 1093 |
elsif ($self->{subfamily} eq 'SmText') { |
| 1094 |
($minsize, $maxsize) = (6, 9); |
| 1095 |
} |
| 1096 |
elsif ($self->{subfamily} eq '') { |
| 1097 |
($minsize, $maxsize) = (9, 13); |
| 1098 |
} |
| 1099 |
elsif ($self->{subfamily} eq 'Subhead') { |
| 1100 |
($minsize, $maxsize) = (13, 24); |
| 1101 |
} |
| 1102 |
elsif ($self->{subfamily} eq 'Display') { |
| 1103 |
($minsize, $maxsize) = (24, 72); |
| 1104 |
} |
| 1105 |
else { |
| 1106 |
die "[ERROR] Unknown subfamily '$self->{subfamily}' in $self->{filename}"; |
| 1107 |
} |
| 1108 |
} |
| 1109 |
|
| 1110 |
@{$self}{qw(minsize maxsize)} = ($minsize, $maxsize); |
| 1111 |
|
| 1112 |
return $self; |
| 1113 |
} |
| 1114 |
|
| 1115 |
|
| 1116 |
# -------------------------------------------------------------------------- |
| 1117 |
# Adds the NFSS classification (rm, sf, tt) to self. |
| 1118 |
# -------------------------------------------------------------------------- |
| 1119 |
sub _parse_nfss_classification { |
| 1120 |
my $self = shift; |
| 1121 |
|
| 1122 |
$self->{nfss} = $self->{is_fixed_pitch} ? 'tt' |
| 1123 |
: $self->{filename} =~ m/mono(?!type)/xmsi ? 'tt' |
| 1124 |
: $self->{filename} =~ m/sans/xmsi ? 'sf' |
| 1125 |
: 'rm' |
| 1126 |
; |
| 1127 |
|
| 1128 |
return $self; |
| 1129 |
} |
| 1130 |
|
| 1131 |
|
| 1132 |
# -------------------------------------------------------------------------- |
| 1133 |
# Determines the OpenType flavor of this font. |
| 1134 |
# -------------------------------------------------------------------------- |
| 1135 |
sub _parse_fonttype() { |
| 1136 |
my $self = shift; |
| 1137 |
|
| 1138 |
my ($ext) = $self->{filename} =~ m/[.] ([^.]+) \z/xmsi; |
| 1139 |
$ext = lc $ext; |
| 1140 |
|
| 1141 |
$self->{fonttype} |
| 1142 |
= $ext eq 'otf' ? 'opentype' |
| 1143 |
: $ext eq 'ttf' ? 'truetype' |
| 1144 |
: '' |
| 1145 |
; |
| 1146 |
|
| 1147 |
if (!$self->{fonttype}) { |
| 1148 |
open my $fontfile, '<:raw', $self->{filename} |
| 1149 |
or die "[ERROR] Could not open '$self->{filename}': $!"; |
| 1150 |
my $fontsignature; |
| 1151 |
read $fontfile, $fontsignature, 4; |
| 1152 |
$self->{fonttype} |
| 1153 |
= $fontsignature eq 'OTTO' ? 'opentype' |
| 1154 |
: $fontsignature eq "\x00\x01\x00\x00" ? 'truetype' |
| 1155 |
: '' |
| 1156 |
; |
| 1157 |
close $fontfile; |
| 1158 |
} |
| 1159 |
|
| 1160 |
if (!$self->{fonttype}) { |
| 1161 |
die "[ERROR] Unknown font type ($self->{filename})" |
| 1162 |
} |
| 1163 |
|
| 1164 |
return $self; |
| 1165 |
} |
| 1166 |
|
| 1167 |
|
| 1168 |
# Error messages, used in assert_unique(). |
| 1169 |
my $ERR_DETAIL =<<'END_ERR_DETAIL'; |
| 1170 |
[ERROR] I've parsed both %s |
| 1171 |
and %s as |
| 1172 |
|
| 1173 |
Family: %s |
| 1174 |
Weight: %s |
| 1175 |
Width: %s |
| 1176 |
Shape: %s |
| 1177 |
Size: %s-%s |
| 1178 |
Smallcaps: %s |
| 1179 |
|
| 1180 |
END_ERR_DETAIL |
| 1181 |
|
| 1182 |
my $ERR_PARSE =<<'END_ERR_PARSE'; |
| 1183 |
[ERROR] I failed to parse all fonts in a unique way; |
| 1184 |
presumably some fonts have unusual widths, weights or shapes. |
| 1185 |
|
| 1186 |
Try one of the following: |
| 1187 |
- Run 'autoinst' on a smaller set of fonts, |
| 1188 |
omitting the ones that weren't parsed correctly; |
| 1189 |
- Add the missing widths, weights or shapes to the tables |
| 1190 |
'WIDTH', 'WEIGHT' or 'SHAPE' in the source code; |
| 1191 |
|
| 1192 |
Please also send a bug report to the author. |
| 1193 |
END_ERR_PARSE |
| 1194 |
|
| 1195 |
# -------------------------------------------------------------------------- |
| 1196 |
# Asserts all parsed fonts are unique. |
| 1197 |
# -------------------------------------------------------------------------- |
| 1198 |
sub assert_unique { |
| 1199 |
my ($log, $fontlist) = @_; |
| 1200 |
|
| 1201 |
# These attributes should uniquely identify each font. |
| 1202 |
my @attributes |
| 1203 |
= qw(family weight width shape minsize maxsize is_smallcaps); |
| 1204 |
|
| 1205 |
my (%seen, $err_details); |
| 1206 |
for my $font (@{$fontlist}) { |
| 1207 |
my $key = join "\x00", @{$font}{@attributes}; |
| 1208 |
|
| 1209 |
if ($seen{$key}) { |
| 1210 |
$err_details .= sprintf $ERR_DETAIL, |
| 1211 |
$seen{$key}{filename}, |
| 1212 |
$font->{filename}, |
| 1213 |
@{$font}{@attributes}; |
| 1214 |
} |
| 1215 |
else { |
| 1216 |
$seen{$key} = $font; |
| 1217 |
} |
| 1218 |
} |
| 1219 |
|
| 1220 |
# Die with detailed error message if the font infos aren't unique. |
| 1221 |
if ($err_details) { |
| 1222 |
$log->log($err_details, $ERR_PARSE); |
| 1223 |
die $err_details, $ERR_PARSE; |
| 1224 |
} |
| 1225 |
|
| 1226 |
return 1; |
| 1227 |
} |
| 1228 |
|
| 1229 |
|
| 1230 |
############################################################################ |
| 1231 |
|
| 1232 |
|
| 1233 |
package LaTeX; |
| 1234 |
|
| 1235 |
# -------------------------------------------------------------------------- |
| 1236 |
# Creates .sty and .fd files for LaTeX. |
| 1237 |
# -------------------------------------------------------------------------- |
| 1238 |
sub create_support_files { |
| 1239 |
my ($worklist, $family, $nfss_mapping) = @_; |
| 1240 |
|
| 1241 |
# Organize the worklist by family, encoding, style, series and shape. |
| 1242 |
my %fddata; |
| 1243 |
for my $workitem (@{$worklist}) { |
| 1244 |
my $encoding = $workitem->{encoding}; |
| 1245 |
my $figurestyle = $workitem->{figurestyle}; |
| 1246 |
my $series = $workitem->{font}{series}; |
| 1247 |
my $shape = $workitem->{fdshape}; |
| 1248 |
my $minsize = $workitem->{font}{minsize}; |
| 1249 |
my $maxsize = $workitem->{font}{maxsize}; |
| 1250 |
|
| 1251 |
push @{$fddata{$encoding}{$figurestyle}{$series}{$shape}}, |
| 1252 |
[ $minsize, $maxsize, $workitem->{fontname} ]; |
| 1253 |
} |
| 1254 |
|
| 1255 |
create_stylefile($nfss_mapping, $family, \%fddata); |
| 1256 |
while (my ($enc, $encdata) = each %fddata) { |
| 1257 |
while (my ($sty, $stydata) = each %$encdata) { |
| 1258 |
create_fdfile($nfss_mapping, $family, $enc, $sty, $stydata); |
| 1259 |
} |
| 1260 |
} |
| 1261 |
|
| 1262 |
return; |
| 1263 |
} |
| 1264 |
|
| 1265 |
|
| 1266 |
# This table is used to generate extra ssub rules in .fd files |
| 1267 |
# to map missing Slanted shapes to Italic and vice versa. |
| 1268 |
my %SSUB_SHAPE = ( |
| 1269 |
sl => 'it', |
| 1270 |
scsl => 'scit', |
| 1271 |
it => 'sl', |
| 1272 |
scit => 'scsl', |
| 1273 |
); |
| 1274 |
|
| 1275 |
# -------------------------------------------------------------------------- |
| 1276 |
# Creates a LaTeX style file. |
| 1277 |
# -------------------------------------------------------------------------- |
| 1278 |
sub create_stylefile { |
| 1279 |
my ($nfss_mapping, $fam, $data) = @_; |
| 1280 |
|
| 1281 |
my %seen = %{Util::get_keys($data)}; |
| 1282 |
|
| 1283 |
my $fn = sprintf "%s.sty", $fam; |
| 1284 |
my $dir = File::Spec->catdir( |
| 1285 |
$ARGV{target}, 'tex', 'latex', $ARGV{typeface} || $fam); |
| 1286 |
File::Path::make_path($dir); |
| 1287 |
$fn = File::Spec->catfile($dir, $fn); |
| 1288 |
open my $STY, '>', $fn or die "[ERROR] Can't create '$fn': $!"; |
| 1289 |
# We use binmode since TeX expects these files to have |
| 1290 |
# Unix-style line ends even on Windows. |
| 1291 |
binmode $STY; |
| 1292 |
|
| 1293 |
print {$STY} <<"END_STY_HEADER"; |
| 1294 |
\\NeedsTeXFormat{LaTeX2e}[2020/02/02] |
| 1295 |
\\ProvidesPackage{$fam} |
| 1296 |
[$TODAY (autoinst) Style file for $fam fonts.] |
| 1297 |
|
| 1298 |
END_STY_HEADER |
| 1299 |
|
| 1300 |
print {$STY} <<"END_STY_XKEYVAL"; |
| 1301 |
\\RequirePackage{xkeyval} |
| 1302 |
\\newcommand*{\\$fam\@scale}{1} |
| 1303 |
\\DeclareOptionX{scale}{\\renewcommand*{\\$fam\@scale}{#1}} |
| 1304 |
\\DeclareOptionX{scaled}{\\renewcommand*{\\$fam\@scale}{#1}} |
| 1305 |
|
| 1306 |
END_STY_XKEYVAL |
| 1307 |
|
| 1308 |
my ($figurestyle_default, $figurealign_default); |
| 1309 |
if ($seen{LF} or $seen{TLF}) { |
| 1310 |
print {$STY} |
| 1311 |
"\\DeclareOptionX{lining}{\\edef\\$fam\@figurestyle{LF}}\n"; |
| 1312 |
$figurestyle_default = 'LF'; |
| 1313 |
} |
| 1314 |
if ($seen{OsF} or $seen{TOsF}) { |
| 1315 |
print {$STY} |
| 1316 |
"\\DeclareOptionX{oldstyle}{\\edef\\$fam\@figurestyle{OsF}}\n"; |
| 1317 |
$figurestyle_default = 'OsF'; |
| 1318 |
} |
| 1319 |
if ($seen{TLF} or $seen{TOsF}) { |
| 1320 |
print {$STY} |
| 1321 |
"\\DeclareOptionX{tabular}{\\edef\\$fam\@figurealign{T}}\n"; |
| 1322 |
$figurealign_default = 'T'; |
| 1323 |
} |
| 1324 |
if ($seen{LF} or $seen{OsF}) { |
| 1325 |
print {$STY} |
| 1326 |
"\\DeclareOptionX{proportional}{\\edef\\$fam\@figurealign{}}\n"; |
| 1327 |
$figurealign_default = ''; |
| 1328 |
} |
| 1329 |
|
| 1330 |
print {$STY} <<"END_STY_MAINFONT"; |
| 1331 |
\\edef\\$fam\@figurestyle{$figurestyle_default} |
| 1332 |
\\edef\\$fam\@figurealign{$figurealign_default} |
| 1333 |
|
| 1334 |
\\DeclareOptionX{mainfont}{ |
| 1335 |
\\renewcommand{\\familydefault}{\\$ARGV{nfss}default} |
| 1336 |
} |
| 1337 |
END_STY_MAINFONT |
| 1338 |
|
| 1339 |
for my $series (qw(heavy black extrabold demibold semibold bold)) { |
| 1340 |
if ( $seen{$series} ) { |
| 1341 |
print {$STY} |
| 1342 |
"\\DeclareOptionX{$series}{\\edef\\bfseries\@$ARGV{nfss}", |
| 1343 |
"{$series}}\n"; |
| 1344 |
} |
| 1345 |
} |
| 1346 |
|
| 1347 |
for my $series (qw(medium book text normal regular)) { |
| 1348 |
if ( $seen{$series} ) { |
| 1349 |
print {$STY} |
| 1350 |
"\\DeclareOptionX{$series}{\\edef\\mdseries\@$ARGV{nfss}", |
| 1351 |
"{$series}}\n"; |
| 1352 |
} |
| 1353 |
} |
| 1354 |
print {$STY} "\n"; |
| 1355 |
|
| 1356 |
if ($ARGV{math}) { |
| 1357 |
print {$STY} <<"END_STY_MATHOPTION"; |
| 1358 |
\\newif\\if$fam\@math\\$fam\@mathfalse |
| 1359 |
\\DeclareOptionX{math}{\\$fam\@mathtrue} |
| 1360 |
\\DeclareOptionX{nomath}{\\$fam\@mathfalse} |
| 1361 |
|
| 1362 |
\\newif\\if$fam\@mathgreek\\$fam\@mathgreektrue |
| 1363 |
\\DeclareOptionX{mathgreek}{\\$fam\@mathgreektrue} |
| 1364 |
\\DeclareOptionX{nomathgreek}{\\$fam\@mathgreekfalse} |
| 1365 |
|
| 1366 |
\\newcommand*{\\$fam\@mathstyle}{TeX} |
| 1367 |
\\DeclareOptionX{math-style}{\\renewcommand*{\\$fam\@mathstyle}{#1}} |
| 1368 |
|
| 1369 |
\\newcommand*{\\$fam\@Sscale}{1.1} |
| 1370 |
\\newcommand*{\\$fam\@SSscale}{\\fpeval{\\$fam\@Sscale * \\$fam\@Sscale}} |
| 1371 |
\\DeclareOptionX{scriptscale}{% |
| 1372 |
\\renewcommand{\\$fam\@Sscale}{#1}% |
| 1373 |
\\renewcommand{\\$fam\@SSscale}{\\fpeval{#1 * #1}}} |
| 1374 |
|
| 1375 |
END_STY_MATHOPTION |
| 1376 |
|
| 1377 |
my ($mathfigurestyle_default, $mathfigurealign_default); |
| 1378 |
if ($seen{OsF} or $seen{TOsF}) { |
| 1379 |
print {$STY} |
| 1380 |
"\\DeclareOptionX{matholdstyle}{\\edef\\$fam\@mathfigurestyle{OsF}}\n"; |
| 1381 |
$mathfigurestyle_default = 'OsF'; |
| 1382 |
} |
| 1383 |
if ($seen{LF} or $seen{TLF}) { |
| 1384 |
print {$STY} |
| 1385 |
"\\DeclareOptionX{mathlining}{\\edef\\$fam\@mathfigurestyle{LF}}\n"; |
| 1386 |
$mathfigurestyle_default = 'LF'; |
| 1387 |
} |
| 1388 |
if ($seen{LF} or $seen{OsF}) { |
| 1389 |
print {$STY} |
| 1390 |
"\\DeclareOptionX{mathproportional}{\\edef\\$fam\@mathfigurealign{}}\n"; |
| 1391 |
$mathfigurealign_default = ''; |
| 1392 |
} |
| 1393 |
if ($seen{TLF} or $seen{TOsF}) { |
| 1394 |
print {$STY} |
| 1395 |
"\\DeclareOptionX{mathtabular}{\\edef\\$fam\@mathfigurealign{T}}\n"; |
| 1396 |
$mathfigurealign_default = 'T'; |
| 1397 |
} |
| 1398 |
print {$STY} <<"END_STY_MATHDEFAULTS"; |
| 1399 |
\\edef\\$fam\@mathfigurestyle{$mathfigurestyle_default} |
| 1400 |
\\edef\\$fam\@mathfigurealign{$mathfigurealign_default} |
| 1401 |
|
| 1402 |
END_STY_MATHDEFAULTS |
| 1403 |
|
| 1404 |
if ($seen{sw}) { |
| 1405 |
print {$STY} <<"END_STY_MATHCALOPTION"; |
| 1406 |
\\newif\\if$fam\@mathcal\\$fam\@mathcalfalse |
| 1407 |
\\DeclareOptionX{mathcal}{\\$fam\@mathcaltrue} |
| 1408 |
|
| 1409 |
END_STY_MATHCALOPTION |
| 1410 |
} |
| 1411 |
} |
| 1412 |
|
| 1413 |
print {$STY} <<"END_STY_PROCESSOPTIONS"; |
| 1414 |
\\ProcessOptionsX\\relax |
| 1415 |
|
| 1416 |
END_STY_PROCESSOPTIONS |
| 1417 |
|
| 1418 |
my @known_encodings = grep { $_ !~ m/\A U_/xmsi } @{$ARGV{encoding}}; |
| 1419 |
my $fontenc = join ',', grep { $_ ne 'OT1' } @known_encodings; |
| 1420 |
if ($fontenc) { |
| 1421 |
print {$STY} "\\RequirePackage[$fontenc]{fontenc}\n"; |
| 1422 |
} |
| 1423 |
print {$STY} "\\RequirePackage{textcomp}\n" if $seen{TS1}; |
| 1424 |
print {$STY} "\\RequirePackage{ifthen}\n"; |
| 1425 |
print {$STY} "\\RequirePackage{xspace}\n"; |
| 1426 |
print {$STY} "\n"; |
| 1427 |
|
| 1428 |
print {$STY} <<'END_STY_FIGUREVERSIONS_START'; |
| 1429 |
\ExplSyntaxOn |
| 1430 |
\IfFileExists{figureversions.sty}{ |
| 1431 |
\RequirePackage{figureversions} |
| 1432 |
|
| 1433 |
END_STY_FIGUREVERSIONS_START |
| 1434 |
|
| 1435 |
if ($seen{Sup}) { |
| 1436 |
print {$STY} <<'END_STY_FIGUREVERSIONS_SUP'; |
| 1437 |
\figureversions_new_figurestyle:nnn {superior} {Sup} {Sup} |
| 1438 |
\def\supfigures{\@nomath\supfigures |
| 1439 |
\fontfigurestyle{superior}\selectfont} |
| 1440 |
\let\sufigures\supfigures |
| 1441 |
\DeclareTextFontCommand{\textsup}{\supfigures} |
| 1442 |
\let\textsu\textsup |
| 1443 |
\let\textsuperior\textsup |
| 1444 |
\let\@oldtextsuperscript\textsuperscript |
| 1445 |
\def\textsuperscript{\@ifstar\@oldtextsuperscript\textsup} |
| 1446 |
\def\@makefnmark{% |
| 1447 |
\mbox{\footnotemarkfont\textsuperscript{\@thefnmark}}} |
| 1448 |
\@ifundefined{ftntm@font}% |
| 1449 |
{\let\footnotemarkfont\normalfont}% |
| 1450 |
{\let\footnotemarkfont\ftntm@font} |
| 1451 |
|
| 1452 |
END_STY_FIGUREVERSIONS_SUP |
| 1453 |
} |
| 1454 |
|
| 1455 |
if ($seen{Inf}) { |
| 1456 |
print {$STY} <<'END_STY_FIGUREVERSIONS_INF'; |
| 1457 |
\figureversions_new_figurestyle:nnn {inferior} {Inf} {Inf} |
| 1458 |
\def\inffigures{\@nomath\inffigures |
| 1459 |
\fontfigurestyle{inferior}\selectfont} |
| 1460 |
\let\infigures\inffigures |
| 1461 |
\DeclareTextFontCommand{\textinf}{\inffigures} |
| 1462 |
\let\textin\textinf |
| 1463 |
\let\textinferior\textinf |
| 1464 |
\let\@oldtextsubscript\textsubscript |
| 1465 |
\def\textsubscript{\@ifstar\@oldtextsubscript\textinf} |
| 1466 |
|
| 1467 |
END_STY_FIGUREVERSIONS_INF |
| 1468 |
} |
| 1469 |
|
| 1470 |
if ($seen{Titl}) { |
| 1471 |
print {$STY} <<'END_STY_FIGUREVERSIONS_TITL'; |
| 1472 |
\figureversions_new_figurestyle:nnn {titlingshape} {Titl} {Titl} |
| 1473 |
\def\tlshape{\@nomath\tlshape |
| 1474 |
\fontfigurestyle{titlingshape}\selectfont} |
| 1475 |
\DeclareTextFontCommand{\texttl}{\tlshape} |
| 1476 |
\let\texttitling\texttl |
| 1477 |
|
| 1478 |
END_STY_FIGUREVERSIONS_TITL |
| 1479 |
} |
| 1480 |
|
| 1481 |
if ($seen{Orn}) { |
| 1482 |
print {$STY} <<'END_STY_FIGUREVERSIONS_ORN'; |
| 1483 |
\figureversions_new_figurestyle:nnn {ornament} {Orn} {Orn} |
| 1484 |
\def\ornament{\@nomath\ornament |
| 1485 |
\fontencoding{U}\fontfigurestyle{ornament}\selectfont} |
| 1486 |
\newcommand*{\textornament}[1]{{\ornament\char##1}\xspace} |
| 1487 |
% Backward-compatible alternates |
| 1488 |
\let\ornaments\ornament |
| 1489 |
\let\textornaments\textornament |
| 1490 |
|
| 1491 |
END_STY_FIGUREVERSIONS_ORN |
| 1492 |
} |
| 1493 |
|
| 1494 |
if ($seen{Numr}) { |
| 1495 |
print {$STY} <<'END_STY_FIGUREVERSIONS_NUMR'; |
| 1496 |
\figureversions_new_figurestyle:nnn {numerators} {Numr} {Numr} |
| 1497 |
\figureversions_new_figurestyle:nnn {numerator} {Numr} {Numr} |
| 1498 |
|
| 1499 |
END_STY_FIGUREVERSIONS_NUMR |
| 1500 |
} |
| 1501 |
|
| 1502 |
if ($seen{Dnom}) { |
| 1503 |
print {$STY} <<'END_STY_FIGUREVERSIONS_DNOM'; |
| 1504 |
\figureversions_new_figurestyle:nnn {denominators} {Dnom} {Dnom} |
| 1505 |
\figureversions_new_figurestyle:nnn {denominator} {Dnom} {Dnom} |
| 1506 |
|
| 1507 |
END_STY_FIGUREVERSIONS_DNOM |
| 1508 |
} |
| 1509 |
|
| 1510 |
print {$STY} "}{}\n\\ExplSyntaxOff\n\n"; |
| 1511 |
|
| 1512 |
# For the scale=MatchLowercase option, we need the name for |
| 1513 |
# one of the fonts from the family, to pass to plain TeX's |
| 1514 |
# \font macro (as explained below, we cannot use NFSS's |
| 1515 |
# font loading mechanism before we have calculated the correct |
| 1516 |
# scaling parameter). |
| 1517 |
my $testfont = eval { |
| 1518 |
my $testenc = $known_encodings[-1]; |
| 1519 |
my $testfig = ( grep { exists $data->{$testenc}{$_} } |
| 1520 |
qw(OsF LF TOsF TLF) )[0] or die; |
| 1521 |
my $testweight = ( grep { $nfss_mapping->{$_} eq "m" } |
| 1522 |
keys %{$nfss_mapping} )[0] or die; |
| 1523 |
my $testshape |
| 1524 |
= ( grep { exists $data->{$testenc}{$testfig}{$testweight}{$_} } |
| 1525 |
qw(n sc it sl) |
| 1526 |
)[0] or die; |
| 1527 |
return $data->{$testenc}{$testfig}{$testweight}{$testshape}[0][2] |
| 1528 |
|| die; |
| 1529 |
}; |
| 1530 |
|
| 1531 |
if (defined $testfont) { |
| 1532 |
print {$STY} <<"END_STY_MATCHLOWERCASE"; |
| 1533 |
% Here we implement the scale=MatchLowercase option. |
| 1534 |
% If this is given, we must compute the correct value of |
| 1535 |
% the "\\$fam\@scale" parameter before loading the .fd files; |
| 1536 |
% but to determine that value we of course need the font's x-height. |
| 1537 |
% To avoid triggering the loading of .fd files, |
| 1538 |
% we use plain TeX's \\font primitive to load the testfont. |
| 1539 |
% We then compute the ratio of the current x-height to our font's x-height; |
| 1540 |
% this is the "\\$fam\@scale" we will pass to the .fd files. |
| 1541 |
\\ifthenelse{\\equal{\\$fam\@scale}{MatchLowercase}} |
| 1542 |
{ \\newlength{\\$fam\@currentx} |
| 1543 |
\\settoheight{\\$fam\@currentx}{x} |
| 1544 |
\\newlength{\\$fam\@xheight} |
| 1545 |
\\settoheight{\\$fam\@xheight} |
| 1546 |
{{\\font\\testfont=$testfont at \\f\@size pt\\testfont x}} |
| 1547 |
\\renewcommand*{\\$fam\@scale} |
| 1548 |
{\\fpeval{\\$fam\@currentx / \\$fam\@xheight}}} |
| 1549 |
{} |
| 1550 |
|
| 1551 |
END_STY_MATCHLOWERCASE |
| 1552 |
} |
| 1553 |
|
| 1554 |
print {$STY} <<"END_STYLE_REST"; |
| 1555 |
\\renewcommand* |
| 1556 |
{\\$ARGV{nfss}default} |
| 1557 |
{$fam-\\$fam\@figurealign\\$fam\@figurestyle} |
| 1558 |
|
| 1559 |
END_STYLE_REST |
| 1560 |
|
| 1561 |
if ($ARGV{math}) { |
| 1562 |
print {$STY} <<"END_STY_MATH"; |
| 1563 |
% Logically these definitions belong inside the \\if$fam\@math, |
| 1564 |
% but somehow Latex doesn't like that. |
| 1565 |
\\newif\\if$fam\@mathLATINup\\$fam\@mathLATINupfalse |
| 1566 |
\\newif\\if$fam\@mathlatinup\\$fam\@mathlatinupfalse |
| 1567 |
\\newif\\if$fam\@mathGREEKup\\$fam\@mathGREEKupfalse |
| 1568 |
\\newif\\if$fam\@mathgreekup\\$fam\@mathgreekupfalse |
| 1569 |
|
| 1570 |
\\if$fam\@math |
| 1571 |
\\ifthenelse{\\equal{\\$fam\@mathstyle}{TeX}} |
| 1572 |
{\\$fam\@mathGREEKuptrue} |
| 1573 |
{} |
| 1574 |
\\ifthenelse{\\equal{\\$fam\@mathstyle}{french}} |
| 1575 |
{\\$fam\@mathLATINuptrue |
| 1576 |
\\$fam\@mathGREEKuptrue |
| 1577 |
\\$fam\@mathgreekuptrue} |
| 1578 |
{} |
| 1579 |
\\ifthenelse{\\equal{\\$fam\@mathstyle}{upright}} |
| 1580 |
{\\$fam\@mathLATINuptrue |
| 1581 |
\\$fam\@mathlatinuptrue |
| 1582 |
\\$fam\@mathGREEKuptrue |
| 1583 |
\\$fam\@mathgreekuptrue} |
| 1584 |
{} |
| 1585 |
|
| 1586 |
\\DeclareMathSizes{8}{8}{\\fpeval{\\$fam\@Sscale * 6}}{\\fpeval{\\$fam\@SSscale * 5}} |
| 1587 |
\\DeclareMathSizes{9}{9}{\\fpeval{\\$fam\@Sscale * 6}}{\\fpeval{\\$fam\@SSscale * 5}} |
| 1588 |
\\DeclareMathSizes{\\\@xpt}{\\\@xpt}{\\fpeval{\\$fam\@Sscale * 7}}{\\fpeval{\\$fam\@SSscale * 5}} |
| 1589 |
\\DeclareMathSizes{\\\@xipt}{\\\@xipt}{\\fpeval{\\$fam\@Sscale * 8}}{\\fpeval{\\$fam\@SSscale * 6}} |
| 1590 |
\\DeclareMathSizes{\\\@xiipt}{\\\@xiipt}{\\fpeval{\\$fam\@Sscale * 8}}{\\fpeval{\\$fam\@SSscale * 6}} |
| 1591 |
\\DeclareMathSizes{\\\@xivpt}{\\\@xivpt}{\\fpeval{\\$fam\@Sscale * \\\@xpt}}{\\fpeval{\\$fam\@SSscale * 7}} |
| 1592 |
\\DeclareMathSizes{\\\@xviipt}{\\\@xviipt}{\\fpeval{\\$fam\@Sscale * \\\@xiipt}}{\\fpeval{\\$fam\@SSscale * \\\@xpt}} |
| 1593 |
\\DeclareMathSizes{\\\@xxpt}{\\\@xxpt}{\\fpeval{\\$fam\@Sscale * \\\@xivpt}}{\\fpeval{\\$fam\@SSscale * \\\@xiipt}} |
| 1594 |
\\DeclareMathSizes{\\\@xxvpt}{\\\@xxvpt}{\\fpeval{\\$fam\@Sscale * \\\@xxpt}}{\\fpeval{\\$fam\@SSscale * \\\@xviipt}} |
| 1595 |
|
| 1596 |
\\def\\defaultscriptratio{\\fpeval{\\$fam\@Sscale * 0.7}} |
| 1597 |
\\def\\defaultscriptscriptratio{\\fpeval{\\$fam\@SSscale * 0.5}} |
| 1598 |
|
| 1599 |
\\DeclareSymbolFont{newoperators} {OT1}{$fam-\\$fam\@mathfigurealign\\$fam\@mathfigurestyle}{\\mdseries\@$ARGV{nfss}}{n} |
| 1600 |
\\SetSymbolFont{newoperators}{bold}{OT1}{$fam-\\$fam\@mathfigurealign\\$fam\@mathfigurestyle}{\\bfseries\@$ARGV{nfss}}{n} |
| 1601 |
|
| 1602 |
\\DeclareSymbolFont{newletters} {OML}{$fam-\\$fam\@mathfigurealign\\$fam\@mathfigurestyle}{\\mdseries\@$ARGV{nfss}}{it} |
| 1603 |
\\SetSymbolFont{newletters}{bold}{OML}{$fam-\\$fam\@mathfigurealign\\$fam\@mathfigurestyle}{\\bfseries\@$ARGV{nfss}}{it} |
| 1604 |
|
| 1605 |
\\DeclareSymbolFontAlphabet{\\mathrm}{newoperators} |
| 1606 |
\\DeclareSymbolFontAlphabet{\\mathnormal}{newletters} |
| 1607 |
|
| 1608 |
\\def\\operator\@font{\\mathgroup\\symnewoperators} |
| 1609 |
\\SetMathAlphabet{\\mathit}{normal}{OT1}{$fam-\\$fam\@mathfigurealign\\$fam\@mathfigurestyle}{\\mdseries\@$ARGV{nfss}}{it} |
| 1610 |
\\SetMathAlphabet{\\mathit}{bold} {OT1}{$fam-\\$fam\@mathfigurealign\\$fam\@mathfigurestyle}{\\bfseries\@$ARGV{nfss}}{it} |
| 1611 |
|
| 1612 |
\\SetMathAlphabet{\\mathbf}{normal}{OT1}{$fam-\\$fam\@mathfigurealign\\$fam\@mathfigurestyle}{\\bfseries\@$ARGV{nfss}}{n} |
| 1613 |
\\SetMathAlphabet{\\mathbf}{bold} {OT1}{$fam-\\$fam\@mathfigurealign\\$fam\@mathfigurestyle}{\\bfseries\@$ARGV{nfss}}{n} |
| 1614 |
|
| 1615 |
\\def\\re\@DeclareMathSymbol#1#2#3#4{% |
| 1616 |
\\if\\relax\\noexpand#1\\let#1=\\undefined\\fi |
| 1617 |
\\DeclareMathSymbol{#1}{#2}{#3}{#4}} |
| 1618 |
|
| 1619 |
\\def\\re\@DeclareMathDelimiter#1#2#3#4#5#6{% |
| 1620 |
\\let#1=\\undefined |
| 1621 |
\\DeclareMathDelimiter{#1}{#2}{#3}{#4}{#5}{#6}} |
| 1622 |
|
| 1623 |
\\def\\re\@DeclareMathAccent#1#2#3#4{% |
| 1624 |
\\let#1=\\undefined |
| 1625 |
\\DeclareMathAccent{#1}{#2}{#3}{#4}} |
| 1626 |
|
| 1627 |
\\re\@DeclareMathSymbol{0}{\\mathalpha}{newoperators}{`0} |
| 1628 |
\\re\@DeclareMathSymbol{1}{\\mathalpha}{newoperators}{`1} |
| 1629 |
\\re\@DeclareMathSymbol{2}{\\mathalpha}{newoperators}{`2} |
| 1630 |
\\re\@DeclareMathSymbol{3}{\\mathalpha}{newoperators}{`3} |
| 1631 |
\\re\@DeclareMathSymbol{4}{\\mathalpha}{newoperators}{`4} |
| 1632 |
\\re\@DeclareMathSymbol{5}{\\mathalpha}{newoperators}{`5} |
| 1633 |
\\re\@DeclareMathSymbol{6}{\\mathalpha}{newoperators}{`6} |
| 1634 |
\\re\@DeclareMathSymbol{7}{\\mathalpha}{newoperators}{`7} |
| 1635 |
\\re\@DeclareMathSymbol{8}{\\mathalpha}{newoperators}{`8} |
| 1636 |
\\re\@DeclareMathSymbol{9}{\\mathalpha}{newoperators}{`9} |
| 1637 |
|
| 1638 |
\\re\@DeclareMathSymbol{a}{\\mathalpha}{newletters}{`a} |
| 1639 |
\\re\@DeclareMathSymbol{b}{\\mathalpha}{newletters}{`b} |
| 1640 |
\\re\@DeclareMathSymbol{c}{\\mathalpha}{newletters}{`c} |
| 1641 |
\\re\@DeclareMathSymbol{d}{\\mathalpha}{newletters}{`d} |
| 1642 |
\\re\@DeclareMathSymbol{e}{\\mathalpha}{newletters}{`e} |
| 1643 |
\\re\@DeclareMathSymbol{f}{\\mathalpha}{newletters}{`f} |
| 1644 |
\\re\@DeclareMathSymbol{g}{\\mathalpha}{newletters}{`g} |
| 1645 |
\\re\@DeclareMathSymbol{h}{\\mathalpha}{newletters}{`h} |
| 1646 |
\\re\@DeclareMathSymbol{i}{\\mathalpha}{newletters}{`i} |
| 1647 |
\\re\@DeclareMathSymbol{j}{\\mathalpha}{newletters}{`j} |
| 1648 |
\\re\@DeclareMathSymbol{k}{\\mathalpha}{newletters}{`k} |
| 1649 |
\\re\@DeclareMathSymbol{l}{\\mathalpha}{newletters}{`l} |
| 1650 |
\\re\@DeclareMathSymbol{m}{\\mathalpha}{newletters}{`m} |
| 1651 |
\\re\@DeclareMathSymbol{n}{\\mathalpha}{newletters}{`n} |
| 1652 |
\\re\@DeclareMathSymbol{o}{\\mathalpha}{newletters}{`o} |
| 1653 |
\\re\@DeclareMathSymbol{p}{\\mathalpha}{newletters}{`p} |
| 1654 |
\\re\@DeclareMathSymbol{q}{\\mathalpha}{newletters}{`q} |
| 1655 |
\\re\@DeclareMathSymbol{r}{\\mathalpha}{newletters}{`r} |
| 1656 |
\\re\@DeclareMathSymbol{s}{\\mathalpha}{newletters}{`s} |
| 1657 |
\\re\@DeclareMathSymbol{t}{\\mathalpha}{newletters}{`t} |
| 1658 |
\\re\@DeclareMathSymbol{u}{\\mathalpha}{newletters}{`u} |
| 1659 |
\\re\@DeclareMathSymbol{v}{\\mathalpha}{newletters}{`v} |
| 1660 |
\\re\@DeclareMathSymbol{w}{\\mathalpha}{newletters}{`w} |
| 1661 |
\\re\@DeclareMathSymbol{x}{\\mathalpha}{newletters}{`x} |
| 1662 |
\\re\@DeclareMathSymbol{y}{\\mathalpha}{newletters}{`y} |
| 1663 |
\\re\@DeclareMathSymbol{z}{\\mathalpha}{newletters}{`z} |
| 1664 |
|
| 1665 |
\\re\@DeclareMathSymbol{A}{\\mathalpha}{newletters}{`A} |
| 1666 |
\\re\@DeclareMathSymbol{B}{\\mathalpha}{newletters}{`B} |
| 1667 |
\\re\@DeclareMathSymbol{C}{\\mathalpha}{newletters}{`C} |
| 1668 |
\\re\@DeclareMathSymbol{D}{\\mathalpha}{newletters}{`D} |
| 1669 |
\\re\@DeclareMathSymbol{E}{\\mathalpha}{newletters}{`E} |
| 1670 |
\\re\@DeclareMathSymbol{F}{\\mathalpha}{newletters}{`F} |
| 1671 |
\\re\@DeclareMathSymbol{G}{\\mathalpha}{newletters}{`G} |
| 1672 |
\\re\@DeclareMathSymbol{H}{\\mathalpha}{newletters}{`H} |
| 1673 |
\\re\@DeclareMathSymbol{I}{\\mathalpha}{newletters}{`I} |
| 1674 |
\\re\@DeclareMathSymbol{J}{\\mathalpha}{newletters}{`J} |
| 1675 |
\\re\@DeclareMathSymbol{K}{\\mathalpha}{newletters}{`K} |
| 1676 |
\\re\@DeclareMathSymbol{L}{\\mathalpha}{newletters}{`L} |
| 1677 |
\\re\@DeclareMathSymbol{M}{\\mathalpha}{newletters}{`M} |
| 1678 |
\\re\@DeclareMathSymbol{N}{\\mathalpha}{newletters}{`N} |
| 1679 |
\\re\@DeclareMathSymbol{O}{\\mathalpha}{newletters}{`O} |
| 1680 |
\\re\@DeclareMathSymbol{P}{\\mathalpha}{newletters}{`P} |
| 1681 |
\\re\@DeclareMathSymbol{Q}{\\mathalpha}{newletters}{`Q} |
| 1682 |
\\re\@DeclareMathSymbol{R}{\\mathalpha}{newletters}{`R} |
| 1683 |
\\re\@DeclareMathSymbol{S}{\\mathalpha}{newletters}{`S} |
| 1684 |
\\re\@DeclareMathSymbol{T}{\\mathalpha}{newletters}{`T} |
| 1685 |
\\re\@DeclareMathSymbol{U}{\\mathalpha}{newletters}{`U} |
| 1686 |
\\re\@DeclareMathSymbol{V}{\\mathalpha}{newletters}{`V} |
| 1687 |
\\re\@DeclareMathSymbol{W}{\\mathalpha}{newletters}{`W} |
| 1688 |
\\re\@DeclareMathSymbol{X}{\\mathalpha}{newletters}{`X} |
| 1689 |
\\re\@DeclareMathSymbol{Y}{\\mathalpha}{newletters}{`Y} |
| 1690 |
\\re\@DeclareMathSymbol{Z}{\\mathalpha}{newletters}{`Z} |
| 1691 |
|
| 1692 |
\\re\@DeclareMathSymbol{\\partial}{\\mathord}{newletters}{"40} |
| 1693 |
\\re\@DeclareMathSymbol{\\ell} {\\mathord}{newletters}{"60} |
| 1694 |
\\re\@DeclareMathSymbol{\\imath} {\\mathord}{newletters}{"7B} |
| 1695 |
\\re\@DeclareMathSymbol{\\jmath} {\\mathord}{newletters}{"7C} |
| 1696 |
|
| 1697 |
% |
| 1698 |
% A number of math symbol declarations have been commented out, |
| 1699 |
% since these characters generally do not work very well when |
| 1700 |
% typesetting maths (either because of spacing issues or because |
| 1701 |
% they don't mix with others symbols). |
| 1702 |
% The commented-out declarations have been left in this style file |
| 1703 |
% in case the user does want to re-activate those characters. |
| 1704 |
% |
| 1705 |
|
| 1706 |
\\re\@DeclareMathSymbol{!}{\\mathclose}{newoperators}{"21} |
| 1707 |
% \\re\@DeclareMathSymbol{+}{\\mathbin} {newoperators}{"2B} |
| 1708 |
% \\re\@DeclareMathSymbol{:}{\\mathrel} {newoperators}{"3A} |
| 1709 |
\\re\@DeclareMathSymbol{;}{\\mathpunct}{newoperators}{"3B} |
| 1710 |
% \\re\@DeclareMathSymbol{=}{\\mathrel} {newoperators}{"3D} |
| 1711 |
\\re\@DeclareMathSymbol{?}{\\mathclose}{newoperators}{"3F} |
| 1712 |
|
| 1713 |
% \\re\@DeclareMathSymbol{.}{\\mathord} {newletters}{"3A} |
| 1714 |
\\re\@DeclareMathSymbol{,}{\\mathpunct}{newletters}{"3B} |
| 1715 |
% \\re\@DeclareMathSymbol{<}{\\mathrel} {newletters}{"3C} |
| 1716 |
% \\re\@DeclareMathSymbol{/}{\\mathord} {newletters}{"3D} |
| 1717 |
% \\re\@DeclareMathSymbol{>}{\\mathrel} {newletters}{"3E} |
| 1718 |
|
| 1719 |
\\re\@DeclareMathSymbol{\\mathdollar}{\\mathord} {newoperators}{"24} |
| 1720 |
\\re\@DeclareMathSymbol{\\colon} {\\mathpunct}{newoperators}{"3A} |
| 1721 |
|
| 1722 |
% \\DeclareMathDelimiter{(}{\\mathopen} {newoperators}{"28}{largesymbols}{"00} |
| 1723 |
% \\DeclareMathDelimiter{)}{\\mathclose}{newoperators}{"29}{largesymbols}{"01} |
| 1724 |
% \\DeclareMathDelimiter{[}{\\mathopen} {newoperators}{"5B}{largesymbols}{"02} |
| 1725 |
% \\DeclareMathDelimiter{]}{\\mathclose}{newoperators}{"5D}{largesymbols}{"03} |
| 1726 |
% \\DeclareMathDelimiter{/}{\\mathord} {newoperators}{"2F}{largesymbols}{"0E} |
| 1727 |
|
| 1728 |
\\re\@DeclareMathAccent{\\grave} {\\mathalpha}{newoperators}{"12} |
| 1729 |
\\re\@DeclareMathAccent{\\acute} {\\mathalpha}{newoperators}{"13} |
| 1730 |
\\re\@DeclareMathAccent{\\check} {\\mathalpha}{newoperators}{"14} |
| 1731 |
\\re\@DeclareMathAccent{\\breve} {\\mathalpha}{newoperators}{"15} |
| 1732 |
\\re\@DeclareMathAccent{\\bar} {\\mathalpha}{newoperators}{"16} |
| 1733 |
\\re\@DeclareMathAccent{\\mathring}{\\mathalpha}{newoperators}{"17} |
| 1734 |
\\re\@DeclareMathAccent{\\hat} {\\mathalpha}{newoperators}{"5E} |
| 1735 |
\\re\@DeclareMathAccent{\\dot} {\\mathalpha}{newoperators}{"5F} |
| 1736 |
\\re\@DeclareMathAccent{\\tilde} {\\mathalpha}{newoperators}{"7E} |
| 1737 |
\\re\@DeclareMathAccent{\\ddot} {\\mathalpha}{newoperators}{"7F} |
| 1738 |
|
| 1739 |
\\if$fam\@mathgreek |
| 1740 |
\\re\@DeclareMathSymbol{\\Gamma} {\\mathalpha}{newoperators}{"00} |
| 1741 |
\\re\@DeclareMathSymbol{\\Delta} {\\mathalpha}{newoperators}{"01} |
| 1742 |
\\re\@DeclareMathSymbol{\\Theta} {\\mathalpha}{newoperators}{"02} |
| 1743 |
\\re\@DeclareMathSymbol{\\Lambda} {\\mathalpha}{newoperators}{"03} |
| 1744 |
\\re\@DeclareMathSymbol{\\Xi} {\\mathalpha}{newoperators}{"04} |
| 1745 |
\\re\@DeclareMathSymbol{\\Pi} {\\mathalpha}{newoperators}{"05} |
| 1746 |
\\re\@DeclareMathSymbol{\\Sigma} {\\mathalpha}{newoperators}{"06} |
| 1747 |
\\re\@DeclareMathSymbol{\\Upsilon} {\\mathalpha}{newoperators}{"07} |
| 1748 |
\\re\@DeclareMathSymbol{\\Phi} {\\mathalpha}{newoperators}{"08} |
| 1749 |
\\re\@DeclareMathSymbol{\\Psi} {\\mathalpha}{newoperators}{"09} |
| 1750 |
\\re\@DeclareMathSymbol{\\Omega} {\\mathalpha}{newoperators}{"0A} |
| 1751 |
|
| 1752 |
\\re\@DeclareMathSymbol{\\upGamma} {\\mathalpha}{newoperators}{"00} |
| 1753 |
\\re\@DeclareMathSymbol{\\upDelta} {\\mathalpha}{newoperators}{"01} |
| 1754 |
\\re\@DeclareMathSymbol{\\upTheta} {\\mathalpha}{newoperators}{"02} |
| 1755 |
\\re\@DeclareMathSymbol{\\upLambda} {\\mathalpha}{newoperators}{"03} |
| 1756 |
\\re\@DeclareMathSymbol{\\upXi} {\\mathalpha}{newoperators}{"04} |
| 1757 |
\\re\@DeclareMathSymbol{\\upPi} {\\mathalpha}{newoperators}{"05} |
| 1758 |
\\re\@DeclareMathSymbol{\\upSigma} {\\mathalpha}{newoperators}{"06} |
| 1759 |
\\re\@DeclareMathSymbol{\\upUpsilon}{\\mathalpha}{newoperators}{"07} |
| 1760 |
\\re\@DeclareMathSymbol{\\upPhi} {\\mathalpha}{newoperators}{"08} |
| 1761 |
\\re\@DeclareMathSymbol{\\upPsi} {\\mathalpha}{newoperators}{"09} |
| 1762 |
\\re\@DeclareMathSymbol{\\upOmega} {\\mathalpha}{newoperators}{"0A} |
| 1763 |
|
| 1764 |
\\re\@DeclareMathSymbol{\\alpha} {\\mathord}{newletters}{"0B} |
| 1765 |
\\re\@DeclareMathSymbol{\\beta} {\\mathord}{newletters}{"0C} |
| 1766 |
\\re\@DeclareMathSymbol{\\gamma} {\\mathord}{newletters}{"0D} |
| 1767 |
\\re\@DeclareMathSymbol{\\delta} {\\mathord}{newletters}{"0E} |
| 1768 |
\\re\@DeclareMathSymbol{\\epsilon} {\\mathord}{newletters}{"0F} |
| 1769 |
\\re\@DeclareMathSymbol{\\zeta} {\\mathord}{newletters}{"10} |
| 1770 |
\\re\@DeclareMathSymbol{\\eta} {\\mathord}{newletters}{"11} |
| 1771 |
\\re\@DeclareMathSymbol{\\theta} {\\mathord}{newletters}{"12} |
| 1772 |
\\re\@DeclareMathSymbol{\\iota} {\\mathord}{newletters}{"13} |
| 1773 |
\\re\@DeclareMathSymbol{\\kappa} {\\mathord}{newletters}{"14} |
| 1774 |
\\re\@DeclareMathSymbol{\\lambda} {\\mathord}{newletters}{"15} |
| 1775 |
\\re\@DeclareMathSymbol{\\mu} {\\mathord}{newletters}{"16} |
| 1776 |
\\re\@DeclareMathSymbol{\\nu} {\\mathord}{newletters}{"17} |
| 1777 |
\\re\@DeclareMathSymbol{\\xi} {\\mathord}{newletters}{"18} |
| 1778 |
\\re\@DeclareMathSymbol{\\pi} {\\mathord}{newletters}{"19} |
| 1779 |
\\re\@DeclareMathSymbol{\\rho} {\\mathord}{newletters}{"1A} |
| 1780 |
\\re\@DeclareMathSymbol{\\sigma} {\\mathord}{newletters}{"1B} |
| 1781 |
\\re\@DeclareMathSymbol{\\tau} {\\mathord}{newletters}{"1C} |
| 1782 |
\\re\@DeclareMathSymbol{\\upsilon} {\\mathord}{newletters}{"1D} |
| 1783 |
\\re\@DeclareMathSymbol{\\phi} {\\mathord}{newletters}{"1E} |
| 1784 |
\\re\@DeclareMathSymbol{\\chi} {\\mathord}{newletters}{"1F} |
| 1785 |
\\re\@DeclareMathSymbol{\\psi} {\\mathord}{newletters}{"20} |
| 1786 |
\\re\@DeclareMathSymbol{\\omega} {\\mathord}{newletters}{"21} |
| 1787 |
\\re\@DeclareMathSymbol{\\varepsilon} {\\mathord}{newletters}{"22} |
| 1788 |
\\re\@DeclareMathSymbol{\\vartheta} {\\mathord}{newletters}{"23} |
| 1789 |
\\re\@DeclareMathSymbol{\\varpi} {\\mathord}{newletters}{"24} |
| 1790 |
\\re\@DeclareMathSymbol{\\varrho} {\\mathord}{newletters}{"25} |
| 1791 |
\\re\@DeclareMathSymbol{\\varsigma} {\\mathord}{newletters}{"26} |
| 1792 |
\\re\@DeclareMathSymbol{\\varphi} {\\mathord}{newletters}{"27} |
| 1793 |
|
| 1794 |
\\re\@DeclareMathSymbol{\\italpha} {\\mathord}{newletters}{"0B} |
| 1795 |
\\re\@DeclareMathSymbol{\\itbeta} {\\mathord}{newletters}{"0C} |
| 1796 |
\\re\@DeclareMathSymbol{\\itgamma} {\\mathord}{newletters}{"0D} |
| 1797 |
\\re\@DeclareMathSymbol{\\itdelta} {\\mathord}{newletters}{"0E} |
| 1798 |
\\re\@DeclareMathSymbol{\\itepsilon} {\\mathord}{newletters}{"0F} |
| 1799 |
\\re\@DeclareMathSymbol{\\itzeta} {\\mathord}{newletters}{"10} |
| 1800 |
\\re\@DeclareMathSymbol{\\iteta} {\\mathord}{newletters}{"11} |
| 1801 |
\\re\@DeclareMathSymbol{\\ittheta} {\\mathord}{newletters}{"12} |
| 1802 |
\\re\@DeclareMathSymbol{\\itiota} {\\mathord}{newletters}{"13} |
| 1803 |
\\re\@DeclareMathSymbol{\\itkappa} {\\mathord}{newletters}{"14} |
| 1804 |
\\re\@DeclareMathSymbol{\\itlambda} {\\mathord}{newletters}{"15} |
| 1805 |
\\re\@DeclareMathSymbol{\\itmu} {\\mathord}{newletters}{"16} |
| 1806 |
\\re\@DeclareMathSymbol{\\itnu} {\\mathord}{newletters}{"17} |
| 1807 |
\\re\@DeclareMathSymbol{\\itxi} {\\mathord}{newletters}{"18} |
| 1808 |
\\re\@DeclareMathSymbol{\\itpi} {\\mathord}{newletters}{"19} |
| 1809 |
\\re\@DeclareMathSymbol{\\itrho} {\\mathord}{newletters}{"1A} |
| 1810 |
\\re\@DeclareMathSymbol{\\itsigma} {\\mathord}{newletters}{"1B} |
| 1811 |
\\re\@DeclareMathSymbol{\\ittau} {\\mathord}{newletters}{"1C} |
| 1812 |
\\re\@DeclareMathSymbol{\\itupsilon} {\\mathord}{newletters}{"1D} |
| 1813 |
\\re\@DeclareMathSymbol{\\itphi} {\\mathord}{newletters}{"1E} |
| 1814 |
\\re\@DeclareMathSymbol{\\itchi} {\\mathord}{newletters}{"1F} |
| 1815 |
\\re\@DeclareMathSymbol{\\itpsi} {\\mathord}{newletters}{"20} |
| 1816 |
\\re\@DeclareMathSymbol{\\itomega} {\\mathord}{newletters}{"21} |
| 1817 |
\\re\@DeclareMathSymbol{\\itvarepsilon}{\\mathord}{newletters}{"22} |
| 1818 |
\\re\@DeclareMathSymbol{\\itvartheta} {\\mathord}{newletters}{"23} |
| 1819 |
\\re\@DeclareMathSymbol{\\itvarpi} {\\mathord}{newletters}{"24} |
| 1820 |
\\re\@DeclareMathSymbol{\\itvarrho} {\\mathord}{newletters}{"25} |
| 1821 |
\\re\@DeclareMathSymbol{\\itvarsigma} {\\mathord}{newletters}{"26} |
| 1822 |
\\re\@DeclareMathSymbol{\\itvarphi} {\\mathord}{newletters}{"27} |
| 1823 |
\\fi |
| 1824 |
|
| 1825 |
\\if$fam\@mathLATINup |
| 1826 |
\\re\@DeclareMathSymbol{A}{\\mathalpha}{newoperators}{`A} |
| 1827 |
\\re\@DeclareMathSymbol{B}{\\mathalpha}{newoperators}{`B} |
| 1828 |
\\re\@DeclareMathSymbol{C}{\\mathalpha}{newoperators}{`C} |
| 1829 |
\\re\@DeclareMathSymbol{D}{\\mathalpha}{newoperators}{`D} |
| 1830 |
\\re\@DeclareMathSymbol{E}{\\mathalpha}{newoperators}{`E} |
| 1831 |
\\re\@DeclareMathSymbol{F}{\\mathalpha}{newoperators}{`F} |
| 1832 |
\\re\@DeclareMathSymbol{G}{\\mathalpha}{newoperators}{`G} |
| 1833 |
\\re\@DeclareMathSymbol{H}{\\mathalpha}{newoperators}{`H} |
| 1834 |
\\re\@DeclareMathSymbol{I}{\\mathalpha}{newoperators}{`I} |
| 1835 |
\\re\@DeclareMathSymbol{J}{\\mathalpha}{newoperators}{`J} |
| 1836 |
\\re\@DeclareMathSymbol{K}{\\mathalpha}{newoperators}{`K} |
| 1837 |
\\re\@DeclareMathSymbol{L}{\\mathalpha}{newoperators}{`L} |
| 1838 |
\\re\@DeclareMathSymbol{M}{\\mathalpha}{newoperators}{`M} |
| 1839 |
\\re\@DeclareMathSymbol{N}{\\mathalpha}{newoperators}{`N} |
| 1840 |
\\re\@DeclareMathSymbol{O}{\\mathalpha}{newoperators}{`O} |
| 1841 |
\\re\@DeclareMathSymbol{P}{\\mathalpha}{newoperators}{`P} |
| 1842 |
\\re\@DeclareMathSymbol{Q}{\\mathalpha}{newoperators}{`Q} |
| 1843 |
\\re\@DeclareMathSymbol{R}{\\mathalpha}{newoperators}{`R} |
| 1844 |
\\re\@DeclareMathSymbol{S}{\\mathalpha}{newoperators}{`S} |
| 1845 |
\\re\@DeclareMathSymbol{T}{\\mathalpha}{newoperators}{`T} |
| 1846 |
\\re\@DeclareMathSymbol{U}{\\mathalpha}{newoperators}{`U} |
| 1847 |
\\re\@DeclareMathSymbol{V}{\\mathalpha}{newoperators}{`V} |
| 1848 |
\\re\@DeclareMathSymbol{W}{\\mathalpha}{newoperators}{`W} |
| 1849 |
\\re\@DeclareMathSymbol{X}{\\mathalpha}{newoperators}{`X} |
| 1850 |
\\re\@DeclareMathSymbol{Y}{\\mathalpha}{newoperators}{`Y} |
| 1851 |
\\re\@DeclareMathSymbol{Z}{\\mathalpha}{newoperators}{`Z} |
| 1852 |
\\fi |
| 1853 |
|
| 1854 |
\\if$fam\@mathlatinup |
| 1855 |
\\DeclareSymbolFont{upletters} {OML}{$fam-\\$fam\@mathfigurealign\\$fam\@mathfigurestyle}{\\mdseries\@$ARGV{nfss}}{n} |
| 1856 |
\\SetSymbolFont{upletters}{bold}{OML}{$fam-\\$fam\@mathfigurealign\\$fam\@mathfigurestyle}{\\bfseries\@$ARGV{nfss}}{n} |
| 1857 |
|
| 1858 |
\\re\@DeclareMathSymbol{a}{\\mathord}{upletters}{`a} |
| 1859 |
\\re\@DeclareMathSymbol{b}{\\mathord}{upletters}{`b} |
| 1860 |
\\re\@DeclareMathSymbol{c}{\\mathord}{upletters}{`c} |
| 1861 |
\\re\@DeclareMathSymbol{d}{\\mathord}{upletters}{`d} |
| 1862 |
\\re\@DeclareMathSymbol{e}{\\mathord}{upletters}{`e} |
| 1863 |
\\re\@DeclareMathSymbol{f}{\\mathord}{upletters}{`f} |
| 1864 |
\\re\@DeclareMathSymbol{g}{\\mathord}{upletters}{`g} |
| 1865 |
\\re\@DeclareMathSymbol{h}{\\mathord}{upletters}{`h} |
| 1866 |
\\re\@DeclareMathSymbol{i}{\\mathord}{upletters}{`i} |
| 1867 |
\\re\@DeclareMathSymbol{j}{\\mathord}{upletters}{`j} |
| 1868 |
\\re\@DeclareMathSymbol{k}{\\mathord}{upletters}{`k} |
| 1869 |
\\re\@DeclareMathSymbol{l}{\\mathord}{upletters}{`l} |
| 1870 |
\\re\@DeclareMathSymbol{m}{\\mathord}{upletters}{`m} |
| 1871 |
\\re\@DeclareMathSymbol{n}{\\mathord}{upletters}{`n} |
| 1872 |
\\re\@DeclareMathSymbol{o}{\\mathord}{upletters}{`o} |
| 1873 |
\\re\@DeclareMathSymbol{p}{\\mathord}{upletters}{`p} |
| 1874 |
\\re\@DeclareMathSymbol{q}{\\mathord}{upletters}{`q} |
| 1875 |
\\re\@DeclareMathSymbol{r}{\\mathord}{upletters}{`r} |
| 1876 |
\\re\@DeclareMathSymbol{s}{\\mathord}{upletters}{`s} |
| 1877 |
\\re\@DeclareMathSymbol{t}{\\mathord}{upletters}{`t} |
| 1878 |
\\re\@DeclareMathSymbol{u}{\\mathord}{upletters}{`u} |
| 1879 |
\\re\@DeclareMathSymbol{v}{\\mathord}{upletters}{`v} |
| 1880 |
\\re\@DeclareMathSymbol{w}{\\mathord}{upletters}{`w} |
| 1881 |
\\re\@DeclareMathSymbol{x}{\\mathord}{upletters}{`x} |
| 1882 |
\\re\@DeclareMathSymbol{y}{\\mathord}{upletters}{`y} |
| 1883 |
\\re\@DeclareMathSymbol{z}{\\mathord}{upletters}{`z} |
| 1884 |
|
| 1885 |
\\re\@DeclareMathSymbol{\\imath}{\\mathord}{upletters}{"7B} |
| 1886 |
\\re\@DeclareMathSymbol{\\jmath}{\\mathord}{upletters}{"7C} |
| 1887 |
\\fi |
| 1888 |
|
| 1889 |
\\if$fam\@mathgreek |
| 1890 |
\\if$fam\@mathGREEKup |
| 1891 |
\\else |
| 1892 |
\\re\@DeclareMathSymbol{\\Gamma} {\\mathalpha}{newletters}{"00} |
| 1893 |
\\re\@DeclareMathSymbol{\\Delta} {\\mathalpha}{newletters}{"01} |
| 1894 |
\\re\@DeclareMathSymbol{\\Theta} {\\mathalpha}{newletters}{"02} |
| 1895 |
\\re\@DeclareMathSymbol{\\Lambda} {\\mathalpha}{newletters}{"03} |
| 1896 |
\\re\@DeclareMathSymbol{\\Xi} {\\mathalpha}{newletters}{"04} |
| 1897 |
\\re\@DeclareMathSymbol{\\Pi} {\\mathalpha}{newletters}{"05} |
| 1898 |
\\re\@DeclareMathSymbol{\\Sigma} {\\mathalpha}{newletters}{"06} |
| 1899 |
\\re\@DeclareMathSymbol{\\Upsilon}{\\mathalpha}{newletters}{"07} |
| 1900 |
\\re\@DeclareMathSymbol{\\Phi} {\\mathalpha}{newletters}{"08} |
| 1901 |
\\re\@DeclareMathSymbol{\\Psi} {\\mathalpha}{newletters}{"09} |
| 1902 |
\\re\@DeclareMathSymbol{\\Omega} {\\mathalpha}{newletters}{"0A} |
| 1903 |
\\fi |
| 1904 |
\\re\@DeclareMathSymbol{\\itGamma} {\\mathalpha}{newletters}{"00} |
| 1905 |
\\re\@DeclareMathSymbol{\\itDelta} {\\mathalpha}{newletters}{"01} |
| 1906 |
\\re\@DeclareMathSymbol{\\itTheta} {\\mathalpha}{newletters}{"02} |
| 1907 |
\\re\@DeclareMathSymbol{\\itLambda} {\\mathalpha}{newletters}{"03} |
| 1908 |
\\re\@DeclareMathSymbol{\\itXi} {\\mathalpha}{newletters}{"04} |
| 1909 |
\\re\@DeclareMathSymbol{\\itPi} {\\mathalpha}{newletters}{"05} |
| 1910 |
\\re\@DeclareMathSymbol{\\itSigma} {\\mathalpha}{newletters}{"06} |
| 1911 |
\\re\@DeclareMathSymbol{\\itUpsilon}{\\mathalpha}{newletters}{"07} |
| 1912 |
\\re\@DeclareMathSymbol{\\itPhi} {\\mathalpha}{newletters}{"08} |
| 1913 |
\\re\@DeclareMathSymbol{\\itPsi} {\\mathalpha}{newletters}{"09} |
| 1914 |
\\re\@DeclareMathSymbol{\\itOmega} {\\mathalpha}{newletters}{"0A} |
| 1915 |
|
| 1916 |
\\DeclareSymbolFont{upletters} {OML}{$fam-\\$fam\@mathfigurealign\\$fam\@mathfigurestyle}{\\mdseries\@$ARGV{nfss}}{n} |
| 1917 |
\\SetSymbolFont{upletters}{bold}{OML}{$fam-\\$fam\@mathfigurealign\\$fam\@mathfigurestyle}{\\bfseries\@$ARGV{nfss}}{n} |
| 1918 |
\\if$fam\@mathgreekup |
| 1919 |
\\re\@DeclareMathSymbol{\\alpha} {\\mathord}{upletters}{"0B} |
| 1920 |
\\re\@DeclareMathSymbol{\\beta} {\\mathord}{upletters}{"0C} |
| 1921 |
\\re\@DeclareMathSymbol{\\gamma} {\\mathord}{upletters}{"0D} |
| 1922 |
\\re\@DeclareMathSymbol{\\delta} {\\mathord}{upletters}{"0E} |
| 1923 |
\\re\@DeclareMathSymbol{\\epsilon} {\\mathord}{upletters}{"0F} |
| 1924 |
\\re\@DeclareMathSymbol{\\zeta} {\\mathord}{upletters}{"10} |
| 1925 |
\\re\@DeclareMathSymbol{\\eta} {\\mathord}{upletters}{"11} |
| 1926 |
\\re\@DeclareMathSymbol{\\theta} {\\mathord}{upletters}{"12} |
| 1927 |
\\re\@DeclareMathSymbol{\\iota} {\\mathord}{upletters}{"13} |
| 1928 |
\\re\@DeclareMathSymbol{\\kappa} {\\mathord}{upletters}{"14} |
| 1929 |
\\re\@DeclareMathSymbol{\\lambda} {\\mathord}{upletters}{"15} |
| 1930 |
\\re\@DeclareMathSymbol{\\mu} {\\mathord}{upletters}{"16} |
| 1931 |
\\re\@DeclareMathSymbol{\\nu} {\\mathord}{upletters}{"17} |
| 1932 |
\\re\@DeclareMathSymbol{\\xi} {\\mathord}{upletters}{"18} |
| 1933 |
\\re\@DeclareMathSymbol{\\pi} {\\mathord}{upletters}{"19} |
| 1934 |
\\re\@DeclareMathSymbol{\\rho} {\\mathord}{upletters}{"1A} |
| 1935 |
\\re\@DeclareMathSymbol{\\sigma} {\\mathord}{upletters}{"1B} |
| 1936 |
\\re\@DeclareMathSymbol{\\tau} {\\mathord}{upletters}{"1C} |
| 1937 |
\\re\@DeclareMathSymbol{\\upsilon} {\\mathord}{upletters}{"1D} |
| 1938 |
\\re\@DeclareMathSymbol{\\phi} {\\mathord}{upletters}{"1E} |
| 1939 |
\\re\@DeclareMathSymbol{\\chi} {\\mathord}{upletters}{"1F} |
| 1940 |
\\re\@DeclareMathSymbol{\\psi} {\\mathord}{upletters}{"20} |
| 1941 |
\\re\@DeclareMathSymbol{\\omega} {\\mathord}{upletters}{"21} |
| 1942 |
\\re\@DeclareMathSymbol{\\varepsilon}{\\mathord}{upletters}{"22} |
| 1943 |
\\re\@DeclareMathSymbol{\\vartheta} {\\mathord}{upletters}{"23} |
| 1944 |
\\re\@DeclareMathSymbol{\\varpi} {\\mathord}{upletters}{"24} |
| 1945 |
\\re\@DeclareMathSymbol{\\varrho} {\\mathord}{upletters}{"25} |
| 1946 |
\\re\@DeclareMathSymbol{\\varsigma} {\\mathord}{upletters}{"26} |
| 1947 |
\\re\@DeclareMathSymbol{\\varphi} {\\mathord}{upletters}{"27} |
| 1948 |
\\fi |
| 1949 |
\\re\@DeclareMathSymbol{\\upalpha} {\\mathord}{upletters}{"0B} |
| 1950 |
\\re\@DeclareMathSymbol{\\upbeta} {\\mathord}{upletters}{"0C} |
| 1951 |
\\re\@DeclareMathSymbol{\\upgamma} {\\mathord}{upletters}{"0D} |
| 1952 |
\\re\@DeclareMathSymbol{\\updelta} {\\mathord}{upletters}{"0E} |
| 1953 |
\\re\@DeclareMathSymbol{\\upepsilon} {\\mathord}{upletters}{"0F} |
| 1954 |
\\re\@DeclareMathSymbol{\\upzeta} {\\mathord}{upletters}{"10} |
| 1955 |
\\re\@DeclareMathSymbol{\\upeta} {\\mathord}{upletters}{"11} |
| 1956 |
\\re\@DeclareMathSymbol{\\uptheta} {\\mathord}{upletters}{"12} |
| 1957 |
\\re\@DeclareMathSymbol{\\upiota} {\\mathord}{upletters}{"13} |
| 1958 |
\\re\@DeclareMathSymbol{\\upkappa} {\\mathord}{upletters}{"14} |
| 1959 |
\\re\@DeclareMathSymbol{\\uplambda} {\\mathord}{upletters}{"15} |
| 1960 |
\\re\@DeclareMathSymbol{\\upmu} {\\mathord}{upletters}{"16} |
| 1961 |
\\re\@DeclareMathSymbol{\\upnu} {\\mathord}{upletters}{"17} |
| 1962 |
\\re\@DeclareMathSymbol{\\upxi} {\\mathord}{upletters}{"18} |
| 1963 |
\\re\@DeclareMathSymbol{\\uppi} {\\mathord}{upletters}{"19} |
| 1964 |
\\re\@DeclareMathSymbol{\\uprho} {\\mathord}{upletters}{"1A} |
| 1965 |
\\re\@DeclareMathSymbol{\\upsigma} {\\mathord}{upletters}{"1B} |
| 1966 |
\\re\@DeclareMathSymbol{\\uptau} {\\mathord}{upletters}{"1C} |
| 1967 |
\\re\@DeclareMathSymbol{\\upupsilon} {\\mathord}{upletters}{"1D} |
| 1968 |
\\re\@DeclareMathSymbol{\\upphi} {\\mathord}{upletters}{"1E} |
| 1969 |
\\re\@DeclareMathSymbol{\\upchi} {\\mathord}{upletters}{"1F} |
| 1970 |
\\re\@DeclareMathSymbol{\\uppsi} {\\mathord}{upletters}{"20} |
| 1971 |
\\re\@DeclareMathSymbol{\\upomega} {\\mathord}{upletters}{"21} |
| 1972 |
\\re\@DeclareMathSymbol{\\upvarepsilon}{\\mathord}{upletters}{"22} |
| 1973 |
\\re\@DeclareMathSymbol{\\upvartheta} {\\mathord}{upletters}{"23} |
| 1974 |
\\re\@DeclareMathSymbol{\\upvarpi} {\\mathord}{upletters}{"24} |
| 1975 |
\\re\@DeclareMathSymbol{\\upvarrho} {\\mathord}{upletters}{"25} |
| 1976 |
\\re\@DeclareMathSymbol{\\upvarsigma} {\\mathord}{upletters}{"26} |
| 1977 |
\\re\@DeclareMathSymbol{\\upvarphi} {\\mathord}{upletters}{"27} |
| 1978 |
\\fi |
| 1979 |
\\fi |
| 1980 |
|
| 1981 |
END_STY_MATH |
| 1982 |
|
| 1983 |
if ($seen{sw}) { |
| 1984 |
print {$STY} <<"END_STY_MATHCAL"; |
| 1985 |
\\if$fam\@mathcal |
| 1986 |
\\SetMathAlphabet{\\mathcal}{normal}{OT1}{$fam-\\$fam\@mathfigurealign\\$fam\@mathfigurestyle}{\\mdseries\@$ARGV{nfss}}{sw} |
| 1987 |
\\SetMathAlphabet{\\mathcal}{bold} {OT1}{$fam-\\$fam\@mathfigurealign\\$fam\@mathfigurestyle}{\\bfseries\@$ARGV{nfss}}{sw} |
| 1988 |
\\fi |
| 1989 |
|
| 1990 |
END_STY_MATHCAL |
| 1991 |
} |
| 1992 |
} |
| 1993 |
|
| 1994 |
print {$STY} "\\endinput\n"; |
| 1995 |
close $STY; |
| 1996 |
|
| 1997 |
return; |
| 1998 |
} |
| 1999 |
|
| 2000 |
|
| 2001 |
# -------------------------------------------------------------------------- |
| 2002 |
# Creates a .fd file for LaTeX. |
| 2003 |
# -------------------------------------------------------------------------- |
| 2004 |
sub create_fdfile { |
| 2005 |
my ($nfss_mapping, $fam, $enc, $sty, $data) = @_; |
| 2006 |
|
| 2007 |
my $fn = sprintf "%s%s-%s.fd", $enc, $fam, $sty; |
| 2008 |
my $dir = File::Spec->catdir( |
| 2009 |
$ARGV{target}, 'tex', 'latex', $ARGV{typeface} || $fam); |
| 2010 |
File::Path::make_path($dir); |
| 2011 |
$fn = File::Spec->catfile($dir, $fn); |
| 2012 |
open my $FD, '>', $fn |
| 2013 |
or die "[ERROR] Can't create '$fn': $!"; |
| 2014 |
binmode $FD; |
| 2015 |
|
| 2016 |
print {$FD} <<"END_FD_HEADER"; |
| 2017 |
%% Generated by autoinst on $TODAY |
| 2018 |
%% |
| 2019 |
\\ProvidesFile{$enc$fam-$sty.fd} |
| 2020 |
[$TODAY (autoinst) Font definitions for $enc/$fam-$sty.] |
| 2021 |
|
| 2022 |
\\ifcsname s\@fct\@alias\\endcsname\\else |
| 2023 |
\\gdef\\s\@fct\@alias{\\sub\@sfcnt\\\@font\@aliasinfo} |
| 2024 |
\\gdef\\\@font\@aliasinfo#1{% |
| 2025 |
\\\@font\@info{Font\\space shape\\space `\\curr\@fontshape'\\space will |
| 2026 |
\\space be\\space aliased\\MessageBreak to\\space `\\mandatory\@arg'}% |
| 2027 |
} |
| 2028 |
\\fi |
| 2029 |
|
| 2030 |
\\expandafter\\ifx\\csname $fam\@scale\\endcsname\\relax |
| 2031 |
\\let\\$fam\@\@scale\\\@empty |
| 2032 |
\\else |
| 2033 |
\\edef\\$fam\@\@scale{s*[\\csname $fam\@scale\\endcsname]}% |
| 2034 |
\\fi |
| 2035 |
|
| 2036 |
\\DeclareFontFamily{$enc}{$fam-$sty}{@{[ |
| 2037 |
$ARGV{nfss} eq 'tt' ? '\hyphenchar\font=-1' |
| 2038 |
: $enc eq 'OML' ? '\skewchar\font=127' |
| 2039 |
: q{} |
| 2040 |
]}} |
| 2041 |
|
| 2042 |
END_FD_HEADER |
| 2043 |
|
| 2044 |
while (my ($series, $fdseries) = each %$data) { |
| 2045 |
my $nfssseries = $nfss_mapping->{$series}; |
| 2046 |
|
| 2047 |
my $alias = $series; |
| 2048 |
if (defined $nfssseries) { |
| 2049 |
print {$FD} "\n% ---- $nfssseries = $series ----\n\n"; |
| 2050 |
$series = $nfssseries; |
| 2051 |
} |
| 2052 |
else { |
| 2053 |
print {$FD} "\n% ---- $series ----\n\n"; |
| 2054 |
} |
| 2055 |
while (my ($shape, $fdshape) = each %$fdseries) { |
| 2056 |
print {$FD} |
| 2057 |
"\\DeclareFontShape{$enc}{$fam-$sty}{$series}{$shape}{\n"; |
| 2058 |
my @sizes = sort { $a->[0] <=> $b->[0] } |
| 2059 |
@{$fdshape}; |
| 2060 |
$sizes[0][0] = $sizes[-1][1] = ''; |
| 2061 |
$sizes[$_][0] = $sizes[$_ - 1][1] for (1 .. $#sizes); |
| 2062 |
for my $size (@sizes) { |
| 2063 |
print {$FD} " <$size->[0]-$size->[1]> ", |
| 2064 |
"\\$fam\@\@scale $size->[2]\n"; |
| 2065 |
} |
| 2066 |
print {$FD} "}{}\n\n"; |
| 2067 |
|
| 2068 |
if (defined $nfssseries) { |
| 2069 |
print {$FD} <<"END_ALIAS_SERIES"; |
| 2070 |
\\DeclareFontShape{$enc}{$fam-$sty}{$alias}{$shape}{ |
| 2071 |
<-> alias * $fam-$sty/$nfssseries/$shape |
| 2072 |
}{} |
| 2073 |
|
| 2074 |
END_ALIAS_SERIES |
| 2075 |
} |
| 2076 |
} |
| 2077 |
|
| 2078 |
# ssub italic for missing slanted, or vice versa |
| 2079 |
while (my ($shape, $replace) = each %SSUB_SHAPE) { |
| 2080 |
if (!exists $fdseries->{$shape} && exists $fdseries->{$replace}) { |
| 2081 |
print {$FD} <<"END_SSUB_SHAPE"; |
| 2082 |
\\DeclareFontShape{$enc}{$fam-$sty}{$series}{$shape}{ |
| 2083 |
<-> ssub * $fam-$sty/$series/$replace |
| 2084 |
}{} |
| 2085 |
|
| 2086 |
END_SSUB_SHAPE |
| 2087 |
if (defined $nfssseries) { |
| 2088 |
print {$FD} <<"END_SSUB_ALIAS"; |
| 2089 |
\\DeclareFontShape{$enc}{$fam-$sty}{$alias}{$shape}{ |
| 2090 |
<-> ssub * $fam-$sty/$alias/$replace |
| 2091 |
}{} |
| 2092 |
|
| 2093 |
END_SSUB_ALIAS |
| 2094 |
} |
| 2095 |
$fdseries->{$shape} = 1; |
| 2096 |
} |
| 2097 |
} |
| 2098 |
} |
| 2099 |
|
| 2100 |
my %seen; |
| 2101 |
while (my ($series, $nfssseries) = each %{$nfss_mapping}) { |
| 2102 |
if (exists $data->{$series}) { |
| 2103 |
for my $shape (keys %{$data->{$series}}) { |
| 2104 |
$seen{$nfssseries}{$shape} = 1; |
| 2105 |
} |
| 2106 |
} |
| 2107 |
} |
| 2108 |
|
| 2109 |
print {$FD} "\n% ---- Extra 'ssub' rules to map 'bx' to 'b' ----\n\n"; |
| 2110 |
for my $shape (keys %{$seen{b}}) { |
| 2111 |
if (!exists $seen{bx}{$shape}) { |
| 2112 |
print {$FD} <<"END_SSUB_BX"; |
| 2113 |
\\DeclareFontShape{$enc}{$fam-$sty}{bx}{$shape}{ |
| 2114 |
<-> ssub * $fam-$sty/b/$shape |
| 2115 |
}{} |
| 2116 |
|
| 2117 |
END_SSUB_BX |
| 2118 |
} |
| 2119 |
} |
| 2120 |
|
| 2121 |
print {$FD} "\\endinput\n"; |
| 2122 |
close $FD; |
| 2123 |
|
| 2124 |
return; |
| 2125 |
} |
| 2126 |
|
| 2127 |
|
| 2128 |
############################################################################ |
| 2129 |
|
| 2130 |
|
| 2131 |
package Log; |
| 2132 |
|
| 2133 |
# -------------------------------------------------------------------------- |
| 2134 |
# Constructor: creates new Log object, writing to $logfile. |
| 2135 |
# -------------------------------------------------------------------------- |
| 2136 |
sub new { |
| 2137 |
my ($class, $filename) = @_; |
| 2138 |
|
| 2139 |
if (-e $filename) { |
| 2140 |
print "[WARNING] File '$filename' already exists;\n" . |
| 2141 |
" appending new log data to end.\n"; |
| 2142 |
} |
| 2143 |
open my $log, '>>', $filename |
| 2144 |
or die "$0: cannot create '$filename': $!"; |
| 2145 |
|
| 2146 |
return bless $log, $class; |
| 2147 |
} |
| 2148 |
|
| 2149 |
|
| 2150 |
# -------------------------------------------------------------------------- |
| 2151 |
# Writes a message to the log file. |
| 2152 |
# -------------------------------------------------------------------------- |
| 2153 |
sub log { |
| 2154 |
my ($self, $msg) = @_; |
| 2155 |
|
| 2156 |
print {$self} $msg; |
| 2157 |
|
| 2158 |
return; |
| 2159 |
} |
| 2160 |
|
| 2161 |
|
| 2162 |
# -------------------------------------------------------------------------- |
| 2163 |
# Closes the logfile associated with this Log object. |
| 2164 |
# -------------------------------------------------------------------------- |
| 2165 |
sub close { |
| 2166 |
my $self = shift; |
| 2167 |
|
| 2168 |
close $self; |
| 2169 |
|
| 2170 |
return; |
| 2171 |
} |
| 2172 |
|
| 2173 |
|
| 2174 |
# -------------------------------------------------------------------------- |
| 2175 |
# Logs the command line options. |
| 2176 |
# -------------------------------------------------------------------------- |
| 2177 |
sub log_options { |
| 2178 |
my $self = shift; |
| 2179 |
|
| 2180 |
print {$self} <<"END_ARGUMENTS"; |
| 2181 |
|
| 2182 |
|
| 2183 |
############################################################################ |
| 2184 |
|
| 2185 |
|
| 2186 |
@{[ POSIX::strftime("[%F %T]", localtime time) ]} $0, version $VERSION |
| 2187 |
|
| 2188 |
Command was: |
| 2189 |
|
| 2190 |
"$ARGV{cmdline}" |
| 2191 |
|
| 2192 |
---------------------------------------------------------------------------- |
| 2193 |
|
| 2194 |
I'm using the following options: |
| 2195 |
|
| 2196 |
encoding(s): @{[ join ', ', @{$ARGV{encoding}} ]} |
| 2197 |
NFSS: $ARGV{nfss} @{[ $ARGV{nfss} eq 'rm' ? '(serif)' |
| 2198 |
: $ARGV{nfss} eq 'sf' ? '(sanserif)' |
| 2199 |
: $ARGV{nfss} eq 'tt' ? '(typewriter)' |
| 2200 |
: '(unknown)' |
| 2201 |
]} |
| 2202 |
|
| 2203 |
lining: @{[ $ARGV{lining} ? 'yes' : 'no' ]} |
| 2204 |
oldstyle: @{[ $ARGV{oldstyle} ? 'yes' : 'no' ]} |
| 2205 |
proportional: @{[ $ARGV{proportional} ? 'yes' : 'no' ]} |
| 2206 |
tabular: @{[ $ARGV{tabular} ? 'yes' : 'no' ]} |
| 2207 |
ts1: @{[ $ARGV{textcomp} ? 'yes' : 'no' ]} |
| 2208 |
smallcaps: @{[ $ARGV{smallcaps} ? 'yes' : 'no' ]} |
| 2209 |
swash: @{[ $ARGV{swash} ? 'yes' : 'no' ]} |
| 2210 |
titling: @{[ $ARGV{titling} ? 'yes' : 'no' ]} |
| 2211 |
superiors: @{[ $ARGV{superiors} ? 'yes' : 'no' ]} |
| 2212 |
inferiors: $ARGV{inferiors} |
| 2213 |
ornaments: @{[ $ARGV{ornaments} ? 'yes' : 'no' ]} |
| 2214 |
fractions: @{[ $ARGV{fractions} ? 'yes' : 'no' ]} |
| 2215 |
ligatures: @{[ $ARGV{ligatures} ? 'yes' : 'no' ]} |
| 2216 |
|
| 2217 |
target: $ARGV{target} |
| 2218 |
extra: $ARGV{extra} |
| 2219 |
|
| 2220 |
figurekern: @{[ $ARGV{figurekern} ? 'keep' : 'remove' ]} |
| 2221 |
|
| 2222 |
nfssweight: @{[ join q{, }, @{$ARGV{nfssweight}} ]} |
| 2223 |
nfsswidth: @{[ join q{, }, @{$ARGV{nfsswidth}} ]} |
| 2224 |
|
| 2225 |
math: @{[ $ARGV{math} ? 'yes' : 'no' ]} |
| 2226 |
mathspacing: $ARGV{mathspacing} |
| 2227 |
|
| 2228 |
auto/manual: @{[ $ARGV{manual} ? 'manual' : 'auto' ]} |
| 2229 |
fontname suffix: @{[ $ARGV{t1suffix} || '(none)' ]} |
| 2230 |
|
| 2231 |
END_ARGUMENTS |
| 2232 |
|
| 2233 |
if ($ARGV{fig_height} or $ARGV{fig_width}) { |
| 2234 |
print {$self} <<"END_FIGURE_DEFAULTS"; |
| 2235 |
default figures: @{[ |
| 2236 |
$ARGV{fig_width} eq 'pnum' ? 'proportional' |
| 2237 |
: 'tabular' |
| 2238 |
]} @{[ |
| 2239 |
$ARGV{fig_height} eq 'onum' ? 'oldstyle' |
| 2240 |
: 'lining' |
| 2241 |
]} |
| 2242 |
|
| 2243 |
END_FIGURE_DEFAULTS |
| 2244 |
} |
| 2245 |
|
| 2246 |
if ($ARGV{dryrun}) { |
| 2247 |
print {$self} " DRY RUN\n\n"; |
| 2248 |
} |
| 2249 |
|
| 2250 |
return; |
| 2251 |
} |
| 2252 |
|
| 2253 |
|
| 2254 |
# -------------------------------------------------------------------------- |
| 2255 |
# Logs command line options and the results of font info parsing. |
| 2256 |
# -------------------------------------------------------------------------- |
| 2257 |
sub log_parsing { |
| 2258 |
my ($self, $fontlist) = @_; |
| 2259 |
|
| 2260 |
print {$self} '-' x 76 . "\n\n" . "Results of font info parsing:\n"; |
| 2261 |
|
| 2262 |
for my $font (@{$fontlist}) { |
| 2263 |
print {$self} <<"END_PARSE_FONT"; |
| 2264 |
|
| 2265 |
$font->{filename} |
| 2266 |
Name: $font->{name} |
| 2267 |
Family: $font->{family} |
| 2268 |
Subfamily: $font->{subfamily} |
| 2269 |
Weight: $font->{weight} ($font->{weight_class}) |
| 2270 |
Width: $font->{width} ($font->{width_class}) |
| 2271 |
Shape: $font->{shape} @{[ $font->{is_smallcaps} |
| 2272 |
? 'smallcaps' : '' ]} |
| 2273 |
Size: $font->{minsize}-$font->{maxsize} |
| 2274 |
Features: @{[ join q(, ), sort keys %{$font->{feature}} ]} |
| 2275 |
END_PARSE_FONT |
| 2276 |
} |
| 2277 |
|
| 2278 |
return; |
| 2279 |
} |
| 2280 |
|
| 2281 |
|
| 2282 |
# -------------------------------------------------------------------------- |
| 2283 |
# Logs the mapping of NFSS codes to weights and widths. |
| 2284 |
# -------------------------------------------------------------------------- |
| 2285 |
sub log_nfss_mapping { |
| 2286 |
my ($self, $nfss_mapping) = @_; |
| 2287 |
|
| 2288 |
print {$self} "\n" . '-' x 76 . "\n\nNFSS mappings:\n\n"; |
| 2289 |
for my $weight (Attr::get_all_nfss_weights()) { |
| 2290 |
printf {$self} " %-3s => %s\n", |
| 2291 |
$weight || 'm', |
| 2292 |
$nfss_mapping->{weight}{$weight}[0] || ''; |
| 2293 |
} |
| 2294 |
printf {$self} "\n"; |
| 2295 |
for my $width (Attr::get_all_nfss_widths()) { |
| 2296 |
printf {$self} " %-3s => %s\n", |
| 2297 |
$width || 'm', |
| 2298 |
$nfss_mapping->{width}{$width}[0] || ''; |
| 2299 |
} |
| 2300 |
|
| 2301 |
return; |
| 2302 |
} |
| 2303 |
|
| 2304 |
|
| 2305 |
# -------------------------------------------------------------------------- |
| 2306 |
# Logs all fonts we're going to create. |
| 2307 |
# -------------------------------------------------------------------------- |
| 2308 |
sub log_worklist { |
| 2309 |
my ($self, $worklist) = @_; |
| 2310 |
|
| 2311 |
my @workitems |
| 2312 |
= sort { $a->{font}{filename} cmp $b->{font}{filename} |
| 2313 |
|| $a->{encoding} cmp $b->{encoding} |
| 2314 |
|| $a->{figurestyle} cmp $b->{figurestyle} |
| 2315 |
} |
| 2316 |
@{$worklist}; |
| 2317 |
|
| 2318 |
my $prevfn = q{}; |
| 2319 |
for my $workitem (@workitems) { |
| 2320 |
if ($prevfn ne $workitem->{font}{filename}) { |
| 2321 |
print {$self} <<"END_FONTINFO"; |
| 2322 |
|
| 2323 |
------------------------------------------------------------------------ |
| 2324 |
|
| 2325 |
$workitem->{font}{filename} |
| 2326 |
|
| 2327 |
Generating these encodings, figure styles and shapes: |
| 2328 |
|
| 2329 |
ENC STYLE SHAPE FEATURES USED |
| 2330 |
|
| 2331 |
END_FONTINFO |
| 2332 |
} |
| 2333 |
printf {$self} " %-3s %-4s %-4s %s\n", |
| 2334 |
$workitem->{encoding}, |
| 2335 |
$workitem->{figurestyle}, |
| 2336 |
$workitem->{fdshape}, |
| 2337 |
join(q{, }, @{$workitem->{features}}); |
| 2338 |
$prevfn = $workitem->{font}{filename}; |
| 2339 |
} |
| 2340 |
|
| 2341 |
return; |
| 2342 |
} |
| 2343 |
|
| 2344 |
|
| 2345 |
# -------------------------------------------------------------------------- |
| 2346 |
# Logs all generated otftotfm commands. |
| 2347 |
# -------------------------------------------------------------------------- |
| 2348 |
sub log_commands { |
| 2349 |
my ($self, $commandlist) = @_; |
| 2350 |
|
| 2351 |
print {$self} "\n\n"; |
| 2352 |
print {$self} join "\n\n", @{$commandlist}; |
| 2353 |
print {$self} "\n"; |
| 2354 |
|
| 2355 |
return; |
| 2356 |
} |
| 2357 |
|
| 2358 |
|
| 2359 |
############################################################################ |
| 2360 |
|
| 2361 |
|
| 2362 |
package Options; |
| 2363 |
|
| 2364 |
my $USAGE =<<'END_USAGE'; |
| 2365 |
|
| 2366 |
'autoinst' is a wrapper around Eddie Kohler's TypeTools |
| 2367 |
(http://www.lcdf.org/type/), for installing OpenType fonts in LaTeX. |
| 2368 |
|
| 2369 |
Usage: autoinst [options] font[s] |
| 2370 |
|
| 2371 |
Possible options: |
| 2372 |
-encoding=ENC[,ENC]* Specify text encoding(s) (default: OT1,LY1,T1) |
| 2373 |
|
| 2374 |
-(no)lining Toggle creation of lining digits |
| 2375 |
-(no)oldstyle Toggle creation of oldstyle digits |
| 2376 |
-(no)proportional Toggle creation of proportional digits |
| 2377 |
-(no)tabular Toggle creation of tabular digits |
| 2378 |
-(no)ts1 Toggle creation of TS1 fonts |
| 2379 |
-(no)smallcaps Toggle creation of smallcaps |
| 2380 |
-(no)swash Toggle creation of swash |
| 2381 |
-(no)titling Toggle creation of titling |
| 2382 |
-(no)superiors Toggle creation of fonts with superior characters |
| 2383 |
-noinferiors |
| 2384 |
-inferiors=[none|auto|subs|sinf|dnom] |
| 2385 |
Use this style for subscripts (see docs) |
| 2386 |
-(no)ornaments Toggle creation of ornament fonts |
| 2387 |
-(no)fractions Toggle creation of fonts with digits for fractions |
| 2388 |
-(no)ligatures Toggle manual addition of f-ligatures to font |
| 2389 |
|
| 2390 |
-serif Install font as serif font |
| 2391 |
-sanserif Install font as sanserif font |
| 2392 |
-typewriter Install font as typewriter font |
| 2393 |
|
| 2394 |
-defaultlining |
| 2395 |
-defaultoldstyle Specify which figure style should be |
| 2396 |
-defaulttabular considered 'default' for this font; see docs |
| 2397 |
-defaultproportional |
| 2398 |
|
| 2399 |
-extra="EXTRA" Add EXTRA to the otftotfm command for all fonts |
| 2400 |
-target="DIRECTORY" Install files into specified TEXMF tree |
| 2401 |
-vendor="VENDOR" Only used for naming directories |
| 2402 |
-typeface="TYPEFACE" Only used for naming directories |
| 2403 |
|
| 2404 |
-(no)figurekern Keep or remove kerns between tabular figures |
| 2405 |
|
| 2406 |
-nfssweight=XX=YYYY Map the "XX" NFSS code to the "YYYY" weight |
| 2407 |
-nfsswidth=XX=YYYY Map the "XX" NFSS code to the "YYYY" width |
| 2408 |
|
| 2409 |
-help Print this text and exit |
| 2410 |
-doc Print the complete documentation and exit |
| 2411 |
-dryrun Don't generate fonts, only log what would be done |
| 2412 |
-logfile="FILE" Write log to "FILE" (default: <fontfamily>.log) |
| 2413 |
-verbose Print more data to log file |
| 2414 |
-version Print version number and exit |
| 2415 |
|
| 2416 |
-math Generate basic math fonts |
| 2417 |
-mathspacing=AMOUNT Letterspace the math fonts by AMOUNT/1000 em |
| 2418 |
|
| 2419 |
-manual Manual mode (see documentation) |
| 2420 |
-t1suffix=SUFFIX Add SUFFIX to name of generated pfb fonts |
| 2421 |
|
| 2422 |
font[s] The fonts (.otf or .ttf format) to install. |
| 2423 |
|
| 2424 |
Please report any bugs or suggestions to <[email protected]>. |
| 2425 |
END_USAGE |
| 2426 |
|
| 2427 |
# Default values for the command-line arguments. |
| 2428 |
%ARGV = ( |
| 2429 |
encoding => 'OT1,LY1,T1', |
| 2430 |
textcomp => '2', # 0 = no, 1 = yes, 2 = ('T1' ? yes : no) |
| 2431 |
lining => '1', # 0 = no, 1 = yes |
| 2432 |
oldstyle => '1', # 0 = no, 1 = yes |
| 2433 |
proportional => '1', # 0 = no, 1 = yes |
| 2434 |
tabular => '1', # 0 = no, 1 = yes |
| 2435 |
smallcaps => '1', # 0 = no, 1 = yes |
| 2436 |
swash => '1', # 0 = no, 1 = yes |
| 2437 |
titling => '1', # 0 = no, 1 = yes |
| 2438 |
superiors => '1', # 0 = no, 1 = yes |
| 2439 |
inferiors => 'none', # values: none, auto, subs, sinf, dnom |
| 2440 |
ornaments => '1', # 0 = no, 1 = yes |
| 2441 |
fractions => '0', # 0 = no, 1 = yes |
| 2442 |
ligatures => '2', # 0 = no, 1 = yes, 2 = ('tt' ? no : yes) |
| 2443 |
nfss => '', |
| 2444 |
fig_height => '', |
| 2445 |
fig_width => '', |
| 2446 |
extra => '', |
| 2447 |
target => '', |
| 2448 |
vendor => 'lcdftools', |
| 2449 |
typeface => '', |
| 2450 |
manual => '0', # 0 = no, 1 = yes |
| 2451 |
dryrun => '0', # 0 = no, 1 = yes |
| 2452 |
logfile => '', |
| 2453 |
figurekern => '1', # 0 = no, 1 = yes |
| 2454 |
verbose => 0, |
| 2455 |
nfsswidth => [], |
| 2456 |
nfssweight => [], |
| 2457 |
math => 0, |
| 2458 |
mathspacing => 0, |
| 2459 |
t1suffix => 'none', |
| 2460 |
); |
| 2461 |
|
| 2462 |
|
| 2463 |
# -------------------------------------------------------------------------- |
| 2464 |
# Parses the command-line options and removes these from @ARGV. |
| 2465 |
# -------------------------------------------------------------------------- |
| 2466 |
sub parse_options { |
| 2467 |
$ARGV{cmdline} = join ' ', ($0, @ARGV); |
| 2468 |
|
| 2469 |
Getopt::Long::GetOptions( |
| 2470 |
'help|?' => sub { print $USAGE; exit }, |
| 2471 |
'version' => sub { exit }, |
| 2472 |
'doc' => sub { Pod::Usage::pod2usage(-verbose => 2) }, |
| 2473 |
'encoding=s' => \$ARGV{encoding}, |
| 2474 |
'ts1!' => \$ARGV{textcomp}, |
| 2475 |
'lining!' => \$ARGV{lining}, |
| 2476 |
'oldstyle!' => \$ARGV{oldstyle}, |
| 2477 |
'proportional!' => \$ARGV{proportional}, |
| 2478 |
'tabular!' => \$ARGV{tabular}, |
| 2479 |
'smallcaps!' => \$ARGV{smallcaps}, |
| 2480 |
'swash!' => \$ARGV{swash}, |
| 2481 |
'titling!' => \$ARGV{titling}, |
| 2482 |
'superiors!' => \$ARGV{superiors}, |
| 2483 |
'noinferiors' => sub { $ARGV{inferiors} = 'none' }, |
| 2484 |
'inferiors:s' => \$ARGV{inferiors}, |
| 2485 |
'ornaments!' => \$ARGV{ornaments}, |
| 2486 |
'fractions!' => \$ARGV{fractions}, |
| 2487 |
'ligatures!' => \$ARGV{ligatures}, |
| 2488 |
'serif' => sub { $ARGV{nfss} = 'rm' }, |
| 2489 |
'sanserif' => sub { $ARGV{nfss} = 'sf' }, |
| 2490 |
'typewriter' => sub { $ARGV{nfss} = 'tt' }, |
| 2491 |
'defaultlining' => sub { $ARGV{fig_height} = 'lnum' }, |
| 2492 |
'defaultoldstyle' => sub { $ARGV{fig_height} = 'onum' }, |
| 2493 |
'defaulttabular' => sub { $ARGV{fig_width} = 'tnum' }, |
| 2494 |
'defaultproportional' => sub { $ARGV{fig_width} = 'pnum' }, |
| 2495 |
'extra=s' => \$ARGV{extra}, |
| 2496 |
'target=s' => \$ARGV{target}, |
| 2497 |
'vendor=s' => \$ARGV{vendor}, |
| 2498 |
'typeface=s' => \$ARGV{typeface}, |
| 2499 |
'manual' => \$ARGV{manual}, |
| 2500 |
'dryrun' => \$ARGV{dryrun}, |
| 2501 |
'figurekern!' => \$ARGV{figurekern}, |
| 2502 |
'logfile=s' => \$ARGV{logfile}, |
| 2503 |
'verbose+' => \$ARGV{verbose}, |
| 2504 |
'nfssweight=s%' => sub { |
| 2505 |
my ($ignored, $key, $values) = @_; |
| 2506 |
$key = lc $key; |
| 2507 |
push @{$ARGV{nfssweight}}, |
| 2508 |
"$key=$values"; |
| 2509 |
my @values = split m/,/, lc $values; |
| 2510 |
$key = q{} if $key eq 'm'; |
| 2511 |
Attr::set_weight($key, @values); |
| 2512 |
$ARGV{$key} = 'user-defined'; |
| 2513 |
}, |
| 2514 |
'nfsswidth=s%' => sub { |
| 2515 |
my ($ignored, $key, $values) = @_; |
| 2516 |
$key = lc $key; |
| 2517 |
my @values = split m/,/, lc $values; |
| 2518 |
push @{$ARGV{nfsswidth}}, |
| 2519 |
"$key=$values"; |
| 2520 |
$key = q{} if $key eq 'm'; |
| 2521 |
Attr::set_width($key, @values); |
| 2522 |
$ARGV{$key} = 'user-defined'; |
| 2523 |
}, |
| 2524 |
'math!' => \$ARGV{math}, |
| 2525 |
'mathspacing=i' => \$ARGV{mathspacing}, |
| 2526 |
't1suffix:s' => \$ARGV{t1suffix}, |
| 2527 |
) |
| 2528 |
or die "$USAGE"; |
| 2529 |
|
| 2530 |
if (!@ARGV) { |
| 2531 |
Pod::Usage::pod2usage( |
| 2532 |
-msg => '[ERROR] No font files given, nothing to do!', |
| 2533 |
-verbose => 1); |
| 2534 |
} |
| 2535 |
|
| 2536 |
return; |
| 2537 |
} |
| 2538 |
|
| 2539 |
|
| 2540 |
############################################################################ |
| 2541 |
|
| 2542 |
|
| 2543 |
package Otftotfm; |
| 2544 |
|
| 2545 |
# -------------------------------------------------------------------------- |
| 2546 |
# Returns a string with all "directory" options for otftotfm set. |
| 2547 |
# Also creates directories that don't exist yet. |
| 2548 |
# -------------------------------------------------------------------------- |
| 2549 |
sub get_targetdirs { |
| 2550 |
my ($family, $fontlist) = @_; |
| 2551 |
|
| 2552 |
my %has_fonttype = map { ($_->{fonttype} => 1) } @{$fontlist}; |
| 2553 |
|
| 2554 |
my @filetypes = qw(tfm vf); |
| 2555 |
if ($has_fonttype{opentype}) { push @filetypes, qw(type1) } |
| 2556 |
if ($has_fonttype{truetype}) { push @filetypes, qw(truetype) } |
| 2557 |
|
| 2558 |
my %dir = map { ( $_ => File::Spec->catdir( |
| 2559 |
$ARGV{target}, |
| 2560 |
'fonts', |
| 2561 |
$_, |
| 2562 |
$ARGV{vendor}, |
| 2563 |
$ARGV{typeface} || $family) ) |
| 2564 |
} |
| 2565 |
@filetypes; |
| 2566 |
|
| 2567 |
$dir{$_} |
| 2568 |
= File::Spec->catdir( |
| 2569 |
$ARGV{target}, 'fonts', $_, 'dvips', $ARGV{typeface} || $family) |
| 2570 |
for qw(enc map); |
| 2571 |
|
| 2572 |
File::Path::make_path(values %dir) unless $ARGV{dryrun}; |
| 2573 |
|
| 2574 |
my $result |
| 2575 |
= join q{ }, |
| 2576 |
map { qq(--${_}-directory="$dir{$_}") } |
| 2577 |
@filetypes; |
| 2578 |
$result .= qq( --encoding-directory="$dir{enc}" --map-file=") |
| 2579 |
. File::Spec->catfile($dir{map}, "$family.map") |
| 2580 |
. '"'; |
| 2581 |
|
| 2582 |
return $result; |
| 2583 |
} |
| 2584 |
|
| 2585 |
|
| 2586 |
# The official names for various coding schemes. |
| 2587 |
my %SCHEME = ( |
| 2588 |
OT1 => 'TEX TEXT', |
| 2589 |
OML => 'TEX MATH ITALIC', |
| 2590 |
T1 => 'EXTENDED TEX FONT ENCODING - LATIN', |
| 2591 |
TS1 => 'TEX TEXT COMPANION SYMBOLS 1---TS1', |
| 2592 |
LY1 => 'TEX TYPEWRITER AND WINDOWS ANSI', |
| 2593 |
LGR => 'GREEK FONT ENCODING - LGR', |
| 2594 |
T2A => 'TEX CYRILLIC FONT ENCODING - T2A', |
| 2595 |
T2B => 'TEX CYRILLIC FONT ENCODING - T2B', |
| 2596 |
T2C => 'TEX CYRILLIC FONT ENCODING - T2C', |
| 2597 |
T3 => 'TEX IPA ENCODING', |
| 2598 |
TS3 => 'TEX IPA SYMBOL ENCODING', |
| 2599 |
); |
| 2600 |
|
| 2601 |
# -------------------------------------------------------------------------- |
| 2602 |
# Generates a command for otftotfm from a work item. |
| 2603 |
# -------------------------------------------------------------------------- |
| 2604 |
sub create_command { |
| 2605 |
my ($workitem, $targetdirs) = @_; |
| 2606 |
|
| 2607 |
my $want_ligkerns |
| 2608 |
= ( $ARGV{ligatures} == 1 ) |
| 2609 |
|| Util::any( map { $_ eq 'liga' } @{$workitem->{features}} ); |
| 2610 |
|
| 2611 |
return join q( ), 'otftotfm', |
| 2612 |
($ARGV{manual} ? '--pl' : '--automatic'), |
| 2613 |
"--encoding=$workitem->{enc_file}", |
| 2614 |
$targetdirs, |
| 2615 |
'--no-updmap', |
| 2616 |
'--force', |
| 2617 |
($SCHEME{$workitem->{encoding}} |
| 2618 |
? qq(--coding-scheme="$SCHEME{$workitem->{encoding}}") |
| 2619 |
: q()), |
| 2620 |
(map { "--feature=$_" } @{$workitem->{features}}), |
| 2621 |
($want_ligkerns |
| 2622 |
? ( '--ligkern="f i =: fi"', |
| 2623 |
'--ligkern="f l =: fl"', |
| 2624 |
'--ligkern="f f =: ff"', |
| 2625 |
'--ligkern="ff i =: ffi"', |
| 2626 |
'--ligkern="ff l =: ffl"' ) |
| 2627 |
: q()), |
| 2628 |
Tables::get_extra($workitem->{figurestyle}), |
| 2629 |
Tables::get_extra($workitem->{style}), |
| 2630 |
$ARGV{extra}, |
| 2631 |
qq("$workitem->{font}{filename}"), |
| 2632 |
$workitem->{fontname}, |
| 2633 |
; |
| 2634 |
} |
| 2635 |
|
| 2636 |
|
| 2637 |
# -------------------------------------------------------------------------- |
| 2638 |
# Executes (or saves to file, when $ARGV{manual} is true) all commands. |
| 2639 |
# -------------------------------------------------------------------------- |
| 2640 |
sub run_commands { |
| 2641 |
my ($commandlist, $family, $log) = @_; |
| 2642 |
|
| 2643 |
if ($ARGV{manual}) { |
| 2644 |
open my $BAT, '>', 'autoinst.bat' |
| 2645 |
or die "[ERROR] Can't create 'autoinst.bat': $!"; |
| 2646 |
print {$BAT} "$_\n" for @{$commandlist}; |
| 2647 |
close $BAT; |
| 2648 |
} |
| 2649 |
else { |
| 2650 |
my $n_cmds = scalar @{$commandlist}; |
| 2651 |
my ($log_ncmds, $ceil) = (1, 10); |
| 2652 |
while ($n_cmds >= $ceil) { |
| 2653 |
$log_ncmds++; |
| 2654 |
$ceil *= 10; |
| 2655 |
} |
| 2656 |
my $template = sprintf "%%%dd of %%%dd", $log_ncmds, $log_ncmds; |
| 2657 |
my $l_template = 4 + 2 * $log_ncmds; |
| 2658 |
$| = 1; # autoflush |
| 2659 |
print "[INFO] Generating fonts for $family: ", " " x $l_template; |
| 2660 |
|
| 2661 |
my $i_cmd = 1; |
| 2662 |
my $oops = 0; |
| 2663 |
for my $command (@{$commandlist}) { |
| 2664 |
print "\b" x $l_template; |
| 2665 |
printf $template, $i_cmd++, $n_cmds; |
| 2666 |
open my $otftotfm, '-|', "$command 2>&1" |
| 2667 |
or die "could not fork(): $!"; |
| 2668 |
my $msgs = do { local $/; <$otftotfm> }; |
| 2669 |
close $otftotfm |
| 2670 |
or do { |
| 2671 |
warn "\n$command\n\n$msgs\n"; |
| 2672 |
$log->log("\n$command\n\n$msgs\n"); |
| 2673 |
$oops = 1; |
| 2674 |
}; |
| 2675 |
} |
| 2676 |
print "\n"; |
| 2677 |
$| = 0; |
| 2678 |
if ($oops) { |
| 2679 |
warn <<"END_OTFTOTFM_WARNING"; |
| 2680 |
[ERROR] One or more calls to 'otftotfm' returned a non-zero status code; |
| 2681 |
please check the messages above and in the log file. |
| 2682 |
END_OTFTOTFM_WARNING |
| 2683 |
} |
| 2684 |
} |
| 2685 |
|
| 2686 |
return; |
| 2687 |
} |
| 2688 |
|
| 2689 |
|
| 2690 |
############################################################################ |
| 2691 |
|
| 2692 |
|
| 2693 |
package Tables; |
| 2694 |
|
| 2695 |
=begin Comment |
| 2696 |
|
| 2697 |
The %STYLE table is used in deciding which font styles |
| 2698 |
(normal, small caps, swash or textcomp) to generate. |
| 2699 |
|
| 2700 |
Each key in this table names a style; the corresponding value |
| 2701 |
is an anonymous hash with several key/value pairs: |
| 2702 |
code An anonymous hash with three possible keys: |
| 2703 |
'n' -> the NFSS code to use for this variant shape |
| 2704 |
if the 'basic shape' is upright; |
| 2705 |
'it' -> the NFSS code to use for this variant shape |
| 2706 |
if the 'basic shape' is italic |
| 2707 |
'sl' -> the NFSS code to use for this variant shape |
| 2708 |
if the 'basic shape' is slanted (aka oblique); |
| 2709 |
If any entry is missing, the corresponding version |
| 2710 |
of this variant style will not be built. |
| 2711 |
reqd A list of required OpenType features; |
| 2712 |
this style is built if the font supports at least *one* |
| 2713 |
of these features. |
| 2714 |
nice A list of optional OpenType features; |
| 2715 |
these are used if the font supports them, but don't |
| 2716 |
prevent this style from being built when missing. |
| 2717 |
extra Extra options passed to otftotfm when creating this style. |
| 2718 |
name A string added to the name of the generated font, |
| 2719 |
to make it unique. |
| 2720 |
|
| 2721 |
Textcomp is treated as a 'style' even though it is technically |
| 2722 |
an encoding; that is just the easiest way to do things. |
| 2723 |
|
| 2724 |
=end Comment |
| 2725 |
|
| 2726 |
=cut |
| 2727 |
|
| 2728 |
my %STYLE = ( |
| 2729 |
normal => { |
| 2730 |
code => { n => 'n', it => 'it', sl => 'sl' }, |
| 2731 |
reqd => [], |
| 2732 |
nice => [], |
| 2733 |
extra => '', |
| 2734 |
name => '', |
| 2735 |
}, |
| 2736 |
smallcaps => { |
| 2737 |
code => { n => 'sc', it => 'scit', sl => 'scsl' }, |
| 2738 |
reqd => [ 'smcp' ], |
| 2739 |
nice => [], |
| 2740 |
extra => '--unicoding="germandbls =: SSsmall" --unicoding="ff =: FFsmall" --unicoding="fi =: FIsmall" --unicoding="ffi =: FFIsmall" --unicoding="fl =: FLsmall" --unicoding="ffl =: FFLsmall"', |
| 2741 |
name => 'sc', |
| 2742 |
}, |
| 2743 |
swash => { |
| 2744 |
code => { n => 'nw', it => 'sw' }, |
| 2745 |
reqd => [ 'swsh' ], |
| 2746 |
nice => [ 'cswh', 'dlig' ], |
| 2747 |
extra => '--include-alternates="*.swash"', |
| 2748 |
name => 'swash', |
| 2749 |
}, |
| 2750 |
textcomp => { |
| 2751 |
code => { n => 'n', it => 'it', sl => 'sl' }, |
| 2752 |
reqd => [], |
| 2753 |
nice => [ 'onum' ], |
| 2754 |
extra => '', |
| 2755 |
name => '', |
| 2756 |
}, |
| 2757 |
math => { |
| 2758 |
code => { n => 'n', it => 'it', sl => 'sl' }, |
| 2759 |
reqd => [], |
| 2760 |
nice => [ 'onum', 'mgrk' ], |
| 2761 |
extra => '--math-spacing=127', |
| 2762 |
name => '', |
| 2763 |
}, |
| 2764 |
); |
| 2765 |
|
| 2766 |
=begin Comment |
| 2767 |
|
| 2768 |
The %FIGURESTYLE table is used in deciding which figure styles to generate. |
| 2769 |
Each figure style (lining, oldstyle, tabular, proportional, superior, |
| 2770 |
inferior etc.) becomes a separate font family. We also treat Ornaments |
| 2771 |
as a figure style here; that's just the easiest way to handle them. |
| 2772 |
|
| 2773 |
Each key in this table names a figure style; the corresponding |
| 2774 |
value is an anonymous hash with four key/value pairs: |
| 2775 |
reqd A list of required OpenType features; this style is built |
| 2776 |
if the font supports *all* these features. |
| 2777 |
nice A list of optional OpenType features; |
| 2778 |
these are used if the font supports them, but don't |
| 2779 |
prevent this style from being built when missing. |
| 2780 |
extra Extra options passed to otftotfm when creating this style. |
| 2781 |
style An anonymous array of 'variant' styles to build with |
| 2782 |
this figure style. |
| 2783 |
|
| 2784 |
The 'reqd' and 'nice' subtables for the TLF, LF, TOsF and OsF styles |
| 2785 |
are empty; these are filled in at run time, depending on |
| 2786 |
which figure style is default for the current font. |
| 2787 |
|
| 2788 |
The 'reqd' subtable for the Inf style is also empty; this may be filled |
| 2789 |
with 'subs', 'sinf' or 'dnom' depending on the -inferiors options. |
| 2790 |
|
| 2791 |
=end Comment |
| 2792 |
|
| 2793 |
=cut |
| 2794 |
|
| 2795 |
my %FIGURESTYLE = ( |
| 2796 |
TLF => { |
| 2797 |
reqd => [], |
| 2798 |
nice => [ 'kern', 'liga' ], |
| 2799 |
extra => '', |
| 2800 |
styles => [ qw(normal smallcaps swash textcomp math) ], |
| 2801 |
}, |
| 2802 |
LF => { |
| 2803 |
reqd => [], |
| 2804 |
nice => [ 'kern', 'liga' ], |
| 2805 |
extra => '', |
| 2806 |
styles => [ qw(normal smallcaps swash textcomp math) ], |
| 2807 |
}, |
| 2808 |
TOsF => { |
| 2809 |
reqd => [], |
| 2810 |
nice => [ 'kern', 'liga' ], |
| 2811 |
extra => '', |
| 2812 |
styles => [ qw(normal smallcaps swash textcomp math) ], |
| 2813 |
}, |
| 2814 |
OsF => { |
| 2815 |
reqd => [], |
| 2816 |
nice => [ 'kern', 'liga' ], |
| 2817 |
extra => '', |
| 2818 |
styles => [ qw(normal smallcaps swash textcomp math) ], |
| 2819 |
}, |
| 2820 |
Sup => { |
| 2821 |
reqd => [ 'sups' ], |
| 2822 |
nice => [], |
| 2823 |
extra => '--ligkern="* {KL} *"', |
| 2824 |
styles => [ 'normal' ], |
| 2825 |
}, |
| 2826 |
Inf => { |
| 2827 |
reqd => [], |
| 2828 |
nice => [], |
| 2829 |
extra => '--ligkern="* {KL} *"', |
| 2830 |
styles => [ 'normal' ], |
| 2831 |
}, |
| 2832 |
Numr => { |
| 2833 |
reqd => [ 'numr'], |
| 2834 |
nice => [], |
| 2835 |
extra => '--ligkern="* {KL} *"', |
| 2836 |
styles => [ 'normal' ], |
| 2837 |
}, |
| 2838 |
Dnom => { |
| 2839 |
reqd => [ 'dnom' ], |
| 2840 |
nice => [], |
| 2841 |
extra => '--ligkern="* {KL} *"', |
| 2842 |
styles => [ 'normal' ], |
| 2843 |
}, |
| 2844 |
Titl => { |
| 2845 |
reqd => [ 'titl' ], |
| 2846 |
nice => [ 'kern', 'liga' ], |
| 2847 |
extra => '', |
| 2848 |
styles => [ 'normal' ], |
| 2849 |
}, |
| 2850 |
Orn => { |
| 2851 |
reqd => [ 'ornm' ], |
| 2852 |
nice => [], |
| 2853 |
extra => '--ligkern="* {KL} *"', |
| 2854 |
styles => [ 'normal' ], |
| 2855 |
}, |
| 2856 |
); |
| 2857 |
|
| 2858 |
|
| 2859 |
# -------------------------------------------------------------------------- |
| 2860 |
# Getter; returns a list of all known figure styles. |
| 2861 |
# -------------------------------------------------------------------------- |
| 2862 |
sub get_all_figurestyles { |
| 2863 |
return keys %FIGURESTYLE; |
| 2864 |
} |
| 2865 |
|
| 2866 |
|
| 2867 |
# -------------------------------------------------------------------------- |
| 2868 |
# Getter; returns all styles to generate for the given figure style. |
| 2869 |
# -------------------------------------------------------------------------- |
| 2870 |
sub get_styles { |
| 2871 |
my $figurestyle = shift; |
| 2872 |
|
| 2873 |
return grep { defined $STYLE{$_} } |
| 2874 |
@{$FIGURESTYLE{$figurestyle}{styles}}; |
| 2875 |
} |
| 2876 |
|
| 2877 |
|
| 2878 |
# -------------------------------------------------------------------------- |
| 2879 |
# Getter; returns a list of req'd features for the given (figure) style. |
| 2880 |
# -------------------------------------------------------------------------- |
| 2881 |
sub get_reqd_features { |
| 2882 |
my $what = shift; |
| 2883 |
|
| 2884 |
my $result = $FIGURESTYLE{$what}{reqd} // $STYLE{$what}{reqd} // []; |
| 2885 |
|
| 2886 |
return @{$result}; |
| 2887 |
} |
| 2888 |
|
| 2889 |
|
| 2890 |
# -------------------------------------------------------------------------- |
| 2891 |
# Getter; returns a list of add'l features for the given (figure) style. |
| 2892 |
# -------------------------------------------------------------------------- |
| 2893 |
sub get_nice_features { |
| 2894 |
my $what = shift; |
| 2895 |
|
| 2896 |
my $result = $FIGURESTYLE{$what}{nice} // $STYLE{$what}{nice} // []; |
| 2897 |
|
| 2898 |
return @{$result}; |
| 2899 |
} |
| 2900 |
|
| 2901 |
|
| 2902 |
# -------------------------------------------------------------------------- |
| 2903 |
# Getter; returns a list of all features for the given (figure) style. |
| 2904 |
# -------------------------------------------------------------------------- |
| 2905 |
sub get_features { |
| 2906 |
my $what = shift; |
| 2907 |
|
| 2908 |
return ( get_reqd_features($what), get_nice_features($what) ); |
| 2909 |
} |
| 2910 |
|
| 2911 |
|
| 2912 |
# -------------------------------------------------------------------------- |
| 2913 |
# Getter; returns the name of the given style. |
| 2914 |
# -------------------------------------------------------------------------- |
| 2915 |
sub get_name { |
| 2916 |
my $what = shift; |
| 2917 |
|
| 2918 |
return $STYLE{$what}{name} // ''; |
| 2919 |
} |
| 2920 |
|
| 2921 |
|
| 2922 |
# -------------------------------------------------------------------------- |
| 2923 |
# Getter; returns the 'extra' arguments for the given (figure) style. |
| 2924 |
# -------------------------------------------------------------------------- |
| 2925 |
sub get_extra { |
| 2926 |
my $what = shift; |
| 2927 |
|
| 2928 |
return $FIGURESTYLE{$what}{extra} // $STYLE{$what}{extra} // ''; |
| 2929 |
} |
| 2930 |
|
| 2931 |
|
| 2932 |
# -------------------------------------------------------------------------- |
| 2933 |
# Getter; returns the NFSS code for the given style and 'basic' shape. |
| 2934 |
# -------------------------------------------------------------------------- |
| 2935 |
sub get_fdshape { |
| 2936 |
my ($style, $basicshape) = @_; |
| 2937 |
|
| 2938 |
return $STYLE{$style}{code}{$basicshape}; |
| 2939 |
} |
| 2940 |
|
| 2941 |
|
| 2942 |
# -------------------------------------------------------------------------- |
| 2943 |
# Processes the command-line options. This is split into a number |
| 2944 |
# of smaller steps, that each process a group of related options. |
| 2945 |
# -------------------------------------------------------------------------- |
| 2946 |
sub process_options { |
| 2947 |
process_styles_options(); |
| 2948 |
process_encoding_options(); |
| 2949 |
process_target_options(); |
| 2950 |
process_output_options(); |
| 2951 |
|
| 2952 |
return; |
| 2953 |
} |
| 2954 |
|
| 2955 |
|
| 2956 |
# -------------------------------------------------------------------------- |
| 2957 |
# Processes all options that select or deselect styles. |
| 2958 |
# -------------------------------------------------------------------------- |
| 2959 |
sub process_styles_options { |
| 2960 |
delete $STYLE{smallcaps} unless $ARGV{smallcaps}; |
| 2961 |
delete $STYLE{swash} unless $ARGV{swash}; |
| 2962 |
|
| 2963 |
delete $FIGURESTYLE{Titl} unless $ARGV{titling}; |
| 2964 |
delete $FIGURESTYLE{Sup} unless $ARGV{superiors}; |
| 2965 |
delete $FIGURESTYLE{Orn} unless $ARGV{ornaments}; |
| 2966 |
delete @FIGURESTYLE{qw(Numr Dnom)} unless $ARGV{fractions}; |
| 2967 |
$ARGV{inferiors} ||= 'auto'; |
| 2968 |
if ($ARGV{inferiors} eq 'none') { delete $FIGURESTYLE{Inf} } |
| 2969 |
elsif ($ARGV{inferiors} eq 'auto') { $FIGURESTYLE{Inf}{reqd} = ['auto'] } |
| 2970 |
elsif ($ARGV{inferiors} eq 'subs') { $FIGURESTYLE{Inf}{reqd} = ['subs'] } |
| 2971 |
elsif ($ARGV{inferiors} eq 'sinf') { $FIGURESTYLE{Inf}{reqd} = ['sinf'] } |
| 2972 |
elsif ($ARGV{inferiors} eq 'dnom') { $FIGURESTYLE{Inf}{reqd} = ['dnom'] } |
| 2973 |
else { |
| 2974 |
# Apparently we mistook the first argument (font name) for |
| 2975 |
# an optional argument to -inferiors; let's undo that. |
| 2976 |
unshift @ARGV, $ARGV{inferiors}; |
| 2977 |
$ARGV{inferiors} = 'auto'; |
| 2978 |
$FIGURESTYLE{Inf}{reqd} = ['auto']; |
| 2979 |
} |
| 2980 |
|
| 2981 |
# Fix the %FIGURESTYLE table to take 'default' figure styles into account. |
| 2982 |
if ($ARGV{fig_height} eq 'onum') { |
| 2983 |
push @{$FIGURESTYLE{TLF}{reqd}}, 'lnum'; |
| 2984 |
push @{$FIGURESTYLE{LF}{reqd}}, 'lnum'; |
| 2985 |
push @{$FIGURESTYLE{TOsF}{nice}}, 'onum'; |
| 2986 |
push @{$FIGURESTYLE{OsF}{nice}}, 'onum'; |
| 2987 |
} |
| 2988 |
else { |
| 2989 |
push @{$FIGURESTYLE{TLF}{nice}}, 'lnum'; |
| 2990 |
push @{$FIGURESTYLE{LF}{nice}}, 'lnum'; |
| 2991 |
push @{$FIGURESTYLE{TOsF}{reqd}}, 'onum'; |
| 2992 |
push @{$FIGURESTYLE{OsF}{reqd}}, 'onum'; |
| 2993 |
} |
| 2994 |
|
| 2995 |
if ($ARGV{fig_width} eq 'pnum') { |
| 2996 |
push @{$FIGURESTYLE{TLF}{reqd}}, 'tnum'; |
| 2997 |
push @{$FIGURESTYLE{TOsF}{reqd}}, 'tnum'; |
| 2998 |
push @{$FIGURESTYLE{LF}{nice}}, 'pnum'; |
| 2999 |
push @{$FIGURESTYLE{OsF}{nice}}, 'pnum'; |
| 3000 |
} |
| 3001 |
else { |
| 3002 |
push @{$FIGURESTYLE{TLF}{nice}}, 'tnum'; |
| 3003 |
push @{$FIGURESTYLE{TOsF}{nice}}, 'tnum'; |
| 3004 |
push @{$FIGURESTYLE{LF}{reqd}}, 'pnum'; |
| 3005 |
push @{$FIGURESTYLE{OsF}{reqd}}, 'pnum'; |
| 3006 |
} |
| 3007 |
|
| 3008 |
delete @FIGURESTYLE{qw(LF TLF)} unless $ARGV{lining}; |
| 3009 |
delete @FIGURESTYLE{qw(OsF TOsF)} unless $ARGV{oldstyle}; |
| 3010 |
delete @FIGURESTYLE{qw(LF OsF)} unless $ARGV{proportional}; |
| 3011 |
delete @FIGURESTYLE{qw(TLF TOsF)} unless $ARGV{tabular}; |
| 3012 |
|
| 3013 |
if (!$ARGV{figurekern}) { |
| 3014 |
my @digits = qw(zero one two three four five six seven eight nine); |
| 3015 |
my $tkern |
| 3016 |
= join ' ', map { my $left = $_; |
| 3017 |
map { qq(--ligkern="$left {} $_") } @digits |
| 3018 |
} |
| 3019 |
@digits; |
| 3020 |
|
| 3021 |
$FIGURESTYLE{TLF}{extra} = $tkern; |
| 3022 |
$FIGURESTYLE{TOsF}{extra} = $tkern; |
| 3023 |
} |
| 3024 |
|
| 3025 |
return; |
| 3026 |
} |
| 3027 |
|
| 3028 |
|
| 3029 |
# -------------------------------------------------------------------------- |
| 3030 |
# Processes the options for selecting encodings. |
| 3031 |
# -------------------------------------------------------------------------- |
| 3032 |
sub process_encoding_options { |
| 3033 |
|
| 3034 |
# All specified encodings should either be built-in, |
| 3035 |
# or have an accompanying .enc file in the current directory. |
| 3036 |
my @encodings = split /,/, $ARGV{encoding}; |
| 3037 |
for my $enc (@encodings) { |
| 3038 |
if ($enc !~ m/\A(OT1|T[1345]|T2[ABC]|TS[13]|LY1|LGR|CS|L7X|QX)\z/xmsi) { |
| 3039 |
my $try = $enc; |
| 3040 |
$try .= '.enc' if $try !~ m/[.]enc\z/xmsi; |
| 3041 |
if (!-e $try) { |
| 3042 |
die "[ERROR] No .enc file found for '$enc'"; |
| 3043 |
} |
| 3044 |
} |
| 3045 |
} |
| 3046 |
my @textencodings = grep { $_ !~ m/TS1/xmsi } @encodings; |
| 3047 |
$ARGV{encoding} = \@textencodings; |
| 3048 |
|
| 3049 |
# TS1-encoded fonts are generated if: |
| 3050 |
# - the user explicitly asked for TS1, or |
| 3051 |
# - the text encodings contain T1 and the user didn't turn off TS1 |
| 3052 |
if ($ARGV{textcomp} == 1 |
| 3053 |
or ($ARGV{textcomp} >= 1 |
| 3054 |
and grep { uc $_ eq 'T1' } @{$ARGV{encoding}})) { |
| 3055 |
$ARGV{textcomp} = 1; |
| 3056 |
} |
| 3057 |
else { |
| 3058 |
delete $STYLE{textcomp}; |
| 3059 |
} |
| 3060 |
|
| 3061 |
if ($ARGV{math}) { |
| 3062 |
if (!( grep { $_ eq 'OT1' } @{$ARGV{encoding}} )) { |
| 3063 |
$ARGV{encoding} = [ 'OT1', @{$ARGV{encoding}} ]; |
| 3064 |
} |
| 3065 |
} |
| 3066 |
else { |
| 3067 |
delete $STYLE{math} |
| 3068 |
} |
| 3069 |
|
| 3070 |
if ($ARGV{mathspacing}) { |
| 3071 |
if (defined $STYLE{math}{extra}) { |
| 3072 |
$STYLE{math}{extra} .= " --letterspacing=$ARGV{mathspacing}"; |
| 3073 |
} |
| 3074 |
} |
| 3075 |
|
| 3076 |
return; |
| 3077 |
} |
| 3078 |
|
| 3079 |
|
| 3080 |
# -------------------------------------------------------------------------- |
| 3081 |
# Processes the options related to the target TEXMF directory. |
| 3082 |
# -------------------------------------------------------------------------- |
| 3083 |
sub process_target_options{ |
| 3084 |
|
| 3085 |
my $localtarget = File::Spec->catdir( Cwd::getcwd(), 'autoinst_output' ); |
| 3086 |
if ($ARGV{manual}) { |
| 3087 |
warn "[WARNING] Option '-target' overridden by '-manual'!\n" |
| 3088 |
if $ARGV{target}; |
| 3089 |
$ARGV{target} = $localtarget; |
| 3090 |
} |
| 3091 |
elsif (!$ARGV{target}) { |
| 3092 |
my $is_windows_os = ( $^O =~ /^MSWin/i ); |
| 3093 |
my $kpsepath = $is_windows_os |
| 3094 |
? eval { qx( kpsewhich -expand-var=\$TEXMFLOCAL;\$TEXMFHOME ) } |
| 3095 |
: eval { qx( kpsewhich -expand-var='\$TEXMFLOCAL:\$TEXMFHOME' ) } |
| 3096 |
; |
| 3097 |
if (!$kpsepath) { |
| 3098 |
warn <<"END_WARNING_KPSEWHICH"; |
| 3099 |
[WARNING] Call to "kpsewhich" failed. |
| 3100 |
Maybe your TeX system doesn't use the kpathsea library? |
| 3101 |
|
| 3102 |
Consider using the "-target" command line option |
| 3103 |
to specify a TEXMF tree where autoinst should install all files. |
| 3104 |
END_WARNING_KPSEWHICH |
| 3105 |
} |
| 3106 |
else { |
| 3107 |
my $pathsep = $is_windows_os ? ';' : ':'; |
| 3108 |
for my $dir ( split m/$pathsep/xms, substr $kpsepath, 0, -1 ) { |
| 3109 |
if (-w $dir) { $ARGV{target} = $dir; last } |
| 3110 |
if (-e $dir) { next } |
| 3111 |
my $par = File::Spec->catdir( $dir, File::Spec->updir() ); |
| 3112 |
if (-w $par) { $ARGV{target} = $dir; last } |
| 3113 |
} |
| 3114 |
} |
| 3115 |
} |
| 3116 |
|
| 3117 |
if (!$ARGV{target}) { |
| 3118 |
$ARGV{target} = $localtarget; |
| 3119 |
warn <<"END_WARNING_DUMPING_FILES"; |
| 3120 |
[WARNING] No user-writable TEXMF-tree found! |
| 3121 |
|
| 3122 |
I'm putting all generated files in "$ARGV{target}". |
| 3123 |
|
| 3124 |
Please install these files into a suitable TEXMF directory, |
| 3125 |
update the filename database and run 'updmap' (or similar); |
| 3126 |
see your TeX installation's documentation. |
| 3127 |
END_WARNING_DUMPING_FILES |
| 3128 |
} |
| 3129 |
|
| 3130 |
if ($ARGV{target} =~ m/\s/xms) { |
| 3131 |
warn <<"END_WARNING_SPACES_IN_PATHS"; |
| 3132 |
[WARNING] The pathname of your target directory contains spaces: |
| 3133 |
"$ARGV{target}" |
| 3134 |
If you experience any problems, try re-running autoinst |
| 3135 |
on a target directory without spaces in its name. |
| 3136 |
END_WARNING_SPACES_IN_PATHS |
| 3137 |
} |
| 3138 |
|
| 3139 |
return; |
| 3140 |
} |
| 3141 |
|
| 3142 |
|
| 3143 |
# -------------------------------------------------------------------------- |
| 3144 |
# Processes the output related options. |
| 3145 |
# -------------------------------------------------------------------------- |
| 3146 |
sub process_output_options{ |
| 3147 |
# If the user gave -t1suffix *without* value as the last option, |
| 3148 |
# Getopt::Long may mistake the next argument (a font filename) |
| 3149 |
# for the value of -t1suffix; we take care of this case |
| 3150 |
# by testing whether the value refers to an existing file |
| 3151 |
# and repairing things if necessary. |
| 3152 |
if (-e $ARGV{t1suffix}) { |
| 3153 |
unshift @ARGV, $ARGV{t1suffix}; |
| 3154 |
$ARGV{t1suffix} = ''; |
| 3155 |
} |
| 3156 |
|
| 3157 |
$ARGV{t1suffix} ||= 'PS'; |
| 3158 |
|
| 3159 |
if ($ARGV{t1suffix} eq 'none') { |
| 3160 |
$ARGV{t1suffix} = ''; |
| 3161 |
} |
| 3162 |
|
| 3163 |
return; |
| 3164 |
} |
| 3165 |
|
| 3166 |
|
| 3167 |
# -------------------------------------------------------------------------- |
| 3168 |
# Processes command line options with font family-specific defaults. |
| 3169 |
# -------------------------------------------------------------------------- |
| 3170 |
sub process_family_dependent_options { |
| 3171 |
my $fontlist = shift; |
| 3172 |
|
| 3173 |
if (!$ARGV{nfss}) { |
| 3174 |
$ARGV{nfss} = $fontlist->[0]{nfss}; |
| 3175 |
} |
| 3176 |
# If the user didn't explicitly say anything about ligatures, |
| 3177 |
# activate them unless the font is a typewriter font. |
| 3178 |
if ($ARGV{ligatures} == 2 and $ARGV{nfss} eq 'tt') { |
| 3179 |
$ARGV{ligatures} = 0; |
| 3180 |
} |
| 3181 |
|
| 3182 |
# We can only handle the '-inferiors=auto' option now; |
| 3183 |
# since we need to know which inferior figures this font supports, |
| 3184 |
# we have to do the font info parsing first. |
| 3185 |
if ($ARGV{inferiors} eq 'auto') { |
| 3186 |
choose_inferiors($fontlist); |
| 3187 |
} |
| 3188 |
|
| 3189 |
$ARGV{logfile} ||= sprintf "%s.log", lc $fontlist->[0]{family}; |
| 3190 |
|
| 3191 |
return; |
| 3192 |
} |
| 3193 |
|
| 3194 |
|
| 3195 |
# -------------------------------------------------------------------------- |
| 3196 |
# Processes the -inferiors=auto option, given a list of fonts. |
| 3197 |
# We look through these fonts and simply pick the very first |
| 3198 |
# type of inferiors we see (we assume that this type is supported |
| 3199 |
# by all fonts in this family). |
| 3200 |
# -------------------------------------------------------------------------- |
| 3201 |
sub choose_inferiors { |
| 3202 |
my $fontlist = shift; |
| 3203 |
|
| 3204 |
FONT: |
| 3205 |
for my $font (@{$fontlist}) { |
| 3206 |
for my $inf (qw(sinf subs dnom)) { |
| 3207 |
if (exists $font->{feature}{$inf}) { |
| 3208 |
$ARGV{inferiors} = "auto (-> $inf)"; |
| 3209 |
$FIGURESTYLE{Inf}{reqd} = [$inf]; |
| 3210 |
last FONT; |
| 3211 |
} |
| 3212 |
} |
| 3213 |
} |
| 3214 |
|
| 3215 |
# If we didn't find any inferior figures, |
| 3216 |
# delete the 'Inf' entry from the %FIGURESTYLE table |
| 3217 |
# to indicate we don't want to generate this style. |
| 3218 |
if ($ARGV{inferiors} eq 'auto') { |
| 3219 |
delete $FIGURESTYLE{Inf}; |
| 3220 |
$ARGV{inferiors} = "auto (-> none)"; |
| 3221 |
} |
| 3222 |
|
| 3223 |
return; |
| 3224 |
} |
| 3225 |
|
| 3226 |
|
| 3227 |
############################################################################ |
| 3228 |
|
| 3229 |
|
| 3230 |
package Util; |
| 3231 |
|
| 3232 |
# -------------------------------------------------------------------------- |
| 3233 |
# Tests if all given predicates are true. |
| 3234 |
# -------------------------------------------------------------------------- |
| 3235 |
sub all { |
| 3236 |
return !( grep { !$_ } @_ ); |
| 3237 |
} |
| 3238 |
|
| 3239 |
|
| 3240 |
# -------------------------------------------------------------------------- |
| 3241 |
# Tests if any of the given predicates are true. |
| 3242 |
# -------------------------------------------------------------------------- |
| 3243 |
sub any { |
| 3244 |
return grep { $_ } @_; |
| 3245 |
} |
| 3246 |
|
| 3247 |
|
| 3248 |
# -------------------------------------------------------------------------- |
| 3249 |
# Walks a (nested) dictionary and returns a lookup table with all keys. |
| 3250 |
# -------------------------------------------------------------------------- |
| 3251 |
sub get_keys { |
| 3252 |
my $dict = shift; |
| 3253 |
my $seen = shift // {}; |
| 3254 |
|
| 3255 |
while (my ($k, $v) = each %$dict) { |
| 3256 |
$seen->{$k} = 1; |
| 3257 |
get_keys($v, $seen) if ref $v eq 'HASH'; |
| 3258 |
} |
| 3259 |
|
| 3260 |
return $seen; |
| 3261 |
} |
| 3262 |
|
| 3263 |
|
| 3264 |
# -------------------------------------------------------------------------- |
| 3265 |
# Sorts its arguments so that longer strings come before shorter ones. |
| 3266 |
# -------------------------------------------------------------------------- |
| 3267 |
sub sort_desc_length { |
| 3268 |
return reverse sort { length($a) <=> length($b) } @_; |
| 3269 |
} |
| 3270 |
|
| 3271 |
|
| 3272 |
############################################################################ |
| 3273 |
|
| 3274 |
|
| 3275 |
package Work; |
| 3276 |
|
| 3277 |
|
| 3278 |
# -------------------------------------------------------------------------- |
| 3279 |
# Decides which styles, figure styles and encodings to generate |
| 3280 |
# for the given fonts. |
| 3281 |
# -------------------------------------------------------------------------- |
| 3282 |
sub generate_worklist { |
| 3283 |
my $fontlist = shift; |
| 3284 |
|
| 3285 |
my @worklist = map { { font => $_ } } @{$fontlist}; |
| 3286 |
|
| 3287 |
# 1. For each font, decide which figure styles should be created. |
| 3288 |
@worklist = map { expand_figurestyles($_) } @worklist; |
| 3289 |
|
| 3290 |
# 2. For each (font, figure style) combination, |
| 3291 |
# decide which styles should be created. |
| 3292 |
@worklist = map { expand_styles($_) } @worklist; |
| 3293 |
|
| 3294 |
# 3. For each (font, figure style, style) combination, |
| 3295 |
# decide which encodings should be created. |
| 3296 |
@worklist = map { expand_encodings($_) } @worklist; |
| 3297 |
|
| 3298 |
# 4. Some miscellaneous finishing touches. |
| 3299 |
@worklist = grep { $_ } map { cleanup($_) } @worklist; |
| 3300 |
|
| 3301 |
return @worklist; |
| 3302 |
} |
| 3303 |
|
| 3304 |
|
| 3305 |
# -------------------------------------------------------------------------- |
| 3306 |
# Determines which figure styles to create for the given work item. |
| 3307 |
# A figure style is created if the current font contains all of |
| 3308 |
# the 'reqd' features for this figure style. |
| 3309 |
# Returns a list of new work items, one for each figure style. |
| 3310 |
# -------------------------------------------------------------------------- |
| 3311 |
sub expand_figurestyles { |
| 3312 |
my $workitem = shift; |
| 3313 |
|
| 3314 |
my $font = $workitem->{font}; |
| 3315 |
|
| 3316 |
my @results; |
| 3317 |
for my $figurestyle (Tables::get_all_figurestyles()) { |
| 3318 |
my @reqd = Tables::get_reqd_features($figurestyle); |
| 3319 |
my $has_all_reqd = Util::all(map { $font->{feature}{$_} } @reqd); |
| 3320 |
if ($has_all_reqd) { |
| 3321 |
my %new_workitem = %{$workitem}; |
| 3322 |
$new_workitem{figurestyle} = $figurestyle; |
| 3323 |
push @results, \%new_workitem; |
| 3324 |
} |
| 3325 |
} |
| 3326 |
|
| 3327 |
return @results; |
| 3328 |
} |
| 3329 |
|
| 3330 |
|
| 3331 |
# -------------------------------------------------------------------------- |
| 3332 |
# Determines which styles to create for the given work item. |
| 3333 |
# A style is created if the current font has at least one of the |
| 3334 |
# 'reqd' features for this style, or if there are no 'reqd' features. |
| 3335 |
# Returns a list of new work items, one for each style. |
| 3336 |
# -------------------------------------------------------------------------- |
| 3337 |
sub expand_styles { |
| 3338 |
my $workitem = shift; |
| 3339 |
|
| 3340 |
my ($font, $figurestyle) = @{$workitem}{qw(font figurestyle)}; |
| 3341 |
|
| 3342 |
my @results; |
| 3343 |
for my $style (Tables::get_styles($figurestyle)) { |
| 3344 |
my @reqd = Tables::get_reqd_features($style); |
| 3345 |
my $has_any_reqd |
| 3346 |
= (scalar @reqd == 0) |
| 3347 |
|| Util::any(map { $font->{feature}{$_} } @reqd); |
| 3348 |
if ($has_any_reqd) { |
| 3349 |
my %new_workitem = %{$workitem}; |
| 3350 |
$new_workitem{style} = $style; |
| 3351 |
push @results, \%new_workitem; |
| 3352 |
} |
| 3353 |
} |
| 3354 |
|
| 3355 |
return @results; |
| 3356 |
} |
| 3357 |
|
| 3358 |
|
| 3359 |
# -------------------------------------------------------------------------- |
| 3360 |
# Determines which encodings to use for the given work item; |
| 3361 |
# returns a list of new work items, one for each encoding. |
| 3362 |
# -------------------------------------------------------------------------- |
| 3363 |
sub expand_encodings { |
| 3364 |
my $workitem = shift; |
| 3365 |
|
| 3366 |
my ($font, $figurestyle, $style) |
| 3367 |
= @{$workitem}{qw(font figurestyle style)}; |
| 3368 |
my @encodings = $style eq 'textcomp' ? qw(ts1) |
| 3369 |
: $figurestyle eq 'Orn' ? qw(ot1) |
| 3370 |
: $style eq 'math' ? qw(oml) |
| 3371 |
: @{$ARGV{encoding}} |
| 3372 |
; |
| 3373 |
|
| 3374 |
my @results; |
| 3375 |
for my $encoding (@encodings) { |
| 3376 |
my %new_workitem = %{$workitem}; |
| 3377 |
$new_workitem{encoding} = $encoding; |
| 3378 |
push @results, \%new_workitem; |
| 3379 |
} |
| 3380 |
|
| 3381 |
return @results; |
| 3382 |
} |
| 3383 |
|
| 3384 |
|
| 3385 |
# -------------------------------------------------------------------------- |
| 3386 |
# Adds some miscellaneous finishing touches to the given work item. |
| 3387 |
# -------------------------------------------------------------------------- |
| 3388 |
sub cleanup { |
| 3389 |
my $workitem = shift; |
| 3390 |
|
| 3391 |
my ($font, $figurestyle, $style) |
| 3392 |
= @{$workitem}{qw(font figurestyle style)}; |
| 3393 |
|
| 3394 |
# Don't generate smallcaps version of TS1-encoded fonts, |
| 3395 |
# as these contain the same glyphs as the regular version. |
| 3396 |
if ($font->{is_smallcaps}) { |
| 3397 |
if ($style eq 'textcomp') { |
| 3398 |
return; |
| 3399 |
} |
| 3400 |
else { |
| 3401 |
$style = 'smallcaps'; |
| 3402 |
} |
| 3403 |
} |
| 3404 |
|
| 3405 |
# Look up the NFSS code for this font's shape... |
| 3406 |
$workitem->{fdshape} = Tables::get_fdshape($style, $font->{basicshape}); |
| 3407 |
# ... but drop this workitem if we shouldn't generate this shape. |
| 3408 |
if (!defined $workitem->{fdshape}) { |
| 3409 |
return; |
| 3410 |
} |
| 3411 |
|
| 3412 |
# Figure out whether the encoding option refers to a custom encoding file |
| 3413 |
# in the current directory, or to the name of one of our standard |
| 3414 |
# encodings. In the former case, we quote the filename, to account |
| 3415 |
# for possible spaces or other metacharacters; in the latter case, |
| 3416 |
# we add the 'fontools_' prefix. |
| 3417 |
if (-e $workitem->{encoding}) { |
| 3418 |
$workitem->{enc_file} = qq{"$workitem->{encoding}"}; |
| 3419 |
$workitem->{encoding} |
| 3420 |
= File::Basename::basename($workitem->{encoding}, '.enc', '.ENC'); |
| 3421 |
} |
| 3422 |
else { |
| 3423 |
($workitem->{enc_file} = $workitem->{encoding}) |
| 3424 |
=~ s{ \A (OT1|OML|T[1345]|T2[ABC]|TS[13]|LY1|LGR|CS|L7X|QX) \z } |
| 3425 |
{fontools_\L$1\E}xmsi; |
| 3426 |
} |
| 3427 |
|
| 3428 |
# Ornaments have no text encoding, and don't need kerning and ligatures. |
| 3429 |
if ($figurestyle eq 'Orn') { |
| 3430 |
$workitem->{encoding} = 'u'; |
| 3431 |
} |
| 3432 |
|
| 3433 |
# Compile list of OpenType features to use with this font. |
| 3434 |
my %feature = map { ($_ => 1) } |
| 3435 |
grep { $font->{feature}{$_} } |
| 3436 |
( Tables::get_features($figurestyle), |
| 3437 |
Tables::get_features($style) ); |
| 3438 |
if ($feature{lnum} && $feature{onum}) { |
| 3439 |
delete $feature{lnum}; |
| 3440 |
} |
| 3441 |
|
| 3442 |
# Don't create ligatures if the user doesn't want them. |
| 3443 |
delete $feature{liga} if !$ARGV{ligatures}; |
| 3444 |
|
| 3445 |
# Don't create kerns and ligatures for symbol or otherwise "unencoded" fonts. |
| 3446 |
delete @feature{qw(kern liga)} |
| 3447 |
if $workitem->{encoding} =~ m/\A ( TS\d | OM[LS] ) \z | \A U_ /xmsi; |
| 3448 |
|
| 3449 |
$workitem->{features} = [ sort keys %feature ]; |
| 3450 |
|
| 3451 |
# Generate a unique name for this font. |
| 3452 |
(my $encoding = lc $workitem->{encoding}) =~ s/\A u_ //xms; |
| 3453 |
$workitem->{fontname} |
| 3454 |
= join '-', grep { $_ } $font->{name}, |
| 3455 |
lc $figurestyle, |
| 3456 |
lc Tables::get_name($style), |
| 3457 |
$encoding; |
| 3458 |
|
| 3459 |
$workitem->{encoding} = uc $workitem->{encoding}; |
| 3460 |
if ($workitem->{encoding} =~ m/\A U_/xms) { |
| 3461 |
$workitem->{encoding} = 'U'; |
| 3462 |
} |
| 3463 |
|
| 3464 |
return $workitem; |
| 3465 |
} |
| 3466 |
|
| 3467 |
|
| 3468 |
# -------------------------------------------------------------------------- |
| 3469 |
# Modify the font and file names of all generated .pfb files. |
| 3470 |
# -------------------------------------------------------------------------- |
| 3471 |
sub modify_fontnames { |
| 3472 |
my ($family, $fontlist) = @_; |
| 3473 |
|
| 3474 |
my %has_fonttype = map { ($_->{fonttype} => 1) } @{$fontlist}; |
| 3475 |
return unless $has_fonttype{opentype}; |
| 3476 |
|
| 3477 |
my $pfb_dir = File::Spec->catdir( |
| 3478 |
$ARGV{target}, |
| 3479 |
'fonts', |
| 3480 |
'type1', |
| 3481 |
$ARGV{vendor}, |
| 3482 |
$ARGV{typeface} || $family); |
| 3483 |
|
| 3484 |
# The otftotfm-generated map file refers to the original otf files; |
| 3485 |
# we need to change this to use our name-modified Type1 fonts instead. |
| 3486 |
# Note that cfftot1 uses the Name INDEX from the CFF table, |
| 3487 |
# not the PostScript name from the name table. These two names are |
| 3488 |
# usually equal, but not necessarily (sec 5.4.2 in OpenType spec). |
| 3489 |
my $mapfile = File::Spec->catfile( |
| 3490 |
$ARGV{target}, |
| 3491 |
'fonts', |
| 3492 |
'map', |
| 3493 |
'dvips', |
| 3494 |
$ARGV{typeface} || $family, |
| 3495 |
$family . '.map'); |
| 3496 |
open my $map, '<', $mapfile |
| 3497 |
or die "[ERROR] Cannot open '$mapfile' for reading"; |
| 3498 |
my $mapdata = do { local $/; <$map> }; |
| 3499 |
close $map; |
| 3500 |
|
| 3501 |
my $NOTICE = 'Converted to Type1 by autoinst/cfftot1; ' |
| 3502 |
. 'for use with pdfTeX only! '; |
| 3503 |
|
| 3504 |
my $newfam = $family . $ARGV{t1suffix}; |
| 3505 |
|
| 3506 |
for my $font (@{$fontlist}) { |
| 3507 |
next unless $font->{fonttype} eq 'opentype'; |
| 3508 |
|
| 3509 |
my $full_family = $font->{originalfamily}; |
| 3510 |
if (index($full_family, $family) > -1) { |
| 3511 |
$full_family = $family; |
| 3512 |
} |
| 3513 |
else { |
| 3514 |
while ($full_family =~ m/[ ]/xms) { |
| 3515 |
(my $no_space = $full_family) =~ s/[ ]+//xmsg; |
| 3516 |
last if $no_space eq $family; |
| 3517 |
$full_family =~ s/[ ]\S*\z//xms; |
| 3518 |
} |
| 3519 |
$full_family ||= $family; |
| 3520 |
} |
| 3521 |
my $newfullfam = $full_family . q( ) . $ARGV{t1suffix}; |
| 3522 |
|
| 3523 |
my $newname; |
| 3524 |
if ($font->{cff_name} =~ m/$family/xms) { |
| 3525 |
($newname = $font->{cff_name}) =~ s/$family/$newfam/xms; |
| 3526 |
} |
| 3527 |
else { |
| 3528 |
(my $dashfam = $font->{originalfamily}) =~ s/[ ]/-/xmsg; |
| 3529 |
if ($font->{cff_name} =~ m/$dashfam(.+)/xms) { |
| 3530 |
$newname = $dashfam . '-' . $ARGV{t1suffix} . $1; |
| 3531 |
} |
| 3532 |
else { |
| 3533 |
$newname = $font->{cff_name} . $ARGV{t1suffix}; |
| 3534 |
} |
| 3535 |
} |
| 3536 |
|
| 3537 |
for my $suffix (q(), q(LCDFJ)) { |
| 3538 |
my $oldfn = File::Spec->catfile( |
| 3539 |
$pfb_dir, $font->{cff_name} . $suffix . '.pfb'); |
| 3540 |
my $newfn = File::Spec->catfile( |
| 3541 |
$pfb_dir, $newname . $suffix . '.pfb'); |
| 3542 |
|
| 3543 |
next unless -e $oldfn; |
| 3544 |
if ($suffix eq 'LCDFJ' and -z $oldfn) { |
| 3545 |
unlink $oldfn; |
| 3546 |
next; |
| 3547 |
} |
| 3548 |
|
| 3549 |
my $cmd = qq(t1disasm "$oldfn"); |
| 3550 |
open my $t1disasm, '-|:raw', $cmd |
| 3551 |
or die "[ERROR] Could not run '$cmd': $!"; |
| 3552 |
my @pfbdata = readline $t1disasm; |
| 3553 |
close $t1disasm |
| 3554 |
or die "[ERROR] '$cmd' failed"; |
| 3555 |
|
| 3556 |
for (@pfbdata) { |
| 3557 |
if (m/%!PS-AdobeFont-1.0:[ ] | \/FontName[ ]/xms) { |
| 3558 |
s/$font->{cff_name}/$newname/; |
| 3559 |
} |
| 3560 |
if (m/\/Notice[ ]/xms) { |
| 3561 |
s/[(]/($NOTICE/xms; |
| 3562 |
} |
| 3563 |
if (m/\/FullName[ ] | \/FamilyName[ ]/xms) { |
| 3564 |
s/$full_family/$newfullfam/ |
| 3565 |
or s/(.+?)(-|\z)/$1$ARGV{t1suffix}$2/; |
| 3566 |
} |
| 3567 |
} |
| 3568 |
|
| 3569 |
$cmd = qq(t1asm --pfb >"$newfn"); |
| 3570 |
open my $t1asm, '|-:raw', $cmd |
| 3571 |
or die "[ERROR] Could not run '$cmd': $!"; |
| 3572 |
print {$t1asm} @pfbdata; |
| 3573 |
close $t1asm |
| 3574 |
or die "[ERROR] '$cmd' failed"; |
| 3575 |
|
| 3576 |
unlink $oldfn unless $oldfn eq $newfn; |
| 3577 |
|
| 3578 |
$mapdata =~ s/$font->{cff_name}$suffix(?!-)/$newname$suffix/g; |
| 3579 |
} |
| 3580 |
} |
| 3581 |
|
| 3582 |
open $map, '>', $mapfile |
| 3583 |
or die "[ERROR] Cannot open '$mapfile' for writing"; |
| 3584 |
print {$map} $mapdata; |
| 3585 |
close $map; |
| 3586 |
|
| 3587 |
return; |
| 3588 |
} |
| 3589 |
|
| 3590 |
|
| 3591 |
############################################################################ |
| 3592 |
|
| 3593 |
|
| 3594 |
package main; |
| 3595 |
|
| 3596 |
if ($RUNNING_AS_MAIN) { |
| 3597 |
main(); |
| 3598 |
} |
| 3599 |
|
| 3600 |
|
| 3601 |
__END__ |
| 3602 |
|
| 3603 |
|
| 3604 |
############################################################################ |
| 3605 |
|
| 3606 |
|
| 3607 |
To create the documentation: |
| 3608 |
|
| 3609 |
pod2man --center='Marc Penninga' --release='fontools' --section=1 \ |
| 3610 |
autoinst - | groff -Tps -man - | ps2pdf - autoinst.pdf |
| 3611 |
|
| 3612 |
|
| 3613 |
=pod |
| 3614 |
|
| 3615 |
=head1 NAME |
| 3616 |
|
| 3617 |
autoinst - wrapper around the F<LCDF TypeTools>, |
| 3618 |
for installing and using OpenType fonts in LaTeX. |
| 3619 |
|
| 3620 |
|
| 3621 |
=head1 SYNOPSIS |
| 3622 |
|
| 3623 |
B<autoinst> I<-help> |
| 3624 |
|
| 3625 |
B<autoinst> [I<options>] B<font(s)> |
| 3626 |
|
| 3627 |
|
| 3628 |
=head1 DESCRIPTION |
| 3629 |
|
| 3630 |
Eddie Kohler's I<LCDF TypeTools> are superb tools for installing |
| 3631 |
OpenType fonts in LaTeX, but they can be hard to use: |
| 3632 |
they need many, often long, command lines |
| 3633 |
and don't generate the F<fd> and F<sty> files LaTeX needs. |
| 3634 |
B<autoinst> simplifies the use of the I<TypeTools> for font installation |
| 3635 |
by generating and executing all commands for I<otftotfm>, |
| 3636 |
and by creating and installing all necessary F<fd> and F<sty> files. |
| 3637 |
|
| 3638 |
Given a family of font files (in F<otf> or F<ttf> format), |
| 3639 |
B<autoinst> will create several LaTeX font families: |
| 3640 |
|
| 3641 |
=over 2 |
| 3642 |
|
| 3643 |
=over 3 |
| 3644 |
|
| 3645 |
=item - |
| 3646 |
|
| 3647 |
Four text families (with lining and oldstyle digits, |
| 3648 |
each in both tabular and proportional variants), |
| 3649 |
all with the following shapes: |
| 3650 |
|
| 3651 |
=over 2 |
| 3652 |
|
| 3653 |
=over 8 |
| 3654 |
|
| 3655 |
=item I<n> |
| 3656 |
|
| 3657 |
Roman (i.e., upright) text |
| 3658 |
|
| 3659 |
=item I<it>, I<sl> |
| 3660 |
|
| 3661 |
Italic and slanted (sometimes called oblique) text |
| 3662 |
|
| 3663 |
=item I<sc> |
| 3664 |
|
| 3665 |
Small caps |
| 3666 |
|
| 3667 |
=item I<scit>, I<scsl> |
| 3668 |
|
| 3669 |
Italic and slanted small caps |
| 3670 |
|
| 3671 |
=item I<sw> |
| 3672 |
|
| 3673 |
Swash |
| 3674 |
|
| 3675 |
=item I<nw> |
| 3676 |
|
| 3677 |
"Upright swash" |
| 3678 |
|
| 3679 |
=back |
| 3680 |
|
| 3681 |
=back |
| 3682 |
|
| 3683 |
=item - |
| 3684 |
|
| 3685 |
For each T1-encoded text family: |
| 3686 |
a family of TS1-encoded symbol fonts, in roman, italic and slanted shapes. |
| 3687 |
|
| 3688 |
=item - |
| 3689 |
|
| 3690 |
Families with superiors, inferiors, numerators and denominators, |
| 3691 |
in roman, italic and slanted shapes. |
| 3692 |
|
| 3693 |
=item - |
| 3694 |
|
| 3695 |
Families with "Titling" characters; |
| 3696 |
these I<"... replace the default glyphs |
| 3697 |
with corresponding forms designed specifically for titling. |
| 3698 |
These may be all-capital and/or larger on the body, |
| 3699 |
and adjusted for viewing at larger sizes"> |
| 3700 |
(according to the OpenType Specification). |
| 3701 |
|
| 3702 |
=item - |
| 3703 |
|
| 3704 |
An ornament family; also in roman, italic and slanted shapes. |
| 3705 |
|
| 3706 |
=back |
| 3707 |
|
| 3708 |
=back |
| 3709 |
|
| 3710 |
Of course, if your fonts don't contain italics, oldstyle digits, small caps |
| 3711 |
etc., the corresponding shapes and families are not created. |
| 3712 |
In addition, the creation of most families and shapes can be controlled |
| 3713 |
by the user (see L</COMMAND-LINE OPTIONS> below). |
| 3714 |
|
| 3715 |
These families use the I<FontPro> project's naming scheme: |
| 3716 |
I<< <FontFamily>-<Suffix> >>, where I<< <Suffix> >> is: |
| 3717 |
|
| 3718 |
=over 8 |
| 3719 |
|
| 3720 |
=item I<LF> |
| 3721 |
|
| 3722 |
proportional (i.e., figures have varying widths) lining figures |
| 3723 |
|
| 3724 |
=item I<TLF> |
| 3725 |
|
| 3726 |
tabular (i.e., all figures have the same width) lining figures |
| 3727 |
|
| 3728 |
=item I<OsF> |
| 3729 |
|
| 3730 |
proportional oldstyle figures |
| 3731 |
|
| 3732 |
=item I<TOsF> |
| 3733 |
|
| 3734 |
tabular oldstyle figures |
| 3735 |
|
| 3736 |
=item I<Sup> |
| 3737 |
|
| 3738 |
superior characters (note that most fonts have only an incomplete set of |
| 3739 |
superior characters: digits, some punctuation and the letters I<abdeilmnorst>; |
| 3740 |
normal forms are used for other characters) |
| 3741 |
|
| 3742 |
=item I<Inf> |
| 3743 |
|
| 3744 |
inferior characters; usually only digits and some punctuation, |
| 3745 |
normal forms for other characters |
| 3746 |
|
| 3747 |
=item I<Titl> |
| 3748 |
|
| 3749 |
Titling characters; see above |
| 3750 |
|
| 3751 |
=item I<Orn> |
| 3752 |
|
| 3753 |
ornaments |
| 3754 |
|
| 3755 |
=item I<Numr>, I<Dnom> |
| 3756 |
|
| 3757 |
numerators and denominators |
| 3758 |
|
| 3759 |
=back |
| 3760 |
|
| 3761 |
The individual fonts are named I<< <FontName>-<suffix>-<shape>-<enc> >>, |
| 3762 |
where I<< <suffix> >> is the same as above (but in lowercase), |
| 3763 |
I<< <shape> >> is either empty, "sc" or "swash", |
| 3764 |
and I<< <enc> >> is the encoding (also in lowercase). |
| 3765 |
A typical name in this scheme would be I<FiraSans-Light-osf-sc-ly1>. |
| 3766 |
|
| 3767 |
|
| 3768 |
=head2 Using the fonts in your LaTeX documents |
| 3769 |
|
| 3770 |
B<autoinst> generates a style file for using the fonts in LaTeX documents, |
| 3771 |
named F<< <FontFamily>.sty >>. This style file also loads the F<fontenc> |
| 3772 |
and F<textcomp> packages, if necessary. |
| 3773 |
To use the fonts, add the command C<<< \usepackage{I<< <FontFamily> >>} >>> |
| 3774 |
to the preamble of your document. |
| 3775 |
|
| 3776 |
This style file has a few options: |
| 3777 |
|
| 3778 |
=over 4 |
| 3779 |
|
| 3780 |
=item C<mainfont> |
| 3781 |
|
| 3782 |
Redefine C<\familydefault> to make this font the main font |
| 3783 |
for the document. |
| 3784 |
This is a no-op if the font is installed as a serif font; |
| 3785 |
but if the font is installed as a sanserif or typewriter font, |
| 3786 |
this option saves you from having to redefine C<\familydefault> |
| 3787 |
yourself. |
| 3788 |
|
| 3789 |
=item C<lining>, C<oldstyle>, C<tabular>, C<proportional> |
| 3790 |
|
| 3791 |
Choose which figure style to use. |
| 3792 |
The defaults are "oldstyle" and "proportional" (if available). |
| 3793 |
|
| 3794 |
=item C<<< scale=I<< <factor> >> >>>, C<scale=MatchLowercase> |
| 3795 |
|
| 3796 |
Scale the font by I<< <factor> >>; |
| 3797 |
as an example, C<<< \usepackage[scale=1.05]{I<< <FontFamily> >>} >>> |
| 3798 |
will increase the font's size by 5%. |
| 3799 |
The special value C<MatchLowercase> may be used to scale the font |
| 3800 |
so that its x-height matches that of the current main font |
| 3801 |
(which is usually Computer Modern Roman, unless you have loaded |
| 3802 |
another font package before this one). |
| 3803 |
The word "scale" may also be spelled as "scaled". |
| 3804 |
|
| 3805 |
=item C<medium>, C<book>, C<text>, C<normal>, C<regular> |
| 3806 |
|
| 3807 |
Select the weight that LaTeX will use as the "regular" weight. |
| 3808 |
|
| 3809 |
=item C<heavy>, C<black>, C<extrabold>, C<demibold>, C<semibold>, C<bold> |
| 3810 |
|
| 3811 |
Select the weight that LaTeX will use as the "bold" weight. |
| 3812 |
|
| 3813 |
=back |
| 3814 |
|
| 3815 |
The default here is not to change LaTeX's default, |
| 3816 |
i.e. use the "m" and "b" weights. |
| 3817 |
|
| 3818 |
The style file will also try to load the F<figureversions> package |
| 3819 |
(on CTAN), which gives easy access to various font shapes and styles. |
| 3820 |
Using the machinery set up by F<figureversions>, the generated style file |
| 3821 |
defines a number of commands (which take the text to be typeset as argument) |
| 3822 |
and declarations (which don't take arguments, but affect all text up to |
| 3823 |
the end of the current group) to access titling, superior and inferior |
| 3824 |
characters: |
| 3825 |
|
| 3826 |
|
| 3827 |
DECLARATION COMMAND SHORT FORM OF COMMAND |
| 3828 |
|
| 3829 |
\tlshape \texttitling \texttl |
| 3830 |
\supfigures \textsuperior \textsup, \textsu |
| 3831 |
\inffigures \textinferior \textinf, \textin |
| 3832 |
|
| 3833 |
|
| 3834 |
Finally, the style file redefines Latex's C<\textsuperscript> and |
| 3835 |
C<\textsubscript> commands to use the fonts' superior and inferior figures, |
| 3836 |
and modifies Latex's footnote mechanism to use C<\textsuperscript> |
| 3837 |
instead of reduced-size numerals from the regular text font. |
| 3838 |
The old versions of these commands are still available as |
| 3839 |
C<\textsuperscript*> and C<\textsubscript*>. |
| 3840 |
|
| 3841 |
There are no commands for accessing the numerator and denominator |
| 3842 |
fonts; these can be selected using F<figureversions>' standard commands, |
| 3843 |
e.g., C<\fontfigurestyle{numerator}\selectfont>. |
| 3844 |
|
| 3845 |
Once again: all these commands are only generated for existing shapes and number styles; |
| 3846 |
no commands are generated for shapes and styles that are missing from your fonts. |
| 3847 |
Note that all these commands are built on top of F<figureversions>; if that package |
| 3848 |
cannot be found, you're limited to using lower-level commands from |
| 3849 |
standard NFSS (C<\fontfamily>, C<\fontseries>, C<\fontshape> etc.). |
| 3850 |
|
| 3851 |
By default, B<autoinst> generates text fonts with OT1, LY1 and T1 |
| 3852 |
encodings, and the generated style files use T1 as the default text encoding. |
| 3853 |
Other encodings can be chosen using the I<-encoding> option |
| 3854 |
(see L</COMMAND-LINE OPTIONS> below). |
| 3855 |
|
| 3856 |
|
| 3857 |
=head2 Maths |
| 3858 |
|
| 3859 |
This is an experimental feature; B<USE AT YOUR OWN RISK!> |
| 3860 |
Test the results thoroughly before using them in real documents, |
| 3861 |
and be warned that future versions of B<autoinst> may introduce |
| 3862 |
incompatible changes. |
| 3863 |
|
| 3864 |
The I<-math> option tells B<autoinst> to generate basic math fonts. |
| 3865 |
When enabled, the generated style file defines a few extra options |
| 3866 |
to access these math fonts: |
| 3867 |
|
| 3868 |
=over 4 |
| 3869 |
|
| 3870 |
=item C<math> |
| 3871 |
|
| 3872 |
Use these fonts for the maths in your document. |
| 3873 |
|
| 3874 |
=item C<mathlining>, C<matholdstyle>, C<mathtabular>, C<mathproportional> |
| 3875 |
|
| 3876 |
Choose which figure style and alignment to use in maths. |
| 3877 |
The defaults are "mathlining" and "mathtabular". |
| 3878 |
|
| 3879 |
=item C<mathcal> |
| 3880 |
|
| 3881 |
Use the swash characters from these fonts as the C<\mathcal> alphabet. |
| 3882 |
(This option will only exist if your fonts actually contain |
| 3883 |
both swash characters and a C<swsh> feature to access them). |
| 3884 |
|
| 3885 |
=item C<nomathgreek> |
| 3886 |
|
| 3887 |
Don't redeclare greek letters in math. |
| 3888 |
|
| 3889 |
=item C<<< math-style=I<< <style> >> >>> |
| 3890 |
|
| 3891 |
Choose the "math style" to use. |
| 3892 |
With C<math-style=ISO>, all latin and greek letters in math are italic; |
| 3893 |
with C<math-style=TeX> (the default), uppercase greek is upright; |
| 3894 |
with C<math-style=french>, all greek as well as uppercase latin is upright; |
| 3895 |
and with C<math-style=upright> all letters are upright. |
| 3896 |
|
| 3897 |
=item C<<< scriptscale=I<< <scale> >> >>> |
| 3898 |
|
| 3899 |
By default, Latex loads fonts for the "script" and "scriptscript" styles |
| 3900 |
at 70% and 50% of the text font size. For many text fonts, this is too small |
| 3901 |
and hurts readability. |
| 3902 |
This option scales the "script" style by a factor of I<scale> and |
| 3903 |
the "scriptscript" style by the square of that. |
| 3904 |
The default value is 1.1, which loads the "script" and "scriptscript" styles |
| 3905 |
at a more readable 77% and 60.5%, respectively. |
| 3906 |
To use Latex's defaults, use C<scriptscale=1.0>. |
| 3907 |
|
| 3908 |
=back |
| 3909 |
|
| 3910 |
The style file also defines commands C<\up...> and C<\it...> to access upright |
| 3911 |
and italic greek characters regardless of the chosen math style: |
| 3912 |
C<\upGamma>, C<\upalpha>, C<\itDelta>, C<\itbeta> etc. |
| 3913 |
|
| 3914 |
Note that this C<math> option only affects digits, latin and greek letters, |
| 3915 |
plus a few basic punctuation characters; all other mathematical symbols, |
| 3916 |
operators, delimiters etc. are left as they were before. |
| 3917 |
If you don't want to use TeX's default versions of those symbols, |
| 3918 |
load another math package (such as F<mathdesign> or F<newtxmath>) |
| 3919 |
before loading the B<autoinst>-generated style file. |
| 3920 |
|
| 3921 |
Finally, note that B<autoinst> doesn't check if your fonts actually contains |
| 3922 |
all of the required characters; |
| 3923 |
it just assumes that they do and sets up the style file accordingly. |
| 3924 |
Even if your fonts do contain greek, characters such as C<\varepsilon> |
| 3925 |
may be missing. |
| 3926 |
You may also find that some glyphs I<are> present in your fonts, |
| 3927 |
but don't work well in equations or don't match other symbols; |
| 3928 |
edit the generated style file to remove the declarations of |
| 3929 |
these offending characters. |
| 3930 |
Once again: test the results before using them! |
| 3931 |
If the characters themselves are fine but spaced too tightly, |
| 3932 |
you may try increasing the side bearings in math fonts with |
| 3933 |
the I<-mathspacing> option (see below), e.g. C<-mathspacing=50>. |
| 3934 |
|
| 3935 |
|
| 3936 |
=head2 NFSS codes |
| 3937 |
|
| 3938 |
LaTeX's New Font Selection System (NFSS) |
| 3939 |
identifies fonts by a combination of family, |
| 3940 |
series (the concatenation of weight and width), shape and size. |
| 3941 |
B<autoinst> parses the font's metadata to determine these parameters. |
| 3942 |
When this fails (usually because the font family contains uncommon weights, |
| 3943 |
widths or shapes), |
| 3944 |
B<autoinst> ends up with multiple fonts having the same values |
| 3945 |
for these font parameters; such fonts cannot be used in NFSS, |
| 3946 |
since there's no way distinguish them. |
| 3947 |
When B<autoinst> detects such a situation, it will print an error message |
| 3948 |
and abort. |
| 3949 |
If that happens, either rerun B<autoinst> on a smaller set of fonts, |
| 3950 |
or add the missing widths, weights and shapes to the tables C<@WIDTH>, |
| 3951 |
C<@WEIGHT> and C<%SHAPE> in the source code. |
| 3952 |
Please also send a bug report (see L<AUTHOR> below). |
| 3953 |
|
| 3954 |
The mapping of shapes to NFSS codes is done using the following table: |
| 3955 |
|
| 3956 |
SHAPE CODE |
| 3957 |
-------------------------------- ---- |
| 3958 |
Roman, Upright n |
| 3959 |
Italic it |
| 3960 |
Oblique, Slant(ed), Incline(d) sl |
| 3961 |
|
| 3962 |
(I<Exception:> Adobe Silentium Pro contains two Roman shapes; |
| 3963 |
we map the first of these to C<n>, for the second one we (ab)use the C<it> code |
| 3964 |
as this family doesn't contain an Italic shape.) |
| 3965 |
|
| 3966 |
For weights and widths, B<autoinst> tries to the standard NFSS codes |
| 3967 |
(ul, el, l, sl, m, sb, b, eb and ub for weights; |
| 3968 |
uc, ec, c, sc, m, sx, x, ex and ux for widths) |
| 3969 |
as much as possible. |
| 3970 |
Of course, not all 81 combinations of these NFSS weights and widths will map |
| 3971 |
to existing fonts; |
| 3972 |
and conversely it may not be possible to assign every existing font |
| 3973 |
a unique code in a sane way (especially for the weights, |
| 3974 |
some font families offer more variants than NFSS's codes can handle; |
| 3975 |
e.g., Fira Sans contains fifteen different weights!). |
| 3976 |
Therefore every font is also assigned a "series" name that is |
| 3977 |
the concatenation of its weight and width, |
| 3978 |
after expanding any abbreviations and converting to lowercase. |
| 3979 |
A font of "Cond" width and "Ultra" weight will then be known |
| 3980 |
as "ultrablackcondensed". |
| 3981 |
|
| 3982 |
The exact mapping between fonts and NFSS codes can be found |
| 3983 |
in the generated F<fd> files and in the log file |
| 3984 |
(you may want to run B<autoinst> with the I<-dryrun> option |
| 3985 |
to check the chosen mapping beforehand). |
| 3986 |
The I<-nfssweight> and I<-nfsswidth> command-line options can be used |
| 3987 |
to finetune the mapping between NFSS codes and fonts. |
| 3988 |
|
| 3989 |
To access specific weights or widths, |
| 3990 |
one can always use the C<\fontseries> command with the full series name |
| 3991 |
(i.e., C<\fontseries{demibold}\selectfont>). |
| 3992 |
|
| 3993 |
|
| 3994 |
=head2 Ornaments |
| 3995 |
|
| 3996 |
B<autoinst> provides a best-effort interface to access ornament characters. |
| 3997 |
The OpenType specification offers two ways for fonts to implement ornaments: |
| 3998 |
one way is to map them to the lowercase ASCII letters, the other is |
| 3999 |
to define them as alternates for the "bullet" character. |
| 4000 |
Ornaments of the first type can be used from Latex without problem, |
| 4001 |
but ornaments implemented in the second way cannot easily be used from Latex |
| 4002 |
(at least not generically; it may be done by creating font-specific encoding files). |
| 4003 |
|
| 4004 |
Unfortunately, there is no way to tell which of these alternatives a font uses; |
| 4005 |
B<autoinst> just assumes that the font maps ornaments to lowercase ASCII |
| 4006 |
and creates an OT1-encoded font that hopefully contains the ornaments, |
| 4007 |
plus a C<\textornament> command to access them. |
| 4008 |
That command takes one argument: the slot number of the ornament. |
| 4009 |
E.g., to access the ornament at the position of "a" (hexadecimal 0x61), |
| 4010 |
use C<\textornament{"61}>. |
| 4011 |
|
| 4012 |
To see which ornaments a font contains (and at which positions), |
| 4013 |
run LaTeX on the file F<nfssfont.tex> (which is included in any |
| 4014 |
standard LaTeX installation), supply the name of the ornament font |
| 4015 |
(i.e., C<Garamontio-Regular-orn-u>) and give the command C<\table\bye>; |
| 4016 |
this will create a table of all glyphs in that font. |
| 4017 |
If this table shows no ornaments, your font unfortunately handles ornaments |
| 4018 |
in a non-Latex-compatible (or at least non-B<autoinst>-compatible) way. |
| 4019 |
|
| 4020 |
As a final caveat, note that even when your font does handle ornaments in |
| 4021 |
a Latex-compatible way, it may very well map them to other characters |
| 4022 |
(such as digits or punctuation) instead of lowercase ASCII. |
| 4023 |
|
| 4024 |
|
| 4025 |
=head1 WARNINGS AND CAVEATS |
| 4026 |
|
| 4027 |
=head2 OpenType fonts and licensing issues |
| 4028 |
|
| 4029 |
Since F<pdfTeX> cannot subset otf-flavoured OpenType fonts, |
| 4030 |
I<otftotfm> will convert such fonts to Type1 (pfb) format. |
| 4031 |
However, many fonts (at least those licensed under the SIL Open Font License) |
| 4032 |
do not allow redistributing such converted versions under their original name. |
| 4033 |
|
| 4034 |
In order to try to meet such licensing requirements, B<autoinst> provides |
| 4035 |
a I<-t1suffix> command-line option that appends a suffix to the names |
| 4036 |
(both the filename and the internal font name) |
| 4037 |
of all generated Type1 fonts; see L</COMMAND-LINE OPTIONS> below. |
| 4038 |
|
| 4039 |
Please note that I am not a lawyer and do not guarantee that |
| 4040 |
this suffix is sufficient to meet the license's requirements. |
| 4041 |
When in doubt, consult a real lawyer! |
| 4042 |
|
| 4043 |
|
| 4044 |
=head2 Sorry, LIGTABLE too long for me to handle |
| 4045 |
|
| 4046 |
The LIGTABLE in TeX's F<tfm> files, which contains a font's ligatures |
| 4047 |
and kerning pairs, is limited to about 32,500 entries (2^15 - 256). |
| 4048 |
If the number of ligatures plus kerns in a font is higher than that limit, |
| 4049 |
I<pltotf> and I<vptovf> will complain loudly and ignore the excess entries. |
| 4050 |
This happens at least with Adobe's Source Serif 4 and Minion 3 font families. |
| 4051 |
Even when I<pltotf> and I<vptovf> don't warn about the LIGTABLE's size, |
| 4052 |
you may still find that I<pdftex> crashes with a |
| 4053 |
C<Bad metric (TFM) file> error. |
| 4054 |
The best way to handle this situation is to use B<autoinst>'s C<-extra> option |
| 4055 |
to raise F<otftotfm>'s value for the C<--min-kern> parameter, which causes it |
| 4056 |
to ignore small kerning pairs: C<-extra='--min-kern=6.0'>. |
| 4057 |
Finding a working value for the C<--min-kern> parameter may require some |
| 4058 |
trial and error. |
| 4059 |
|
| 4060 |
|
| 4061 |
=head2 A note for MiKTeX users |
| 4062 |
|
| 4063 |
Automatically installing the fonts into a suitable TEXMF tree |
| 4064 |
(as B<autoinst> tries to do by default) only works for TeX-installations |
| 4065 |
that use the F<kpathsea> library; with TeX distributions that implement |
| 4066 |
their own directory searching, such as MiKTeX, B<autoinst> will complain |
| 4067 |
that it cannot find the F<kpsewhich> program and move all generated files |
| 4068 |
into a subdirectory C<autoinst_output/> of the current directory. |
| 4069 |
If you use such a TeX distribution, you should either move these files |
| 4070 |
to their correct destinations by hand, or use the I<-target> option |
| 4071 |
(see L</COMMAND-LINE OPTIONS> below) to manually specify a TEXMF tree. |
| 4072 |
|
| 4073 |
Also, some OpenType fonts contain so many kerning pairs that the resulting |
| 4074 |
F<pl> and F<vpl> files are too big for MiKTeX's F<pltotf> and F<vptovf>; |
| 4075 |
the versions that come with W32TeX (F<http://www.w32tex.org>) |
| 4076 |
and TeXLive (F<http://tug.org/texlive>) don't seem to have this problem. |
| 4077 |
|
| 4078 |
|
| 4079 |
=head2 A note for MacTeX users |
| 4080 |
|
| 4081 |
By default, B<autoinst> will try to install all generated files into |
| 4082 |
the $TEXMFLOCAL tree; when this directory isn't user-writable, |
| 4083 |
it will use the $TEXMFHOME tree instead. Unfortunately, MacTeX's version |
| 4084 |
of C<updmap-sys> doesn't search in $TEXMFHOME, |
| 4085 |
and hence MacTeX will not find the new fonts. |
| 4086 |
|
| 4087 |
To remedy this, either run B<autoinst> as root (so that it can install |
| 4088 |
everything into $TEXMFLOCAL) or manually run C<updmap -user> to tell |
| 4089 |
TeX about the files in $TEXMFHOME. |
| 4090 |
This latter option does, however, come with some caveats; |
| 4091 |
see F<https://tug.org/texlive/scripts-sys-user.html>. |
| 4092 |
|
| 4093 |
|
| 4094 |
|
| 4095 |
=head1 COMMAND-LINE OPTIONS |
| 4096 |
|
| 4097 |
B<autoinst> tries hard to do The Right Thing (TM) by default, |
| 4098 |
so you usually won't need these options; |
| 4099 |
but most aspects of its operation can be fine-tuned if you want to. |
| 4100 |
|
| 4101 |
You may use either one or two dashes before options, |
| 4102 |
and option names may be shortened to a unique prefix |
| 4103 |
(e.g., B<-encoding> may be abbreviated to B<-enc> or even B<-en>, |
| 4104 |
but B<-e> is ambiguous (it may mean either B<-encoding> or B<-extra>)). |
| 4105 |
|
| 4106 |
|
| 4107 |
=head2 General options |
| 4108 |
|
| 4109 |
=over 4 |
| 4110 |
|
| 4111 |
=item B<-help> |
| 4112 |
|
| 4113 |
Print a (relatively) short help text and exit. |
| 4114 |
|
| 4115 |
=item B<-dryrun> |
| 4116 |
|
| 4117 |
Don't generate output; just parse input fonts and write |
| 4118 |
the results to the log file. |
| 4119 |
|
| 4120 |
=item B<-verbose> |
| 4121 |
|
| 4122 |
Add more details to the log file. |
| 4123 |
|
| 4124 |
=item B<-version> |
| 4125 |
|
| 4126 |
Print B<autoinst>'s version number and exit. |
| 4127 |
|
| 4128 |
=back |
| 4129 |
|
| 4130 |
|
| 4131 |
=head2 Font creation options |
| 4132 |
|
| 4133 |
=over 4 |
| 4134 |
|
| 4135 |
=item B<-encoding>=I<encoding[,encoding]> |
| 4136 |
|
| 4137 |
Generate the specified encoding(s) for the text fonts. |
| 4138 |
Multiple encodings may be specified as a comma-separated list |
| 4139 |
(without spaces!); the default choice of encodings is C<OT1,LY1,T1>. |
| 4140 |
|
| 4141 |
For each encoding argument, B<autoinst> will first check if it is |
| 4142 |
the filename of an encoding file, and if found it will use that; |
| 4143 |
otherwise the argument is assumed to be the name of one of |
| 4144 |
the built-in encodings. |
| 4145 |
If the argument is a filename, |
| 4146 |
B<autoinst> will define the font with an NFSS encoding |
| 4147 |
equal to the filename (minus a ".enc" extension), |
| 4148 |
except when the filename starts with "U_"; |
| 4149 |
in that case the NFSS encoding will be "U" |
| 4150 |
and the part after "U_" will be used as the "enc" part |
| 4151 |
of the name of the generated font. |
| 4152 |
|
| 4153 |
Currently B<autoinst> comes with built-in support for the OT1, T1/TS1, LY1, |
| 4154 |
T2A/B/C, T3/TS3, T4, T5, LGR, CS, L7X and QX encodings. |
| 4155 |
(The corresponding files are called F<fontools_ot1.enc> etc., |
| 4156 |
to avoid name clashes with other packages; |
| 4157 |
the F<fontools_> prefix may be omitted.) |
| 4158 |
|
| 4159 |
=item B<-ts1>/B<-nots1> |
| 4160 |
|
| 4161 |
Control the creation of TS1-encoded fonts. The default is B<-ts1> |
| 4162 |
if the text encodings (see I<-encoding> above) include T1, |
| 4163 |
B<-nots1> otherwise. |
| 4164 |
|
| 4165 |
=item B<-lining>/B<-nolining> |
| 4166 |
|
| 4167 |
Control the creation of fonts with lining figures. The default is |
| 4168 |
B<-lining>. |
| 4169 |
|
| 4170 |
=item B<-oldstyle>/B<-nooldstyle> |
| 4171 |
|
| 4172 |
Control the creation of fonts with oldstyle figures. The default is |
| 4173 |
B<-oldstyle>. |
| 4174 |
|
| 4175 |
=item B<-proportional>/B<-noproportional> |
| 4176 |
|
| 4177 |
Control the creation of fonts with proportional figures. The default is |
| 4178 |
B<-proportional>. |
| 4179 |
|
| 4180 |
=item B<-tabular>/B<-notabular> |
| 4181 |
|
| 4182 |
Control the creation of fonts with tabular figures. The default is |
| 4183 |
B<-tabular>. |
| 4184 |
|
| 4185 |
=item B<-smallcaps>/B<-nosmallcaps> |
| 4186 |
|
| 4187 |
Control the creation of small caps fonts. The default is |
| 4188 |
B<-smallcaps>. |
| 4189 |
|
| 4190 |
=item B<-swash>/B<-noswash> |
| 4191 |
|
| 4192 |
Control the creation of swash fonts. The default is B<-swash>. |
| 4193 |
|
| 4194 |
=item B<-titling>/B<-notitling> |
| 4195 |
|
| 4196 |
Control the creation of titling families. The default is B<-titling>. |
| 4197 |
|
| 4198 |
=item B<-superiors>/B<-nosuperiors> |
| 4199 |
|
| 4200 |
Control the creation of fonts with superior characters. |
| 4201 |
The default is B<-superiors>. |
| 4202 |
|
| 4203 |
=item B<-inferiors> [ = B<none> | B<auto> | B<subs> | B<sinf> | B<dnom> ] |
| 4204 |
|
| 4205 |
=item B<-noinferiors> |
| 4206 |
|
| 4207 |
The OpenType standard defines several kinds of digits that might be used |
| 4208 |
as inferiors or subscripts: "Subscripts" (OpenType feature C<subs>), |
| 4209 |
"Scientific Inferiors" (C<sinf>), and "Denominators" (C<dnom>). |
| 4210 |
This option allows the user to determine which of these styles B<autoinst> |
| 4211 |
should use for the inferior characters. |
| 4212 |
Alternatively, the value "auto" tells B<autoinst> to use the first value |
| 4213 |
in C<sinf>, C<subs> or C<dnom> that is supported by the font. |
| 4214 |
Saying just B<-inferiors> is equivalent to B<-inferiors=auto>; |
| 4215 |
otherwise the default is B<-noinferiors>. |
| 4216 |
|
| 4217 |
I<< If you specify a style of inferiors that isn't present in the font, |
| 4218 |
B<autoinst> will fall back to its default behaviour of not creating fonts |
| 4219 |
with inferiors at all; it won't try to substitute one of the other styles. >> |
| 4220 |
|
| 4221 |
=item B<-fractions>/B<-nofractions> |
| 4222 |
|
| 4223 |
Control the creation of fonts with numerators and denominators. |
| 4224 |
The default is B<-nofractions>. |
| 4225 |
|
| 4226 |
=item B<-ligatures>/B<-noligatures> |
| 4227 |
|
| 4228 |
Some fonts contain glyphs for the standard f-ligatures (ff, fi, fl, ffi, ffl), |
| 4229 |
but don't provide a C<liga> feature to access these. |
| 4230 |
This option tells B<autoinst> to add extra C<LIGKERN> rules to |
| 4231 |
the generated fonts to enable the use of these ligatures. |
| 4232 |
The default is B<-ligatures>, except for typewriter fonts. |
| 4233 |
|
| 4234 |
Specify B<-noligatures> to disable generation of ligatures even for fonts |
| 4235 |
that do contain a C<liga> feature. |
| 4236 |
|
| 4237 |
=item B<-ornaments>/B<-noornaments> |
| 4238 |
|
| 4239 |
Control the creation of ornament fonts. The default is B<-ornaments>. |
| 4240 |
|
| 4241 |
=item B<-serif>/B<-sanserif>/B<-typewriter> |
| 4242 |
|
| 4243 |
Install the font as a serif, sanserif or typewriter font, respectively. |
| 4244 |
This changes how you access the font in LaTeX: |
| 4245 |
with C<\rmfamily>/C<\textrm>, C<\sffamily>/C<\textsf> |
| 4246 |
or C<\ttfamily>/C<\texttt>. |
| 4247 |
|
| 4248 |
Installing the font as a typewriter font will cause two further changes: |
| 4249 |
it will - by default - turn off the use of f-ligatures |
| 4250 |
(though this can be overridden with the I<-ligatures> option), |
| 4251 |
and it will disable hyphenation for this font. |
| 4252 |
This latter effect cannot be re-enabled in B<autoinst>; |
| 4253 |
if you want typewriter text to be hyphenated, use the F<hyphenat> package. |
| 4254 |
|
| 4255 |
If none of these options is specified, B<autoinst> tries to guess: |
| 4256 |
if the font's filename contains the string "mono" |
| 4257 |
or if the field C<isFixedPitch> in the font's C<post> table is True, |
| 4258 |
it will select B<-typewriter>; |
| 4259 |
else if the filename contains "sans" it will select B<-sanserif>; |
| 4260 |
otherwise it will opt for B<-serif>. |
| 4261 |
|
| 4262 |
=item B<-math> |
| 4263 |
|
| 4264 |
Tells B<autoinst> to create basic math fonts (see above). |
| 4265 |
|
| 4266 |
=item B<-mathspacing>=I<amount> |
| 4267 |
|
| 4268 |
Letterspace each character in the math fonts by I<amount> units, |
| 4269 |
where 1000 units equal one em. |
| 4270 |
In my opinion, many text fonts benefit from letterspacing by 50 to 100 units |
| 4271 |
when used in maths; some fonts need even more. Use your own judgement! |
| 4272 |
|
| 4273 |
=back |
| 4274 |
|
| 4275 |
|
| 4276 |
=head2 Output options |
| 4277 |
|
| 4278 |
=over 4 |
| 4279 |
|
| 4280 |
=item B<-t1suffix> [ = I<SUFFIX> ] |
| 4281 |
|
| 4282 |
Tell B<autoinst> to modify the font names of all generated Type1-fonts, |
| 4283 |
by adding I<SUFFIX> to the family name. |
| 4284 |
If you use this option without specifying a I<SUFFIX> value, |
| 4285 |
B<autoinst> will use the value "PS". |
| 4286 |
The default behaviour when this option is not given |
| 4287 |
is to not modify font names at all. |
| 4288 |
|
| 4289 |
See also L</OpenType fonts and licensing issues> in L<WARNINGS AND CAVEATS> above. |
| 4290 |
|
| 4291 |
=item B<-target>=I<DIRECTORY> |
| 4292 |
|
| 4293 |
Install all generated files into the TEXMF tree at I<DIRECTORY>. |
| 4294 |
|
| 4295 |
By default, B<autoinst> searches the $TEXMFLOCAL and $TEXMFHOME trees |
| 4296 |
and installs all files into the first user-writable TEXMF tree it finds. |
| 4297 |
If B<autoinst> cannot find such a user-writable directory |
| 4298 |
(which shouldn't happen, since $TEXMFHOME is supposed to be user-writable) |
| 4299 |
it will print a warning message and put all files into the subdirectory |
| 4300 |
C<autoinst_output/> of the current directory. |
| 4301 |
It's then up to the user to move the generated files to a better location |
| 4302 |
and update all relevant databases |
| 4303 |
(usually by calling F<texhash> and F<updmap>). |
| 4304 |
|
| 4305 |
=item B<-vendor>=I<VENDOR> |
| 4306 |
|
| 4307 |
=item B<-typeface>=I<TYPEFACE> |
| 4308 |
|
| 4309 |
These options are equivalent to F<otftotfm>'s I< --vendor> and I< --typeface> |
| 4310 |
options: they change the "vendor" and "typeface" parts of the names of the |
| 4311 |
subdirectories in the TEXMF tree where generated files will be stored. |
| 4312 |
The default values are "lcdftools" and the font's FontFamily name. |
| 4313 |
These options change I<only> directory names, |
| 4314 |
not the names of any generated files. |
| 4315 |
|
| 4316 |
=item B<-logfile>=I<filename> |
| 4317 |
|
| 4318 |
Write log data to F<filename> instead of the default F<< <fontfamily>.log >>. |
| 4319 |
If the file already exists, B<autoinst> appends to it; |
| 4320 |
it doesn't overwrite an existing file. |
| 4321 |
|
| 4322 |
=back |
| 4323 |
|
| 4324 |
|
| 4325 |
=head2 Specialist options |
| 4326 |
|
| 4327 |
=over 4 |
| 4328 |
|
| 4329 |
=item B<-defaultlining>/B<-defaultoldstyle> |
| 4330 |
|
| 4331 |
=item B<-defaulttabular>/B<-defaultproportional> |
| 4332 |
|
| 4333 |
Tell B<autoinst> which figure style is the current font family's default |
| 4334 |
(i.e., which figures you get when you don't specify any OpenType features). |
| 4335 |
|
| 4336 |
I<Don't use these options unless you are certain you need them!> |
| 4337 |
They are only needed for fonts that don't provide OpenType features |
| 4338 |
for their default figure style; and even in that case, |
| 4339 |
B<autoinst>'s default values (B<-defaultlining> and B<-defaulttabular>) |
| 4340 |
are usually correct. |
| 4341 |
|
| 4342 |
=item B<-nfssweight>=I<code>=I<weight> |
| 4343 |
|
| 4344 |
=item B<-nfsswidth>=I<code>=I<width> |
| 4345 |
|
| 4346 |
Map the NFSS code I<code> to the given weight or width, |
| 4347 |
overriding the built-in tables. |
| 4348 |
Each of these options may be given multiple times, |
| 4349 |
to override more than one NFSS code. |
| 4350 |
Example: to map the C<ul> code to the "Thin" weight, |
| 4351 |
use C<-nfssweight=ul=thin>. |
| 4352 |
To inhibit the use of the C<ul> code completely, |
| 4353 |
use C<-nfssweight=ul=>. |
| 4354 |
|
| 4355 |
=item B<-extra>=I<extra options> |
| 4356 |
|
| 4357 |
Pass I<extra options> to the commands for I<otftotfm>. |
| 4358 |
To prevent I<extra options> from accidentily being interpreted as |
| 4359 |
options to B<autoinst>, they should be properly quoted. |
| 4360 |
|
| 4361 |
=item B<-manual> |
| 4362 |
|
| 4363 |
Manual mode; for users who want to post-process the generated files |
| 4364 |
and commands. By default, B<autoinst> immediately executes all |
| 4365 |
F<otftotfm> commands it generates; |
| 4366 |
in manual mode, these are instead written to a file F<autoinst.bat>. |
| 4367 |
Furthermore it tells F<otftotfm> to generate human readable (and editable) |
| 4368 |
F<pl/vpl> files instead of the default F<tfm/vf> ones, |
| 4369 |
and to place all generated files in a subdirectory C<./autoinst_output/> |
| 4370 |
of the current directory, rather than install them into your TeX installation. |
| 4371 |
|
| 4372 |
When using this option, you need to execute the following manual steps after |
| 4373 |
B<autoinst> has finished: |
| 4374 |
|
| 4375 |
=over 2 |
| 4376 |
|
| 4377 |
=item - run F<pltotf> and F<vptovf> on the generated F<pl> and F<vf> files, |
| 4378 |
to convert them to F<tfm/vf> format; |
| 4379 |
|
| 4380 |
=item - move all generated files to a proper TEXMF tree, |
| 4381 |
and, if necessary, update the filename database; |
| 4382 |
|
| 4383 |
=item - tell TeX about the new F<map> file |
| 4384 |
(usually by running C<updmap> or similar). |
| 4385 |
|
| 4386 |
=back |
| 4387 |
|
| 4388 |
Note that some options (I<-target>, I<-vendor> and I<-typeface>) |
| 4389 |
are meaningless, and hence ignored, in manual mode. |
| 4390 |
|
| 4391 |
Also note that font name modification doesn't happen in manual mode. |
| 4392 |
|
| 4393 |
=item B<-nofigurekern> |
| 4394 |
|
| 4395 |
Some fonts provide kerning pairs for tabular figures. |
| 4396 |
This is very probably not what you want |
| 4397 |
(e.g., numbers in tables won't line up exactly). |
| 4398 |
This option adds extra I< --ligkern> options |
| 4399 |
to the commands for I<otftotfm> to suppress such kerns. |
| 4400 |
Note that this option leads to very long commands (it adds |
| 4401 |
one hundred I< --ligkern> options), which may cause problems on some systems; |
| 4402 |
hence it is not active by default. |
| 4403 |
|
| 4404 |
=back |
| 4405 |
|
| 4406 |
|
| 4407 |
=head1 SEE ALSO |
| 4408 |
|
| 4409 |
Eddie Kohler's B<TypeTools> and B<T1Utils> (F<http://www.lcdf.org/type>). |
| 4410 |
|
| 4411 |
B<Perl> can be obtained from F<http://www.perl.org>; |
| 4412 |
it is included in most Linux distributions. |
| 4413 |
For Windows, try ActivePerl (F<http://www.activestate.com>) |
| 4414 |
or Strawberry Perl (F<http://strawberryperl.com>). |
| 4415 |
|
| 4416 |
B<LuaTeX> (F<http://www.luatex.org>) and |
| 4417 |
B<XeTeX> (F<http://www.tug.org/xetex>) |
| 4418 |
are Unicode-aware TeX engines that can use OpenType fonts directly, |
| 4419 |
without any (La)TeX-specific support files. |
| 4420 |
|
| 4421 |
The B<FontPro> project (F<https://github.com/sebschub/FontPro>) |
| 4422 |
offers very complete LaTeX support (even for typesetting maths) for |
| 4423 |
Adobe's Minion Pro, Myriad Pro and Cronos Pro font families. |
| 4424 |
|
| 4425 |
|
| 4426 |
=head1 AUTHOR |
| 4427 |
|
| 4428 |
Marc Penninga (F<[email protected]>) |
| 4429 |
|
| 4430 |
When sending a bug report, please give as much relevant information as |
| 4431 |
possible; this usually includes (but may not be limited to) the log file |
| 4432 |
(please add the I<-verbose> command-line option, for extra info). |
| 4433 |
If you see any error messages, please include these I<verbatim>; |
| 4434 |
don't paraphase. |
| 4435 |
|
| 4436 |
|
| 4437 |
=head1 COPYRIGHT |
| 4438 |
|
| 4439 |
Copyright (C) 2005-2026 Marc Penninga. |
| 4440 |
|
| 4441 |
|
| 4442 |
=head1 LICENSE |
| 4443 |
|
| 4444 |
This program is free software; you can redistribute it and/or modify |
| 4445 |
it under the terms of the GNU General Public License as published |
| 4446 |
by the Free Software Foundation, either version 2 of the License, |
| 4447 |
or (at your option) any later version. |
| 4448 |
A copy of the text of the GNU General Public License is included in |
| 4449 |
the I<fontools> distribution; see the file F<GPLv2.txt>. |
| 4450 |
|
| 4451 |
|
| 4452 |
=head1 DISCLAIMER |
| 4453 |
|
| 4454 |
This program is distributed in the hope that it will be useful, |
| 4455 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 4456 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 4457 |
GNU General Public License for more details. |
| 4458 |
|
| 4459 |
|
| 4460 |
=head1 VERSION |
| 4461 |
|
| 4462 |
This document describes B<autoinst> version 20260210. |
| 4463 |
|
| 4464 |
|
| 4465 |
=head1 RECENT CHANGES |
| 4466 |
|
| 4467 |
(See the source for the full story, all the way back to 2005.) |
| 4468 |
|
| 4469 |
=over 12 |
| 4470 |
|
| 4471 |
=item I<2026-02-10> |
| 4472 |
|
| 4473 |
Generated style files now use the I<figureversions> package |
| 4474 |
to access superior and inferior figures and fractions, |
| 4475 |
instead of the (deprecated) I<fontaxes> package. |
| 4476 |
Added the I<scriptscale> option to the generated style file. |
| 4477 |
When creating math fonts, we use the font's "mgrk" feature, |
| 4478 |
if present. |
| 4479 |
Fixed a few obscure bugs. |
| 4480 |
|
| 4481 |
=item I<2025-09-09> |
| 4482 |
|
| 4483 |
Use the font's WeightClass if its weight cannot be determined |
| 4484 |
from other metadata (suggested by Christoph L. Spiel). |
| 4485 |
|
| 4486 |
=item I<2025-08-25> |
| 4487 |
|
| 4488 |
Fixed a bug in the processing of the C<-nfssweight> and |
| 4489 |
C<-nfsswidth> options. |
| 4490 |
|
| 4491 |
=item I<2025-08-19> |
| 4492 |
|
| 4493 |
Fixed a bug where any fonts with the word "Typewriter" |
| 4494 |
in their name would be parsed as "Italic". |
| 4495 |
|
| 4496 |
=item I<2025-07-02> |
| 4497 |
|
| 4498 |
The hack in font metadata parsing for Source Serif 4 |
| 4499 |
(See 2025-01-07) is also needed for other fonts; |
| 4500 |
at least for Arno Pro, maybe some other Adobe fonts as well. |
| 4501 |
So we changed the test again: we apply this hack by default, |
| 4502 |
except for Libertinus. |
| 4503 |
|
| 4504 |
=item I<2025-06-23> |
| 4505 |
|
| 4506 |
Introduced the "U_" rule for encoding file names. |
| 4507 |
|
| 4508 |
=item I<2025-04-16> |
| 4509 |
|
| 4510 |
Don't load the I<mweights> package, as its functionality |
| 4511 |
is now part of the LaTeX kernel |
| 4512 |
(and, in fact, has been for a while ...). |
| 4513 |
|
| 4514 |
=item I<2025-01-07> |
| 4515 |
|
| 4516 |
The 'fix' in font metadata parsing that we introduced |
| 4517 |
for Source Serif 4 was biting Libertinus Serif Display |
| 4518 |
(and maybe other fonts as well), |
| 4519 |
so we now test if the family is actually Source Serif 4 |
| 4520 |
before applying that fix. |
| 4521 |
|
| 4522 |
=back |
| 4523 |
|
| 4524 |
|
| 4525 |
=begin Really_old_history |
| 4526 |
|
| 4527 |
=over 12 |
| 4528 |
|
| 4529 |
=item I<2024-01-04> |
| 4530 |
|
| 4531 |
We take a more generic approach to font metadata parsing; |
| 4532 |
this should work better for fonts with unusually named weights |
| 4533 |
or widths. |
| 4534 |
We now also warn in font metadata parsing could not find |
| 4535 |
a 'Regular' weight or width. |
| 4536 |
|
| 4537 |
=item I<2023-12-30> |
| 4538 |
|
| 4539 |
Bugfix: font info parsing now works for Junicode 2. |
| 4540 |
|
| 4541 |
=item I<2023-09-14> |
| 4542 |
|
| 4543 |
Added the C<\up...> and C<\it...> commands to the style file. |
| 4544 |
|
| 4545 |
=item I<2023-06-28> |
| 4546 |
|
| 4547 |
Adapted font metadata parsing for Adobe Source Serif 4. |
| 4548 |
|
| 4549 |
=item I<2023-02-01> |
| 4550 |
|
| 4551 |
Added support for the T4, T5, CS, L7X and QX encodings. |
| 4552 |
|
| 4553 |
=item I<2023-01-31> |
| 4554 |
|
| 4555 |
If the fonts contain superior and/or inferior figures, |
| 4556 |
the generated style file now redefines the C<\textsuperscript> |
| 4557 |
and C<\textsubscript> commands, and patches Latex's footnote |
| 4558 |
mechanism to use these figures |
| 4559 |
(inspired by the F<realscripts> package). |
| 4560 |
Fixed a few bugs in metadata parsing, style file generation |
| 4561 |
and the C<-t1suffix> option, so that the latter also works |
| 4562 |
for dvips and dvipdfmx. |
| 4563 |
|
| 4564 |
=item I<2021-11-15> |
| 4565 |
|
| 4566 |
Bugfix: font info parsing now works for Adobe Source Serif 4. |
| 4567 |
|
| 4568 |
=item I<2021-07-21> |
| 4569 |
|
| 4570 |
Bugfixes: |
| 4571 |
|
| 4572 |
=over 3 |
| 4573 |
|
| 4574 |
=item - |
| 4575 |
|
| 4576 |
Yet another problem with argument quoting on Windows. |
| 4577 |
|
| 4578 |
=item - |
| 4579 |
|
| 4580 |
Selecting numerator/denominator fonts didn't work as documented. |
| 4581 |
|
| 4582 |
=item - |
| 4583 |
|
| 4584 |
Font info parsing failed for Microsoft Sitka and LucasFonts Thesis. |
| 4585 |
|
| 4586 |
=back |
| 4587 |
|
| 4588 |
=item I<2021-04-01> |
| 4589 |
|
| 4590 |
The I<-encoding> option now also accepts filenames of encoding files |
| 4591 |
in directories other than the current directory. |
| 4592 |
Directory names containing spaces do (or at least should) also work. |
| 4593 |
|
| 4594 |
=item I<2020-12-18> |
| 4595 |
|
| 4596 |
Fixed a problem with files not being found on Windows. |
| 4597 |
Added extra C<--unicoding> options to prevent getting |
| 4598 |
lowercase f-ligatures in smallcaps for some buggy fonts. |
| 4599 |
Optimized font info parsing for DTL and TypeBy font families. |
| 4600 |
Cleaned up the code for better maintainability. |
| 4601 |
|
| 4602 |
=item I<2020-07-29> |
| 4603 |
|
| 4604 |
Some changes in the generated F<sty> and F<fd> files, |
| 4605 |
to improve compatibility with the F<microtype> package. |
| 4606 |
Made sure that F<pfb> fonts are always generated whenever |
| 4607 |
the input fonts are in F<otf> format. |
| 4608 |
Added the I<-t1suffix> command-line option, |
| 4609 |
to modify the font and file names of those generated Type1 fonts. |
| 4610 |
|
| 4611 |
=item I<2020-06-19> |
| 4612 |
|
| 4613 |
Added the C<nomathgreek> option to generated style files. |
| 4614 |
Reorganized the generated style files to make them more |
| 4615 |
standards-conforming. |
| 4616 |
|
| 4617 |
=item I<2020-05-27> |
| 4618 |
|
| 4619 |
Added basic (and still somewhat experimental) math support. |
| 4620 |
Implemented the C<scale=MatchLowercase> option value |
| 4621 |
in the generated style files. |
| 4622 |
"Wide" fonts are mapped to the C<sx> NFSS code instead of C<x>, |
| 4623 |
to cater for League Mono Variable's Wide and Extended widths. |
| 4624 |
The generated style files now use C<\textsup> and C<\textinf> |
| 4625 |
instead of the more cryptic C<\textsu> and C<\textin> to access |
| 4626 |
superior and inferior characters |
| 4627 |
(though the old forms are retained for backwards compatibility). |
| 4628 |
|
| 4629 |
=item I<2020-05-11> |
| 4630 |
|
| 4631 |
When present, use encoding files in the current working directory |
| 4632 |
in preference of the ones that come with B<autoinst>. |
| 4633 |
Changed the way ornament fonts are created; ornament glyphs are now |
| 4634 |
always included in the position chosen by the font's designer. |
| 4635 |
|
| 4636 |
=item I<2020-04-28> |
| 4637 |
|
| 4638 |
Fix a bug where the first font argument would be mistaken for |
| 4639 |
an argument to I<-inferiors>. |
| 4640 |
|
| 4641 |
=item I<2020-01-29> |
| 4642 |
|
| 4643 |
Don't create empty subdirectories in the target TEXMF tree. |
| 4644 |
|
| 4645 |
=item I<2019-11-18> |
| 4646 |
|
| 4647 |
Fine-tuned calling of F<kpsewhich> on Windows (patch by Akira Kakuto). |
| 4648 |
The font info parsing now also recognises numerical weights, e.g. in Museo. |
| 4649 |
|
| 4650 |
=item I<2019-10-29> |
| 4651 |
|
| 4652 |
The generated style files now use T1 as the default text encoding. |
| 4653 |
|
| 4654 |
=item I<2019-10-27> |
| 4655 |
|
| 4656 |
The mapping in F<fd> files between font series and standard NFSS attributes |
| 4657 |
now uses the new I<alias> function instead of I<ssub> (based on code by |
| 4658 |
Frank Mittelbach). |
| 4659 |
The way F<otftotfm> is called was changed to work around a Perl/Windows bug; |
| 4660 |
the old way might cause the process to hang. |
| 4661 |
Using the I<-target> option now implies I<-noupdmap>, since choosing |
| 4662 |
a non-standard target directory interferes with kpathsea/texhash and updmap. |
| 4663 |
|
| 4664 |
=item I<2019-10-01> |
| 4665 |
|
| 4666 |
Handle I<-target> directories with spaces in their path names. |
| 4667 |
Tweaked messages and logs to make them more useful to the user. |
| 4668 |
|
| 4669 |
=item I<2019-07-12> |
| 4670 |
|
| 4671 |
Replaced single quotes in calls to F<otfinfo> with double quotes, |
| 4672 |
as they caused problems on Windows 10. |
| 4673 |
|
| 4674 |
=item I<2019-06-25> |
| 4675 |
|
| 4676 |
=over 3 |
| 4677 |
|
| 4678 |
=item - |
| 4679 |
|
| 4680 |
Added the I<-mergeweights> and I<-mergeshapes> options, |
| 4681 |
and improved I<-mergewidths>. |
| 4682 |
|
| 4683 |
=item - |
| 4684 |
|
| 4685 |
Improved the parsing of fonts' widths and weights. |
| 4686 |
|
| 4687 |
=item - |
| 4688 |
|
| 4689 |
Improved the mapping of widths and weights to NFSS codes. |
| 4690 |
|
| 4691 |
=item - |
| 4692 |
|
| 4693 |
Changed logging code so that that results of font info parsing |
| 4694 |
are always logged, even (especially!) when parsing fails. |
| 4695 |
|
| 4696 |
=item - |
| 4697 |
|
| 4698 |
Added a warning when installing fonts from multiple families. |
| 4699 |
|
| 4700 |
=item - |
| 4701 |
|
| 4702 |
Added simple recognition for sanserif and typewriter fonts. |
| 4703 |
|
| 4704 |
=item - |
| 4705 |
|
| 4706 |
Fixed error checking after calls to F<otfinfo> |
| 4707 |
(B<autoinst> previously only checked whether C<fork()> was successful, |
| 4708 |
not whether the actual call to F<otfinfo> worked). |
| 4709 |
|
| 4710 |
=item - |
| 4711 |
|
| 4712 |
Fixed a bug in the I<-inferiors> option; |
| 4713 |
when used without a (supposedly optional) value, |
| 4714 |
it would silently gobble the next option instead. |
| 4715 |
|
| 4716 |
=back |
| 4717 |
|
| 4718 |
=item I<2019-05-22> |
| 4719 |
|
| 4720 |
Added the I<mainfont> option to the generated F<sty> files. |
| 4721 |
Prevented hyphenation for typewriter fonts |
| 4722 |
(added C<\hyphenchar\font=-1> to the C<\DeclareFontFamily> declarations). |
| 4723 |
Added the I<-version> option. |
| 4724 |
|
| 4725 |
=item I<2019-05-17> |
| 4726 |
|
| 4727 |
Changed the way the F<-ligatures> option works: |
| 4728 |
F<-ligatures> enables f-ligatures (even without a C<liga> feature), |
| 4729 |
F<-noligatures> now disables f-ligatures (overriding a C<liga> feature). |
| 4730 |
|
| 4731 |
=item I<2019-05-11> |
| 4732 |
|
| 4733 |
Separate small caps families are now also recognised when the family name |
| 4734 |
ends with "SC" (previously B<autoinst> only looked for "SmallCaps"). |
| 4735 |
|
| 4736 |
=item I<2019-04-22> |
| 4737 |
|
| 4738 |
Fixed a bug in the generation of swash shapes. |
| 4739 |
|
| 4740 |
=item I<2019-04-19> |
| 4741 |
|
| 4742 |
Fixed a bug that affected -mergesmallcaps with multiple encodings. |
| 4743 |
|
| 4744 |
=item I<2019-04-16> |
| 4745 |
|
| 4746 |
Added the <-mergesmallcaps> option, to handle cases where |
| 4747 |
the small caps fonts are in separate font families. |
| 4748 |
Titling shape is now treated as a separate family instead of a distinct shape; |
| 4749 |
it is generated only for fonts with the C<titl> feature. |
| 4750 |
Only add f-ligatures to fonts when explicitly asked to (I<-ligatures>). |
| 4751 |
|
| 4752 |
=item I<2019-04-11> |
| 4753 |
|
| 4754 |
Tried to make the log file more relevant. |
| 4755 |
Added the I<-nfssweight> and I<-nfsswidth> options, |
| 4756 |
and finetuned the automatic mapping between fonts and NFSS codes. |
| 4757 |
Changed the name of the generated log file to F<< <fontfamily>.log >>, |
| 4758 |
and revived the I<-logfile> option to allow overriding this choice. |
| 4759 |
Made I<-mergewidths> the default (instead of I<-nomergewidths>). |
| 4760 |
|
| 4761 |
=item I<2019-04-01> |
| 4762 |
|
| 4763 |
Fine-tuned the decision where to put generated files; |
| 4764 |
in particular, create $TEXMFHOME if it doesn't already exist |
| 4765 |
and $TEXMFLOCAL isn't user-writable. |
| 4766 |
|
| 4767 |
In manual mode, or when we can't find a user-writable TEXMF tree, |
| 4768 |
put all generated files into a subdirectory C<./autoinst_output/> |
| 4769 |
instead of all over the current working directory. |
| 4770 |
|
| 4771 |
Added "auto" value to the I<inferiors> option, |
| 4772 |
to tell B<autoinst> to use whatever inferior characters are available. |
| 4773 |
|
| 4774 |
=item I<2019-03-14> |
| 4775 |
|
| 4776 |
Overhauled the mapping of fonts (more specifically of weights and widths; |
| 4777 |
the mapping of shapes didn't change) to NFSS codes. |
| 4778 |
Instead of inventing our own codes to deal with every possible weight |
| 4779 |
and width out there, we now create "long" codes based on the names |
| 4780 |
in the font metadata. |
| 4781 |
Then we add C<ssub> rules to the F<fd> files to map the standard NFSS codes |
| 4782 |
to our fancy names (see the section B<NFSS codes>; |
| 4783 |
based on discussions with Frank Mittelbach and Bob Tennent). |
| 4784 |
|
| 4785 |
=item I<2018-08-10> |
| 4786 |
|
| 4787 |
Added encoding files for LGR and T2A/B/C to I<fontools>. |
| 4788 |
|
| 4789 |
=item I<2018-03-26> |
| 4790 |
|
| 4791 |
Added the I<-(no)mergewidths> option; tried to improve the documentation. |
| 4792 |
|
| 4793 |
=item I<2018-03-26> |
| 4794 |
|
| 4795 |
Added the "Text" weight and the I<-(no)mergewidths> option. |
| 4796 |
Changed the NFSS codes for "Thin" and "Book" to C<i> and C<o>, respectively. |
| 4797 |
Tried to improve the documentation. |
| 4798 |
|
| 4799 |
=item I<2018-01-09> |
| 4800 |
|
| 4801 |
Added the C<sl> weight for font families (such as Fira Sans) that contain both |
| 4802 |
"Book" and "Regular" weights (reported by Bob Tennent). |
| 4803 |
Added the "Two", "Four", "Eight" and "Hair" weights (for Fira Sans). |
| 4804 |
|
| 4805 |
=item I<2017-06-16> |
| 4806 |
|
| 4807 |
Changed the I<-inferiors> option from a binary yes-or-no choice to allow |
| 4808 |
the user to choose one of the C<subs>, C<sinf> and C<dnom> features. |
| 4809 |
B<autoinst> now always creates a log file. |
| 4810 |
|
| 4811 |
=item I<2017-03-21> |
| 4812 |
|
| 4813 |
Updated the F<fontools_ot1.enc> encoding file to include the "Lslash" |
| 4814 |
and "lslash" glyphs (thanks to Bob Tennent). |
| 4815 |
|
| 4816 |
=item I<2015-11-22> |
| 4817 |
|
| 4818 |
Bugfix: LaTeX doesn't like command names with dashes in it. |
| 4819 |
|
| 4820 |
=item I<2015-05-13> |
| 4821 |
|
| 4822 |
Fixed an error message that mixed up width and weight. |
| 4823 |
|
| 4824 |
=item I<2014-04-04> |
| 4825 |
|
| 4826 |
Fixed a bug in the font info parsing code. |
| 4827 |
|
| 4828 |
=item I<2014-01-21> |
| 4829 |
|
| 4830 |
"Oblique" or "slanted" fonts are now mapped to NFSS code C<sl> instead |
| 4831 |
of C<it>; added C<ssub> rules to the F<fd> files to substitute slanted fonts |
| 4832 |
for italic ones if the latter are missing. Fixed a few bugs. |
| 4833 |
|
| 4834 |
=item I<2014-01-03> |
| 4835 |
|
| 4836 |
Added the I<-dryrun> and I<-logfile> options; changed which info is logged. |
| 4837 |
Added the I<-lining>, I<-oldstyle>, I<-tabular> and I<-proportional> |
| 4838 |
options; the old options with those names have been renamed to |
| 4839 |
I<-defaultlining>, I<-defaultoldstyle> etc. |
| 4840 |
|
| 4841 |
=item I<2013-10-31> |
| 4842 |
|
| 4843 |
The previous change required Perl v5.14 or newer; |
| 4844 |
now it also works with older versions. |
| 4845 |
|
| 4846 |
=item I<2013-10-01> |
| 4847 |
|
| 4848 |
Added the I<-lining>, I<-oldstyle>, I<-tabular> and I<-proportional> |
| 4849 |
command line options. |
| 4850 |
|
| 4851 |
=item I<2013-07-25> |
| 4852 |
|
| 4853 |
The generated F<sty> files now use the I<mweights> package instead of |
| 4854 |
redefining C<\mddefault> and C<\bfdefault>. |
| 4855 |
Added C<scale> as an alias for the package option C<scaled>. |
| 4856 |
|
| 4857 |
=item I<2013-02-06> |
| 4858 |
|
| 4859 |
Bugfix: the directory names for map and encoding files contained |
| 4860 |
the "vendor" instead of the "typeface". |
| 4861 |
|
| 4862 |
=item I<2013-01-03> |
| 4863 |
|
| 4864 |
Added extra C<ssub> rules to the F<fd> files that substitute C<b> for C<bx>. |
| 4865 |
Verbose mode now also prints all generated commands before they're executed. |
| 4866 |
|
| 4867 |
=item I<2012-10-25> |
| 4868 |
|
| 4869 |
Added extra C<ssub> rules to the F<fd> files that substitute italic |
| 4870 |
shapes for slanted ones. |
| 4871 |
|
| 4872 |
=item I<2012-09-25> |
| 4873 |
|
| 4874 |
Added the I<-vendor>, I<-typeface> and I<-(no)updmap> command line options. |
| 4875 |
|
| 4876 |
=item I<2012-07-06> |
| 4877 |
|
| 4878 |
Documentation update. |
| 4879 |
|
| 4880 |
=item I<2012-03-06> |
| 4881 |
|
| 4882 |
Implemented the "splitting the font family into multiple subfamilies" |
| 4883 |
emergency strategy when font info parsing fails. |
| 4884 |
Added recognition for a number of unusual widths, weights and shapes. |
| 4885 |
|
| 4886 |
=item I<2012-02-29> |
| 4887 |
|
| 4888 |
Fixed a bug in the font parsing code, |
| 4889 |
where possible widths, weights and shapes where tested in the wrong order; |
| 4890 |
this led to "ExtraLight" fonts being recognised as "Light". |
| 4891 |
Added recognition for "Narrow" and "Wide" widths. |
| 4892 |
Also added the I<-(no)figurekern> command-line option. |
| 4893 |
|
| 4894 |
=item I<2012-02-01> |
| 4895 |
|
| 4896 |
Reorganised the code, and fixed some bugs in the process. |
| 4897 |
Added the I<-target> command-line option. |
| 4898 |
Made B<autoinst> install the F<fd> and F<sty> files in |
| 4899 |
the same TEXMF tree as the other generated files. |
| 4900 |
Generate OT1, T1 and LY1 encoded text fonts by default. |
| 4901 |
Made I<-titling> a default option (instead of I<-notitling>). |
| 4902 |
Updated the documentation. |
| 4903 |
|
| 4904 |
=item I<2011-06-15> |
| 4905 |
|
| 4906 |
Fixed the font info parsing code for some fonts that are |
| 4907 |
too lazy to spell out "Italic" in full. |
| 4908 |
|
| 4909 |
=item I<2010-04-29> |
| 4910 |
|
| 4911 |
The I< --feature=kern> option is only used for fonts that |
| 4912 |
contain either a I<kern> feature or a I<kern> table. |
| 4913 |
Font feature selection commands in the F<sty> file are only |
| 4914 |
generated for shapes and figure styles that are supported |
| 4915 |
by the current font, and whose generation has not been |
| 4916 |
turned off using the command-line options. |
| 4917 |
Fixed the font info parsing to work with the Condensed fonts |
| 4918 |
in the Minion Pro family. |
| 4919 |
|
| 4920 |
=item I<2010-04-23> |
| 4921 |
|
| 4922 |
Always provide the I< --feature=kern> option to F<otftotfm>, |
| 4923 |
even if the font doesn't have a I<kern> feature; |
| 4924 |
this will make F<otftotfm> use the I<kern> table if present. |
| 4925 |
For fonts without a I<liga> feature, add I< --ligkern> |
| 4926 |
options for the common f-ligatures to the F<otftotfm> command line, |
| 4927 |
so that any ligatures present in the font will still be used. |
| 4928 |
Bug fix: the generated F<sty> files now work for font families |
| 4929 |
with names containing digits. |
| 4930 |
|
| 4931 |
=item I<2009-04-09> |
| 4932 |
|
| 4933 |
Prefixed the filenames of the included encoding files with |
| 4934 |
I<fontools_>, to prevent name clashes with other packages. |
| 4935 |
|
| 4936 |
=item I<2009-04-06> |
| 4937 |
|
| 4938 |
A small patch to the C<get_orn> subroutine: |
| 4939 |
it now also recognises the I<bullet.xxx> ornament glyphs |
| 4940 |
in Adobe Kepler Pro. |
| 4941 |
|
| 4942 |
=item I<2007-08-07> |
| 4943 |
|
| 4944 |
Fixed a small bug with filename quoting on Windows. |
| 4945 |
|
| 4946 |
=item I<2007-07-31> |
| 4947 |
|
| 4948 |
Changed the tables that map weights and widths to NFSS codes: |
| 4949 |
in some extended families, different combinations of |
| 4950 |
weight and width were mapped to the same series. |
| 4951 |
Added a work-around for incorrect size info in some Kepler fonts. |
| 4952 |
Fixed a small bug in the generated commands for otftotfm |
| 4953 |
(sometimes, the C<onum> feature was included twice). |
| 4954 |
Added encoding file for OT1 to the I<fontools> collection. |
| 4955 |
|
| 4956 |
=item I<2007-07-27> |
| 4957 |
|
| 4958 |
Two bugfixes: a closing brace was missing in the generated style file, |
| 4959 |
and the NFSS series was formed as "width plus weight" instead of the reverse. |
| 4960 |
|
| 4961 |
=item I<2007-06-10> |
| 4962 |
|
| 4963 |
Bugfix: silently replacing \DeclareOption, \ProcessOptions and |
| 4964 |
\ExecuteOptions with their counterparts from the xkeyval package |
| 4965 |
caused problems for some other packages. |
| 4966 |
|
| 4967 |
=item I<2007-06-04> |
| 4968 |
|
| 4969 |
Added the I< --no-updmap> option to all generated commands for F<otftotfm> |
| 4970 |
(except the last); this should yield a significant speed-up for large |
| 4971 |
families (suggested by Steven E. Harris). |
| 4972 |
Tweaked the font info parsing to work around a bug in the naming of |
| 4973 |
some FontFont fonts, where every font is in a family of its own. |
| 4974 |
Added the C<scaled> option (including the loading of F<xkeyval>) |
| 4975 |
to the generated style file. |
| 4976 |
Extended the output of the I<-verbose> option. |
| 4977 |
|
| 4978 |
=item I<2007-02-08> |
| 4979 |
|
| 4980 |
Yet Another Complete Rewrite. |
| 4981 |
The code is now much more readable and more flexible; |
| 4982 |
the program can now handle fonts from different families, |
| 4983 |
as well as multiple text encodings. |
| 4984 |
Rewrote the font info parsing code to work for Arno Pro. |
| 4985 |
|
| 4986 |
=item I<2006-10-11> |
| 4987 |
|
| 4988 |
The program determines the fonts' weights, widths and shapes by parsing |
| 4989 |
the output from C<otfinfo --info> instead of the font filename. |
| 4990 |
This should make B<autoinst> work for non-Adobe fonts. |
| 4991 |
Filenames with spaces now work as well. |
| 4992 |
|
| 4993 |
=item I<2006-08-31> |
| 4994 |
|
| 4995 |
Made the generated style files try to include F<fontaxes.sty>; |
| 4996 |
changed the names of the generated fonts and families |
| 4997 |
(to make the previous change possible); |
| 4998 |
added command-line options for most font styles and shapes; |
| 4999 |
tweaked the filename parsing code for Cronos Pro and Gill Sans Pro; |
| 5000 |
added runtime generation of encoding vectors for ornament fonts |
| 5001 |
(because GaramondPremier's ornament names differ from other fonts); |
| 5002 |
changed the NFSS-code for italic small caps and titling to C<scit> and C<tlit> |
| 5003 |
(to work with F<fontaxes>); |
| 5004 |
and edited (and hopefully improved) the documentation. |
| 5005 |
|
| 5006 |
=item I<2005-10-03> |
| 5007 |
|
| 5008 |
When creating LY1, T1, OT1 or TS1 encoded fonts, the I<-coding-scheme> |
| 5009 |
option is added to the commands for F<otftotfm>; this should make the |
| 5010 |
generated F<pl> and F<vpl> files acceptable to I<fontinst>. |
| 5011 |
Also elaborated the documentation somewhat and fixed a small bug. |
| 5012 |
|
| 5013 |
=item I<2005-09-22> |
| 5014 |
|
| 5015 |
Added check to see if filename parsing succeeded; |
| 5016 |
updated the filename parsing code to cater for GaramondPremier Pro, |
| 5017 |
Silentium Pro and some non-Adobe fonts; |
| 5018 |
added the I<-sanserif> and I<-typewriter> options and hacked the |
| 5019 |
style files to support using several different font families in one document. |
| 5020 |
|
| 5021 |
=item I<2005-09-12> |
| 5022 |
|
| 5023 |
Cleaned up the code (it now runs under the F<strict> and F<warnings> pragmas); |
| 5024 |
fixed a (rather obscure) bug that occurred when creating TS1-encoded |
| 5025 |
fonts for families with multiple optical masters and oldstyle digits; |
| 5026 |
added the I<medium, semibold> etc. options to the style file; |
| 5027 |
and improved the layout of the generated files. |
| 5028 |
|
| 5029 |
=item I<2005-08-11> |
| 5030 |
|
| 5031 |
The generated commands weren't actually executed, only printed... |
| 5032 |
Also added a small hack to cater for fonts |
| 5033 |
(such as some recent versions of MinionPro) |
| 5034 |
that contain swash characters but don't provide a C<swsh> feature. |
| 5035 |
|
| 5036 |
=item I<2005-08-10> |
| 5037 |
|
| 5038 |
Dropped the "fontname" scheme in favor of a more verbose naming scheme, |
| 5039 |
since many filenames were still more than eight characters long anyway. |
| 5040 |
Added F<nfssext.sty>-like commands to the generated style file. |
| 5041 |
Changed the default encoding to LY1 and added the "inferior" shape. |
| 5042 |
|
| 5043 |
=item I<2005-08-01> |
| 5044 |
|
| 5045 |
Rewrote (and hopefully improved) the user interface; |
| 5046 |
changed the program to by default execute the generated F<otftotfm> command |
| 5047 |
lines rather than writing them to a file; |
| 5048 |
added automatic determination of the "fontname" code for the font family; |
| 5049 |
changed the NFSS code for italic small caps to C<si>; added titling shapes; |
| 5050 |
changed the generated style |
| 5051 |
file to include an interface for the ornaments and to load Lehman's NFSS |
| 5052 |
extensions F<nfssext.sty> if this is installed; corrected the "fontname" codes |
| 5053 |
for OT1, T1, LY1 and user-specific encodings; extended the output generated by |
| 5054 |
the I<-verbose> option; and rewrote and extended the documentation. |
| 5055 |
|
| 5056 |
=item I<2005-06-16> |
| 5057 |
|
| 5058 |
Did some more finetuning to the filename-parsing code. |
| 5059 |
|
| 5060 |
=item I<2005-05-31> |
| 5061 |
|
| 5062 |
Generate correct fontname for OT1-encoded fonts. |
| 5063 |
|
| 5064 |
=item I<2005-05-18> |
| 5065 |
|
| 5066 |
Tried to make the filename-parsing code a bit more robust by adding several |
| 5067 |
weights and widths; changed the error that's displayed when filename parsing |
| 5068 |
fails; commented the code. |
| 5069 |
|
| 5070 |
=item I<2005-04-29> |
| 5071 |
|
| 5072 |
Rewrote large parts of the code (yes it I<was> even worse). |
| 5073 |
|
| 5074 |
=item I<2005-04-18> |
| 5075 |
|
| 5076 |
Changed default text-encoding to T1, added TS1. |
| 5077 |
|
| 5078 |
=item I<2005-03-29> |
| 5079 |
|
| 5080 |
Added support for font families with multiple widths. |
| 5081 |
|
| 5082 |
=item I<2005-03-15> |
| 5083 |
|
| 5084 |
First version. |
| 5085 |
|
| 5086 |
=back |
| 5087 |
|
| 5088 |
=end Really_old_history |