Font utilities

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

10.1 Limn algorithm

Limn can always (barring bugs, of course) fit some sort of outline to the bitmap input. But its default fit is likely to be far from the ideal: character features may disappear, curves distorted, straight lines turned into curves and curves into straight lines, and on and on.

To control the fitting process, you must specify options to override Limn's defaults. To describe those options, we must describe the algorithm Limn uses to do the fitting, which we do in this section. We mention the options at the appropriate point.

The next section summarizes all the options, in alphabetical order.

Here is a schematic of the algorithm. The subsections below go into detail for each step. Except for the very first step, this is implemented in `limn/fit.c'.

 
find pixel outlines
for each pixel outline:
  find corners, yielding curve lists
  for each curve list:
    remove knees
    filter
    if too small:
      fit with straight line
    otherwise fit with spline:
      set initial t values
      find tangents
      fit with one spline
      while error > reparameterize-threshold, reparameterize
      if error > error-threshold, subdivide and recurse
      if linearity < line-threshold, change to straight line
    revert bad lines
    align endpoints

10.1.1 Finding pixel outlines  Extracting the edges from the bitmap.
10.1.2 Finding corners  Finding subsections of each outline.
10.1.3 Removing knees  Removing extraneous points.
10.1.4 Filtering curves  Smoothing the outlines.
10.1.5 Fitting the bitmap curve  Doing the fitting.
10.1.6 Changing splines to lines  Use straight lines where possible.
10.1.7 Changing lines to splines  Sometimes it isn't possible.
10.1.8 Aligning endpoints  If points are close enough, line them out.
10.1.9 Displaying fitting online  Seeing the results as Limn runs.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]