git.shiar.nl
/
sheet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
font: mkttfinfo: find font files in common locations
[sheet.git]
/
tools
/
mkttfinfo
diff --git
a/tools/mkttfinfo
b/tools/mkttfinfo
index 864873aceb6824db6df194ab606dacc0c6e95793..8593be60dd0df6dd739121e54b1bf62f6d3c937d 100755
(executable)
--- a/
tools/mkttfinfo
+++ b/
tools/mkttfinfo
@@
-9,6
+9,15
@@
use Font::TTF::Font;
my ($ttfuri, $outfile) = @ARGV;
$ttfuri or die "usage error\n";
my ($ttfuri, $outfile) = @ARGV;
$ttfuri or die "usage error\n";
+my $fontinc = $ENV{FONTINC} // '~/.fonts,/usr/share/fonts/truetype/*';
+if (!-e $ttfuri) {
+ my $found = (grep {-e} glob "{$fontinc}/$ttfuri")[0] or do {
+ warn "font not found: $ttfuri\n";
+ exit 1;
+ };
+ $ttfuri = $found;
+}
+
for ($outfile || ()) {
open my $output, '>', $_ or die "Cannot write to $outfile: $!\n";
select $output;
for ($outfile || ()) {
open my $output, '>', $_ or die "Cannot write to $outfile: $!\n";
select $output;