#!@@PERL@@ -n
#
#	This script is part of rtfdtohtml.
#	Copyright (c) 1996  Elmar Ludwig - Universitaet Osnabrueck
#
#	Map fontsizes to those listed in the html-trans file.
#	Note: All fontsizes here are in half points (e.g. 16.0 pt. == 32)

$out = '';

while (/\\fs([0-9]+)/)
{
    $fs = $1;
    if (substr($`, -1) ne '\\')
    {
	$fs = int($fs * $ENV{'FONT_SCALE'});

	if    ($fs >= 48) { $fs = '48'; }	# Heading level 1
	elsif ($fs >= 38) { $fs = '38'; }	# Heading level 2
	elsif ($fs >= 32) { $fs = '32'; }	# Heading level 3
	elsif ($fs >= 28) { $fs = '28'; }	# Heading level 4
	elsif ($fs >= 18) { $fs = '24'; }	# Normal text
	elsif ($fs >= 14) { $fs = '16'; }	# Heading level 5
	else		  { $fs = '12'; }	# Heading level 6
    }
    $out .= "$`\\fs$fs";
    $_ = $';
}

print $out . $_;
