💾 Archived View for thrig.me › art › forth-the.pl captured on 2024-08-31 at 14:17:54.

View Raw

More Information

⬅️ Previous capture (2023-05-24)

-=-=-=-=-=-=-

#!/usr/bin/env perl
use 5.24.0;
use warnings;
use Imager;
use Imager::Fill;

my $font =
  Imager::Font->new( file => "$ENV{HOME}/.fonts/zx_spectrum-7_bold.ttf" )
  or die;

my $img = Imager->new( xsize => 1366, ysize => 768 ) or die;

my $fill_fg    = Imager::Color->new("#EEEEEE");
my $fill_bg    = Imager::Color->new("#CCCCCC");
my $font_color = Imager::Color->new("#212121");

my $fill =
  Imager::Fill->new( hatch => 'stipple', fg => $fill_fg, bg => $fill_bg );

$img->box(
    xmin => 0,
    ymin => 0,
    xmax => 1366,
    ymax => 768,
    fill => $fill,
);

my @phrase = readline *DATA;
chomp @phrase;

for my $i ( 0 .. $#phrase ) {
    $img->string(
        x      => 100,
        y      => 95 + 120 * $i,
        font   => $font,
        string => $phrase[$i],
        size   => 120,
        aa     => 0,
        color  => $font_color,
    );
}

$img->write( file => "forth-the.png" );

__DATA__
: THE . ; : MAY 3 ;
: WITH 7 ; : BE * ;
: FORTH * ; : YOU, 2 ;
: ALWAYS YOU, MAY WITH
  BE FORTH THE ;
ALWAYS