Font-BDF-Reader

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

The Font::BDF::Reader module provides an OO interface to reading a BDF file.

It has been built on Perl 5.8.0 on Linux Mandrake and tested only with
one bdf file (kanji48.bdf from the Monash University's Nihongo FTP site),
but should work with any other BDF file.

See http://www.csse.monash.edu.au/~jwb/japanese.html to download the
kanji48.bdf file.

The bdf2png script, also included, breaks down a BDF file into
one PNG file per character.  The PNG file is transparent, the foreground
color black.

INSTALLATION

To install this module type the following:

   perl Makefile.PL
   make
   make test
   make install

bin/bdf2png  view on Meta::CPAN

  my $font_data	= shift;
  my $BBX	= $font_data->{BBX};
  my $x		= $BBX->[0];
  my $y		= $BBX->[0];
  my $BITMAP	= $font_data->{BITMAP};
  # create a new image
  my $I		= GD::Image->new( $x, $y );
  # allocate some colors
  my $white	= $I->colorAllocate( 255, 255, 255 );
  my $black	= $I->colorAllocate( 0, 0, 0 );
  # make the background transparent
  $I->transparent( $white );
  # Fill with transparency
  $I->rectangle( 0, 0, $x, $y, $white );
  $I->fill( 1, 1, $white );

  my $line_number	= 0;
  foreach my $line ( @$BITMAP ) {
    $line	=~ s/(.)/$h2b{$1}/eg;
    my @pels	= split //, $line;
    foreach my $i ( 0 .. $x - 1 ) {
      if( $pels[$i] ) {

bin/bdf2png  view on Meta::CPAN

      }
    }
    $line_number++;
  }
  return $I->png;
}


=head1 NAME

bdf2png convert a BDF file into a number of transparent PNG files

=head1 SYNOPSIS

  bdf2png BDF_FILE

=head1 DESCRIPTION

This script takes the BDF file 'BDF_FILE' and creates a PNG file for
each character defined by the BDF file.  For a BDF file named "kanji48.bdf",
each PNG file will be named "kanji48.STARTCHAR.pdf".



( run in 0.558 second using v1.01-cache-2.11-cpan-0a6323c29d9 )