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

Bug#847501: bdf2psf: misleading error message -- "the width is not integer number"



Package: bdf2psf
Version: 1.123
Severity: normal


In the script /usr/bin/bdf2psf in the section for reading the BDF
starting at


   ########### READ BDFs ################################################

   for my $bdf (@bdfs) {

there are tests

        if ($height) {

and

        if ($width) {


I am probably misunderstanding something here, because I do not understand
how these variables $height and $width can have a value at this point in the script
other than undefined (rendering the test for non defined value pointless) since they
have not been assigned a default value and are not yet set from a value read from the BDF.

Now in the "else" part of the test for $width which is executed since $width
is undefined, the value of $averagewidth is checked


        else {
          $averagewidth % 10 == 0
                     or die ("$0: $bdf: the width is not integer number.\n");


$averagewidth should be set from a value read from the BDF

                  if (/^AVERAGE_WIDTH\s+\"?([0-9]+)\"?$/) {
            $averagewidth = $1;


Of course to be safe, there really should be a test that $averagewidth
has a value and is not "undefined" before applying the test of its value.

The starting point of this bug report is that "the width is not
integer number" is not an appropriate message since any integer value of
$averagewidth which is not a multiple of 10 will produce this misleading
error message.  Why must the average width be a multiple of 10 (eg 75, 84,
113, or whatever) though and how should the script deal with these cases?

So in the error message why say that width is not an integer number when the
test for not for width but averagewidth and why state it is not an integer
number when it is rather than it is not a multiple of 10?

If the test really should be "is the value of averagewidth a positive integer
value, then the regular expression used to read it, $averagewidth, should have
filtered out a non integer number, and hence the need to check that
it is defined, before trying to apply any tests to the variable.

One user in Debian Bug Report #539108 forced the value in the BDF file from
whatever it was to 80 with

         sed -e "s/AVERAGE_WIDTH.*/AVERAGE_WIDTH 80/"

but this surely is not optimal and may give poor results for differing
font sizes.


Also, to help improve the clarity of the script I suggest that the code
which is not a subroutine function

  for my $c (0 ... $font_size - 1) {
      $position_type[$c] = $dont_copy_8th;
  }
  for my $c (0xc0 ... 0xdf) {
      $position_type[$c] = $copy_8th;
  }
  for my $c (0x1c0 ... 0x1df) {
      $position_type[$c] = $copy_8th;
  }

but which is buried amongst the subroutine functions definitions and which is executed
in main when the script starts just before main starts reading the bdf at

   ########### READ BDFs ################################################

   for my $bdf (@bdfs) {

should be moved to just before this "READ BDFs" code section.


These issues are also present in the latest bdf2psf script in package
version 1.154.


Hoping for clarification on these matters and thanking you for your
maintenance and support of the package.


-- System Information:
Debian Release: 8.6
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: armel (armv5tel)

Kernel: Linux 3.16.0-4-kirkwood
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages bdf2psf depends on:
ii  perl  5.20.2-3+deb8u6

bdf2psf recommends no packages.

bdf2psf suggests no packages.

-- no debconf information


Reply to: