[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: request for help and question about donation

On 2004.03.04 at 01:50:45 +0100, Sergey V. Spiridonov wrote:

> Hash: SHA1
> Hi
> I want to make mozilla-* (firefox, thunderbird) Debian packages print
> Russian text out of the box. It can be possible even without hacking
> the source code, just by proper configuration, not sure.

The only thing which is needed, is to cure Mozilla from false assumption
that standard postscript fonts such as Courier, Times and Helvetica
contain Russian letters.

If you just replace these font names with names of some other fonts
which contain Russian letters and are known to your Ghostscript, you'll
see Russian in your postscript-viewer.

But there would be wrong spacing, becouse Mozilla doesn't use proper
font metrics.

And you'll need to embed .pfa files for these fonts into postscript file
in order to print it on hardware Postscript printer.

I do these first and last tasks with following perl script:


my $pfamap='/usr/share/a2ps/afm/fonts.map';
my $pfadir = '/usr/share/a2ps/fonts';
open F,$substfile or die "Cannot open font substitution file ($substfile): $!\n";
my (%fontsubst,%needed);

%fontsubst = (
Courier	=>	"Courier10PitchCyr-Roman",
Courier-Bold =>	"Courier10PitchCyr-Bold",
Courier-BoldOblique	=> "Courier10PitchCyr-BoldItalic",
Courier-Oblique => "Courier10PitchCyr-Italic",
Times-Roman => "TimesCyr-Medium",
Times-Bold => "TimesCyr-Bold",
Times-Italic => "TimesCyr-Italic",
Times-BoldItalic => "TimesCyr-BoldItalic",
Helvetica => "HelveticaCyr-Medium",
Helvetica-Bold => "HelveticaCyr-Bold",
Helvetica-Oblique => "HelveticaCyr-Italic",
Helvetica-BoldOblique => "HelveticaCyr-BoldItalic",

# Following block can be replaced by just map of font names to filenames 
# of .pfa files
open F,$pfamap or die "Cannot open font map ($pfamap): $!\n";
my @fonts;
while (<F>) {
	next if /^#/;
	my ($font,$file) = split /\s+/;
	push @fonts,$pfadir . "/" . $file . ".pfa"  if exists $needed{$font};
close F;

# Real postscript processing

while (<>) {
  if (/^\%\%BeginProlog/) {
	for my $file (@fonts) {
	  open F,$file or print STDERR "Error reading font file $file :$!\n";
	  while ($file_line=<F>) {
	    print $file_line;
	  close F;
   } else {
     if (/^\s+\/([-a-zA-Z0-9_]+)\s+findfont/ && exists $fontsubst{$1}) {
	   $_="\t/$fontsubst{$1} findfont\n";

This script is used as print command to mozilla i.e using
patchps |lpr instead of just lpr.

Of course, it is better to patch mozilla to read and use corresponding
afm files instead of using builtin metrics.

BTW, you should also see altlinux builds of Mozilla (www.altlinux.ru).
May be they have done something.

Reply to: