tesseract_bin 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (612) hide show
  1. data/.document +5 -0
  2. data/Gemfile +14 -0
  3. data/Gemfile.lock +23 -0
  4. data/LICENSE.txt +20 -0
  5. data/README.rdoc +19 -0
  6. data/Rakefile +46 -0
  7. data/VERSION +1 -0
  8. data/ext/tesseract_bin/extconf.rb +17 -0
  9. data/lib/tesseract_bin.rb +12 -0
  10. data/tesseract_bin.gemspec +660 -0
  11. data/test/helper.rb +18 -0
  12. data/test/test_tesseract_bin.rb +7 -0
  13. data/vendor/tesseract-2.04/AUTHORS +8 -0
  14. data/vendor/tesseract-2.04/COPYING +23 -0
  15. data/vendor/tesseract-2.04/ChangeLog +71 -0
  16. data/vendor/tesseract-2.04/INSTALL +229 -0
  17. data/vendor/tesseract-2.04/Makefile.am +20 -0
  18. data/vendor/tesseract-2.04/Makefile.in +641 -0
  19. data/vendor/tesseract-2.04/NEWS +1 -0
  20. data/vendor/tesseract-2.04/README +138 -0
  21. data/vendor/tesseract-2.04/ReleaseNotes +213 -0
  22. data/vendor/tesseract-2.04/StdAfx.cpp +8 -0
  23. data/vendor/tesseract-2.04/StdAfx.h +24 -0
  24. data/vendor/tesseract-2.04/ccmain/Makefile.am +63 -0
  25. data/vendor/tesseract-2.04/ccmain/Makefile.in +735 -0
  26. data/vendor/tesseract-2.04/ccmain/adaptions.cpp +1082 -0
  27. data/vendor/tesseract-2.04/ccmain/adaptions.h +109 -0
  28. data/vendor/tesseract-2.04/ccmain/applybox.cpp +891 -0
  29. data/vendor/tesseract-2.04/ccmain/applybox.h +73 -0
  30. data/vendor/tesseract-2.04/ccmain/baseapi.cpp +1105 -0
  31. data/vendor/tesseract-2.04/ccmain/baseapi.h +256 -0
  32. data/vendor/tesseract-2.04/ccmain/blobcmp.cpp +76 -0
  33. data/vendor/tesseract-2.04/ccmain/blobcmp.h +29 -0
  34. data/vendor/tesseract-2.04/ccmain/callnet.cpp +93 -0
  35. data/vendor/tesseract-2.04/ccmain/callnet.h +32 -0
  36. data/vendor/tesseract-2.04/ccmain/charcut.cpp +704 -0
  37. data/vendor/tesseract-2.04/ccmain/charcut.h +120 -0
  38. data/vendor/tesseract-2.04/ccmain/charsample.cpp +699 -0
  39. data/vendor/tesseract-2.04/ccmain/control.cpp +1842 -0
  40. data/vendor/tesseract-2.04/ccmain/control.h +198 -0
  41. data/vendor/tesseract-2.04/ccmain/docqual.cpp +1481 -0
  42. data/vendor/tesseract-2.04/ccmain/docqual.h +155 -0
  43. data/vendor/tesseract-2.04/ccmain/expandblob.cpp +82 -0
  44. data/vendor/tesseract-2.04/ccmain/expandblob.h +13 -0
  45. data/vendor/tesseract-2.04/ccmain/fixspace.cpp +989 -0
  46. data/vendor/tesseract-2.04/ccmain/fixspace.h +72 -0
  47. data/vendor/tesseract-2.04/ccmain/fixxht.cpp +825 -0
  48. data/vendor/tesseract-2.04/ccmain/fixxht.h +93 -0
  49. data/vendor/tesseract-2.04/ccmain/imgscale.cpp +154 -0
  50. data/vendor/tesseract-2.04/ccmain/imgscale.h +32 -0
  51. data/vendor/tesseract-2.04/ccmain/matmatch.cpp +391 -0
  52. data/vendor/tesseract-2.04/ccmain/matmatch.h +48 -0
  53. data/vendor/tesseract-2.04/ccmain/output.cpp +1273 -0
  54. data/vendor/tesseract-2.04/ccmain/output.h +116 -0
  55. data/vendor/tesseract-2.04/ccmain/pagewalk.cpp +666 -0
  56. data/vendor/tesseract-2.04/ccmain/pagewalk.h +155 -0
  57. data/vendor/tesseract-2.04/ccmain/paircmp.cpp +107 -0
  58. data/vendor/tesseract-2.04/ccmain/paircmp.h +43 -0
  59. data/vendor/tesseract-2.04/ccmain/pgedit.cpp +1867 -0
  60. data/vendor/tesseract-2.04/ccmain/pgedit.h +181 -0
  61. data/vendor/tesseract-2.04/ccmain/reject.cpp +1775 -0
  62. data/vendor/tesseract-2.04/ccmain/reject.h +181 -0
  63. data/vendor/tesseract-2.04/ccmain/scaleimg.cpp +366 -0
  64. data/vendor/tesseract-2.04/ccmain/scaleimg.h +35 -0
  65. data/vendor/tesseract-2.04/ccmain/tessbox.cpp +375 -0
  66. data/vendor/tesseract-2.04/ccmain/tessbox.h +110 -0
  67. data/vendor/tesseract-2.04/ccmain/tessedit.cpp +278 -0
  68. data/vendor/tesseract-2.04/ccmain/tessedit.h +49 -0
  69. data/vendor/tesseract-2.04/ccmain/tessembedded.cpp +110 -0
  70. data/vendor/tesseract-2.04/ccmain/tessembedded.h +38 -0
  71. data/vendor/tesseract-2.04/ccmain/tesseractfull.cc +37 -0
  72. data/vendor/tesseract-2.04/ccmain/tesseractmain.cpp +387 -0
  73. data/vendor/tesseract-2.04/ccmain/tesseractmain.h +58 -0
  74. data/vendor/tesseract-2.04/ccmain/tessio.h +110 -0
  75. data/vendor/tesseract-2.04/ccmain/tessvars.cpp +38 -0
  76. data/vendor/tesseract-2.04/ccmain/tessvars.h +48 -0
  77. data/vendor/tesseract-2.04/ccmain/tfacep.h +62 -0
  78. data/vendor/tesseract-2.04/ccmain/tfacepp.cpp +443 -0
  79. data/vendor/tesseract-2.04/ccmain/tfacepp.h +85 -0
  80. data/vendor/tesseract-2.04/ccmain/tstruct.cpp +549 -0
  81. data/vendor/tesseract-2.04/ccmain/tstruct.h +108 -0
  82. data/vendor/tesseract-2.04/ccmain/varabled.cpp +346 -0
  83. data/vendor/tesseract-2.04/ccmain/varabled.h +125 -0
  84. data/vendor/tesseract-2.04/ccmain/werdit.cpp +193 -0
  85. data/vendor/tesseract-2.04/ccmain/werdit.h +67 -0
  86. data/vendor/tesseract-2.04/ccstruct/Makefile.am +25 -0
  87. data/vendor/tesseract-2.04/ccstruct/Makefile.in +650 -0
  88. data/vendor/tesseract-2.04/ccstruct/blckerr.h +29 -0
  89. data/vendor/tesseract-2.04/ccstruct/blobbox.cpp +778 -0
  90. data/vendor/tesseract-2.04/ccstruct/blobbox.h +381 -0
  91. data/vendor/tesseract-2.04/ccstruct/blobs.cpp +247 -0
  92. data/vendor/tesseract-2.04/ccstruct/blobs.h +119 -0
  93. data/vendor/tesseract-2.04/ccstruct/blread.cpp +537 -0
  94. data/vendor/tesseract-2.04/ccstruct/blread.h +63 -0
  95. data/vendor/tesseract-2.04/ccstruct/callcpp.cpp +252 -0
  96. data/vendor/tesseract-2.04/ccstruct/coutln.cpp +650 -0
  97. data/vendor/tesseract-2.04/ccstruct/coutln.h +186 -0
  98. data/vendor/tesseract-2.04/ccstruct/crakedge.h +39 -0
  99. data/vendor/tesseract-2.04/ccstruct/genblob.cpp +133 -0
  100. data/vendor/tesseract-2.04/ccstruct/genblob.h +52 -0
  101. data/vendor/tesseract-2.04/ccstruct/hpddef.h +39 -0
  102. data/vendor/tesseract-2.04/ccstruct/hpdsizes.h +8 -0
  103. data/vendor/tesseract-2.04/ccstruct/ipoints.h +479 -0
  104. data/vendor/tesseract-2.04/ccstruct/labls.cpp +188 -0
  105. data/vendor/tesseract-2.04/ccstruct/labls.h +38 -0
  106. data/vendor/tesseract-2.04/ccstruct/linlsq.cpp +249 -0
  107. data/vendor/tesseract-2.04/ccstruct/linlsq.h +102 -0
  108. data/vendor/tesseract-2.04/ccstruct/lmedsq.cpp +453 -0
  109. data/vendor/tesseract-2.04/ccstruct/lmedsq.h +84 -0
  110. data/vendor/tesseract-2.04/ccstruct/mod128.cpp +100 -0
  111. data/vendor/tesseract-2.04/ccstruct/mod128.h +85 -0
  112. data/vendor/tesseract-2.04/ccstruct/normalis.cpp +176 -0
  113. data/vendor/tesseract-2.04/ccstruct/normalis.h +108 -0
  114. data/vendor/tesseract-2.04/ccstruct/ocrblock.cpp +369 -0
  115. data/vendor/tesseract-2.04/ccstruct/ocrblock.h +235 -0
  116. data/vendor/tesseract-2.04/ccstruct/ocrrow.cpp +216 -0
  117. data/vendor/tesseract-2.04/ccstruct/ocrrow.h +133 -0
  118. data/vendor/tesseract-2.04/ccstruct/pageblk.cpp +879 -0
  119. data/vendor/tesseract-2.04/ccstruct/pageblk.h +318 -0
  120. data/vendor/tesseract-2.04/ccstruct/pageres.cpp +330 -0
  121. data/vendor/tesseract-2.04/ccstruct/pageres.h +313 -0
  122. data/vendor/tesseract-2.04/ccstruct/pdblock.cpp +361 -0
  123. data/vendor/tesseract-2.04/ccstruct/pdblock.h +181 -0
  124. data/vendor/tesseract-2.04/ccstruct/pdclass.h +54 -0
  125. data/vendor/tesseract-2.04/ccstruct/points.cpp +102 -0
  126. data/vendor/tesseract-2.04/ccstruct/points.h +299 -0
  127. data/vendor/tesseract-2.04/ccstruct/polyaprx.cpp +588 -0
  128. data/vendor/tesseract-2.04/ccstruct/polyaprx.h +51 -0
  129. data/vendor/tesseract-2.04/ccstruct/polyblk.cpp +398 -0
  130. data/vendor/tesseract-2.04/ccstruct/polyblk.h +122 -0
  131. data/vendor/tesseract-2.04/ccstruct/polyblob.cpp +357 -0
  132. data/vendor/tesseract-2.04/ccstruct/polyblob.h +102 -0
  133. data/vendor/tesseract-2.04/ccstruct/polyvert.cpp +23 -0
  134. data/vendor/tesseract-2.04/ccstruct/polyvert.h +58 -0
  135. data/vendor/tesseract-2.04/ccstruct/poutline.cpp +441 -0
  136. data/vendor/tesseract-2.04/ccstruct/poutline.h +125 -0
  137. data/vendor/tesseract-2.04/ccstruct/quadlsq.cpp +147 -0
  138. data/vendor/tesseract-2.04/ccstruct/quadlsq.h +67 -0
  139. data/vendor/tesseract-2.04/ccstruct/quadratc.cpp +21 -0
  140. data/vendor/tesseract-2.04/ccstruct/quadratc.h +63 -0
  141. data/vendor/tesseract-2.04/ccstruct/quspline.cpp +382 -0
  142. data/vendor/tesseract-2.04/ccstruct/quspline.h +113 -0
  143. data/vendor/tesseract-2.04/ccstruct/ratngs.cpp +372 -0
  144. data/vendor/tesseract-2.04/ccstruct/ratngs.h +198 -0
  145. data/vendor/tesseract-2.04/ccstruct/rect.cpp +229 -0
  146. data/vendor/tesseract-2.04/ccstruct/rect.h +320 -0
  147. data/vendor/tesseract-2.04/ccstruct/rejctmap.cpp +545 -0
  148. data/vendor/tesseract-2.04/ccstruct/rejctmap.h +284 -0
  149. data/vendor/tesseract-2.04/ccstruct/rwpoly.cpp +89 -0
  150. data/vendor/tesseract-2.04/ccstruct/rwpoly.h +45 -0
  151. data/vendor/tesseract-2.04/ccstruct/statistc.cpp +905 -0
  152. data/vendor/tesseract-2.04/ccstruct/statistc.h +135 -0
  153. data/vendor/tesseract-2.04/ccstruct/stepblob.cpp +296 -0
  154. data/vendor/tesseract-2.04/ccstruct/stepblob.h +88 -0
  155. data/vendor/tesseract-2.04/ccstruct/txtregn.cpp +230 -0
  156. data/vendor/tesseract-2.04/ccstruct/txtregn.h +155 -0
  157. data/vendor/tesseract-2.04/ccstruct/vecfuncs.cpp +63 -0
  158. data/vendor/tesseract-2.04/ccstruct/vecfuncs.h +91 -0
  159. data/vendor/tesseract-2.04/ccstruct/werd.cpp +967 -0
  160. data/vendor/tesseract-2.04/ccstruct/werd.h +277 -0
  161. data/vendor/tesseract-2.04/ccutil/Makefile.am +19 -0
  162. data/vendor/tesseract-2.04/ccutil/Makefile.in +626 -0
  163. data/vendor/tesseract-2.04/ccutil/basedir.cpp +118 -0
  164. data/vendor/tesseract-2.04/ccutil/basedir.h +32 -0
  165. data/vendor/tesseract-2.04/ccutil/bits16.cpp +30 -0
  166. data/vendor/tesseract-2.04/ccutil/bits16.h +61 -0
  167. data/vendor/tesseract-2.04/ccutil/boxread.cpp +105 -0
  168. data/vendor/tesseract-2.04/ccutil/boxread.h +44 -0
  169. data/vendor/tesseract-2.04/ccutil/clst.cpp +626 -0
  170. data/vendor/tesseract-2.04/ccutil/clst.h +1085 -0
  171. data/vendor/tesseract-2.04/ccutil/debugwin.cpp +500 -0
  172. data/vendor/tesseract-2.04/ccutil/debugwin.h +103 -0
  173. data/vendor/tesseract-2.04/ccutil/elst.cpp +593 -0
  174. data/vendor/tesseract-2.04/ccutil/elst.h +1125 -0
  175. data/vendor/tesseract-2.04/ccutil/elst2.cpp +606 -0
  176. data/vendor/tesseract-2.04/ccutil/elst2.h +1121 -0
  177. data/vendor/tesseract-2.04/ccutil/errcode.cpp +104 -0
  178. data/vendor/tesseract-2.04/ccutil/errcode.h +104 -0
  179. data/vendor/tesseract-2.04/ccutil/fileerr.h +34 -0
  180. data/vendor/tesseract-2.04/ccutil/globaloc.cpp +115 -0
  181. data/vendor/tesseract-2.04/ccutil/globaloc.h +40 -0
  182. data/vendor/tesseract-2.04/ccutil/hashfn.cpp +57 -0
  183. data/vendor/tesseract-2.04/ccutil/hashfn.h +30 -0
  184. data/vendor/tesseract-2.04/ccutil/host.h +180 -0
  185. data/vendor/tesseract-2.04/ccutil/hosthplb.h +1 -0
  186. data/vendor/tesseract-2.04/ccutil/lsterr.h +43 -0
  187. data/vendor/tesseract-2.04/ccutil/mainblk.cpp +126 -0
  188. data/vendor/tesseract-2.04/ccutil/mainblk.h +39 -0
  189. data/vendor/tesseract-2.04/ccutil/memblk.cpp +1106 -0
  190. data/vendor/tesseract-2.04/ccutil/memblk.h +189 -0
  191. data/vendor/tesseract-2.04/ccutil/memry.cpp +532 -0
  192. data/vendor/tesseract-2.04/ccutil/memry.h +192 -0
  193. data/vendor/tesseract-2.04/ccutil/memryerr.h +38 -0
  194. data/vendor/tesseract-2.04/ccutil/mfcpch.cpp +5 -0
  195. data/vendor/tesseract-2.04/ccutil/mfcpch.h +37 -0
  196. data/vendor/tesseract-2.04/ccutil/ndminx.h +31 -0
  197. data/vendor/tesseract-2.04/ccutil/notdll.h +28 -0
  198. data/vendor/tesseract-2.04/ccutil/nwmain.h +176 -0
  199. data/vendor/tesseract-2.04/ccutil/ocrclass.h +345 -0
  200. data/vendor/tesseract-2.04/ccutil/ocrshell.cpp +772 -0
  201. data/vendor/tesseract-2.04/ccutil/ocrshell.h +191 -0
  202. data/vendor/tesseract-2.04/ccutil/platform.h +18 -0
  203. data/vendor/tesseract-2.04/ccutil/scanutils.cpp +543 -0
  204. data/vendor/tesseract-2.04/ccutil/scanutils.h +55 -0
  205. data/vendor/tesseract-2.04/ccutil/secname.h +9 -0
  206. data/vendor/tesseract-2.04/ccutil/serialis.cpp +117 -0
  207. data/vendor/tesseract-2.04/ccutil/serialis.h +93 -0
  208. data/vendor/tesseract-2.04/ccutil/stderr.h +26 -0
  209. data/vendor/tesseract-2.04/ccutil/strngs.cpp +495 -0
  210. data/vendor/tesseract-2.04/ccutil/strngs.h +138 -0
  211. data/vendor/tesseract-2.04/ccutil/tessclas.h +135 -0
  212. data/vendor/tesseract-2.04/ccutil/tessopt.cpp +61 -0
  213. data/vendor/tesseract-2.04/ccutil/tessopt.h +30 -0
  214. data/vendor/tesseract-2.04/ccutil/tprintf.cpp +122 -0
  215. data/vendor/tesseract-2.04/ccutil/tprintf.h +35 -0
  216. data/vendor/tesseract-2.04/ccutil/unichar.cpp +144 -0
  217. data/vendor/tesseract-2.04/ccutil/unichar.h +84 -0
  218. data/vendor/tesseract-2.04/ccutil/unicharmap.cpp +172 -0
  219. data/vendor/tesseract-2.04/ccutil/unicharmap.h +82 -0
  220. data/vendor/tesseract-2.04/ccutil/unicharset.cpp +307 -0
  221. data/vendor/tesseract-2.04/ccutil/unicharset.h +267 -0
  222. data/vendor/tesseract-2.04/ccutil/varable.cpp +672 -0
  223. data/vendor/tesseract-2.04/ccutil/varable.h +419 -0
  224. data/vendor/tesseract-2.04/classify/Makefile.am +24 -0
  225. data/vendor/tesseract-2.04/classify/Makefile.in +647 -0
  226. data/vendor/tesseract-2.04/classify/adaptive.cpp +535 -0
  227. data/vendor/tesseract-2.04/classify/adaptive.h +199 -0
  228. data/vendor/tesseract-2.04/classify/adaptmatch.cpp +2958 -0
  229. data/vendor/tesseract-2.04/classify/adaptmatch.h +86 -0
  230. data/vendor/tesseract-2.04/classify/baseline.cpp +58 -0
  231. data/vendor/tesseract-2.04/classify/baseline.h +91 -0
  232. data/vendor/tesseract-2.04/classify/blobclass.cpp +123 -0
  233. data/vendor/tesseract-2.04/classify/blobclass.h +49 -0
  234. data/vendor/tesseract-2.04/classify/chartoname.cpp +74 -0
  235. data/vendor/tesseract-2.04/classify/chartoname.h +21 -0
  236. data/vendor/tesseract-2.04/classify/cluster.cpp +2834 -0
  237. data/vendor/tesseract-2.04/classify/cluster.h +158 -0
  238. data/vendor/tesseract-2.04/classify/clusttool.cpp +507 -0
  239. data/vendor/tesseract-2.04/classify/clusttool.h +70 -0
  240. data/vendor/tesseract-2.04/classify/cutoffs.cpp +73 -0
  241. data/vendor/tesseract-2.04/classify/cutoffs.h +49 -0
  242. data/vendor/tesseract-2.04/classify/extern.h +32 -0
  243. data/vendor/tesseract-2.04/classify/extract.cpp +100 -0
  244. data/vendor/tesseract-2.04/classify/extract.h +36 -0
  245. data/vendor/tesseract-2.04/classify/featdefs.cpp +244 -0
  246. data/vendor/tesseract-2.04/classify/featdefs.h +71 -0
  247. data/vendor/tesseract-2.04/classify/flexfx.cpp +87 -0
  248. data/vendor/tesseract-2.04/classify/flexfx.h +34 -0
  249. data/vendor/tesseract-2.04/classify/float2int.cpp +126 -0
  250. data/vendor/tesseract-2.04/classify/float2int.h +65 -0
  251. data/vendor/tesseract-2.04/classify/fpoint.cpp +73 -0
  252. data/vendor/tesseract-2.04/classify/fpoint.h +63 -0
  253. data/vendor/tesseract-2.04/classify/fxdefs.cpp +74 -0
  254. data/vendor/tesseract-2.04/classify/fxdefs.h +93 -0
  255. data/vendor/tesseract-2.04/classify/fxid.h +69 -0
  256. data/vendor/tesseract-2.04/classify/hideedge.cpp +35 -0
  257. data/vendor/tesseract-2.04/classify/hideedge.h +76 -0
  258. data/vendor/tesseract-2.04/classify/intfx.cpp +608 -0
  259. data/vendor/tesseract-2.04/classify/intfx.h +63 -0
  260. data/vendor/tesseract-2.04/classify/intmatcher.cpp +1524 -0
  261. data/vendor/tesseract-2.04/classify/intmatcher.h +199 -0
  262. data/vendor/tesseract-2.04/classify/intproto.cpp +1823 -0
  263. data/vendor/tesseract-2.04/classify/intproto.h +320 -0
  264. data/vendor/tesseract-2.04/classify/kdtree.cpp +884 -0
  265. data/vendor/tesseract-2.04/classify/kdtree.h +118 -0
  266. data/vendor/tesseract-2.04/classify/mf.cpp +106 -0
  267. data/vendor/tesseract-2.04/classify/mf.h +43 -0
  268. data/vendor/tesseract-2.04/classify/mfdefs.cpp +58 -0
  269. data/vendor/tesseract-2.04/classify/mfdefs.h +60 -0
  270. data/vendor/tesseract-2.04/classify/mfoutline.cpp +1087 -0
  271. data/vendor/tesseract-2.04/classify/mfoutline.h +277 -0
  272. data/vendor/tesseract-2.04/classify/mfx.cpp +436 -0
  273. data/vendor/tesseract-2.04/classify/mfx.h +52 -0
  274. data/vendor/tesseract-2.04/classify/normfeat.cpp +132 -0
  275. data/vendor/tesseract-2.04/classify/normfeat.h +63 -0
  276. data/vendor/tesseract-2.04/classify/normmatch.cpp +305 -0
  277. data/vendor/tesseract-2.04/classify/normmatch.h +38 -0
  278. data/vendor/tesseract-2.04/classify/ocrfeatures.cpp +310 -0
  279. data/vendor/tesseract-2.04/classify/ocrfeatures.h +148 -0
  280. data/vendor/tesseract-2.04/classify/outfeat.cpp +262 -0
  281. data/vendor/tesseract-2.04/classify/outfeat.h +76 -0
  282. data/vendor/tesseract-2.04/classify/picofeat.cpp +297 -0
  283. data/vendor/tesseract-2.04/classify/picofeat.h +65 -0
  284. data/vendor/tesseract-2.04/classify/protos.cpp +472 -0
  285. data/vendor/tesseract-2.04/classify/protos.h +258 -0
  286. data/vendor/tesseract-2.04/classify/sigmenu.cpp +225 -0
  287. data/vendor/tesseract-2.04/classify/sigmenu.h +39 -0
  288. data/vendor/tesseract-2.04/classify/speckle.cpp +127 -0
  289. data/vendor/tesseract-2.04/classify/speckle.h +69 -0
  290. data/vendor/tesseract-2.04/classify/xform2d.cpp +120 -0
  291. data/vendor/tesseract-2.04/classify/xform2d.h +60 -0
  292. data/vendor/tesseract-2.04/config/config.guess +1466 -0
  293. data/vendor/tesseract-2.04/config/config.h.in +188 -0
  294. data/vendor/tesseract-2.04/config/config.sub +1579 -0
  295. data/vendor/tesseract-2.04/config/depcomp +530 -0
  296. data/vendor/tesseract-2.04/config/install-sh +269 -0
  297. data/vendor/tesseract-2.04/config/missing +198 -0
  298. data/vendor/tesseract-2.04/config/mkinstalldirs +40 -0
  299. data/vendor/tesseract-2.04/config/stamp-h.in +0 -0
  300. data/vendor/tesseract-2.04/configure +10424 -0
  301. data/vendor/tesseract-2.04/cutil/Makefile.am +14 -0
  302. data/vendor/tesseract-2.04/cutil/Makefile.in +612 -0
  303. data/vendor/tesseract-2.04/cutil/bitvec.cpp +115 -0
  304. data/vendor/tesseract-2.04/cutil/bitvec.h +100 -0
  305. data/vendor/tesseract-2.04/cutil/callcpp.h +190 -0
  306. data/vendor/tesseract-2.04/cutil/const.h +108 -0
  307. data/vendor/tesseract-2.04/cutil/cutil.cpp +92 -0
  308. data/vendor/tesseract-2.04/cutil/cutil.h +159 -0
  309. data/vendor/tesseract-2.04/cutil/danerror.cpp +144 -0
  310. data/vendor/tesseract-2.04/cutil/danerror.h +41 -0
  311. data/vendor/tesseract-2.04/cutil/debug.cpp +97 -0
  312. data/vendor/tesseract-2.04/cutil/debug.h +348 -0
  313. data/vendor/tesseract-2.04/cutil/efio.cpp +62 -0
  314. data/vendor/tesseract-2.04/cutil/efio.h +32 -0
  315. data/vendor/tesseract-2.04/cutil/emalloc.cpp +91 -0
  316. data/vendor/tesseract-2.04/cutil/emalloc.h +44 -0
  317. data/vendor/tesseract-2.04/cutil/freelist.cpp +75 -0
  318. data/vendor/tesseract-2.04/cutil/freelist.h +45 -0
  319. data/vendor/tesseract-2.04/cutil/funcdefs.h +35 -0
  320. data/vendor/tesseract-2.04/cutil/general.h +33 -0
  321. data/vendor/tesseract-2.04/cutil/globals.cpp +69 -0
  322. data/vendor/tesseract-2.04/cutil/globals.h +70 -0
  323. data/vendor/tesseract-2.04/cutil/listio.cpp +68 -0
  324. data/vendor/tesseract-2.04/cutil/listio.h +43 -0
  325. data/vendor/tesseract-2.04/cutil/minmax.h +40 -0
  326. data/vendor/tesseract-2.04/cutil/oldheap.cpp +337 -0
  327. data/vendor/tesseract-2.04/cutil/oldheap.h +126 -0
  328. data/vendor/tesseract-2.04/cutil/oldlist.cpp +393 -0
  329. data/vendor/tesseract-2.04/cutil/oldlist.h +350 -0
  330. data/vendor/tesseract-2.04/cutil/structures.cpp +66 -0
  331. data/vendor/tesseract-2.04/cutil/structures.h +112 -0
  332. data/vendor/tesseract-2.04/cutil/tessarray.cpp +115 -0
  333. data/vendor/tesseract-2.04/cutil/tessarray.h +166 -0
  334. data/vendor/tesseract-2.04/cutil/tordvars.cpp +95 -0
  335. data/vendor/tesseract-2.04/cutil/tordvars.h +61 -0
  336. data/vendor/tesseract-2.04/cutil/variables.cpp +317 -0
  337. data/vendor/tesseract-2.04/cutil/variables.h +170 -0
  338. data/vendor/tesseract-2.04/dict/Makefile.am +13 -0
  339. data/vendor/tesseract-2.04/dict/Makefile.in +609 -0
  340. data/vendor/tesseract-2.04/dict/choicearr.h +96 -0
  341. data/vendor/tesseract-2.04/dict/choices.cpp +210 -0
  342. data/vendor/tesseract-2.04/dict/choices.h +241 -0
  343. data/vendor/tesseract-2.04/dict/context.cpp +270 -0
  344. data/vendor/tesseract-2.04/dict/context.h +82 -0
  345. data/vendor/tesseract-2.04/dict/dawg.cpp +363 -0
  346. data/vendor/tesseract-2.04/dict/dawg.h +394 -0
  347. data/vendor/tesseract-2.04/dict/hyphen.cpp +84 -0
  348. data/vendor/tesseract-2.04/dict/hyphen.h +125 -0
  349. data/vendor/tesseract-2.04/dict/lookdawg.cpp +228 -0
  350. data/vendor/tesseract-2.04/dict/lookdawg.h +76 -0
  351. data/vendor/tesseract-2.04/dict/makedawg.cpp +449 -0
  352. data/vendor/tesseract-2.04/dict/makedawg.h +83 -0
  353. data/vendor/tesseract-2.04/dict/matchdefs.h +145 -0
  354. data/vendor/tesseract-2.04/dict/permdawg.cpp +415 -0
  355. data/vendor/tesseract-2.04/dict/permdawg.h +98 -0
  356. data/vendor/tesseract-2.04/dict/permngram.cpp +358 -0
  357. data/vendor/tesseract-2.04/dict/permngram.h +33 -0
  358. data/vendor/tesseract-2.04/dict/permnum.cpp +522 -0
  359. data/vendor/tesseract-2.04/dict/permnum.h +83 -0
  360. data/vendor/tesseract-2.04/dict/permute.cpp +1704 -0
  361. data/vendor/tesseract-2.04/dict/permute.h +93 -0
  362. data/vendor/tesseract-2.04/dict/reduce.cpp +424 -0
  363. data/vendor/tesseract-2.04/dict/reduce.h +112 -0
  364. data/vendor/tesseract-2.04/dict/states.cpp +382 -0
  365. data/vendor/tesseract-2.04/dict/states.h +111 -0
  366. data/vendor/tesseract-2.04/dict/stopper.cpp +1458 -0
  367. data/vendor/tesseract-2.04/dict/stopper.h +103 -0
  368. data/vendor/tesseract-2.04/dict/trie.cpp +683 -0
  369. data/vendor/tesseract-2.04/dict/trie.h +190 -0
  370. data/vendor/tesseract-2.04/dlltest/Makefile.am +2 -0
  371. data/vendor/tesseract-2.04/dlltest/Makefile.in +388 -0
  372. data/vendor/tesseract-2.04/dlltest/dlltest.cpp +163 -0
  373. data/vendor/tesseract-2.04/dlltest/dlltest.dsp +186 -0
  374. data/vendor/tesseract-2.04/dlltest/dlltest.vcproj +637 -0
  375. data/vendor/tesseract-2.04/eurotext.tif +0 -0
  376. data/vendor/tesseract-2.04/image/Makefile.am +10 -0
  377. data/vendor/tesseract-2.04/image/Makefile.in +596 -0
  378. data/vendor/tesseract-2.04/image/bitstrm.cpp +157 -0
  379. data/vendor/tesseract-2.04/image/bitstrm.h +73 -0
  380. data/vendor/tesseract-2.04/image/img.h +336 -0
  381. data/vendor/tesseract-2.04/image/imgbmp.cpp +223 -0
  382. data/vendor/tesseract-2.04/image/imgbmp.h +50 -0
  383. data/vendor/tesseract-2.04/image/imgerrs.h +35 -0
  384. data/vendor/tesseract-2.04/image/imgio.cpp +321 -0
  385. data/vendor/tesseract-2.04/image/imgio.h +22 -0
  386. data/vendor/tesseract-2.04/image/imgs.cpp +1764 -0
  387. data/vendor/tesseract-2.04/image/imgs.h +102 -0
  388. data/vendor/tesseract-2.04/image/imgtiff.cpp +723 -0
  389. data/vendor/tesseract-2.04/image/imgtiff.h +89 -0
  390. data/vendor/tesseract-2.04/image/imgunpk.h +1377 -0
  391. data/vendor/tesseract-2.04/image/svshowim.cpp +40 -0
  392. data/vendor/tesseract-2.04/image/svshowim.h +25 -0
  393. data/vendor/tesseract-2.04/java/Makefile.am +4 -0
  394. data/vendor/tesseract-2.04/java/Makefile.in +473 -0
  395. data/vendor/tesseract-2.04/java/com/Makefile.am +1 -0
  396. data/vendor/tesseract-2.04/java/com/Makefile.in +470 -0
  397. data/vendor/tesseract-2.04/java/com/google/Makefile.am +1 -0
  398. data/vendor/tesseract-2.04/java/com/google/Makefile.in +470 -0
  399. data/vendor/tesseract-2.04/java/com/google/scrollview/Makefile.am +4 -0
  400. data/vendor/tesseract-2.04/java/com/google/scrollview/Makefile.in +473 -0
  401. data/vendor/tesseract-2.04/java/com/google/scrollview/ScrollView.java +421 -0
  402. data/vendor/tesseract-2.04/java/com/google/scrollview/events/Makefile.am +5 -0
  403. data/vendor/tesseract-2.04/java/com/google/scrollview/events/Makefile.in +474 -0
  404. data/vendor/tesseract-2.04/java/com/google/scrollview/events/SVEvent.java +87 -0
  405. data/vendor/tesseract-2.04/java/com/google/scrollview/events/SVEventHandler.java +296 -0
  406. data/vendor/tesseract-2.04/java/com/google/scrollview/events/SVEventType.java +31 -0
  407. data/vendor/tesseract-2.04/java/com/google/scrollview/ui/Makefile.am +7 -0
  408. data/vendor/tesseract-2.04/java/com/google/scrollview/ui/Makefile.in +476 -0
  409. data/vendor/tesseract-2.04/java/com/google/scrollview/ui/SVAbstractMenuItem.java +58 -0
  410. data/vendor/tesseract-2.04/java/com/google/scrollview/ui/SVCheckboxMenuItem.java +60 -0
  411. data/vendor/tesseract-2.04/java/com/google/scrollview/ui/SVEmptyMenuItem.java +48 -0
  412. data/vendor/tesseract-2.04/java/com/google/scrollview/ui/SVImageHandler.java +228 -0
  413. data/vendor/tesseract-2.04/java/com/google/scrollview/ui/SVMenuBar.java +130 -0
  414. data/vendor/tesseract-2.04/java/com/google/scrollview/ui/SVMenuItem.java +61 -0
  415. data/vendor/tesseract-2.04/java/com/google/scrollview/ui/SVPopupMenu.java +142 -0
  416. data/vendor/tesseract-2.04/java/com/google/scrollview/ui/SVSubMenuItem.java +41 -0
  417. data/vendor/tesseract-2.04/java/com/google/scrollview/ui/SVWindow.java +643 -0
  418. data/vendor/tesseract-2.04/java/makefile +55 -0
  419. data/vendor/tesseract-2.04/pageseg/Makefile.am +13 -0
  420. data/vendor/tesseract-2.04/pageseg/Makefile.in +596 -0
  421. data/vendor/tesseract-2.04/pageseg/leptonica_pageseg.cpp +363 -0
  422. data/vendor/tesseract-2.04/pageseg/leptonica_pageseg.h +90 -0
  423. data/vendor/tesseract-2.04/pageseg/leptonica_pageseg_interface.cpp +82 -0
  424. data/vendor/tesseract-2.04/pageseg/leptonica_pageseg_interface.h +30 -0
  425. data/vendor/tesseract-2.04/pageseg/pageseg.cpp +170 -0
  426. data/vendor/tesseract-2.04/pageseg/pageseg.h +29 -0
  427. data/vendor/tesseract-2.04/phototest.tif +0 -0
  428. data/vendor/tesseract-2.04/tessdata/Makefile.am +31 -0
  429. data/vendor/tesseract-2.04/tessdata/Makefile.in +529 -0
  430. data/vendor/tesseract-2.04/tessdata/configs/Makefile.am +3 -0
  431. data/vendor/tesseract-2.04/tessdata/configs/Makefile.in +344 -0
  432. data/vendor/tesseract-2.04/tessdata/configs/api_config +1 -0
  433. data/vendor/tesseract-2.04/tessdata/configs/box.train +19 -0
  434. data/vendor/tesseract-2.04/tessdata/configs/box.train.stderr +18 -0
  435. data/vendor/tesseract-2.04/tessdata/configs/inter +4 -0
  436. data/vendor/tesseract-2.04/tessdata/configs/kannada +4 -0
  437. data/vendor/tesseract-2.04/tessdata/configs/makebox +1 -0
  438. data/vendor/tesseract-2.04/tessdata/configs/unlv +3 -0
  439. data/vendor/tesseract-2.04/tessdata/confsets +3 -0
  440. data/vendor/tesseract-2.04/tessdata/eng.DangAmbigs +39 -0
  441. data/vendor/tesseract-2.04/tessdata/eng.freq-dawg +0 -0
  442. data/vendor/tesseract-2.04/tessdata/eng.inttemp +0 -0
  443. data/vendor/tesseract-2.04/tessdata/eng.normproto +1247 -0
  444. data/vendor/tesseract-2.04/tessdata/eng.pffmtable +111 -0
  445. data/vendor/tesseract-2.04/tessdata/eng.unicharset +113 -0
  446. data/vendor/tesseract-2.04/tessdata/eng.user-words +921 -0
  447. data/vendor/tesseract-2.04/tessdata/eng.word-dawg +0 -0
  448. data/vendor/tesseract-2.04/tessdata/makedummies +8 -0
  449. data/vendor/tesseract-2.04/tessdata/tessconfigs/Makefile.am +3 -0
  450. data/vendor/tesseract-2.04/tessdata/tessconfigs/Makefile.in +344 -0
  451. data/vendor/tesseract-2.04/tessdata/tessconfigs/batch +2 -0
  452. data/vendor/tesseract-2.04/tessdata/tessconfigs/batch.nochop +2 -0
  453. data/vendor/tesseract-2.04/tessdata/tessconfigs/matdemo +7 -0
  454. data/vendor/tesseract-2.04/tessdata/tessconfigs/msdemo +13 -0
  455. data/vendor/tesseract-2.04/tessdata/tessconfigs/nobatch +2 -0
  456. data/vendor/tesseract-2.04/tessdata/tessconfigs/segdemo +9 -0
  457. data/vendor/tesseract-2.04/tessdll.cpp +351 -0
  458. data/vendor/tesseract-2.04/tessdll.dsp +2050 -0
  459. data/vendor/tesseract-2.04/tessdll.h +143 -0
  460. data/vendor/tesseract-2.04/tessdll.vcproj +5495 -0
  461. data/vendor/tesseract-2.04/tesseract.dsp +2124 -0
  462. data/vendor/tesseract-2.04/tesseract.dsw +116 -0
  463. data/vendor/tesseract-2.04/tesseract.sln +59 -0
  464. data/vendor/tesseract-2.04/tesseract.spec +188 -0
  465. data/vendor/tesseract-2.04/tesseract.vcproj +5859 -0
  466. data/vendor/tesseract-2.04/testing/Makefile.am +2 -0
  467. data/vendor/tesseract-2.04/testing/Makefile.in +312 -0
  468. data/vendor/tesseract-2.04/testing/README +43 -0
  469. data/vendor/tesseract-2.04/testing/counttestset.sh +61 -0
  470. data/vendor/tesseract-2.04/testing/reorgdata.sh +44 -0
  471. data/vendor/tesseract-2.04/testing/reports/1995.bus.3B.sum +1 -0
  472. data/vendor/tesseract-2.04/testing/reports/1995.doe3.3B.sum +1 -0
  473. data/vendor/tesseract-2.04/testing/reports/1995.mag.3B.sum +1 -0
  474. data/vendor/tesseract-2.04/testing/reports/1995.news.3B.sum +1 -0
  475. data/vendor/tesseract-2.04/testing/reports/2.03.summary +9 -0
  476. data/vendor/tesseract-2.04/testing/reports/2.04.summary +9 -0
  477. data/vendor/tesseract-2.04/testing/runalltests.sh +110 -0
  478. data/vendor/tesseract-2.04/testing/runtestset.sh +61 -0
  479. data/vendor/tesseract-2.04/textord/Makefile.am +20 -0
  480. data/vendor/tesseract-2.04/textord/Makefile.in +624 -0
  481. data/vendor/tesseract-2.04/textord/blkocc.cpp +809 -0
  482. data/vendor/tesseract-2.04/textord/blkocc.h +327 -0
  483. data/vendor/tesseract-2.04/textord/blobcmpl.h +31 -0
  484. data/vendor/tesseract-2.04/textord/drawedg.cpp +77 -0
  485. data/vendor/tesseract-2.04/textord/drawedg.h +34 -0
  486. data/vendor/tesseract-2.04/textord/drawtord.cpp +469 -0
  487. data/vendor/tesseract-2.04/textord/drawtord.h +107 -0
  488. data/vendor/tesseract-2.04/textord/edgblob.cpp +412 -0
  489. data/vendor/tesseract-2.04/textord/edgblob.h +100 -0
  490. data/vendor/tesseract-2.04/textord/edgloop.cpp +211 -0
  491. data/vendor/tesseract-2.04/textord/edgloop.h +66 -0
  492. data/vendor/tesseract-2.04/textord/fpchop.cpp +1641 -0
  493. data/vendor/tesseract-2.04/textord/fpchop.h +238 -0
  494. data/vendor/tesseract-2.04/textord/gap_map.cpp +166 -0
  495. data/vendor/tesseract-2.04/textord/gap_map.h +40 -0
  496. data/vendor/tesseract-2.04/textord/makerow.cpp +2628 -0
  497. data/vendor/tesseract-2.04/textord/makerow.h +295 -0
  498. data/vendor/tesseract-2.04/textord/oldbasel.cpp +1761 -0
  499. data/vendor/tesseract-2.04/textord/oldbasel.h +195 -0
  500. data/vendor/tesseract-2.04/textord/pithsync.cpp +696 -0
  501. data/vendor/tesseract-2.04/textord/pithsync.h +134 -0
  502. data/vendor/tesseract-2.04/textord/pitsync1.cpp +425 -0
  503. data/vendor/tesseract-2.04/textord/pitsync1.h +135 -0
  504. data/vendor/tesseract-2.04/textord/scanedg.cpp +452 -0
  505. data/vendor/tesseract-2.04/textord/scanedg.h +74 -0
  506. data/vendor/tesseract-2.04/textord/sortflts.cpp +80 -0
  507. data/vendor/tesseract-2.04/textord/sortflts.h +64 -0
  508. data/vendor/tesseract-2.04/textord/tessout.h +76 -0
  509. data/vendor/tesseract-2.04/textord/topitch.cpp +2019 -0
  510. data/vendor/tesseract-2.04/textord/topitch.h +195 -0
  511. data/vendor/tesseract-2.04/textord/tordmain.cpp +907 -0
  512. data/vendor/tesseract-2.04/textord/tordmain.h +132 -0
  513. data/vendor/tesseract-2.04/textord/tospace.cpp +1939 -0
  514. data/vendor/tesseract-2.04/textord/tospace.h +193 -0
  515. data/vendor/tesseract-2.04/textord/tovars.cpp +87 -0
  516. data/vendor/tesseract-2.04/textord/tovars.h +94 -0
  517. data/vendor/tesseract-2.04/textord/underlin.cpp +312 -0
  518. data/vendor/tesseract-2.04/textord/underlin.h +53 -0
  519. data/vendor/tesseract-2.04/textord/wordseg.cpp +620 -0
  520. data/vendor/tesseract-2.04/textord/wordseg.h +70 -0
  521. data/vendor/tesseract-2.04/training/Makefile.am +54 -0
  522. data/vendor/tesseract-2.04/training/Makefile.in +720 -0
  523. data/vendor/tesseract-2.04/training/cnTraining.cpp +855 -0
  524. data/vendor/tesseract-2.04/training/cntraining.dsp +243 -0
  525. data/vendor/tesseract-2.04/training/cntraining.vcproj +950 -0
  526. data/vendor/tesseract-2.04/training/mergenf.cpp +451 -0
  527. data/vendor/tesseract-2.04/training/mergenf.h +106 -0
  528. data/vendor/tesseract-2.04/training/mfTraining.cpp +1341 -0
  529. data/vendor/tesseract-2.04/training/mftraining.dsp +285 -0
  530. data/vendor/tesseract-2.04/training/mftraining.vcproj +1055 -0
  531. data/vendor/tesseract-2.04/training/name2char.cpp +166 -0
  532. data/vendor/tesseract-2.04/training/name2char.h +38 -0
  533. data/vendor/tesseract-2.04/training/training.cpp +190 -0
  534. data/vendor/tesseract-2.04/training/training.h +130 -0
  535. data/vendor/tesseract-2.04/training/unicharset_extractor.cpp +140 -0
  536. data/vendor/tesseract-2.04/training/unicharset_extractor.dsp +335 -0
  537. data/vendor/tesseract-2.04/training/unicharset_extractor.vcproj +769 -0
  538. data/vendor/tesseract-2.04/training/wordlist2dawg.cpp +69 -0
  539. data/vendor/tesseract-2.04/training/wordlist2dawg.dsp +319 -0
  540. data/vendor/tesseract-2.04/training/wordlist2dawg.vcproj +1113 -0
  541. data/vendor/tesseract-2.04/viewer/Makefile.am +9 -0
  542. data/vendor/tesseract-2.04/viewer/Makefile.in +591 -0
  543. data/vendor/tesseract-2.04/viewer/scrollview.cpp +825 -0
  544. data/vendor/tesseract-2.04/viewer/scrollview.h +414 -0
  545. data/vendor/tesseract-2.04/viewer/svmnode.cpp +140 -0
  546. data/vendor/tesseract-2.04/viewer/svmnode.h +94 -0
  547. data/vendor/tesseract-2.04/viewer/svpaint.cpp +220 -0
  548. data/vendor/tesseract-2.04/viewer/svutil.cpp +347 -0
  549. data/vendor/tesseract-2.04/viewer/svutil.h +138 -0
  550. data/vendor/tesseract-2.04/wordrec/Makefile.am +23 -0
  551. data/vendor/tesseract-2.04/wordrec/Makefile.in +641 -0
  552. data/vendor/tesseract-2.04/wordrec/associate.cpp +62 -0
  553. data/vendor/tesseract-2.04/wordrec/associate.h +93 -0
  554. data/vendor/tesseract-2.04/wordrec/badwords.cpp +106 -0
  555. data/vendor/tesseract-2.04/wordrec/badwords.h +51 -0
  556. data/vendor/tesseract-2.04/wordrec/bestfirst.cpp +526 -0
  557. data/vendor/tesseract-2.04/wordrec/bestfirst.h +203 -0
  558. data/vendor/tesseract-2.04/wordrec/charsample.h +208 -0
  559. data/vendor/tesseract-2.04/wordrec/chop.cpp +458 -0
  560. data/vendor/tesseract-2.04/wordrec/chop.h +153 -0
  561. data/vendor/tesseract-2.04/wordrec/chopper.cpp +750 -0
  562. data/vendor/tesseract-2.04/wordrec/chopper.h +104 -0
  563. data/vendor/tesseract-2.04/wordrec/closed.cpp +136 -0
  564. data/vendor/tesseract-2.04/wordrec/closed.h +65 -0
  565. data/vendor/tesseract-2.04/wordrec/djmenus.cpp +118 -0
  566. data/vendor/tesseract-2.04/wordrec/djmenus.h +33 -0
  567. data/vendor/tesseract-2.04/wordrec/drawfx.cpp +92 -0
  568. data/vendor/tesseract-2.04/wordrec/drawfx.h +33 -0
  569. data/vendor/tesseract-2.04/wordrec/findseam.cpp +566 -0
  570. data/vendor/tesseract-2.04/wordrec/findseam.h +69 -0
  571. data/vendor/tesseract-2.04/wordrec/gradechop.cpp +226 -0
  572. data/vendor/tesseract-2.04/wordrec/gradechop.h +91 -0
  573. data/vendor/tesseract-2.04/wordrec/heuristic.cpp +194 -0
  574. data/vendor/tesseract-2.04/wordrec/heuristic.h +120 -0
  575. data/vendor/tesseract-2.04/wordrec/makechop.cpp +281 -0
  576. data/vendor/tesseract-2.04/wordrec/makechop.h +69 -0
  577. data/vendor/tesseract-2.04/wordrec/matchtab.cpp +191 -0
  578. data/vendor/tesseract-2.04/wordrec/matchtab.h +45 -0
  579. data/vendor/tesseract-2.04/wordrec/matrix.cpp +118 -0
  580. data/vendor/tesseract-2.04/wordrec/matrix.h +104 -0
  581. data/vendor/tesseract-2.04/wordrec/measure.h +135 -0
  582. data/vendor/tesseract-2.04/wordrec/metrics.cpp +363 -0
  583. data/vendor/tesseract-2.04/wordrec/metrics.h +130 -0
  584. data/vendor/tesseract-2.04/wordrec/mfvars.cpp +51 -0
  585. data/vendor/tesseract-2.04/wordrec/mfvars.h +27 -0
  586. data/vendor/tesseract-2.04/wordrec/msmenus.cpp +110 -0
  587. data/vendor/tesseract-2.04/wordrec/msmenus.h +45 -0
  588. data/vendor/tesseract-2.04/wordrec/olutil.cpp +153 -0
  589. data/vendor/tesseract-2.04/wordrec/olutil.h +128 -0
  590. data/vendor/tesseract-2.04/wordrec/outlines.cpp +172 -0
  591. data/vendor/tesseract-2.04/wordrec/outlines.h +148 -0
  592. data/vendor/tesseract-2.04/wordrec/pieces.cpp +410 -0
  593. data/vendor/tesseract-2.04/wordrec/pieces.h +154 -0
  594. data/vendor/tesseract-2.04/wordrec/plotedges.cpp +134 -0
  595. data/vendor/tesseract-2.04/wordrec/plotedges.h +71 -0
  596. data/vendor/tesseract-2.04/wordrec/plotseg.cpp +116 -0
  597. data/vendor/tesseract-2.04/wordrec/plotseg.h +73 -0
  598. data/vendor/tesseract-2.04/wordrec/render.cpp +152 -0
  599. data/vendor/tesseract-2.04/wordrec/render.h +58 -0
  600. data/vendor/tesseract-2.04/wordrec/seam.cpp +482 -0
  601. data/vendor/tesseract-2.04/wordrec/seam.h +136 -0
  602. data/vendor/tesseract-2.04/wordrec/split.cpp +182 -0
  603. data/vendor/tesseract-2.04/wordrec/split.h +115 -0
  604. data/vendor/tesseract-2.04/wordrec/tally.cpp +68 -0
  605. data/vendor/tesseract-2.04/wordrec/tally.h +94 -0
  606. data/vendor/tesseract-2.04/wordrec/tessinit.cpp +108 -0
  607. data/vendor/tesseract-2.04/wordrec/tessinit.h +46 -0
  608. data/vendor/tesseract-2.04/wordrec/tface.cpp +272 -0
  609. data/vendor/tesseract-2.04/wordrec/tface.h +35 -0
  610. data/vendor/tesseract-2.04/wordrec/wordclass.cpp +284 -0
  611. data/vendor/tesseract-2.04/wordrec/wordclass.h +64 -0
  612. metadata +708 -0
@@ -0,0 +1,1867 @@
1
+ /**********************************************************************
2
+ * File: pgedit.cpp (Formerly pgeditor.c)
3
+ * Description: Page structure file editor
4
+ * Author: Phil Cheatle
5
+ * Created: Thu Oct 10 16:25:24 BST 1991
6
+ *
7
+ *(C) Copyright 1991, Hewlett-Packard Ltd.
8
+ ** Licensed under the Apache License, Version 2.0(the "License");
9
+ ** you may not use this file except in compliance with the License.
10
+ ** You may obtain a copy of the License at
11
+ ** http:// www.apache.org/licenses/LICENSE-2.0
12
+ ** Unless required by applicable law or agreed to in writing, software
13
+ ** distributed under the License is distributed on an "AS IS" BASIS,
14
+ ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ ** See the License for the specific language governing permissions and
16
+ ** limitations under the License.
17
+ *
18
+ **********************************************************************/
19
+
20
+ #include "pgedit.h"
21
+
22
+ #include <ctype.h>
23
+ #include <math.h>
24
+
25
+ #include "genblob.h"
26
+ #include "tessio.h"
27
+ #include "tessout.h"
28
+ #include "tordmain.h"
29
+ #include "statistc.h"
30
+ #include "debugwin.h"
31
+ #include "svshowim.h"
32
+ #include "mainblk.h"
33
+ #include "varabled.h"
34
+ #include "string.h"
35
+
36
+ #include "scrollview.h"
37
+ #include "svmnode.h"
38
+
39
+ #include "control.h"
40
+
41
+ #ifndef GRAPHICS_DISABLED
42
+ #define ASC_HEIGHT (2 * bln_baseline_offset + bln_x_height)
43
+ #define X_HEIGHT (bln_baseline_offset + bln_x_height)
44
+ #define BL_HEIGHT bln_baseline_offset
45
+ #define DESC_HEIGHT 0
46
+ #define MAXSPACING 128 /*max expected spacing in pix */
47
+
48
+ const ERRCODE EMPTYBLOCKLIST = "No blocks to edit";
49
+ extern IMAGE page_image;
50
+
51
+ enum CMD_EVENTS
52
+ {
53
+ NULL_CMD_EVENT,
54
+ DELETE_CMD_EVENT,
55
+ COPY_CMD_EVENT,
56
+ CHANGE_DISP_CMD_EVENT,
57
+ CHANGE_TEXT_CMD_EVENT,
58
+ TOGGLE_SEG_CMD_EVENT,
59
+ DUMP_WERD_CMD_EVENT,
60
+ SHOW_POINT_CMD_EVENT,
61
+ ROW_SPACE_STAT_CMD_EVENT,
62
+ BLOCK_SPACE_STAT_CMD_EVENT,
63
+ SHOW_BLN_WERD_CMD_EVENT,
64
+ SEGMENT_WERD_CMD_EVENT,
65
+ BOUNDING_BOX_CMD_EVENT,
66
+ CORRECT_TEXT_CMD_EVENT,
67
+ POLYGONAL_CMD_EVENT,
68
+ BL_NORM_CMD_EVENT,
69
+ BITMAP_CMD_EVENT,
70
+ TIDY_CMD_EVENT,
71
+ VIEW_CMD_EVENT,
72
+ IMAGE_CMD_EVENT,
73
+ BLOCKS_CMD_EVENT,
74
+ BASELINES_CMD_EVENT,
75
+ WRITE_CMD_EVENT,
76
+ NEW_SOURCE_CMD_EVENT,
77
+ UNIFORM_DISP_CMD_EVENT,
78
+ REFRESH_CMD_EVENT,
79
+ QUIT_CMD_EVENT,
80
+ RECOG_WERDS,
81
+ RECOG_PSEUDO
82
+ };
83
+
84
+ /**********************************************************************
85
+ *
86
+ * Some global data
87
+ *
88
+ **********************************************************************/
89
+
90
+ ScrollView* image_win;
91
+ VariablesEditor* ve;
92
+ bool stillRunning = false;
93
+
94
+ #ifdef __UNIX__
95
+ FILE *debug_window = NULL; // opened on demand
96
+ #endif
97
+ // baseline norm words
98
+ ScrollView* bln_word_window = NULL;
99
+
100
+ CMD_EVENTS mode = CHANGE_DISP_CMD_EVENT;
101
+ // Selected words op
102
+
103
+ BITS16 word_display_mode;
104
+ BOOL8 display_image = FALSE;
105
+ BOOL8 display_blocks = FALSE;
106
+ BOOL8 display_baselines = FALSE;
107
+ BOOL8 viewing_source = TRUE;
108
+
109
+ BLOCK_LIST *source_block_list = NULL; // image blocks
110
+ BLOCK_LIST target_block_list; // target blocks
111
+ BLOCK_LIST *other_block_list = &target_block_list;
112
+
113
+ BOOL8 source_changed = FALSE; // Changes not saved
114
+ BOOL8 target_changed = FALSE; // Changes not saved
115
+ BOOL8 *other_image_changed = &target_changed;
116
+
117
+
118
+ /* Public globals */
119
+
120
+ #define EXTERN
121
+
122
+ EXTERN BLOCK_LIST *current_block_list = NULL;
123
+ EXTERN BOOL8 *current_image_changed = &source_changed;
124
+
125
+ /* Variables */
126
+
127
+ EXTERN STRING_VAR(editor_image_win_name, "EditorImage",
128
+ "Editor image window name");
129
+ EXTERN INT_VAR(editor_image_xpos, 590, "Editor image X Pos");
130
+ EXTERN INT_VAR(editor_image_ypos, 10, "Editor image Y Pos");
131
+ EXTERN INT_VAR(editor_image_menuheight, 50, "Add to image height for menu bar");
132
+ EXTERN INT_VAR(editor_image_word_bb_color, ScrollView::BLUE,
133
+ "Word bounding box colour");
134
+ EXTERN INT_VAR(editor_image_blob_bb_color, ScrollView::YELLOW,
135
+ "Blob bounding box colour");
136
+ EXTERN INT_VAR(editor_image_text_color, ScrollView::WHITE,
137
+ "Correct text colour");
138
+
139
+ EXTERN STRING_VAR(editor_dbwin_name, "EditorDBWin",
140
+ "Editor debug window name");
141
+ EXTERN INT_VAR(editor_dbwin_xpos, 50, "Editor debug window X Pos");
142
+ EXTERN INT_VAR(editor_dbwin_ypos, 500, "Editor debug window Y Pos");
143
+ EXTERN INT_VAR(editor_dbwin_height, 24, "Editor debug window height");
144
+ EXTERN INT_VAR(editor_dbwin_width, 80, "Editor debug window width");
145
+
146
+ EXTERN STRING_VAR(editor_word_name, "BlnWords", "BL normalised word window");
147
+ EXTERN INT_VAR(editor_word_xpos, 60, "Word window X Pos");
148
+ EXTERN INT_VAR(editor_word_ypos, 510, "Word window Y Pos");
149
+ EXTERN INT_VAR(editor_word_height, 240, "Word window height");
150
+ EXTERN INT_VAR(editor_word_width, 655, "Word window width");
151
+
152
+ EXTERN double_VAR(editor_smd_scale_factor, 1.0, "Scaling for smd image");
153
+
154
+ /**********************************************************************
155
+ * add_word()
156
+ *
157
+ * Inserts the a word into a specified block list. The list is searched for a
158
+ * block and row of the same file as those of the word to be added, which
159
+ * contain the bounding box of the word. If such a row is found, the new
160
+ * word is inserted into the row in the correct X order. If the
161
+ * block is found, but not the row, a copy of the word's old row is added to
162
+ * the block in the correct Y order, and the word is put in that row.
163
+ * If neither the row nor the block are found, then the word's old block is
164
+ * copied with only the word's row. It is added to the block list in the
165
+ * correct Y order.
166
+ **********************************************************************/
167
+
168
+ void add_word( // to block list
169
+ WERD *word, // word to be added
170
+ ROW *src_row, // source row
171
+ BLOCK *src_block, // source block
172
+ BLOCK_LIST *dest_block_list // add to this
173
+ ) {
174
+ BLOCK_IT block_it(dest_block_list);
175
+ BLOCK *block; // current block
176
+ BLOCK *dest_block = NULL; // destination block
177
+ ROW_IT row_it;
178
+ ROW *row; // destination row
179
+ ROW *dest_row = NULL; // destination row
180
+ WERD_IT word_it;
181
+ TBOX word_box = word->bounding_box();
182
+ TBOX insert_point_word_box;
183
+ BOOL8 seen_blocks_for_current_file = FALSE;
184
+
185
+ block_it.mark_cycle_pt();
186
+ while(!block_it.cycled_list() &&(dest_block == NULL)) {
187
+ block = block_it.data();
188
+ if ((block->bounding_box().contains(word_box)) &&
189
+ (strcmp(block->name(), src_block->name()) == 0)) {
190
+ dest_block = block; // found dest block
191
+ row_it.set_to_list(block->row_list());
192
+ row_it.mark_cycle_pt();
193
+ while((!row_it.cycled_list()) &&(dest_row == NULL)) {
194
+ row = row_it.data();
195
+ if (row->bounding_box().contains(word_box))
196
+ dest_row = row; // found dest row
197
+ else
198
+ row_it.forward();
199
+ }
200
+ }
201
+ else
202
+ block_it.forward();
203
+ }
204
+
205
+ if (dest_block == NULL) { // make a new one
206
+ dest_block = new BLOCK;
207
+ *dest_block = *src_block;
208
+
209
+ block_it.set_to_list(dest_block_list);
210
+ for (block_it.mark_cycle_pt();
211
+ !block_it.cycled_list(); block_it.forward()) {
212
+ block = block_it.data();
213
+
214
+ if (!seen_blocks_for_current_file &&
215
+ (strcmp(block->name(), dest_block->name()) == 0))
216
+ seen_blocks_for_current_file = TRUE;
217
+
218
+ if (seen_blocks_for_current_file &&
219
+ ((strcmp(block->name(), dest_block->name()) != 0) ||
220
+ (block->bounding_box().top() <
221
+ dest_block->bounding_box().top())))
222
+ break;
223
+ }
224
+
225
+ if (block_it.cycled_list())
226
+ // didn't find insrt pt
227
+ block_it.add_to_end(dest_block);
228
+ else
229
+ // did find insert pt
230
+ block_it.add_before_stay_put(dest_block);
231
+ }
232
+
233
+ if (dest_row == NULL) { // make a new one
234
+ dest_row = new ROW;
235
+ *dest_row = *src_row;
236
+
237
+ row_it.set_to_list(dest_block->row_list());
238
+ for (row_it.mark_cycle_pt(); !row_it.cycled_list(); row_it.forward()) {
239
+ if (row_it.data()->bounding_box().top() <
240
+ dest_row->bounding_box().top())
241
+ break;
242
+ }
243
+
244
+ if (row_it.cycled_list())
245
+ // didn't find insrt pt
246
+ row_it.add_to_end(dest_row);
247
+ else
248
+ // did find insert pt
249
+ row_it.add_before_stay_put(dest_row);
250
+ }
251
+
252
+ /* dest_block and dest_row are now found or built and inserted as necessesary
253
+ so add the word to dest row */
254
+
255
+ word_it.set_to_list(dest_row->word_list());
256
+ for (word_it.mark_cycle_pt(); !word_it.cycled_list(); word_it.forward()) {
257
+ if (word_it.data()->bounding_box().right() >= word_box.left())
258
+ break;
259
+ }
260
+
261
+ if (word_it.cycled_list())
262
+ word_it.add_to_end(word); // didn't find insrt pt
263
+ else { // did find insert pt
264
+ insert_point_word_box = word_it.data()->bounding_box();
265
+ if (insert_point_word_box.contains(word_box) ||
266
+ word_box.contains(insert_point_word_box))
267
+ image_win->AddMessage("Refusing to add words which obliterate,"
268
+ " or are obliterated by, others");
269
+ else {
270
+ if (word_it.data()->bounding_box().left() >
271
+ word->bounding_box().left())
272
+ // infront of insert pt
273
+ word_it.add_before_stay_put(word);
274
+ else
275
+ // behind insert pt
276
+ word_it.add_after_stay_put(word);
277
+ }
278
+ }
279
+ }
280
+
281
+
282
+ /**********************************************************************
283
+ * bln_word_window_handle()
284
+ *
285
+ * Return a WINDOW for the word window, creating it if necessary
286
+ **********************************************************************/
287
+
288
+ class BlnEventHandler : public SVEventHandler {
289
+ public:
290
+ void Notify(const SVEvent* sv_event) {
291
+ if (sv_event->type == SVET_DESTROY)
292
+ bln_word_window = NULL;
293
+ else if (sv_event->type == SVET_CLICK)
294
+ show_point(current_block_list, sv_event->x, sv_event->y);
295
+ }
296
+ };
297
+
298
+ ScrollView* bln_word_window_handle() { // return handle
299
+ // not opened yet
300
+ if (bln_word_window == NULL) {
301
+ pgeditor_msg("Creating BLN word window...");
302
+ bln_word_window = new ScrollView(editor_word_name.string(),
303
+ editor_word_xpos, editor_word_ypos, editor_word_width,
304
+ editor_word_height, 4000, 4000, true);
305
+ BlnEventHandler* a = new BlnEventHandler();
306
+ bln_word_window->AddEventHandler(a);
307
+ pgeditor_msg("Creating BLN word window...Done");
308
+ }
309
+ return bln_word_window;
310
+ }
311
+
312
+ /**********************************************************************
313
+ * build_image_window()
314
+ *
315
+ * Destroy the existing image window if there is one. Work out how big the
316
+ * new window needs to be. Create it and re-display.
317
+ **********************************************************************/
318
+
319
+ void build_image_window(TBOX page_bounding_box) {
320
+ if (image_win != NULL) { delete image_win; }
321
+ image_win = new ScrollView(editor_image_win_name.string(),
322
+ editor_image_xpos, editor_image_ypos,
323
+ page_bounding_box.right() + 1,
324
+ page_bounding_box.top() +
325
+ editor_image_menuheight + 1,
326
+ page_bounding_box.right() + 1,
327
+ page_bounding_box.top() + 1,
328
+ true);
329
+ }
330
+
331
+
332
+ /**********************************************************************
333
+ * build_menu()
334
+ *
335
+ * Construct the menu tree used by the command window
336
+ **********************************************************************/
337
+
338
+ SVMenuNode *build_menu_new() {
339
+
340
+ SVMenuNode* parent_menu;
341
+ SVMenuNode* root_menu_item = new SVMenuNode();
342
+
343
+ SVMenuNode* modes_menu_item = root_menu_item->AddChild("MODES");
344
+
345
+ modes_menu_item->AddChild("Change Display",
346
+ CHANGE_DISP_CMD_EVENT);
347
+ modes_menu_item->AddChild("Delete",
348
+ DELETE_CMD_EVENT);
349
+ modes_menu_item->AddChild("Copy to TARGET",
350
+ COPY_CMD_EVENT);
351
+ modes_menu_item->AddChild("Change Text",
352
+ CHANGE_TEXT_CMD_EVENT);
353
+ modes_menu_item->AddChild("Toggle Correct Seg Flg",
354
+ TOGGLE_SEG_CMD_EVENT);
355
+ modes_menu_item->AddChild("Dump Word",
356
+ DUMP_WERD_CMD_EVENT);
357
+ modes_menu_item->AddChild("Show Point",
358
+ SHOW_POINT_CMD_EVENT);
359
+ modes_menu_item->AddChild("Row gaps hist",
360
+ ROW_SPACE_STAT_CMD_EVENT);
361
+ modes_menu_item->AddChild("Block gaps hist",
362
+ BLOCK_SPACE_STAT_CMD_EVENT);
363
+ modes_menu_item->AddChild("Show BL Norm Word",
364
+ SHOW_BLN_WERD_CMD_EVENT);
365
+ modes_menu_item->AddChild("Re-Segment Word",
366
+ SEGMENT_WERD_CMD_EVENT);
367
+ modes_menu_item->AddChild("Recog Words",
368
+ RECOG_WERDS);
369
+ modes_menu_item->AddChild("Recog Blobs",
370
+ RECOG_PSEUDO);
371
+
372
+ parent_menu = root_menu_item->AddChild("DISPLAY");
373
+
374
+ parent_menu->AddChild("Bounding Boxes",
375
+ BOUNDING_BOX_CMD_EVENT, TRUE);
376
+ parent_menu->AddChild("Correct Text",
377
+ CORRECT_TEXT_CMD_EVENT, FALSE);
378
+ parent_menu->AddChild("Polygonal Approx",
379
+ POLYGONAL_CMD_EVENT, FALSE);
380
+ parent_menu->AddChild("Baseline Normalised",
381
+ BL_NORM_CMD_EVENT, FALSE);
382
+ parent_menu->AddChild("Edge Steps",
383
+ BITMAP_CMD_EVENT, FALSE);
384
+
385
+ parent_menu = root_menu_item->AddChild("OTHER");
386
+
387
+ parent_menu->AddChild("Quit",
388
+ QUIT_CMD_EVENT);
389
+ parent_menu->AddChild("Tidy Target",
390
+ TIDY_CMD_EVENT);
391
+
392
+ parent_menu->AddChild("View TARGET",
393
+ VIEW_CMD_EVENT, FALSE);
394
+ parent_menu->AddChild("Show Image",
395
+ IMAGE_CMD_EVENT, FALSE);
396
+ parent_menu->AddChild("ShowBlock Outlines",
397
+ BLOCKS_CMD_EVENT, FALSE);
398
+ parent_menu->AddChild("Show Baselines",
399
+ BASELINES_CMD_EVENT, FALSE);
400
+ parent_menu->AddChild("Write File",
401
+ WRITE_CMD_EVENT, imagebasename.string());
402
+ parent_menu->AddChild("New Source File",
403
+ NEW_SOURCE_CMD_EVENT, imagebasename.string());
404
+ parent_menu->AddChild("Uniform Display",
405
+ UNIFORM_DISP_CMD_EVENT);
406
+ parent_menu->AddChild("Refresh Display",
407
+ REFRESH_CMD_EVENT);
408
+
409
+ return root_menu_item;
410
+ }
411
+
412
+
413
+ /**********************************************************************
414
+ * display_bln_lines()
415
+ *
416
+ * Display normalised baseline, x-height, ascender limit and descender limit
417
+ **********************************************************************/
418
+
419
+ void display_bln_lines(ScrollView* window,
420
+ ScrollView::Color colour,
421
+ float scale_factor,
422
+ float y_offset,
423
+ float minx,
424
+ float maxx) {
425
+ window->Pen(colour);
426
+ window->Line(minx, y_offset + scale_factor * DESC_HEIGHT,
427
+ maxx, y_offset + scale_factor * DESC_HEIGHT);
428
+ window->Line(minx, y_offset + scale_factor * BL_HEIGHT,
429
+ maxx, y_offset + scale_factor * BL_HEIGHT);
430
+ window->Line(minx, y_offset + scale_factor * X_HEIGHT,
431
+ maxx, y_offset + scale_factor * X_HEIGHT);
432
+ window->Line(minx, y_offset + scale_factor * ASC_HEIGHT,
433
+ maxx, y_offset + scale_factor * ASC_HEIGHT);
434
+ }
435
+
436
+
437
+ /**********************************************************************
438
+ * do_new_source()
439
+ *
440
+ * Change to another source file. Automatically tidy page first
441
+ *
442
+ **********************************************************************/
443
+
444
+ void do_new_source( // serialise
445
+ ) {
446
+ FILE *infp; // input file
447
+
448
+ char* name = image_win->ShowInputDialog("New Source File name");
449
+
450
+ STRING name_str(name);
451
+ delete[] name;
452
+
453
+ if (source_changed) {
454
+
455
+ int a = image_win->ShowYesNoDialog(
456
+ "Source changes will be LOST. Continue?(Y/N)");
457
+ if (a != 'y') { image_win->AddMessage("Write cancelled"); return; }
458
+
459
+ }
460
+
461
+ // if not file exists
462
+ if (!(infp = fopen(name_str.string(), "r"))) {
463
+
464
+ image_win->AddMessage("Cant open file " "%s" "", name_str.string());
465
+ return;
466
+ }
467
+
468
+ fclose(infp);
469
+
470
+ image_win->AddMessage("Reading file " "%s" "...", name_str.string());
471
+ source_block_list->clear();
472
+ // appends to SOURCE
473
+ pgeditor_read_file(name_str, source_block_list);
474
+ source_changed = FALSE;
475
+
476
+ image_win->AddMessage("Doing automatic Tidy Target...");
477
+ viewing_source = FALSE; // Force viewing source
478
+ do_tidy_cmd();
479
+
480
+ image_win->AddMessage("Doing automatic Tidy Target...Done");
481
+
482
+ }
483
+
484
+
485
+ /**********************************************************************
486
+ * do_re_display()
487
+ *
488
+ * Redisplay page
489
+ **********************************************************************/
490
+
491
+ void
492
+ // function to call
493
+ do_re_display(BOOL8 word_painter(
494
+ BLOCK *, ROW *, WERD *)) {
495
+ BLOCK_IT block_it(current_block_list);
496
+ BLOCK *block;
497
+ int block_count = 1;
498
+
499
+ ROW_IT row_it;
500
+ ROW *row;
501
+
502
+ WERD_IT word_it;
503
+ WERD *word;
504
+
505
+ image_win->Clear();
506
+ if (display_image != 0) {
507
+ sv_show_sub_image(&page_image, 0, 0,
508
+ page_image.get_xsize(), page_image.get_ysize(),
509
+ image_win, 0, 0);
510
+ }
511
+
512
+ for (block_it.mark_cycle_pt();
513
+ !block_it.cycled_list(); block_it.forward()) {
514
+ block = block_it.data();
515
+ row_it.set_to_list(block->row_list());
516
+ for (row_it.mark_cycle_pt(); !row_it.cycled_list(); row_it.forward()) {
517
+ row = row_it.data();
518
+ word_it.set_to_list(row->word_list());
519
+ for (word_it.mark_cycle_pt();
520
+ !word_it.cycled_list(); word_it.forward()) {
521
+ word = word_it.data();
522
+ word_painter(block, row, word);
523
+ }
524
+ if (display_baselines)
525
+ row->plot_baseline(image_win, ScrollView::GREEN);
526
+ }
527
+ if (display_blocks)
528
+ block->plot(image_win, block_count++, ScrollView::RED);
529
+ }
530
+ image_win->Update();
531
+ }
532
+
533
+
534
+ /**********************************************************************
535
+ * do_tidy_cmd()
536
+ *
537
+ * Tidy TARGET page
538
+ **********************************************************************/
539
+
540
+ const TBOX do_tidy_cmd() { // tidy
541
+ ICOORD shift_vector;
542
+ TBOX tidy_box; // Just the tidy area
543
+ TBOX source_box; // source file area
544
+
545
+ source_box = block_list_bounding_box(source_block_list);
546
+ // find src area
547
+
548
+ if (!target_block_list.empty()) {
549
+ tidy_box = block_list_compress(&target_block_list);
550
+
551
+ /* Shift tidied target above the source image area. */
552
+
553
+ shift_vector = ICOORD(0, source_box.top() + BLOCK_SPACING)
554
+ - tidy_box.botleft();
555
+ block_list_move(&target_block_list, shift_vector);
556
+ tidy_box.move(shift_vector);
557
+ }
558
+ source_box += tidy_box;
559
+ // big enough for both
560
+ build_image_window(source_box);
561
+ do_view_cmd();
562
+ return tidy_box;
563
+ }
564
+
565
+
566
+ /**********************************************************************
567
+ * do_view_cmd()
568
+ *
569
+ * View TARGET/View SOURCE command
570
+ **********************************************************************/
571
+
572
+ void do_view_cmd() {
573
+ viewing_source = !viewing_source;
574
+ image_win->Clear();
575
+ if (viewing_source) {
576
+ current_block_list = source_block_list;
577
+ current_image_changed = &source_changed;
578
+ other_block_list = &target_block_list;
579
+ other_image_changed = &target_changed;
580
+ do_re_display(&word_display);
581
+ }
582
+ else {
583
+ current_block_list = &target_block_list;
584
+ current_image_changed = &target_changed;
585
+ other_block_list = source_block_list;
586
+ other_image_changed = &source_changed;
587
+ do_re_display(&word_display);
588
+ }
589
+ }
590
+
591
+
592
+ /**********************************************************************
593
+ * do_write_file()
594
+ *
595
+ * Serialise a block list to file
596
+ *
597
+ * If writing image, tidy page and move to(0,0) first
598
+ **********************************************************************/
599
+
600
+ void do_write_file( // serialise
601
+ ) {
602
+
603
+ char* name = image_win->ShowInputDialog("File Name");
604
+
605
+ FILE *infp; // input file
606
+ char msg_str[80];
607
+
608
+ TBOX enclosing_box;
609
+
610
+ // if file exists
611
+ if ((infp = fopen(name, "r")) != NULL) {
612
+ fclose(infp);
613
+ sprintf(msg_str, "Overwrite file " "%s" "?(Y/N)", name);
614
+
615
+ int a = image_win->ShowYesNoDialog(msg_str);
616
+ if (a != 'y') { image_win->AddMessage("Write cancelled"); delete[] name; return; }
617
+ }
618
+
619
+ infp = fopen(name, "w"); // can we write to it?
620
+ if (infp == NULL) {
621
+
622
+ image_win->AddMessage("Cant write to file " "%s" "", name);
623
+ delete[] name;
624
+ return;
625
+ }
626
+ fclose(infp);
627
+
628
+ delete [] name;
629
+
630
+ if (!viewing_source && !target_block_list.empty()) {
631
+ // Tidy & move to(0,0)
632
+ image_win->AddMessage("Automatic tidy...");
633
+ viewing_source = TRUE; // Stay viewing target!
634
+ enclosing_box = do_tidy_cmd();
635
+ block_list_move(&target_block_list, -enclosing_box.botleft());
636
+ image_win->AddMessage("Writing file...");
637
+ pgeditor_write_file(name, &target_block_list);
638
+ // move back
639
+ block_list_move(&target_block_list,
640
+ enclosing_box.botleft());
641
+ }
642
+ else {
643
+ image_win->AddMessage("Writing file...");
644
+ pgeditor_write_file(name, current_block_list);
645
+ }
646
+ image_win->AddMessage("Writing file...Done");
647
+ *current_image_changed = FALSE;
648
+
649
+ }
650
+
651
+ /**********************************************************************
652
+ * notify()
653
+ *
654
+ * Event handler that processes incoming events, either forwarding
655
+ * them to process_cmd_win_event or process_image_event.
656
+ *
657
+ **********************************************************************/
658
+
659
+ void PGEventHandler::Notify(const SVEvent* event) {
660
+ char myval = '0';
661
+ if (event->type == SVET_POPUP) {
662
+ ve->Notify(event);
663
+ } // These are handled by Var. Editor
664
+ else if (event->type == SVET_EXIT) { stillRunning = false; }
665
+ else if (event->type == SVET_MENU) {
666
+ if (strcmp(event->parameter, "true") == 0) { myval = 'T'; }
667
+ else if (strcmp(event->parameter, "false") == 0) { myval = 'F'; }
668
+ process_cmd_win_event(event->command_id, &myval);
669
+ }
670
+ else {
671
+ process_image_event(*event);
672
+ // else pgeditor_show_point(*event);
673
+ }
674
+ current_word_quit.set_value(FALSE);
675
+ selection_quit.set_value(FALSE);
676
+ // replot all var wins
677
+ }
678
+
679
+
680
+ /**********************************************************************
681
+ * pgeditor_main()
682
+ *
683
+ * Top level editor operation:
684
+ * Setup a new window and an according event handler
685
+ *
686
+ **********************************************************************/
687
+
688
+ void pgeditor_main(BLOCK_LIST *blocks) {
689
+
690
+ source_block_list = blocks;
691
+ current_block_list = blocks;
692
+ if (current_block_list->empty())
693
+ return;
694
+
695
+ stillRunning = true;
696
+
697
+ build_image_window(block_list_bounding_box(source_block_list));
698
+ do_re_display(&word_display);
699
+ word_display_mode.turn_on_bit(DF_BOX);
700
+ #ifndef GRAPHICS_DISABLED
701
+ ve = new VariablesEditor(image_win);
702
+ #endif
703
+ PGEventHandler pgEventHandler;
704
+
705
+ image_win->AddEventHandler(&pgEventHandler);
706
+ image_win->AddMessageBox();
707
+
708
+ SVMenuNode* svMenuRoot = build_menu_new();
709
+
710
+ svMenuRoot->BuildMenu(image_win);
711
+ image_win->SetVisible(true);
712
+
713
+ image_win->AwaitEvent(SVET_DESTROY);
714
+ }
715
+
716
+
717
+ /**********************************************************************
718
+ * pgeditor_msg()
719
+ *
720
+ * Display a message - in the command window if there is one, or to stdout
721
+ **********************************************************************/
722
+
723
+ void pgeditor_msg( // message display
724
+ const char *msg) {
725
+ image_win->AddMessage(msg);
726
+ }
727
+
728
+ #endif // GRAPHCICS_DISABLED
729
+ /**********************************************************************
730
+ * pgeditor_read_file()
731
+ *
732
+ * Deserialise source file
733
+ **********************************************************************/
734
+
735
+ void pgeditor_read_file( // of serialised file
736
+ STRING &name,
737
+ BLOCK_LIST *blocks // block list to add to
738
+ ) {
739
+ #ifdef GRAPHICS_DISABLED
740
+ edges_and_textord(name.string(), blocks);
741
+ }
742
+ #else
743
+ int c; // input character
744
+ FILE *infp; // input file
745
+ BLOCK_IT block_it(blocks); // iterator
746
+ BLOCK *block; // current block
747
+
748
+ ICOORD page_tr; // topright of page
749
+
750
+ const char *filename_extension;
751
+
752
+ block_it.move_to_last();
753
+
754
+ // ptr to last dot
755
+ filename_extension = strrchr(name.string(), '.');
756
+ #ifdef __UNIX__
757
+ /* TEXTROW* tessrows;
758
+ TBLOB* tessblobs;
759
+ TPOINT tess_tr;
760
+
761
+ if (strcmp(filename_extension, ".r" ) == 0)
762
+ {
763
+ tprintf("Converting from .r file format.\n" );
764
+ tessrows = get_tess_row_file(name.string(), // get the row file
765
+ &tess_tr );
766
+ page_tr = ICOORD(tess_tr.x, tess_tr.y );
767
+ make_blocks_from_rows(tessrows, name.string(), // reconstruct blocks
768
+ page_tr, TRUE, &block_it );
769
+ }
770
+ else if (strcmp(filename_extension, ".b" ) == 0)
771
+ {
772
+ tprintf("Converting from .b file format.\n" );
773
+ tessblobs = get_tess_blob_file(name.string(), // get the blob file
774
+ &tess_tr );
775
+ page_tr = ICOORD(tess_tr.x, tess_tr.y );
776
+ make_blocks_from_blobs(tessblobs, name.string(),
777
+ // reconstruct blocks
778
+ page_tr, FALSE,blocks);
779
+ }
780
+ else*/
781
+ if (strcmp(filename_extension, ".pb") == 0) {
782
+ tprintf("Converting from .pb file format.\n");
783
+ // construct blocks
784
+ read_and_textord(name.string(), blocks);
785
+ }
786
+ else
787
+ #endif
788
+ if ((strcmp(filename_extension, ".pg") == 0) ||
789
+ // read a .pg file
790
+ // or a .sp file
791
+ (strcmp(filename_extension, ".sp") == 0)) {
792
+ tprintf("Reading %s file format.\n", filename_extension);
793
+ infp = fopen(name.string(), "r");
794
+ if (infp == NULL)
795
+ CANTOPENFILE.error("pgeditor_read_file", EXIT, name.string());
796
+ // can't open file
797
+
798
+ while(((c = fgetc(infp)) != EOF) &&(ungetc(c, infp) != EOF)) {
799
+ // get one
800
+ block = BLOCK::de_serialise(infp);
801
+ // add to list
802
+ block_it.add_after_then_move(block);
803
+ }
804
+ fclose(infp);
805
+ } else {
806
+ edges_and_textord(name.string(), blocks);
807
+ }
808
+ }
809
+
810
+
811
+ /**********************************************************************
812
+ * pgeditor_show_point()
813
+ *
814
+ * Display the coordinates of a point in the command window
815
+ **********************************************************************/
816
+
817
+ void pgeditor_show_point( // display coords
818
+ SVEvent *event) {
819
+ image_win->AddMessage("Pointing at(%d, %d)", event->x, event->y);
820
+ }
821
+
822
+
823
+ /**********************************************************************
824
+ * pgeditor_write_file()
825
+ *
826
+ * Serialise a block list to file
827
+ *
828
+ **********************************************************************/
829
+
830
+ void pgeditor_write_file( // serialise
831
+ char *name, // file name
832
+ BLOCK_LIST *blocks // block list to write
833
+ ) {
834
+ FILE *infp; // input file
835
+ BLOCK_IT block_it(blocks); // block iterator
836
+ BLOCK *block; // current block
837
+ ROW_IT row_it; // row iterator
838
+
839
+ infp = fopen(name, "w"); // create output file
840
+ if (infp == NULL)
841
+ CANTCREATEFILE.error("pgeditor_write_file", EXIT, name);
842
+
843
+ for (block_it.mark_cycle_pt();
844
+ !block_it.cycled_list(); block_it.forward()) {
845
+ block = block_it.extract();
846
+
847
+ row_it.set_to_list(block->row_list());
848
+ for (row_it.mark_cycle_pt(); !row_it.cycled_list(); row_it.forward())
849
+ // ensure correct
850
+ row_it.data()->recalc_bounding_box();
851
+
852
+ block->serialise(infp); // serialize non-empty
853
+ block_it.add_after_then_move(block);
854
+ }
855
+ fclose(infp);
856
+ }
857
+
858
+
859
+ /**********************************************************************
860
+ * process_cmd_win_event()
861
+ *
862
+ * Process a command returned from the command window
863
+ * (Just call the appropriate command handler)
864
+ **********************************************************************/
865
+
866
+ BOOL8 process_cmd_win_event( // UI command semantics
867
+ inT32 cmd_event, // which menu item?
868
+ char *new_value // any prompt data
869
+ ) {
870
+ char msg[160];
871
+ BOOL8 exit = FALSE;
872
+
873
+ switch(cmd_event) {
874
+ case NULL_CMD_EVENT:
875
+ break;
876
+
877
+ case VIEW_CMD_EVENT:
878
+ do_view_cmd();
879
+ break;
880
+ case CHANGE_DISP_CMD_EVENT:
881
+ case DELETE_CMD_EVENT:
882
+ case CHANGE_TEXT_CMD_EVENT:
883
+ case TOGGLE_SEG_CMD_EVENT:
884
+ case DUMP_WERD_CMD_EVENT:
885
+ case SHOW_POINT_CMD_EVENT:
886
+ case ROW_SPACE_STAT_CMD_EVENT:
887
+ case BLOCK_SPACE_STAT_CMD_EVENT:
888
+ case SHOW_BLN_WERD_CMD_EVENT:
889
+ case SEGMENT_WERD_CMD_EVENT:
890
+ mode =(CMD_EVENTS) cmd_event;
891
+ break;
892
+ case COPY_CMD_EVENT:
893
+ mode =(CMD_EVENTS) cmd_event;
894
+ if (!viewing_source)
895
+ image_win->AddMessage("Can't COPY while viewing target!");
896
+ break;
897
+ case BOUNDING_BOX_CMD_EVENT:
898
+ if (new_value[0] == 'T')
899
+ word_display_mode.turn_on_bit(DF_BOX);
900
+ else
901
+ word_display_mode.turn_off_bit(DF_BOX);
902
+ mode = CHANGE_DISP_CMD_EVENT;
903
+ break;
904
+ case CORRECT_TEXT_CMD_EVENT:
905
+ if (new_value[0] == 'T')
906
+ word_display_mode.turn_on_bit(DF_TEXT);
907
+ else
908
+ word_display_mode.turn_off_bit(DF_TEXT);
909
+ mode = CHANGE_DISP_CMD_EVENT;
910
+ break;
911
+ case POLYGONAL_CMD_EVENT:
912
+ if (new_value[0] == 'T')
913
+ word_display_mode.turn_on_bit(DF_POLYGONAL);
914
+ else
915
+ word_display_mode.turn_off_bit(DF_POLYGONAL);
916
+ mode = CHANGE_DISP_CMD_EVENT;
917
+ break;
918
+ case BL_NORM_CMD_EVENT:
919
+ if (new_value[0] == 'T')
920
+ word_display_mode.turn_on_bit(DF_BN_POLYGONAL);
921
+ else
922
+ word_display_mode.turn_off_bit(DF_BN_POLYGONAL);
923
+ mode = CHANGE_DISP_CMD_EVENT;
924
+ break;
925
+ case BITMAP_CMD_EVENT:
926
+ if (new_value[0] == 'T')
927
+ word_display_mode.turn_on_bit(DF_EDGE_STEP);
928
+ else
929
+ word_display_mode.turn_off_bit(DF_EDGE_STEP);
930
+ mode = CHANGE_DISP_CMD_EVENT;
931
+ break;
932
+ case UNIFORM_DISP_CMD_EVENT:
933
+ do_re_display(&word_set_display);
934
+ *current_image_changed = TRUE;
935
+ break;
936
+ case WRITE_CMD_EVENT:
937
+ do_write_file();
938
+ break;
939
+ case TIDY_CMD_EVENT:
940
+ if (!target_block_list.empty()) {
941
+ viewing_source = TRUE; // Force viewing target
942
+ do_tidy_cmd();
943
+ }
944
+ break;
945
+ case NEW_SOURCE_CMD_EVENT:
946
+ do_new_source();
947
+ break;
948
+ case IMAGE_CMD_EVENT:
949
+ display_image =(new_value[0] == 'T');
950
+ do_re_display(&word_display);
951
+ break;
952
+ case BLOCKS_CMD_EVENT:
953
+ display_blocks =(new_value[0] == 'T');
954
+ do_re_display(&word_display);
955
+ break;
956
+ case BASELINES_CMD_EVENT:
957
+ display_baselines =(new_value[0] == 'T');
958
+ do_re_display(&word_display);
959
+ break;
960
+ case REFRESH_CMD_EVENT:
961
+ do_re_display(&word_display);
962
+ break;
963
+ case QUIT_CMD_EVENT:
964
+ if (source_changed || target_changed) {
965
+ int a = image_win->ShowYesNoDialog(
966
+ "Changes not saved. Exit anyway?(Y/N)");
967
+ if (a == 'y') { exit = TRUE; ScrollView::Exit(); }
968
+ }
969
+ else {
970
+ exit = TRUE;
971
+ ScrollView::Exit();
972
+ }
973
+ break;
974
+ case RECOG_WERDS:
975
+ mode = RECOG_WERDS;
976
+ break;
977
+ case RECOG_PSEUDO:
978
+ mode = RECOG_PSEUDO;
979
+ break;
980
+
981
+ default:
982
+ sprintf(msg, "Unrecognised event " INT32FORMAT "(%s)",
983
+ cmd_event, new_value);
984
+ image_win->AddMessage(msg);
985
+ break;
986
+ }
987
+ return exit;
988
+ }
989
+
990
+
991
+ /**********************************************************************
992
+ * process_image_event()
993
+ *
994
+ * User has done something in the image window - mouse down or up. Work out
995
+ * what it is and do something with it.
996
+ * If DOWN - just remember where it was.
997
+ * If UP - for each word in the selected area do the operation defined by
998
+ * the current mode.
999
+ **********************************************************************/
1000
+
1001
+ void process_image_event( // action in image win
1002
+ const SVEvent &event) {
1003
+ static ICOORD down;
1004
+ ICOORD up;
1005
+ TBOX selection_box;
1006
+ char msg[80];
1007
+
1008
+ switch(event.type) {
1009
+
1010
+ case SVET_SELECTION:
1011
+ if (event.type == SVET_SELECTION) {
1012
+ down.set_x(event.x - event.x_size);
1013
+ down.set_y(event.y + event.y_size);
1014
+ if (mode == SHOW_POINT_CMD_EVENT)
1015
+ show_point(current_block_list, event.x, event.y);
1016
+ }
1017
+
1018
+ up.set_x(event.x);
1019
+ up.set_y(event.y);
1020
+
1021
+ selection_box = TBOX(down, up);
1022
+
1023
+ switch(mode) {
1024
+ case CHANGE_DISP_CMD_EVENT:
1025
+ process_selected_words(current_block_list,
1026
+ selection_box,
1027
+ &word_blank_and_set_display);
1028
+ break;
1029
+ case COPY_CMD_EVENT:
1030
+ if (!viewing_source)
1031
+ image_win->AddMessage("Can't COPY while viewing target!");
1032
+ else
1033
+ process_selected_words(current_block_list,
1034
+ selection_box,
1035
+ &word_copy);
1036
+ break;
1037
+ case DELETE_CMD_EVENT:
1038
+ process_selected_words_it(current_block_list,
1039
+ selection_box,
1040
+ &word_delete);
1041
+ break;
1042
+ case CHANGE_TEXT_CMD_EVENT:
1043
+ process_selected_words(current_block_list,
1044
+ selection_box,
1045
+ &word_change_text);
1046
+ break;
1047
+ case TOGGLE_SEG_CMD_EVENT:
1048
+ process_selected_words(current_block_list,
1049
+ selection_box,
1050
+ &word_toggle_seg);
1051
+ break;
1052
+ case DUMP_WERD_CMD_EVENT:
1053
+ process_selected_words(current_block_list,
1054
+ selection_box,
1055
+ &word_dumper);
1056
+ break;
1057
+ case SHOW_BLN_WERD_CMD_EVENT:
1058
+ process_selected_words(current_block_list,
1059
+ selection_box,
1060
+ &word_bln_display);
1061
+ break;
1062
+ case SEGMENT_WERD_CMD_EVENT:
1063
+ re_segment_word(current_block_list, selection_box);
1064
+ break;
1065
+ case ROW_SPACE_STAT_CMD_EVENT:
1066
+ row_space_stat(current_block_list, selection_box);
1067
+ break;
1068
+ case BLOCK_SPACE_STAT_CMD_EVENT:
1069
+ block_space_stat(current_block_list, selection_box);
1070
+ break;
1071
+ case SHOW_POINT_CMD_EVENT:
1072
+ break; // ignore up event
1073
+
1074
+ case RECOG_WERDS:
1075
+ image_win->AddMessage("Recogging selected words");
1076
+ process_selected_words(current_block_list,
1077
+ selection_box, &recog_interactive);
1078
+ break;
1079
+ case RECOG_PSEUDO:
1080
+ image_win->AddMessage("Recogging selected blobs");
1081
+ recog_pseudo_word(current_block_list, selection_box);
1082
+ break;
1083
+
1084
+ default:
1085
+ sprintf(msg, "Mode %d not yet implemented", mode);
1086
+ image_win->AddMessage(msg);
1087
+ break;
1088
+ }
1089
+ default:
1090
+ break;
1091
+ }
1092
+ }
1093
+
1094
+
1095
+ /**********************************************************************
1096
+ * re_scale_and_move_bln_word()
1097
+ *
1098
+ * Scale and move a bln word so that it fits in a specified bounding box.
1099
+ * Scale by width or height to generate the largest image
1100
+ **********************************************************************/
1101
+
1102
+ float re_scale_and_move_bln_word( // put bln word in box
1103
+ WERD *norm_word, // BL normalised word
1104
+ const TBOX &box // destination box
1105
+ ) {
1106
+ TBOX norm_box = norm_word->bounding_box();
1107
+ float width_scale_factor;
1108
+ float height_scale_factor;
1109
+ float selected_scale_factor;
1110
+
1111
+ width_scale_factor = box.width() /(float) norm_box.width();
1112
+ height_scale_factor = box.height() /(float) ASC_HEIGHT;
1113
+
1114
+ if ((ASC_HEIGHT * width_scale_factor) <= box.height())
1115
+ selected_scale_factor = width_scale_factor;
1116
+ else
1117
+ selected_scale_factor = height_scale_factor;
1118
+
1119
+ norm_word->scale(selected_scale_factor);
1120
+ norm_word->move(ICOORD((box.left() + box.width() / 2), box.bottom()));
1121
+ return selected_scale_factor;
1122
+ }
1123
+
1124
+
1125
+ /**********************************************************************
1126
+ * re_segment_word()
1127
+ *
1128
+ * If all selected blobs are in the same row, remove them from their current
1129
+ * word(s) and put them in a new word. Insert the new word in the row at the
1130
+ * appropriate point. Delete any empty words.
1131
+ *
1132
+ **********************************************************************/
1133
+
1134
+ void re_segment_word( // break/join words
1135
+ BLOCK_LIST *block_list, // blocks to check
1136
+ TBOX &selection_box) {
1137
+ BLOCK_IT block_it(block_list);
1138
+ BLOCK *block;
1139
+ BLOCK *block_to_process = NULL;
1140
+ ROW_IT row_it;
1141
+ ROW *row;
1142
+ ROW *row_to_process = NULL;
1143
+ WERD_IT word_it;
1144
+ WERD *word;
1145
+ WERD *new_word = NULL;
1146
+ BOOL8 polyg = false;
1147
+ PBLOB_IT blob_it;
1148
+ PBLOB_LIST dummy; // Just to initialize new_blob_it.
1149
+ PBLOB_IT new_blob_it = &dummy;
1150
+ PBLOB *blob;
1151
+
1152
+ /* Find row to process - error if selections from more than one row */
1153
+
1154
+ for (block_it.mark_cycle_pt();
1155
+ !block_it.cycled_list(); block_it.forward()) {
1156
+ block = block_it.data();
1157
+ if (block->bounding_box().overlap(selection_box)) {
1158
+ row_it.set_to_list(block->row_list());
1159
+ for (row_it.mark_cycle_pt();
1160
+ !row_it.cycled_list(); row_it.forward()) {
1161
+ row = row_it.data();
1162
+ if (row->bounding_box().overlap(selection_box)) {
1163
+ if (row_to_process == NULL) {
1164
+ block_to_process = block;
1165
+ row_to_process = row;
1166
+ }
1167
+ else {
1168
+ image_win->AddMessage("Cant resegment words "
1169
+ "in more than one row");
1170
+ return;
1171
+ }
1172
+ }
1173
+ }
1174
+ }
1175
+ }
1176
+ /* Continue with row_to_process */
1177
+
1178
+ word_it.set_to_list(row_to_process->word_list());
1179
+ for (word_it.mark_cycle_pt(); !word_it.cycled_list(); word_it.forward()) {
1180
+ word = word_it.data();
1181
+ polyg = word->flag(W_POLYGON);
1182
+ if (word->bounding_box().overlap(selection_box)) {
1183
+ blob_it.set_to_list(word->gblob_list());
1184
+ for (blob_it.mark_cycle_pt();
1185
+ !blob_it.cycled_list(); blob_it.forward()) {
1186
+ blob = blob_it.data();
1187
+ if (gblob_bounding_box(blob, polyg).overlap(selection_box)) {
1188
+ if (new_word == NULL) {
1189
+ new_word = word->shallow_copy();
1190
+ new_blob_it.set_to_list(new_word->gblob_list());
1191
+ }
1192
+ new_blob_it.add_to_end(blob_it.extract());
1193
+ // move blob
1194
+ }
1195
+ }
1196
+ if (blob_it.empty()) { // no blobs in word
1197
+ // so delete word
1198
+ delete word_it.extract();
1199
+ }
1200
+ }
1201
+ }
1202
+ if (new_word != NULL) {
1203
+ gblob_sort_list(new_word->gblob_list(), polyg);
1204
+ word_it.add_to_end(new_word);
1205
+ word_it.sort(word_comparator);
1206
+ row_to_process->bounding_box().plot(image_win,
1207
+ ScrollView::BLACK, ScrollView::BLACK);
1208
+ word_it.set_to_list(row_to_process->word_list());
1209
+ for (word_it.mark_cycle_pt();
1210
+ !word_it.cycled_list(); word_it.forward())
1211
+ word_display(block_to_process, row_to_process, word_it.data());
1212
+ *current_image_changed = TRUE;
1213
+ }
1214
+ }
1215
+
1216
+
1217
+ void block_space_stat( // show space stats
1218
+ BLOCK_LIST *block_list, // blocks to check
1219
+ TBOX &selection_box) {
1220
+ BLOCK_IT block_it(block_list);
1221
+ BLOCK *block;
1222
+ ROW_IT row_it;
1223
+ ROW *row;
1224
+ int block_idx = 0;
1225
+ STATS all_gap_stats(0, MAXSPACING);
1226
+ WERD_IT word_it;
1227
+ WERD *word;
1228
+ PBLOB_IT blob_it;
1229
+ PBLOB *blob;
1230
+ C_BLOB_IT cblob_it;
1231
+ C_BLOB *cblob;
1232
+ TBOX box;
1233
+ inT16 prev_box_right;
1234
+ inT16 gap_width;
1235
+ inT16 min_inter_word_gap;
1236
+ inT16 max_inter_char_gap;
1237
+
1238
+ /* Find blocks to process */
1239
+
1240
+ for (block_it.mark_cycle_pt();
1241
+ !block_it.cycled_list(); block_it.forward()) {
1242
+ block_idx++;
1243
+ block = block_it.data();
1244
+ if (block->bounding_box().overlap(selection_box)) {
1245
+ /* Process a block */
1246
+ tprintf("\nBlock %d\n", block_idx);
1247
+ min_inter_word_gap = 3000;
1248
+ max_inter_char_gap = 0;
1249
+ all_gap_stats.clear();
1250
+ row_it.set_to_list(block->row_list());
1251
+ for (row_it.mark_cycle_pt();
1252
+ !row_it.cycled_list(); row_it.forward()) {
1253
+ row = row_it.data();
1254
+ prev_box_right = -1;
1255
+ word_it.set_to_list(row->word_list());
1256
+ for (word_it.mark_cycle_pt();
1257
+ !word_it.cycled_list(); word_it.forward()) {
1258
+ word = word_it.data();
1259
+ if (word->flag(W_POLYGON)) {
1260
+ blob_it.set_to_list(word->blob_list());
1261
+ for (blob_it.mark_cycle_pt();
1262
+ !blob_it.cycled_list(); blob_it.forward()) {
1263
+ blob = blob_it.data();
1264
+ box = blob->bounding_box();
1265
+ if (prev_box_right > -1) {
1266
+ gap_width = box.left() - prev_box_right;
1267
+ all_gap_stats.add(gap_width, 1);
1268
+ if (blob_it.at_first()) {
1269
+ if (gap_width < min_inter_word_gap)
1270
+ min_inter_word_gap = gap_width;
1271
+ }
1272
+ else {
1273
+ if (gap_width > max_inter_char_gap)
1274
+ max_inter_char_gap = gap_width;
1275
+ }
1276
+ }
1277
+ prev_box_right = box.right();
1278
+ }
1279
+ }
1280
+ else {
1281
+ cblob_it.set_to_list(word->cblob_list());
1282
+ for (cblob_it.mark_cycle_pt();
1283
+ !cblob_it.cycled_list(); cblob_it.forward()) {
1284
+ cblob = cblob_it.data();
1285
+ box = cblob->bounding_box();
1286
+ if (prev_box_right > -1) {
1287
+ gap_width = box.left() - prev_box_right;
1288
+ all_gap_stats.add(gap_width, 1);
1289
+ if (cblob_it.at_first()) {
1290
+ if (gap_width < min_inter_word_gap)
1291
+ min_inter_word_gap = gap_width;
1292
+ }
1293
+ else {
1294
+ if (gap_width > max_inter_char_gap)
1295
+ max_inter_char_gap = gap_width;
1296
+ }
1297
+ }
1298
+ prev_box_right = box.right();
1299
+ }
1300
+ }
1301
+ }
1302
+ }
1303
+ tprintf("Max inter char gap = %d.\nMin inter word gap = %d.\n",
1304
+ max_inter_char_gap, min_inter_word_gap);
1305
+ all_gap_stats.short_print(NULL, TRUE);
1306
+ all_gap_stats.smooth(2);
1307
+ tprintf("SMOOTHED DATA...\n");
1308
+ all_gap_stats.short_print(NULL, TRUE);
1309
+ }
1310
+ }
1311
+ }
1312
+
1313
+
1314
+ void row_space_stat( // show space stats
1315
+ BLOCK_LIST *block_list, // blocks to check
1316
+ TBOX &selection_box) {
1317
+ BLOCK_IT block_it(block_list);
1318
+ BLOCK *block;
1319
+ ROW_IT row_it;
1320
+ ROW *row;
1321
+ int block_idx = 0;
1322
+ int row_idx;
1323
+ STATS all_gap_stats(0, MAXSPACING);
1324
+ WERD_IT word_it;
1325
+ WERD *word;
1326
+ PBLOB_IT blob_it;
1327
+ PBLOB *blob;
1328
+ C_BLOB_IT cblob_it;
1329
+ C_BLOB *cblob;
1330
+ TBOX box;
1331
+ inT16 prev_box_right;
1332
+ inT16 gap_width;
1333
+ inT16 min_inter_word_gap;
1334
+ inT16 max_inter_char_gap;
1335
+
1336
+ /* Find rows to process */
1337
+
1338
+ for (block_it.mark_cycle_pt();
1339
+ !block_it.cycled_list(); block_it.forward()) {
1340
+ block_idx++;
1341
+ block = block_it.data();
1342
+ if (block->bounding_box().overlap(selection_box)) {
1343
+ row_it.set_to_list(block->row_list());
1344
+ row_idx = 0;
1345
+ for (row_it.mark_cycle_pt();
1346
+ !row_it.cycled_list(); row_it.forward()) {
1347
+ row_idx++;
1348
+ row = row_it.data();
1349
+ if (row->bounding_box().overlap(selection_box)) {
1350
+ /* Process a row */
1351
+
1352
+ tprintf("\nBlock %d Row %d\n", block_idx, row_idx);
1353
+ min_inter_word_gap = 3000;
1354
+ max_inter_char_gap = 0;
1355
+ prev_box_right = -1;
1356
+ all_gap_stats.clear();
1357
+ word_it.set_to_list(row->word_list());
1358
+ for (word_it.mark_cycle_pt();
1359
+ !word_it.cycled_list(); word_it.forward()) {
1360
+ word = word_it.data();
1361
+ if (word->flag(W_POLYGON)) {
1362
+ blob_it.set_to_list(word->blob_list());
1363
+ for (blob_it.mark_cycle_pt();
1364
+ !blob_it.cycled_list(); blob_it.forward()) {
1365
+ blob = blob_it.data();
1366
+ box = blob->bounding_box();
1367
+ if (prev_box_right > -1) {
1368
+ gap_width = box.left() - prev_box_right;
1369
+ all_gap_stats.add(gap_width, 1);
1370
+ if (blob_it.at_first()) {
1371
+ if (gap_width < min_inter_word_gap)
1372
+ min_inter_word_gap = gap_width;
1373
+ }
1374
+ else {
1375
+ if (gap_width > max_inter_char_gap)
1376
+ max_inter_char_gap = gap_width;
1377
+ }
1378
+ }
1379
+ prev_box_right = box.right();
1380
+ }
1381
+ }
1382
+ else {
1383
+ cblob_it.set_to_list(word->cblob_list());
1384
+ for (cblob_it.mark_cycle_pt();
1385
+ !cblob_it.cycled_list(); cblob_it.forward()) {
1386
+ cblob = cblob_it.data();
1387
+ box = cblob->bounding_box();
1388
+ if (prev_box_right > -1) {
1389
+ gap_width = box.left() - prev_box_right;
1390
+ all_gap_stats.add(gap_width, 1);
1391
+ if (cblob_it.at_first()) {
1392
+ if (gap_width < min_inter_word_gap)
1393
+ min_inter_word_gap = gap_width;
1394
+ }
1395
+ else {
1396
+ if (gap_width > max_inter_char_gap)
1397
+ max_inter_char_gap = gap_width;
1398
+ }
1399
+ }
1400
+ prev_box_right = box.right();
1401
+ }
1402
+ }
1403
+ }
1404
+ tprintf
1405
+ ("Max inter char gap = %d.\nMin inter word gap = %d.\n",
1406
+ max_inter_char_gap, min_inter_word_gap);
1407
+ all_gap_stats.short_print(NULL, TRUE);
1408
+ all_gap_stats.smooth(2);
1409
+ tprintf("SMOOTHED DATA...\n");
1410
+ all_gap_stats.short_print(NULL, TRUE);
1411
+ }
1412
+ }
1413
+ }
1414
+ }
1415
+ }
1416
+
1417
+
1418
+ /**********************************************************************
1419
+ * show_point()
1420
+ *
1421
+ * Show coords of point, blob bounding box, word bounding box and offset from
1422
+ * row baseline
1423
+ **********************************************************************/
1424
+
1425
+ void show_point( // display posn of bloba word
1426
+ BLOCK_LIST *block_list, // blocks to check
1427
+ float x,
1428
+ float y) {
1429
+ FCOORD pt(x, y);
1430
+ TBOX box;
1431
+ BLOCK_IT block_it(block_list);
1432
+ BLOCK *block;
1433
+ ROW_IT row_it;
1434
+ ROW *row;
1435
+ WERD_IT word_it;
1436
+ WERD *word;
1437
+ PBLOB_IT blob_it;
1438
+ PBLOB *blob;
1439
+ C_BLOB_IT cblob_it;
1440
+ C_BLOB *cblob;
1441
+
1442
+ char msg[160];
1443
+ char *msg_ptr = msg;
1444
+
1445
+ msg_ptr += sprintf(msg_ptr, "Pt:(%0.3f, %0.3f) ", x, y);
1446
+
1447
+ for (block_it.mark_cycle_pt();
1448
+ !block_it.cycled_list(); block_it.forward()) {
1449
+ block = block_it.data();
1450
+ if (block->bounding_box().contains(pt)) {
1451
+ row_it.set_to_list(block->row_list());
1452
+ for (row_it.mark_cycle_pt();
1453
+ !row_it.cycled_list(); row_it.forward()) {
1454
+ row = row_it.data();
1455
+ if (row->bounding_box().contains(pt)) {
1456
+ msg_ptr += sprintf(msg_ptr, "BL(x)=%0.3f ",
1457
+ row->base_line(x));
1458
+
1459
+ word_it.set_to_list(row->word_list());
1460
+ for (word_it.mark_cycle_pt();
1461
+ !word_it.cycled_list(); word_it.forward()) {
1462
+ word = word_it.data();
1463
+ box = word->bounding_box();
1464
+ if (box.contains(pt)) {
1465
+ msg_ptr += sprintf(msg_ptr,
1466
+ "Wd(%d, %d)/(%d, %d) ",
1467
+ box.left(), box.bottom(),
1468
+ box.right(), box.top());
1469
+
1470
+ if (word->flag(W_POLYGON)) {
1471
+ blob_it.set_to_list(word->blob_list());
1472
+ for (blob_it.mark_cycle_pt();
1473
+ !blob_it.cycled_list();
1474
+ blob_it.forward()) {
1475
+ blob = blob_it.data();
1476
+ box = blob->bounding_box();
1477
+ if (box.contains(pt)) {
1478
+ msg_ptr += sprintf(msg_ptr,
1479
+ "Blb(%d, %d)/(%d, %d) ",
1480
+ box.left(),
1481
+ box.bottom(),
1482
+ box.right(),
1483
+ box.top());
1484
+ }
1485
+ }
1486
+ }
1487
+ else {
1488
+ cblob_it.set_to_list(word->cblob_list());
1489
+ for (cblob_it.mark_cycle_pt();
1490
+ !cblob_it.cycled_list();
1491
+ cblob_it.forward()) {
1492
+ cblob = cblob_it.data();
1493
+ box = cblob->bounding_box();
1494
+ if (box.contains(pt)) {
1495
+ msg_ptr += sprintf(msg_ptr,
1496
+ "CBlb(%d, %d)/(%d, %d) ",
1497
+ box.left(),
1498
+ box.bottom(),
1499
+ box.right(),
1500
+ box.top());
1501
+ }
1502
+ }
1503
+ }
1504
+ }
1505
+ }
1506
+ }
1507
+ }
1508
+ }
1509
+ }
1510
+ image_win->AddMessage(msg);
1511
+ }
1512
+
1513
+
1514
+ /**********************************************************************
1515
+ * WERD PROCESSOR FUNCTIONS
1516
+ * ========================
1517
+ *
1518
+ * These routines are invoked by one or mode of:
1519
+ * process_all_words()
1520
+ * process_selected_words()
1521
+ * or
1522
+ * process_all_words_it()
1523
+ * process_selected_words_it()
1524
+ * for each word to be processed
1525
+ **********************************************************************/
1526
+
1527
+ /**********************************************************************
1528
+ * word_blank_and_set_display() Word processor
1529
+ *
1530
+ * Blank display of word then redisplay word according to current display mode
1531
+ * settings
1532
+ **********************************************************************/
1533
+
1534
+ BOOL8 word_blank_and_set_display( // display a word
1535
+ BLOCK *block, // block holding word
1536
+ ROW *row, // row holding word
1537
+ WERD *word // word to be processed
1538
+ ) {
1539
+ word->bounding_box().plot(image_win, ScrollView::BLACK, ScrollView::BLACK);
1540
+ return word_set_display(block, row, word);
1541
+ }
1542
+
1543
+
1544
+ /**********************************************************************
1545
+ * word_bln_display()
1546
+ *
1547
+ * Normalise word and display in word window
1548
+ **********************************************************************/
1549
+
1550
+ BOOL8 word_bln_display( // bln & display
1551
+ BLOCK *, // block holding word
1552
+ ROW *row, // row holding word
1553
+ WERD *word // word to be processed
1554
+ ) {
1555
+ WERD *bln_word;
1556
+
1557
+ bln_word = word->poly_copy(row->x_height());
1558
+ bln_word->baseline_normalise(row);
1559
+ bln_word_window_handle()->Clear();
1560
+ display_bln_lines(bln_word_window_handle(), ScrollView::CYAN,
1561
+ 1.0, 0.0f, -1000.0f, 1000.0f);
1562
+ bln_word->plot(bln_word_window_handle(), ScrollView::RED);
1563
+ delete bln_word;
1564
+ return TRUE;
1565
+ }
1566
+
1567
+
1568
+ /**********************************************************************
1569
+ * word_change_text()
1570
+ *
1571
+ * Change the correct text of a word
1572
+ **********************************************************************/
1573
+
1574
+ BOOL8 word_change_text( // change correct text
1575
+ BLOCK *block, // block holding word
1576
+ ROW *row, // row holding word
1577
+ WERD *word // word to be processed
1578
+ ) {
1579
+ char* cp = image_win->ShowInputDialog(
1580
+ "Enter/edit the correct text and press <<RETURN>>");
1581
+ word->set_text(cp);
1582
+ delete[] cp;
1583
+
1584
+ if (word_display_mode.bit(DF_TEXT) || word->display_flag(DF_TEXT)) {
1585
+ word_blank_and_set_display(block, row, word);
1586
+ ScrollView::Update();
1587
+ }
1588
+
1589
+ *current_image_changed = TRUE;
1590
+ return TRUE;
1591
+ }
1592
+
1593
+
1594
+ /**********************************************************************
1595
+ * word_copy()
1596
+ *
1597
+ * Copy a word to other display list
1598
+ **********************************************************************/
1599
+
1600
+ BOOL8 word_copy( // copy a word
1601
+ BLOCK *block, // block holding word
1602
+ ROW *row, // row holding word
1603
+ WERD *word // word to be processed
1604
+ ) {
1605
+ WERD *copy_word = new WERD;
1606
+
1607
+ *copy_word = *word;
1608
+ add_word(copy_word, row, block, other_block_list);
1609
+ *other_image_changed = TRUE;
1610
+ return TRUE;
1611
+ }
1612
+
1613
+
1614
+ /**********************************************************************
1615
+ * word_delete()
1616
+ *
1617
+ * Delete a word
1618
+ **********************************************************************/
1619
+
1620
+ BOOL8 word_delete( // delete a word
1621
+ BLOCK *block, // block holding word
1622
+ ROW *row, // row holding word
1623
+ WERD *word, // word to be processed
1624
+ BLOCK_IT &block_it, // block list iterator
1625
+ ROW_IT &row_it, // row list iterator
1626
+ WERD_IT &word_it // word list iterator
1627
+ ) {
1628
+ word_it.extract();
1629
+ word->bounding_box().plot(image_win, ScrollView::BLACK, ScrollView::BLACK);
1630
+ delete(word);
1631
+
1632
+ if (word_it.empty()) { // no words left in row
1633
+ // so delete row
1634
+ row_it.extract();
1635
+ row->bounding_box().plot(image_win, ScrollView::BLACK, ScrollView::BLACK);
1636
+ delete(row);
1637
+
1638
+ if (row_it.empty()) { // no rows left in blk
1639
+ // so delete block
1640
+ block_it.extract();
1641
+ block->bounding_box().plot(image_win, ScrollView::BLACK, ScrollView::BLACK);
1642
+ delete(block);
1643
+ }
1644
+ }
1645
+ *current_image_changed = TRUE;
1646
+ return TRUE;
1647
+ }
1648
+
1649
+
1650
+ /**********************************************************************
1651
+ * word_display() Word Processor
1652
+ *
1653
+ * Display a word according to its display modes
1654
+ **********************************************************************/
1655
+
1656
+ BOOL8 word_display( // display a word
1657
+ BLOCK *, // block holding word
1658
+ ROW *row, // row holding word
1659
+ WERD *word // word to be processed
1660
+ ) {
1661
+ TBOX word_bb; // word bounding box
1662
+ int word_height; // ht of word BB
1663
+ BOOL8 displayed_something = FALSE;
1664
+ BOOL8 displayed_rainbow = FALSE;
1665
+ float shift; // from bot left
1666
+ PBLOB_IT it; // blob iterator
1667
+ C_BLOB_IT c_it; // cblob iterator
1668
+ WERD *word_ptr; // poly copy
1669
+ WERD temp_word;
1670
+ float scale_factor; // for BN_POLYGON
1671
+
1672
+ /*
1673
+ Note the double coercions of(COLOUR)((inT32)editor_image_word_bb_color)
1674
+ etc. are to keep the compiler happy.
1675
+ */
1676
+
1677
+ // display bounding box
1678
+ if (word->display_flag(DF_BOX)) {
1679
+ word->bounding_box().plot(image_win,
1680
+ (ScrollView::Color)((inT32)
1681
+ editor_image_word_bb_color),
1682
+ (ScrollView::Color)((inT32)
1683
+ editor_image_word_bb_color));
1684
+
1685
+ ScrollView::Color c = (ScrollView::Color)
1686
+ ((inT32) editor_image_blob_bb_color);
1687
+ image_win->Pen(c);
1688
+ if (word->flag(W_POLYGON)) {
1689
+ it.set_to_list(word->blob_list());
1690
+ for (it.mark_cycle_pt(); !it.cycled_list(); it.forward())
1691
+ it.data()->bounding_box().plot(image_win);
1692
+ }
1693
+ else {
1694
+ c_it.set_to_list(word->cblob_list());
1695
+ for (c_it.mark_cycle_pt(); !c_it.cycled_list(); c_it.forward())
1696
+ c_it.data()->bounding_box().plot(image_win);
1697
+ }
1698
+ displayed_something = TRUE;
1699
+ }
1700
+
1701
+ // display edge steps
1702
+ if (word->display_flag(DF_EDGE_STEP) &&
1703
+ !word->flag(W_POLYGON)) { // edgesteps available
1704
+ word->plot(image_win); // rainbow colors
1705
+ displayed_something = TRUE;
1706
+ displayed_rainbow = TRUE;
1707
+ }
1708
+
1709
+ // display poly approx
1710
+ if (word->display_flag(DF_POLYGONAL)) {
1711
+ // need to convert
1712
+ if (!word->flag(W_POLYGON)) {
1713
+ word_ptr = word->poly_copy(row->x_height());
1714
+
1715
+ /* CALL POLYGONAL APPROXIMATOR WHEN AVAILABLE - on a temp_word */
1716
+
1717
+ if (displayed_rainbow)
1718
+ // ensure its visible
1719
+ word_ptr->plot(image_win, ScrollView::WHITE);
1720
+ else
1721
+ // rainbow colors
1722
+ word_ptr->plot(image_win);
1723
+ delete word_ptr;
1724
+ }
1725
+ else {
1726
+ if (displayed_rainbow)
1727
+ // ensure its visible
1728
+ word->plot(image_win, ScrollView::WHITE);
1729
+ else
1730
+ word->plot(image_win); // rainbow colors
1731
+ }
1732
+
1733
+ displayed_rainbow = TRUE;
1734
+ displayed_something = TRUE;
1735
+ }
1736
+
1737
+ // disp BN poly approx
1738
+ if (word->display_flag(DF_BN_POLYGONAL)) {
1739
+ // need to convert
1740
+ if (!word->flag(W_POLYGON)) {
1741
+ word_ptr = word->poly_copy(row->x_height());
1742
+ temp_word = *word_ptr;
1743
+ delete word_ptr;
1744
+
1745
+ /* CALL POLYGONAL APPROXIMATOR WHEN AVAILABLE - on a temp_word */
1746
+
1747
+ }
1748
+ else
1749
+ temp_word = *word; // copy word
1750
+ word_bb = word->bounding_box();
1751
+ if (!temp_word.flag(W_NORMALIZED))
1752
+ temp_word.baseline_normalise(row);
1753
+
1754
+ scale_factor = re_scale_and_move_bln_word(&temp_word, word_bb);
1755
+ display_bln_lines(image_win, ScrollView::CYAN, scale_factor,
1756
+ word_bb.bottom(), word_bb.left(), word_bb.right());
1757
+
1758
+ if (displayed_rainbow)
1759
+ // ensure its visible
1760
+ temp_word.plot(image_win, ScrollView::WHITE);
1761
+ else
1762
+ temp_word.plot(image_win); // rainbow colors
1763
+
1764
+ displayed_rainbow = TRUE;
1765
+ displayed_something = TRUE;
1766
+ }
1767
+
1768
+ // display correct text
1769
+ if (word->display_flag(DF_TEXT)) {
1770
+ word_bb = word->bounding_box();
1771
+ ScrollView::Color c =(ScrollView::Color)
1772
+ ((inT32) editor_image_blob_bb_color);
1773
+ image_win->Pen(c);
1774
+ word_height = word_bb.height();
1775
+ image_win->TextAttributes("Times", 0.75 * word_height,
1776
+ false, false, false);
1777
+ if (word_height < word_bb.width())
1778
+ shift = 0.25 * word_height;
1779
+ else
1780
+ shift = 0.0f;
1781
+
1782
+ image_win->Text(word_bb.left() + shift,
1783
+ word_bb.bottom() + 0.25 * word_height, word->text());
1784
+
1785
+ if (strlen(word->text()) > 0)
1786
+ displayed_something = TRUE;
1787
+ }
1788
+
1789
+ if (!displayed_something) // display BBox anyway
1790
+ word->bounding_box().plot(image_win,
1791
+ (ScrollView::Color)((inT32) editor_image_word_bb_color),
1792
+ (ScrollView::Color)((inT32)
1793
+ editor_image_word_bb_color));
1794
+ return TRUE;
1795
+ }
1796
+
1797
+
1798
+ /**********************************************************************
1799
+ * word_dumper()
1800
+ *
1801
+ * Dump members to the debug window
1802
+ **********************************************************************/
1803
+
1804
+ BOOL8 word_dumper( // dump word
1805
+ BLOCK *block, // block holding word
1806
+ ROW *row, // row holding word
1807
+ WERD *word // word to be processed
1808
+ ) {
1809
+
1810
+ tprintf("\nBlock data...\n");
1811
+ block->print(NULL, FALSE);
1812
+ tprintf("\nRow data...\n");
1813
+ row->print(NULL);
1814
+ tprintf("\nWord data...\n");
1815
+ word->print(NULL);
1816
+ return TRUE;
1817
+ }
1818
+
1819
+
1820
+ /**********************************************************************
1821
+ * word_set_display() Word processor
1822
+ *
1823
+ * Display word according to current display mode settings
1824
+ **********************************************************************/
1825
+
1826
+ BOOL8 word_set_display( // display a word
1827
+ BLOCK *block, // block holding word
1828
+ ROW *row, // row holding word
1829
+ WERD *word // word to be processed
1830
+ ) {
1831
+ TBOX word_bb; // word bounding box
1832
+
1833
+ word->set_display_flag(DF_BOX, word_display_mode.bit(DF_BOX));
1834
+ word->set_display_flag(DF_TEXT, word_display_mode.bit(DF_TEXT));
1835
+ word->set_display_flag(DF_POLYGONAL, word_display_mode.bit(DF_POLYGONAL));
1836
+ word->set_display_flag(DF_EDGE_STEP, word_display_mode.bit(DF_EDGE_STEP));
1837
+ word->set_display_flag(DF_BN_POLYGONAL,
1838
+ word_display_mode.bit(DF_BN_POLYGONAL));
1839
+ *current_image_changed = TRUE;
1840
+ return word_display(block, row, word);
1841
+ }
1842
+
1843
+
1844
+ /**********************************************************************
1845
+ * word_toggle_seg()
1846
+ *
1847
+ * Toggle the correct segmentation flag
1848
+ **********************************************************************/
1849
+
1850
+ BOOL8 word_toggle_seg( // toggle seg flag
1851
+ BLOCK *, // block holding word
1852
+ ROW *, // row holding word
1853
+ WERD *word // word to be processed
1854
+ ) {
1855
+ word->set_flag(W_SEGMENTED, !word->flag(W_SEGMENTED));
1856
+ *current_image_changed = TRUE;
1857
+ return TRUE;
1858
+ }
1859
+
1860
+ #endif // GRAPHICS_DISABLED
1861
+
1862
+ /* DEBUG ONLY */
1863
+
1864
+ void do_check_mem( // do it
1865
+ inT32 level) {
1866
+ check_mem("Doing it", level);
1867
+ }