mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-18 14:41:36 +08:00
Merge pull request #148 from nickjwhite/tesstrainbetterargs
Use shell quoting rather than pluses to separate font arguments in tesstrain.sh
This commit is contained in:
commit
d025616af5
@ -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.
|
||||
|
@ -89,19 +89,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))
|
||||
|
Loading…
Reference in New Issue
Block a user