smooth.c: better smoothing rules

The updated rules are still asymmetrical with respect to black/white
pixels.  This partly has to do with morphology of character shapes and
specifically with the fact that the outer curve of a character is longer
than its inner/inward parts of the curve.  Thus clearing a single
spike-like pixel on the outer part is typically okay, while turning
a white pixel into black on the inside is less so.

The updated rules actually do turn black pixels on, but only for a very
good reason: when all its four neighbours are black.  This is the case
in the following example, with the pixel in question denoted with "X".

"              ++++     "
"              ++X+     "
"             ++++      "
"            +++++      "
"            ++++++     "
"           +++++++     "
"          ++++++++     "
"          ++++++++     "
"         +++++++++     "
"        ++++++++++     "
"        ++++ +++++     "
"       ++++  +++++     "
"      +++++  +++++     "
"      ++++   +++++     "
"     ++++    +++++     "
"    ++++     +++++     "
"   +++++     +++++     "
"   ++++      +++++     "
"  ++++       +++++     "
" +++++       +++++     "
" +++++++++++++++++++++ "
"+++++++++++++++++++++++"
"+++++++++++++++++++++++"
"            ++++++     "
"            ++++++     "
"            ++++++     "
"            ++++++     "
"          +++++++++++  "
"         +++++++++++++ "
"         +++++++++++++ "
"          +++     ++++ "

The updated rules also handle differently black pixels with only one
neighbour.  Previously, such pixels have been cleared unconditionally.
This was not always the right thing to do, as demonstrated with the
following example.  Here the black pixel denoted "X" has only one black
neighbour.  However, it functions as a somewhat deficient "weak"
horizontal link, and clearing the pixel will further distort the shape.
We only check for horizontal linking when the neighbour is either on
the left or right, and for vertical linking if the neighbour is on
the top or bottom.  Weak diagonal linking is not taken into account.

"      +++++++++         "
"    +++++++++++++       "
"  ++++++++++++++++      "
"  ++++++    ++++++      "
" +++++       ++++++     "
" +++++        ++++++    "
" ++++++        +++++    "
" ++++++        +++++    "
"  +++++        +++++    "
"   ++++       ++++++    "
"          ++++++++++    "
"      ++++++++++++++    "
"     +++++++   +++++    "
"   X+++++      +++++    "
" ++ +++        +++++    "
"+++            +++++    "
"++++           +++++    "
"++++           +++++    "
"++++          ++++++    "
"++++         ++++++     "
"+++          +++++++    "
"+++       ++++++++++  ++"
"+++  +++++++++ +++++++++"
" +++++++++++    ++++++++"
"  ++++++++       +++++  "
"    ++            ++    "