diff --git a/training/tesstrain.sh b/training/tesstrain.sh index c1af1e86c1..231b5360fb 100755 --- a/training/tesstrain.sh +++ b/training/tesstrain.sh @@ -17,7 +17,7 @@ # USAGE: # # tesstrain.sh -# --fontlist FONTS_STR # A plus-separated list of fontnames to train on. +# --fontlist FONTS # A list of fontnames to train on. # --fonts_dir FONTS_PATH # Path to font files. # --lang LANG_CODE # ISO 639 code. # --langdata_dir DATADIR # Path to tesseract/training/langdata directory. diff --git a/training/tesstrain_utils.sh b/training/tesstrain_utils.sh index 30006bc1f7..cd0bc8d7fc 100755 --- a/training/tesstrain_utils.sh +++ b/training/tesstrain_utils.sh @@ -90,19 +90,21 @@ parse_flags() { case ${ARGV[$i]} in --) break;; - --fontlist) # Expect a plus-separated list of names - if [[ -z ${ARGV[$j]} ]] || [[ ${ARGV[$j]:0:2} == "--" ]]; then - err_exit "Invalid value passed to --fontlist" - fi - local ofs=$IFS - IFS='+' - FONTS=( ${ARGV[$j]} ) - IFS=$ofs - i=$j ;; + --fontlist) + fn=0 + FONTS="" + while test $j -lt ${#ARGV[@]}; do + test -z "${ARGV[$j]}" && break + test `echo ${ARGV[$j]} | cut -c -2` = "--" && break + FONTS[$fn]="${ARGV[$j]}" + fn=$((fn+1)) + j=$((j+1)) + done + i=$((j-1)) ;; --exposures) exp="" while test $j -lt ${#ARGV[@]}; do - test -z ${ARGV[$j]} && break + test -z "${ARGV[$j]}" && break test `echo ${ARGV[$j]} | cut -c -2` = "--" && break exp="$exp ${ARGV[$j]}" j=$((j+1))