Commit Graph

194 Commits

Author SHA1 Message Date
Zdenko Podobný
9ccda80dd6 backport from 4.00: training shell scripts 2016-12-02 21:07:28 +01:00
Zdenko Podobný
5750e728d9 use TessHashMap instead of hash_map, unordered_map 2016-11-30 21:58:57 +01:00
Zdenko Podobn??
70ed782ab5 style fix 2016-11-30 10:38:08 +01:00
Zdenko Podobný
6dcafe64f8 revert TessHashMap to hash_map in training/stringrenderer.h from 90651e1 (to fix build) 2016-11-27 21:26:29 +01:00
Zdenko Podobný
90651e111f backport style changes from 4.00 for better identification of fixes and new code 2016-11-25 15:14:46 +01:00
Zdenko Podobný
057b932f02 backport from 4.00: add missing License information 2016-11-25 13:13:28 +01:00
Stefan Weil
67fa73c95a training: Fix compiler warnings (deprecated register keyword)
training/commontraining.cpp:824:3: warning:
 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register]
...

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-11-25 09:17:08 +01:00
Stefan Weil
34af6155eb training: Remove unnecessary const qualifiers
This fixes several gcc warnings:

warning:
 type qualifiers ignored on function return type [-Wignored-qualifiers]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-10-08 11:28:22 +02:00
Zdenko Podobný
61032d9b14 set fonts_dir to system default font location. Fixes #409 2016-09-01 18:27:00 +02:00
Zdenko Podobný
916897da1b print text2image info to stdout instead of strerr 2016-09-01 13:38:06 +02:00
Stefan Weil
6ec1a0a09b fileio: Replace assert with tprintf() and exit(1)
Assertions are good for programming errors, but not for wrong user input.

The new code no longer needs File::ReadFileToStringOrDie, so remove that
method.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-08-30 07:13:56 +02:00
Stefan Weil
1950fec7a2 tlog: Remove unused macro TLOG_FATAL
The implementation was also wrong because it did not use __VA_ARGS__.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-08-29 19:11:01 +02:00
Stefan Weil
3420acabe5 text2image: Add linefeed to error message
This changes the error message for a missing font from

  Could not find font named Times New Roman.Please correct --font arg.

(missing space after first sentence) to

  Could not find font named Times New Roman.
  Please correct --font arg.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-08-28 21:33:52 +02:00
Stefan Weil
34ed8ddf62 stringrenderer: Fix compiler warning (-Wwrite-strings)
gcc reported this warning:

../training/stringrenderer.cpp:
 In member function ‘void tesseract::StringRenderer::SetLayoutProperties()’:
../training/stringrenderer.cpp:211:42: warning:
 ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
     set_features("liga, clig, dlig, hlig");
                                          ^
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-08-28 14:07:03 +02:00
zdenop
939023ffb9 Merge pull request #391 from vidiecan/issue_390
fixed #390 by introducing new rotate_image flag
2016-08-15 20:04:30 +02:00
jm
b69561c802 fixed #390 by introducing new rotate_image flag 2016-08-15 18:16:35 +02:00
jm
941e1c4c84 fixes #388 by using raw bytes utf8 encoding 2016-08-15 18:11:01 +02:00
jm
8d2d94e4ed fixes some of the windows issue with text2image, see #380 2016-08-05 20:11:01 +02:00
zdenop
5ca73cca26 Merge pull request #355 from amitdo/pango-name-is-empty
Check that pango's suggested font name is not an empty string
2016-06-20 10:26:11 +02:00
Stefan Weil
ed053aab94 Fix Cygwin compatibility – part III
Commit 65504c8cd2 misplaced the #endif.
The definition of _GNU_SOURCE is only needed for Cygwin.

Defining _GNU_SOURCE on Linux results in compiler warnings because this
macro is already defined by the compiler.

Fix this by moving the #endif to the right place. In addition the code
for Cygwin is made more robust: If a future Cygwin compiler defines
_GNU_SOURCE, too, the code will still work.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-06-19 22:38:03 +02:00
amitdo
724fb894ac Check that pango's suggested font name is not an empty string
On msys2 pango seems to always returns empty string for the suggested
font. It's a good idea to check that the string is not empty before
printing it - on all platforms.
2016-06-19 13:40:17 +03:00
Amit
96720c785d Merge pull request #351 from amitdo/cygwin-compat
Fix Cygwin compatibility
2016-06-19 12:43:35 +03:00
Stefan Weil
65504c8cd2 Fix Cygwin compatibility - Part II 2016-06-19 11:59:58 +03:00
Amit Dovev
13d789d4df Merge pull request #288 from nickjwhite/opentypeligatures
Enable all ligatures available in a font for text2image rendering
2016-06-19 03:33:32 +03:00
Amit Dovev
034d666e7a Replace use of TLOG_FATAL() with tprintf() and exit(1) (#349)
Asserts should not be used for missing or invalid input in the command
line! This leads to a bad UX.
2016-06-16 12:10:53 +03:00
Shreeshrii
c3a7fab349 Replace asserts with tprintf() and exit(1)
Asserts should not be used for missing or invalid input in the command
line! This leads to a bad UX.
2016-06-14 14:35:05 +03:00
amitdo
cd1a14450c Training tools: Print help message when (argv == 1) 2016-05-22 11:16:42 +03:00
Zdenko Podobný
cab6de1740 remove unused GlyphLessFont files 2016-05-20 21:19:00 +02:00
Nick White
76ed9decb3 Only enable extra ligatures with recent Pango versions
Pango's opentype feature selection functions are only available
from version 1.38+, which is still quite new, so ensure it's just
ignored if using an older version.
2016-03-21 13:03:03 +00:00
Nick White
9100adcbde Enable all ligatures available in a font for text2image rendering
This enables all OpenType ligatures for a specific font, where
available. Specifically, it explicitly enables the OpenType
features liga (standard ligatures), hlig (historical ligatures),
clig (contextual ligatures), and dlig (discretionary ligatures).

This feature requires Pango 1.38 or newer.
2016-03-21 11:41:36 +00:00
Amit Dovev
96c2f637fd Add missing % char from format specifier in tlog()
- In training/ango_font_info.cpp
2016-03-17 01:09:46 +02:00
Egor Pugin
4d4bfb552c Add inactivity timeout for icu download on windows 2016-03-04 12:34:01 +03:00
Ryan Baumann
bd5452d40c Add Junicode to neo-Latin fonts 2016-01-13 10:15:57 -05:00
Ryan Baumann
5b40277d08 Use different font list and exposures for "lat" language training 2016-01-04 11:48:02 -05:00
Hamid Safdari
0cd6e17419 correct minor syntax errors language-specific.sh 2015-12-25 09:50:15 +04:30
Egor Pugin
c16c7831a2 Merge branch 'master' of github.com:tesseract-ocr/tesseract 2015-11-30 11:43:18 +03:00
Egor Pugin
f15cd961c6 Download icu on windows to build set_unicharset_properties target. 2015-11-30 11:43:01 +03:00
zdenop
d025616af5 Merge pull request #148 from nickjwhite/tesstrainbetterargs
Use shell quoting rather than pluses to separate font arguments in tesstrain.sh
2015-11-27 21:56:40 +01:00
zdenop
359593217b Merge pull request #149 from nickjwhite/updategrc
Add defaults for grc training to language-specific.sh
2015-11-27 21:55:46 +01:00
Stefan Weil
29f36d9264 training: Fix typos in comments and strings
All of them were found by codespell.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-11-04 21:58:42 +01:00
Stefan Weil
38f3db8ca5 Fix more typos in comments (found by codespell)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-11-04 21:58:42 +01:00
Nick White
306610c5ec Use shell quoting rather than pluses to separate font arguments in tesstrain.sh
The way tesstrain.sh handled font names was really weird, using '+'
signs as a delimiter. However quoting arguments is a much more
straightforward, standard and sensible way to do things.

So whereas previously one would have used this:
  --fontlist Times New Roman + Arial Black
Now they should be specified like this:
  --fontlist "Times New Roman" "Arial Black"
2015-10-30 13:26:45 +00:00
zdenop
896db80f26 Merge pull request #108 from johnteslade/unicharset_extractor
Unicharset extractor problems with wchar
2015-10-05 21:49:03 +02:00
John Slade
379da1f2e0 training/unicharset_extractor.cpp: Print whether WCTYPE is included
Character properties are autogenerated only if wctype is found on the
system.  However, it is not possible to know if a version of
unicharset_extractor was compiled with this support (especially if it
was installed as a pre-compiled binary).

This commit adds a print to the usage details to output if the binary
was compiled with wctype support.
2015-10-05 11:54:24 +01:00
Egor Pugin
f369585f56 Merge branch 'master' of github.com:tesseract-ocr/tesseract 2015-10-02 12:02:04 +03:00
Nick White
b389e2782c Set default exposure settings for grc training 2015-09-11 13:30:05 +01:00
Nick White
ac6050def0 Remove NUMBER_DAWG_FACTOR and WORD_DAWG_FACTOR from grc rules
These aren't used anywhere, and are difficult to calculate for grc,
so leave them as the default.
2015-09-11 09:29:55 +01:00
zdenop
b216f6f66b Merge pull request #92 from nickjwhite/bettertesstrain
Improve tesstrain.sh script
2015-09-10 19:00:26 +02:00
Nick White
714d2cc4ae Use different font list for grc training
This font list contains a selection fonts produced by the Greek Font
Society <http://greekfontsociety.gr>, and is the result of testing
with a large corpus of a variety of scanned works.
2015-09-10 15:34:44 +01:00
Nick White
de789ac8ea Use mktemp to create workspace directory
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.
2015-09-10 15:05:07 +01:00