* src/tools/ftrandom/ftrandom.c (GOOD_FONTS_DIR): Provide better default. (error_fraction): Make it of type `double' to work as advertized – this was completely broken. Update all related code. (error_count, fcnt): Make it unsigned to fix compiler warnings. Update all related code. (fontlist): Change `len' member to `long' to fix compiler warnings. (FT_MoveTo, FT_LineTo, FT_ConicTo, FT_CubicTo, abort_test): Tag unused variables. (TestFace, FindFonts, copyfont, do_test): Fix compiler warnings. (ExecuteTest): Ditto. Call `FT_Done_FreeType'. (getErrorCnt): Replace `ceil' with an ordinary cast to `unsigned int'. (usage): Improve output. (main): Fix compiler warnings. * src/tools/ftrandom/README: Updated.Harmony
parent
b98dfda392
commit
ca8e98d94a
3 changed files with 148 additions and 59 deletions
@ -1,48 +1,69 @@ |
||||
ftrandom |
||||
-------- |
||||
======== |
||||
|
||||
This program expects a set of directories containing good fonts, and a set |
||||
of extensions of fonts to be tested. It will randomly pick a font, copy it, |
||||
introduce and error and then test it. |
||||
introduce an error and then test it. |
||||
|
||||
The FreeType tests are quite basic: |
||||
The FreeType tests are quite basic; for each erroneous font ftrandom |
||||
|
||||
For each erroneous font it |
||||
forks off a new tester; |
||||
initializes the library; |
||||
opens each font in the file; |
||||
loads each glyph; |
||||
(optionally reviewing the contours of the glyph) |
||||
(optionally rasterizing) |
||||
closes the face. |
||||
. forks off a new tester, |
||||
. initializes the library, |
||||
. opens each font in the file, |
||||
. loads each glyph, |
||||
. optionally reviews the contours of the glyph, |
||||
. optionally rasterizes the glyph, and |
||||
. closes the face. |
||||
|
||||
If the tester exits with a signal, or takes longer than 20 seconds then |
||||
ftrandom saves the erroneous font and continues. If the tester exits |
||||
normally or with an error, then the superstructure removes the test font and |
||||
continues. |
||||
If a tester takes longer than 20 seconds, ftrandom saves the erroneous font |
||||
and continues. If the tester exits normally or with an error, then the |
||||
superstructure removes the test font and continues. |
||||
|
||||
Arguments are: |
||||
|
||||
Command line options |
||||
-------------------- |
||||
|
||||
--all Test every font in the directory(ies) no matter |
||||
what its extension (some CID-keyed fonts have no |
||||
extension). |
||||
--check-outlines Call FT_Outline_Decompose on each glyph. |
||||
what its extension. |
||||
--check-outlines Call `FT_Outline_Decompose' on each glyph. |
||||
--dir <dir> Append <dir> to the list of directories to search |
||||
for good fonts. |
||||
for good fonts. No recursive search. |
||||
--error-count <cnt> Introduce <cnt> single-byte errors into the |
||||
erroneous fonts. |
||||
erroneous fonts (default: 1). |
||||
--error-fraction <frac> Multiply the file size of the font by <frac> and |
||||
introduce that many errors into the erroneous |
||||
font file. |
||||
--ext <ext> Add <ext> to the set of font types tested. Known |
||||
extensions are `ttf', `otf', `ttc', `cid', `pfb', |
||||
`pfa', `bdf', `pcf', `pfr', `fon', `otb', and |
||||
`cff'. |
||||
font file. <frac> should be in the range [0;1] |
||||
(default: 0.0). |
||||
--ext <ext> Add <ext> to the set of font types tested. |
||||
--help Print out this list of options. |
||||
--nohints Specify FT_LOAD_NO_HINTING when loading glyphs. |
||||
--rasterize Call FT_Render_Glyph as well as loading it. |
||||
--rasterize Call `FT_Render_Glyph' as well as loading it. |
||||
--result <dir> This is the directory in which test files are |
||||
placed. |
||||
--test <file> Run a single test on a pre-generated testcase. |
||||
Done in the current process so it can be debugged |
||||
more easily. |
||||
This is done in the current process so it can be |
||||
debugged more easily. |
||||
|
||||
The default font extensions tested by ftrandom are |
||||
|
||||
.ttf .otf .ttc .cid .pfb .pfa .bdf .pcf .pfr .fon .otb .cff |
||||
|
||||
The default font directory is controlled by the macro `GOOD_FONTS_DIR' in |
||||
the source code (and can be thus specified during compilation); its default |
||||
value is |
||||
|
||||
/usr/local/share/fonts |
||||
|
||||
The default result directory is `results' (in the current directory). |
||||
|
||||
|
||||
Compilation |
||||
----------- |
||||
|
||||
Two possible solutions. |
||||
|
||||
. Run ftrandom within a debugging tool like `valgrind' to catch various |
||||
memory issues. |
||||
|
||||
. Compile FreeType with sanitizer flags as provided by gcc or clang, for |
||||
example, then link it with ftrandom. |
||||
|
Loading…
Reference in new issue