mktemp is a better idea for security, as well as enabling users to
specify a different directory using the TMPDIR environment variable,
which is useful if /tmp is a small tmpfs.
Also fix a bug where the first few log messages were failing as the
workspace directory wasn't been created early enough.
This flag can be used to specify multiple different exposure levels
for a training. There was some code already in tesstrain_utils.sh
to deal with multiple exposure levels, so it looks like this
functionality was always intended.
The default usage does not change, with exposure level 0 being the
only one used if --exposures is not used.
The --bin_dir option to tesstrain.sh is not useful, as $PATH does the
same job much better, so switch to relying on that instead.
This also makes the code a bit more readable, as it removes the need
to refer to binaries as COMMAND_NAME_EXE rather than just command_name.
The fontconfig initialisation hardcodes using Arial. However it may
not be available, whereas the fonts being used later will be, so use
one of them for initialisation instead.
Previously the fonts specified in language-selection.sh would override
any specified on the command line.
This changes language-specific.sh from overriding a user request to
just setting the default fonts if none are specified with --fontlist.
The --fontlist argument to tesstrain.sh was always ignored, even if
the language had no specific fonts specified in language-specific.sh.
Change this behaviour so the --fontlist argument is used if no specifc
fonts are selected by language-specific.sh.
Also fixed a writable strings warning/error.
warning: ISO C++11 does not allow conversion from
string literal to 'char *' [-Wwritable-strings]
Several were of this form and fixed as the compiler suggested:
openclwrapper.cpp:2411:33: error: non-constant-expression cannot be narrowed
from type 'int' to 'size_t' (aka 'unsigned long') in initializer list
[-Wc++11-narrowing]
size_t local_work_size[] = {block_size};
^~~~~~~~~~
openclwrapper.cpp:2411:33: note: insert an explicit cast to silence this issue
size_t local_work_size[] = {block_size};
^~~~~~~~~~
static_cast<size_t>( )
Should have low impact on other platforms/compilers. The change makes
the code more correct.