From: Ian Jackson Date: Sat, 4 Jul 2009 16:36:58 +0000 (+0100) Subject: make --edit-charset the default if there are some already X-Git-Tag: 1.9.2~34 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.main.git;a=commitdiff_plain;h=a16191c13cdc1eab1e43cc9662c2271481b3a9b8 make --edit-charset the default if there are some already --- diff --git a/pctb/README b/pctb/README index 9691433..a8dc8d7 100644 --- a/pctb/README +++ b/pctb/README @@ -32,6 +32,7 @@ Options to vary the processing: --screenshot-file F Store or read screenshots in F rather than #pages#.pnm --window-id ID Specified X window is the YPP client - do not search --edit-charset Enable character set editing. See README.dictionary. + --no-edit-charset Do not edit charset even if #local-char*#.txt exists. --find-island Find and print the ocean and island. Suppresses OCR and output unless used with result processing option. --test-servers Set default servers to be the test servers, not diff --git a/pctb/README.charset b/pctb/README.charset index 49bc9c7..31e1221 100644 --- a/pctb/README.charset +++ b/pctb/README.charset @@ -152,9 +152,11 @@ Enabling interactive character set update ----------------------------------------- Now that you have read this document, you should rerun your OCR job -with the --edit-charset option. So - ./ypp-commodities --edit-charset -In future, always run it with the --edit-charset option. +with the --edit-charset option. So run + ./ypp-commodities --edit-charset +In future, this option is not usually needed, because it is the +default if there is a local character set dictionary #local-#.txt +for the relevant character height. With --edit-charset, when the OCR finds characters it does not understand, it will put up an OCR resolution query window. This will diff --git a/pctb/convert.c b/pctb/convert.c index 8101fb9..3250d18 100644 --- a/pctb/convert.c +++ b/pctb/convert.c @@ -195,7 +195,8 @@ int main(int argc, char **argv) { else if (IS("--find-island")) o_flags |= ffs_printisland; else if (IS("--single-page")) o_flags |= ff_singlepage; else if (IS("--quiet")) o_quiet= 1; - else if (IS("--edit-charset")) o_flags |= ff_editcharset; + else if (IS("--edit-charset")) o_flags |= ff_charset_edit; + else if (IS("--no-edit-charset")) o_flags &= ~(ffm_charset); else if (IS("--test-servers")) o_flags |= ff_testservers; else if (IS("--dict-local-only")) o_flags &= ~ffs_dict; else if (IS("--dict-read-only")) o_flags &= (~ffs_dict | ff_dict_fetch); diff --git a/pctb/convert.h b/pctb/convert.h index 0ab09db..07c3a6f 100644 --- a/pctb/convert.h +++ b/pctb/convert.h @@ -96,20 +96,24 @@ void vprogress_spinner(const char *fmt, va_list) FMT(1,0); void progress_spinner(const char *fmt, ...) FMT(1,2); enum flags { - ff_editcharset= 00001, - ff_singlepage= 00002, - ff_testservers= 00004, + ff_singlepage= 000002, + ff_testservers= 000004, + + ff_charset_edit= 000010, + ff_charset_allowedit= 000020, + ff_charset_havelocal= 000040, + ffm_charset= 000070, - ff_dict_fetch= 00010, - ff_dict_submit= 00020, - ff_dict_pirate= 00040, - ffs_dict= 00070, - - ff_needisland= 00100, - ff_printisland= 00200, - ff_upload= 00400, - ffs_printisland= 00300, - ffs_upload= 00500, + ff_dict_fetch= 000100, + ff_dict_submit= 000200, + ff_dict_pirate= 000400, + ffs_dict= 000700, + + ff_needisland= 001000, + ff_printisland= 002000, + ff_upload= 004000, + ffs_printisland= 003000, + ffs_upload= 005000, }; extern enum flags o_flags; diff --git a/pctb/ocr.c b/pctb/ocr.c index bbdbedc..4759782 100644 --- a/pctb/ocr.c +++ b/pctb/ocr.c @@ -126,6 +126,9 @@ static void readdb1(OcrReader *rd, const char *which, int local) { if (!dbfile_open(dbfname)) goto x; + if (local) + o_flags |= ff_charset_havelocal; + FGETSLINE; dbassert(!strcmp(lbuf,"# ypp-sc-tools pctb font v2"));