[Prev][Next][Index]

Re: 1. hebrew with linux, 2. Boca modem - help please



In your message from [Fri, 30 Jun 1995 01:06:30 +0300 (IDT)] you wrote:
> "Yair G. Rajwan" <yair@hobbes.jct.ac.il> wrote:
> 
> > I'm looking for an option to use Einshtein, hpico, netscape and qtext 
> > under linux - i.e. need hebrew-vga font for xdos-emu 
> 
> If it's not done yet, do it yourself - rather simple, IMHO. When I wanted to
> russify xdos, it took about 2 hours to write the bdf font taking vga as base
> one.
> 
> Evgeny

Here's an even shorter way:  vgf2bdf 

Use it like this:

   vgf2bdf pcfont.vgf > xfont.bdf
   
There are some options that you can check with -help.

#!/usr/local/bin/perl
##############################################################################
#  Convert vgf fonts to bdf fonts.
#
#  Version 0.2
#  30 Oct 1992
#
#  Dov Grobgeld
#  dov@menora.weizmann.ac.il
#
##############################################################################
#  Note about the vgf format
#
#  The vgf file is a 4096 byte long file. It is a raw bitmap file of the
#  256 characters in the font. Each font takes up 16 consequitive bytes
#  which define the bitmap of each character. It is the format which is
#  created and which can be read by the EVAFONT program available from
#  simtel.
#
#  Version 0.2
##############################################################################

# Get parameters
while(($_=$ARGV[0])=~ /^-/) {
    shift;
    if (/-h(elp)?$|-u(sage)?$/) {
        print<<EOH;
vgf2bdf - Convert a VGA font to a bdf font

Syntax:
      vgf2bdf [-8|-9] fontfile

Options:
      -8  Make a 8 pixel wide font
      -9  Make a 9 pixel wide font
      -height  Give height of characters in pixels. (Note that the 
      	       height * 256 = size of vgf-file.) Default is 16.
      -name Give the font a name. Default is the name of the file.

Author:
    Dov Grobgeld (dov@menora.weizmann.ac.il)
EOH
        exit;
    }
    elsif (/-8/) {
        $fontwidth=8;
    }
    elsif (/-9/) {
        $fontwidth=9;
    }
    elsif (/-height/) {
        $height=shift;
    }
    elsif (/-name/) {
        $fontname=shift;
    }
    else {
	die "Unknown option $_!\n";
    }
}

# defaults
$fontwidth=8 unless $fontwidth;
$height=16 unless $height;

($filename=shift) || die "No filename given!\n";
$filename=~ /[^\.]*/; 
$fontname= $& unless $fontname;
open(STDIN, $filename);

&outputHead;
for $c (0..255) {
    read(STDIN, $_,$height);
    &outputChar($c, $_);
}
&outputTail;

###########################################################################
#  Header of the bdf file.
###########################################################################
sub outputHead {
    local($a) = $height-4;
    print<<QQ;
STARTFONT 2.1
COMMENT
COMMENT  This font was automatically created by the program vgf2bdf
COMMENT  version 0.2 by Dov Grobgeld.
COMMENT
FONT $fontname
SIZE $height 75 75
FONTBOUNDINGBOX $fontwidth $height 0 -4
STARTPROPERTIES 12
PIXEL_SIZE $height
POINT_SIZE 160
RESOLUTION_X 75
RESOLUTION_Y 75
SPACING "C"
AVERAGE_WIDTH 80
CHARSET_REGISTRY "Unknown"
CHARSET_ENCODING "1"
FONT_ASCENT $a
FONT_DESCENT 4
DEFAULT_CHAR 0
COPYRIGHT "Free font."
ENDPROPERTIES
CHARS 256
QQ
}

###########################################################################
#  Tail of the bdf file.
###########################################################################
sub outputTail {
    print "ENDFONT\n";
}

###########################################################################
#  Output of each character.
###########################################################################
sub outputChar {
    local(@rows)=unpack("C*",$_[1]);
    local($bitmap,$r);
    local($charname)=sprintf("C%03d", $_[0]);

    foreach $r (@rows) { $bitmap.= sprintf("%02x00\n",$r) }
    $bitmap=~ s/\n$//;
    print<<QQ;
STARTCHAR $charname
ENCODING $_[0]
SWIDTH 666 0
DWIDTH $fontwidth 0
BBX $fontwidth $height 0 -4
BITMAP
$bitmap
ENDCHAR
QQ
}
__END__

--
Dov Grobgeld             Email: dov@orbotech.co.il
The Rainbow Project, Orbotech
Yavne, Israel