The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Term::Graille::Font - convert and use ZX Spectrum fonts in Term::Graille

SYNOPSIS

    use Term::Graille::Font  qw/convertDG saveGrf fontWrite/;
        my $grf=convertDG("$fontName.z80.asm");
        $canvas->blockBlit($grf->{A},$gridX,$gridY); # old method single character
        fontWrite($canvas,$grf,$gridX,$gridY,$text); # new method text string
        saveGrf($grf,"$fontName.grf");
        

DESCRIPTION

This allows the creation, saving and usage of Braille Character to form Bitmap 8x8 font. It currently only accepts DameinGuards z80.asm files as found in damieng.com/typography/zx-origins/ where there a couple of hundred fonts available.

FUNCTIONS

my $grf=convertDG("$fontName.z80.asm");

Reads an ASM file as on Damien Guard's typography pages and returns a hashref containing the extracted 8x8 fonts converted into 4x2 Braille characters.

saveGrf($font,$file);

Uses Data::Dumper to produce convert a font hashref into a file that can be read using loadGrf

my $font=loadGrf($file);

Loads a font hashref from a file. The hashRef indexes 4x2 braille character blocks by character they represent; This may be used to represent any kind of character block, including tilemaps, sprites etc.

$fontWrite($canvas,$font,$gridX,$gridY,$text);

Writes a $text string using a loaded font into a particular grid location in a $canvas