Home | History | Annotate | Download | only in ftrandom
      1 ftrandom
      2 ========
      3 
      4 This program expects a set of directories containing good fonts, and a set
      5 of extensions of fonts to be tested.  It will randomly pick a font, copy it,
      6 introduce an error and then test it.
      7 
      8 The FreeType tests are quite basic; for each erroneous font ftrandom
      9 
     10   . forks off a new tester,
     11   . initializes the library,
     12   . opens each font in the file,
     13   . loads each glyph,
     14   . optionally reviews the contours of the glyph,
     15   . optionally rasterizes the glyph, and
     16   . closes the face.
     17 
     18 If a tester takes longer than 20 seconds, ftrandom saves the erroneous font
     19 and continues.  If the tester exits normally or with an error, then the
     20 superstructure removes the test font and continues.
     21 
     22 
     23 Command line options
     24 --------------------
     25 
     26   --all                    Test every font in the directory(ies) no matter
     27                            what its extension.
     28   --check-outlines         Call `FT_Outline_Decompose' on each glyph.
     29   --dir <dir>              Append <dir> to the list of directories to search
     30                            for good fonts.  No recursive search.
     31   --error-count <cnt>      Introduce <cnt> single-byte errors into the
     32                            erroneous fonts (default: 1).
     33   --error-fraction <frac>  Multiply the file size of the font by <frac> and
     34                            introduce that many errors into the erroneous
     35                            font file.  <frac> should be in the range [0;1]
     36                            (default: 0.0).
     37   --ext <ext>              Add <ext> to the set of font types tested.
     38   --help                   Print out this list of options.
     39   --nohints                Specify FT_LOAD_NO_HINTING when loading glyphs.
     40   --rasterize              Call `FT_Render_Glyph' as well as loading it.
     41   --result <dir>           This is the directory in which test files are
     42                            placed.
     43   --test <file>            Run a single test on a pre-generated testcase.
     44                            This is done in the current process so it can be
     45                            debugged more easily.
     46 
     47 The default font extensions tested by ftrandom are
     48 
     49   .ttf .otf .ttc .cid .pfb .pfa .bdf .pcf .pfr .fon .otb .cff
     50 
     51 The default font directory is controlled by the macro `GOOD_FONTS_DIR' in
     52 the source code (and can be thus specified during compilation); its default
     53 value is
     54 
     55   /usr/local/share/fonts
     56 
     57 The default result directory is `results' (in the current directory).
     58 
     59 
     60 Compilation
     61 -----------
     62 
     63 Two possible solutions.
     64 
     65 . Run ftrandom within a debugging tool like `valgrind' to catch various
     66   memory issues.
     67 
     68 . Compile FreeType with sanitizer flags as provided by gcc or clang, for
     69   example, then link it with ftrandom.
     70