git clone https://git.lucas.co/Myna.git
drawcomp (1.5K)
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 my $symbols = [
7 { "pos" => 200, "sym" => "->" },
8 { "pos" => 400, "sym" => "=>" },
9 { "pos" => 600, "sym" => "~>" },
10 { "pos" => 800, "sym" => "<>" },
11 { "pos" => 1000, "sym" => "=~" },
12 { "pos" => 1200, "sym" => "<\$>" },
13 { "pos" => 1400, "sym" => "<*>" },
14 { "pos" => 1600, "sym" => ">>=" },
15 ];
16
17 my $fonts = [
18 { "pos" => 100, "name" => "Cascadia-Mono-Regular" },
19 { "pos" => 200, "name" => "Source-Code-Pro-Regular" },
20 { "pos" => 300, "name" => "Dejavu-Sans-Mono" },
21 { "pos" => 400, "name" => "JetBrains-Mono-Regular" },
22 { "pos" => 500, "name" => "Iosevka" },
23 { "pos" => 600, "name" => "Ubuntu-Mono" },
24 { "pos" => 700, "name" => "Fira-Mono-Regular" },
25 { "pos" => 800, "name" => "Liberation-Mono" },
26 { "pos" => 900, "name" => "Roboto-Mono-Regular" }
27 ];
28
29 sub f {
30 my ($x, $s, $c, $a) = @_;
31 return join(" ",
32 "-pointsize 64",
33 "-fill " . $c . " ",
34 (map { "-font \"$_->{name}\" -annotate +$x+$_->{pos} \"$s\"" } $fonts->@*),
35 "-fill " . $a . " -font \"Myna-Regular\" -annotate +@{[$x + 10]}+1000 \"$s\"",
36 );
37 }
38
39 system (join(" ",
40 "magick",
41 "-size 2000x1200 xc:black",
42 "-gravity northwest",
43 join (' ', map { f($_->{pos}, $_->{sym}, "white", "cyan") } $symbols->@*),
44 quotemeta($ARGV[0])
45 ));
46
47 system (join(" ",
48 "magick",
49 "-size 2000x1200 xc:white",
50 "-gravity northwest",
51 join (' ', map { f($_->{pos}, $_->{sym}, "black", "crimson") } $symbols->@*),
52 quotemeta($ARGV[1])
53 ));