chiark / gitweb /
make --edit-charset the default if there are some already
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 4 Jul 2009 16:36:58 +0000 (17:36 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 4 Jul 2009 16:36:58 +0000 (17:36 +0100)
pctb/README
pctb/README.charset
pctb/convert.c
pctb/convert.h
pctb/ocr.c

index 96914335c7351132b7c955df238de53344d81e37..a8dc8d7b8f59cbb58b7330b99cc117f812fd8d2f 100644 (file)
@@ -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
index 49bc9c7eb0bae10f3e2e8c3e62aa64ced0d9ff33..31e1221d7b4340c1f2bb1ed68fb0366f69c0478c 100644 (file)
@@ -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-<h>#.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
index 8101fb920a40adafad02ab92ed4efd5181c2ae44..3250d183a940caa8397b75e502ed3237b5303e67 100644 (file)
@@ -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);
index 0ab09dbccb7ac56b2076cb870d9956f701af6f09..07c3a6ffaf366759da1e8fbf9bf5dd2e7b6271ce 100644 (file)
@@ -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;
 
index bbdbedc3b0c14631fd82fa7875a9970eba23bcd3..47597828c5f0091f1b5dce2e1592bb2e82aa4da6 100644 (file)
@@ -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"));