[Debian-hebrew-package] [svn] r283 - in pkg/hocr/branches/upstream/current: . examples examples/hocr examples/hocr-gtk examples/hocr-qt po src tests

Lior Kaplan kaplan-guest at costa.debian.org
Sat Dec 24 18:39:43 UTC 2005


Author: kaplan-guest
Date: Sat Dec 24 18:37:24 2005
New Revision: 283

Added:
   pkg/hocr/branches/upstream/current/src/font_recognition.c
   pkg/hocr/branches/upstream/current/src/font_recognition.h
   pkg/hocr/branches/upstream/current/src/hocr_object.c
   pkg/hocr/branches/upstream/current/src/hocr_object.h
   pkg/hocr/branches/upstream/current/src/hocr_pixbuf.c
   pkg/hocr/branches/upstream/current/src/hocr_pixbuf.h
   pkg/hocr/branches/upstream/current/src/hocr_textbuffer.c
   pkg/hocr/branches/upstream/current/src/hocr_textbuffer.h
   pkg/hocr/branches/upstream/current/tests/test3.jpg   (contents, props changed)
   pkg/hocr/branches/upstream/current/tests/test4.jpg   (contents, props changed)
   pkg/hocr/branches/upstream/current/tests/test5.jpg   (contents, props changed)
   pkg/hocr/branches/upstream/current/tests/test6.jpg   (contents, props changed)
   pkg/hocr/branches/upstream/current/tests/test7.jpg   (contents, props changed)
Removed:
   pkg/hocr/branches/upstream/current/examples/COPYING_examples
   pkg/hocr/branches/upstream/current/examples/README_examples
   pkg/hocr/branches/upstream/current/examples/hocr-qt/
   pkg/hocr/branches/upstream/current/hocr.spec
   pkg/hocr/branches/upstream/current/hocr.spec.in
   pkg/hocr/branches/upstream/current/src/font_markers.c
   pkg/hocr/branches/upstream/current/src/font_markers.h
   pkg/hocr/branches/upstream/current/src/hocrpp.h
Modified:
   pkg/hocr/branches/upstream/current/BUGS
   pkg/hocr/branches/upstream/current/ChangeLog
   pkg/hocr/branches/upstream/current/Makefile.am
   pkg/hocr/branches/upstream/current/Makefile.in
   pkg/hocr/branches/upstream/current/aclocal.m4
   pkg/hocr/branches/upstream/current/autogen.sh   (props changed)
   pkg/hocr/branches/upstream/current/config.guess   (props changed)
   pkg/hocr/branches/upstream/current/config.sub   (props changed)
   pkg/hocr/branches/upstream/current/configure   (contents, props changed)
   pkg/hocr/branches/upstream/current/configure.in
   pkg/hocr/branches/upstream/current/examples/Makefile.am
   pkg/hocr/branches/upstream/current/examples/Makefile.in
   pkg/hocr/branches/upstream/current/examples/hocr-gtk/Makefile.am
   pkg/hocr/branches/upstream/current/examples/hocr-gtk/Makefile.in
   pkg/hocr/branches/upstream/current/examples/hocr-gtk/callbacks.c
   pkg/hocr/branches/upstream/current/examples/hocr-gtk/callbacks.h
   pkg/hocr/branches/upstream/current/examples/hocr-gtk/hocr-gtk.c
   pkg/hocr/branches/upstream/current/examples/hocr-gtk/interface.c
   pkg/hocr/branches/upstream/current/examples/hocr-gtk/interface.h
   pkg/hocr/branches/upstream/current/examples/hocr/Makefile.am
   pkg/hocr/branches/upstream/current/examples/hocr/Makefile.in
   pkg/hocr/branches/upstream/current/examples/hocr/hocr-cmd.c
   pkg/hocr/branches/upstream/current/examples/hocr/hocr.1
   pkg/hocr/branches/upstream/current/install-sh   (props changed)
   pkg/hocr/branches/upstream/current/libhocr.pc
   pkg/hocr/branches/upstream/current/missing   (props changed)
   pkg/hocr/branches/upstream/current/mkinstalldirs   (contents, props changed)
   pkg/hocr/branches/upstream/current/po/he.gmo
   pkg/hocr/branches/upstream/current/po/he.po
   pkg/hocr/branches/upstream/current/po/hocr-gtk.pot
   pkg/hocr/branches/upstream/current/src/Makefile.am
   pkg/hocr/branches/upstream/current/src/Makefile.in
   pkg/hocr/branches/upstream/current/src/consts.h
   pkg/hocr/branches/upstream/current/src/font_layout.c
   pkg/hocr/branches/upstream/current/src/font_layout.h
   pkg/hocr/branches/upstream/current/src/hocr.c
   pkg/hocr/branches/upstream/current/src/hocr.h
   pkg/hocr/branches/upstream/current/src/page_layout.c
   pkg/hocr/branches/upstream/current/src/page_layout.h
   pkg/hocr/branches/upstream/current/tests/Makefile.am
   pkg/hocr/branches/upstream/current/tests/Makefile.in
Log:
Load /tmp/tmp.TcCvvM/hocr-0.6.4 into
pkg/hocr/branches/upstream/current.


Modified: pkg/hocr/branches/upstream/current/BUGS
==============================================================================
--- pkg/hocr/branches/upstream/current/BUGS	(original)
+++ pkg/hocr/branches/upstream/current/BUGS	Sat Dec 24 18:37:24 2005
@@ -8,7 +8,7 @@
 
 bugs:
 
-   - find out why programs crash on some inputs.
+   - find out why programs crash on some inputs. [done, kobi 1,12,2005]
    - give some feedback when input is unreadble.
 
 code cleaning:
@@ -21,6 +21,8 @@
 
 features:
 
+   - add dictionary support
+   - add suport for multi columns pages [done, kobi 9,12,2005]
    - add support for new shapes (numbers, english letters)
    - add support for nikud.
    - add support for more then one shape for each font.

Modified: pkg/hocr/branches/upstream/current/ChangeLog
==============================================================================
--- pkg/hocr/branches/upstream/current/ChangeLog	(original)
+++ pkg/hocr/branches/upstream/current/ChangeLog	Sat Dec 24 18:37:24 2005
@@ -1,3 +1,50 @@
+hocr (0.6.4)
+
+ * make memory allocation dinamic in do_ocr
+
+ -- Yaacov Zamir <kzamir at walla.co.il>  Wed, 14 Dec 2005 22:13
+
+hocr (0.6.1)
+
+ * code cleanups
+ * add benchmark tests for: 
+   Literature, poetry (with nikud) and bible texts.
+
+ -- Yaacov Zamir <kzamir at walla.co.il>  Wed, 14 Dec 2005 22:13
+ 
+hocr (0.6.0)
+
+ * can read nikud
+ * add command var to the pixbuf structure
+
+ -- Yaacov Zamir <kzamir at walla.co.il>  Tue, 13 Dec 2005 22:13
+ 
+hocr (0.5.1)
+  
+  * examples now named: hocr, hocr-gtk
+  * fix line equation for short lines
+  * create different file for different objects
+  * use a textbuffer structure
+   
+  -- Yaacov Zamir <kzamir at walla.co.il>  Sat, 10 Dec 2005 22:13
+
+hocr (0.4.8)
+
+  * Use columns
+  * Ignure nikud marks
+  * use non horizontal lines
+  * add command to the image buffer struct to let user control ocr.
+  * add none-used error to the image struct to let peogram return 
+    feedback to user
+
+  -- Yaacov Zamir <kzamir at walla.co.il> Wed, 07 Dec 2005 22:13
+
+hocr (0.4.7)
+
+  * Remove cpp (and hocr-qt) bindings, untill API stabilize.
+
+  -- Yaacov Zamir <kzamir at walla.co.il> Wed, 07 Dec 2005 22:13
+
 hocr (0.4.6)
 
   * Fix a bug in get/set bit functions

Modified: pkg/hocr/branches/upstream/current/Makefile.am
==============================================================================
--- pkg/hocr/branches/upstream/current/Makefile.am	(original)
+++ pkg/hocr/branches/upstream/current/Makefile.am	Sat Dec 24 18:37:24 2005
@@ -1,9 +1,9 @@
 ## Process this file with automake to produce Makefile.in
 
-SUBDIRS = src po tests examples
+SUBDIRS = src $(PO_DIR) tests examples
 
 EXTRA_DIST = \
-	autogen.sh hocr.spec.in hocr.spec libhocr.pc.in libhocr.pc BUGS HACKING
+	autogen.sh libhocr.pc.in libhocr.pc BUGS HACKING
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libhocr.pc

Modified: pkg/hocr/branches/upstream/current/Makefile.in
==============================================================================
--- pkg/hocr/branches/upstream/current/Makefile.in	(original)
+++ pkg/hocr/branches/upstream/current/Makefile.in	Sat Dec 24 18:37:24 2005
@@ -57,8 +57,12 @@
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+build_alias = @build_alias@
+build_triplet = @build@
 host_alias = @host_alias@
 host_triplet = @host@
+target_alias = @target_alias@
+target_triplet = @target@
 AR = @AR@
 AS = @AS@
 CATALOGS = @CATALOGS@
@@ -95,6 +99,7 @@
 PKG_CONFIG = @PKG_CONFIG@
 POFILES = @POFILES@
 POSUB = @POSUB@
+PO_DIR = @PO_DIR@
 PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@
 PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@
 RANLIB = @RANLIB@
@@ -103,12 +108,16 @@
 USE_NLS = @USE_NLS@
 VERSION = @VERSION@
 VERSION_INFO = @VERSION_INFO@
+WINDRES = @WINDRES@
+WITH_GTKSPELL = @WITH_GTKSPELL@
 gtk_CFLAGS = @gtk_CFLAGS@
 gtk_LIBS = @gtk_LIBS@
+gtkspell_CFLAGS = @gtkspell_CFLAGS@
+gtkspell_LIBS = @gtkspell_LIBS@
 
-SUBDIRS = src po tests examples
+SUBDIRS = src $(PO_DIR) tests examples
 
-EXTRA_DIST =  	autogen.sh hocr.spec.in hocr.spec libhocr.pc.in libhocr.pc BUGS HACKING
+EXTRA_DIST =  	autogen.sh libhocr.pc.in libhocr.pc BUGS HACKING
 
 
 pkgconfigdir = $(libdir)/pkgconfig
@@ -120,13 +129,13 @@
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_HEADER = config.h
-CONFIG_CLEAN_FILES =  hocr.spec libhocr.pc
+CONFIG_CLEAN_FILES =  libhocr.pc
 DATA =  $(hocrdoc_DATA) $(pkgconfig_DATA)
 
 DIST_COMMON =  README ./stamp-h.in AUTHORS COPYING ChangeLog INSTALL \
 Makefile.am Makefile.in NEWS aclocal.m4 config.guess config.h.in \
-config.sub configure configure.in hocr.spec.in install-sh libhocr.pc.in \
-ltmain.sh missing mkinstalldirs
+config.sub configure configure.in install-sh libhocr.pc.in ltmain.sh \
+missing mkinstalldirs
 
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
@@ -177,8 +186,6 @@
 	-rm -f config.h
 
 maintainer-clean-hdr:
-hocr.spec: $(top_builddir)/config.status hocr.spec.in
-	cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
 libhocr.pc: $(top_builddir)/config.status libhocr.pc.in
 	cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
 

Modified: pkg/hocr/branches/upstream/current/aclocal.m4
==============================================================================
--- pkg/hocr/branches/upstream/current/aclocal.m4	(original)
+++ pkg/hocr/branches/upstream/current/aclocal.m4	Sat Dec 24 18:37:24 2005
@@ -951,6 +951,29 @@
 fi
 AC_SUBST($1)])
 
+# Like AC_CONFIG_HEADER, but automatically create stamp file.
+
+AC_DEFUN([AM_CONFIG_HEADER],
+[AC_PREREQ([2.12])
+AC_CONFIG_HEADER([$1])
+dnl When config.status generates a header, we must update the stamp-h file.
+dnl This file resides in the same directory as the config header
+dnl that is generated.  We must strip everything past the first ":",
+dnl and everything past the last "/".
+AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
+ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
+<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
+<<am_indx=1
+for am_file in <<$1>>; do
+  case " <<$>>CONFIG_HEADERS " in
+  *" <<$>>am_file "*<<)>>
+    echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
+    ;;
+  esac
+  am_indx=`expr "<<$>>am_indx" + 1`
+done<<>>dnl>>)
+changequote([,]))])
+
 # Add --enable-maintainer-mode option to configure.
 # From Jim Meyering
 
@@ -984,29 +1007,6 @@
   $1_FALSE=
 fi])
 
-# Like AC_CONFIG_HEADER, but automatically create stamp file.
-
-AC_DEFUN([AM_CONFIG_HEADER],
-[AC_PREREQ([2.12])
-AC_CONFIG_HEADER([$1])
-dnl When config.status generates a header, we must update the stamp-h file.
-dnl This file resides in the same directory as the config header
-dnl that is generated.  We must strip everything past the first ":",
-dnl and everything past the last "/".
-AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
-ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
-<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
-<<am_indx=1
-for am_file in <<$1>>; do
-  case " <<$>>CONFIG_HEADERS " in
-  *" <<$>>am_file "*<<)>>
-    echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
-    ;;
-  esac
-  am_indx=`expr "<<$>>am_indx" + 1`
-done<<>>dnl>>)
-changequote([,]))])
-
 # isc-posix.m4 serial 2 (gettext-0.11.2)
 dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation

Modified: pkg/hocr/branches/upstream/current/configure
==============================================================================
--- pkg/hocr/branches/upstream/current/configure	(original)
+++ pkg/hocr/branches/upstream/current/configure	Sat Dec 24 18:37:24 2005
@@ -463,7 +463,7 @@
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO SET_MAKE MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT VERSION_INFO CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP build build_cpu build_vendor build_os host host_cpu host_vendor host_os LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP CXX CXXFLAGS ac_ct_CXX CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG GETTEXT_PACKAGE USE_NLS MSGFMT GMSGFMT XGETTEXT CATALOGS CATOBJEXT DATADIRNAME GMOFILES INSTOBJEXT INTLLIBS PO_IN_DATADIR_TRUE PO_IN_DATADIR_FALSE POFILES POSUB MKINSTALLDIRS ac_pt_PKG_CONFIG gtk_CFLAGS gtk_LIBS WITH_GTK_TRUE WITH_GTK_FALSE WITH_CMD_TRUE WITH_CMD_FALSE PACKAGE_CFLAGS PACKAGE_LIBS LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO SET_MAKE MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT VERSION_INFO CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP CXX CXXFLAGS ac_ct_CXX CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG WINDRES ac_ct_WINDRES WITH_WIN32_TRUE WITH_WIN32_FALSE GETTEXT_PACKAGE USE_NLS MSGFMT GMSGFMT XGETTEXT CATALOGS CATOBJEXT DATADIRNAME GMOFILES INSTOBJEXT INTLLIBS PO_IN_DATADIR_TRUE PO_IN_DATADIR_FALSE POFILES POSUB MKINSTALLDIRS PO_DIR ac_pt_PKG_CONFIG gtk_CFLAGS gtk_LIBS WITH_GTK_TRUE WITH_GTK_FALSE gtkspell_CFLAGS gtkspell_LIBS WITH_GTKSPELL_TRUE WITH_GTKSPELL_FALSE WITH_GTKSPELL WITH_CMD_TRUE WITH_CMD_FALSE PACKAGE_CFLAGS PACKAGE_LIBS LIBOBJS LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -956,6 +956,14 @@
 ac_env_gtk_LIBS_value=$gtk_LIBS
 ac_cv_env_gtk_LIBS_set=${gtk_LIBS+set}
 ac_cv_env_gtk_LIBS_value=$gtk_LIBS
+ac_env_gtkspell_CFLAGS_set=${gtkspell_CFLAGS+set}
+ac_env_gtkspell_CFLAGS_value=$gtkspell_CFLAGS
+ac_cv_env_gtkspell_CFLAGS_set=${gtkspell_CFLAGS+set}
+ac_cv_env_gtkspell_CFLAGS_value=$gtkspell_CFLAGS
+ac_env_gtkspell_LIBS_set=${gtkspell_LIBS+set}
+ac_env_gtkspell_LIBS_value=$gtkspell_LIBS
+ac_cv_env_gtkspell_LIBS_set=${gtkspell_LIBS+set}
+ac_cv_env_gtkspell_LIBS_value=$gtkspell_LIBS
 
 #
 # Report the --help message.
@@ -1025,6 +1033,7 @@
 System types:
   --build=BUILD     configure for building on BUILD [guessed]
   --host=HOST       cross-compile to build programs to run on HOST [BUILD]
+  --target=TARGET   configure for building compilers for TARGET [HOST]
 _ACEOF
 fi
 
@@ -1044,8 +1053,10 @@
   --enable-fast-install[=PKGS]
                           optimize for fast installation [default=yes]
   --disable-libtool-lock  avoid locking (might break parallel builds)
-  --disable-gtk		build hocr-gtk program [default=yes]
-  --disable-cmd		build hocr program [default=yes]
+  --disable-nls		disable native language support
+  --disable-gtk		do not build hocr-gtk program
+  --disable-gtkspell	do not build hocr-gtk spellchecker
+  --disable-cmd		do not build hocr program
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -1072,6 +1083,10 @@
   PKG_CONFIG  path to pkg-config utility
   gtk_CFLAGS  C compiler flags for gtk, overriding pkg-config
   gtk_LIBS    linker flags for gtk, overriding pkg-config
+  gtkspell_CFLAGS
+              C compiler flags for gtkspell, overriding pkg-config
+  gtkspell_LIBS
+              linker flags for gtkspell, overriding pkg-config
 
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
@@ -1511,7 +1526,6 @@
 
 
 
-am__api_version="1.4"
 ac_aux_dir=
 for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
   if test -f $ac_dir/install-sh; then
@@ -1537,6 +1551,89 @@
 ac_config_sub="$SHELL $ac_aux_dir/config.sub"
 ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
 
+# Make sure we can run config.sub.
+$ac_config_sub sun4 >/dev/null 2>&1 ||
+  { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
+echo "$as_me: error: cannot run $ac_config_sub" >&2;}
+   { (exit 1); exit 1; }; }
+
+echo "$as_me:$LINENO: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6
+if test "${ac_cv_build+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_build_alias=$build_alias
+test -z "$ac_cv_build_alias" &&
+  ac_cv_build_alias=`$ac_config_guess`
+test -z "$ac_cv_build_alias" &&
+  { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+   { (exit 1); exit 1; }; }
+ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
+  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6
+build=$ac_cv_build
+build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+echo "$as_me:$LINENO: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6
+if test "${ac_cv_host+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_host_alias=$host_alias
+test -z "$ac_cv_host_alias" &&
+  ac_cv_host_alias=$ac_cv_build_alias
+ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
+  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6
+host=$ac_cv_host
+host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+echo "$as_me:$LINENO: checking target system type" >&5
+echo $ECHO_N "checking target system type... $ECHO_C" >&6
+if test "${ac_cv_target+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_target_alias=$target_alias
+test "x$ac_cv_target_alias" = "x" &&
+  ac_cv_target_alias=$ac_cv_host_alias
+ac_cv_target=`$ac_config_sub $ac_cv_target_alias` ||
+  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_target_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_target" >&5
+echo "${ECHO_T}$ac_cv_target" >&6
+target=$ac_cv_target
+target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+test -n "$target_alias" &&
+  test "$program_prefix$program_suffix$program_transform_name" = \
+    NONENONEs,x,x, &&
+  program_prefix=${target_alias}-
+am__api_version="1.4"
 # Find a good install program.  We prefer a C program (faster),
 # so one script is as good as another.  But avoid the broken or
 # incompatible versions:
@@ -1706,7 +1803,7 @@
 
 PACKAGE=hocr
 
-VERSION=0.4.6
+VERSION=0.6.4
 
 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
   { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
@@ -1802,6 +1899,11 @@
 fi
 
 
+
+          ac_config_headers="$ac_config_headers config.h"
+
+          ac_config_commands="$ac_config_commands default-1"
+
 echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5
 echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6
     # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
@@ -1826,14 +1928,9 @@
 
 
 
-          ac_config_headers="$ac_config_headers config.h"
-
-          ac_config_commands="$ac_config_commands default-1"
-
 VERSION_INFO=0:0:0
 
 
-
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -4148,60 +4245,6 @@
   enable_fast_install=yes
 fi;
 
-# Make sure we can run config.sub.
-$ac_config_sub sun4 >/dev/null 2>&1 ||
-  { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
-echo "$as_me: error: cannot run $ac_config_sub" >&2;}
-   { (exit 1); exit 1; }; }
-
-echo "$as_me:$LINENO: checking build system type" >&5
-echo $ECHO_N "checking build system type... $ECHO_C" >&6
-if test "${ac_cv_build+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_cv_build_alias=$build_alias
-test -z "$ac_cv_build_alias" &&
-  ac_cv_build_alias=`$ac_config_guess`
-test -z "$ac_cv_build_alias" &&
-  { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
-echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
-   { (exit 1); exit 1; }; }
-ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
-  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5
-echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;}
-   { (exit 1); exit 1; }; }
-
-fi
-echo "$as_me:$LINENO: result: $ac_cv_build" >&5
-echo "${ECHO_T}$ac_cv_build" >&6
-build=$ac_cv_build
-build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-
-
-echo "$as_me:$LINENO: checking host system type" >&5
-echo $ECHO_N "checking host system type... $ECHO_C" >&6
-if test "${ac_cv_host+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_cv_host_alias=$host_alias
-test -z "$ac_cv_host_alias" &&
-  ac_cv_host_alias=$ac_cv_build_alias
-ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
-  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5
-echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
-   { (exit 1); exit 1; }; }
-
-fi
-echo "$as_me:$LINENO: result: $ac_cv_host" >&5
-echo "${ECHO_T}$ac_cv_host" >&6
-host=$ac_cv_host
-host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-
-
 echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5
 echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6
 if test "${lt_cv_path_SED+set}" = set; then
@@ -4666,7 +4709,7 @@
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 4669 "configure"' > conftest.$ac_ext
+  echo '#line 4712 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -5728,7 +5771,7 @@
 
 
 # Provide some information about the compiler.
-echo "$as_me:5731:" \
+echo "$as_me:5774:" \
      "checking for Fortran 77 compiler version" >&5
 ac_compiler=`set X $ac_compile; echo $2`
 { (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@@ -6824,11 +6867,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:6827: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:6870: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:6831: \$? = $ac_status" >&5
+   echo "$as_me:6874: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -7086,11 +7129,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7089: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7132: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7093: \$? = $ac_status" >&5
+   echo "$as_me:7136: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -7148,11 +7191,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7151: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7194: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:7155: \$? = $ac_status" >&5
+   echo "$as_me:7198: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -9400,7 +9443,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 9403 "configure"
+#line 9446 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -9498,7 +9541,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 9501 "configure"
+#line 9544 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11751,11 +11794,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:11754: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:11797: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:11758: \$? = $ac_status" >&5
+   echo "$as_me:11801: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -11813,11 +11856,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:11816: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:11859: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:11820: \$? = $ac_status" >&5
+   echo "$as_me:11863: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -13198,7 +13241,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 13201 "configure"
+#line 13244 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -13296,7 +13339,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 13299 "configure"
+#line 13342 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -14181,11 +14224,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14184: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:14227: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:14188: \$? = $ac_status" >&5
+   echo "$as_me:14231: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -14243,11 +14286,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14246: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:14289: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:14250: \$? = $ac_status" >&5
+   echo "$as_me:14293: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -16384,11 +16427,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16387: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16430: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:16391: \$? = $ac_status" >&5
+   echo "$as_me:16434: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -16646,11 +16689,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16649: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16692: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:16653: \$? = $ac_status" >&5
+   echo "$as_me:16696: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -16708,11 +16751,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16711: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16754: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:16715: \$? = $ac_status" >&5
+   echo "$as_me:16758: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -18960,7 +19003,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 18963 "configure"
+#line 19006 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -19058,7 +19101,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 19061 "configure"
+#line 19104 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -20153,7 +20196,112 @@
 PACKAGE_CFLAGS=
 PACKAGE_LIBS=-lm
 
-GETTEXT_PACKAGE=hocr
+win32=no
+case "${host_os}" in
+  *mingw* | pw32* | cygwin*)
+	win32="yes"
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args.
+set dummy ${ac_tool_prefix}windres; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_WINDRES+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$WINDRES"; then
+  ac_cv_prog_WINDRES="$WINDRES" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_WINDRES="${ac_tool_prefix}windres"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+WINDRES=$ac_cv_prog_WINDRES
+if test -n "$WINDRES"; then
+  echo "$as_me:$LINENO: result: $WINDRES" >&5
+echo "${ECHO_T}$WINDRES" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_WINDRES"; then
+  ac_ct_WINDRES=$WINDRES
+  # Extract the first word of "windres", so it can be a program name with args.
+set dummy windres; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_WINDRES+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_WINDRES"; then
+  ac_cv_prog_ac_ct_WINDRES="$ac_ct_WINDRES" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_WINDRES="windres"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_prog_ac_ct_WINDRES" && ac_cv_prog_ac_ct_WINDRES=":"
+fi
+fi
+ac_ct_WINDRES=$ac_cv_prog_ac_ct_WINDRES
+if test -n "$ac_ct_WINDRES"; then
+  echo "$as_me:$LINENO: result: $ac_ct_WINDRES" >&5
+echo "${ECHO_T}$ac_ct_WINDRES" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  WINDRES=$ac_ct_WINDRES
+else
+  WINDRES="$ac_cv_prog_WINDRES"
+fi
+
+    PACKAGE_CFLAGS="$PACKAGE_CFLAGS -mms-bitfields -mno-cygwin"
+esac
+
+
+if test x"$win32" = "xyes"; then
+  WITH_WIN32_TRUE=
+  WITH_WIN32_FALSE='#'
+else
+  WITH_WIN32_TRUE='#'
+  WITH_WIN32_FALSE=
+fi
+
+# Check whether --enable-nls or --disable-nls was given.
+if test "${enable_nls+set}" = set; then
+  enableval="$enable_nls"
+  nls="$enableval"
+else
+  nls=yes
+fi;
+
+if test "x$nls" = "xyes"; then
+	GETTEXT_PACKAGE=hocr-gtk
 
 
 cat >>confdefs.h <<_ACEOF
@@ -20161,7 +20309,7 @@
 _ACEOF
 
 
-ALL_LINGUAS="he"
+		ALL_LINGUAS="he"
 
 
 for ac_header in locale.h
@@ -21716,8 +21864,13 @@
 	< $srcdir/po/POTFILES.in > po/POTFILES
 
 
+	PO_DIR=po
+
+fi
+
 
 build_gtk=yes
+gtk=no
 
 # Check whether --enable-gtk or --disable-gtk was given.
 if test "${enable_gtk+set}" = set; then
@@ -21727,7 +21880,8 @@
   build_gtk=yes
 fi;
 
-gtk_pkg_modules="gtk+-2.0 gtkspell-2.0"
+if test "x$build_gtk" = "xyes"; then
+	gtk_pkg_modules="gtk+-2.0"
 
 
 if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
@@ -21904,19 +22058,11 @@
 fi
 
 
-
-if test "x$gtk" = "xyes"; then
-          echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
-else
-		  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-		  build_gtk=no
 fi
 
 
 
-if test "x$build_gtk" = "xyes"; then
+if test "x$gtk" = "xyes"; then
   WITH_GTK_TRUE=
   WITH_GTK_FALSE='#'
 else
@@ -21925,7 +22071,108 @@
 fi
 
 
+build_gtkspell=yes
+gtkspell=no
+
+# Check whether --enable-gtkspell or --disable-gtkspell was given.
+if test "${enable_gtkspell+set}" = set; then
+  enableval="$enable_gtkspell"
+  build_gtkspell="$enableval"
+else
+  build_gtkspell=yes
+fi;
+
+if test "x$gtk" = "xyes"; then
+	if test "x$build_gtkspell" = "xyes"; then
+		gtkspell_pkg_modules="gtkspell-2.0"
+
+pkg_failed=no
+echo "$as_me:$LINENO: checking for gtkspell" >&5
+echo $ECHO_N "checking for gtkspell... $ECHO_C" >&6
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$gtkspell_CFLAGS"; then
+        pkg_cv_gtkspell_CFLAGS="$gtkspell_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"\$gtkspell_pkg_modules\"") >&5
+  ($PKG_CONFIG --exists --print-errors "$gtkspell_pkg_modules") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  pkg_cv_gtkspell_CFLAGS=`$PKG_CONFIG --cflags "$gtkspell_pkg_modules" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$gtkspell_LIBS"; then
+        pkg_cv_gtkspell_LIBS="$gtkspell_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"\$gtkspell_pkg_modules\"") >&5
+  ($PKG_CONFIG --exists --print-errors "$gtkspell_pkg_modules") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  pkg_cv_gtkspell_LIBS=`$PKG_CONFIG --libs "$gtkspell_pkg_modules" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+	pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+	        gtkspell_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$gtkspell_pkg_modules"`
+        else
+	        gtkspell_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$gtkspell_pkg_modules"`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$gtkspell_PKG_ERRORS" >&5
+
+	gtkspell=no
+elif test $pkg_failed = untried; then
+	gtkspell=no
+else
+	gtkspell_CFLAGS=$pkg_cv_gtkspell_CFLAGS
+	gtkspell_LIBS=$pkg_cv_gtkspell_LIBS
+        echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+	gtkspell=yes
+fi
+
+
+	fi
+fi
+
+
+
+if test "x$gtkspell" = "xyes"; then
+  WITH_GTKSPELL_TRUE=
+  WITH_GTKSPELL_FALSE='#'
+else
+  WITH_GTKSPELL_TRUE='#'
+  WITH_GTKSPELL_FALSE=
+fi
+
+
+
 build_cmd=yes
+cmd=no
 
 # Check whether --enable-cmd or --disable-cmd was given.
 if test "${enable_cmd+set}" = set; then
@@ -21935,9 +22182,13 @@
   build_cmd=yes
 fi;
 
+if test "x$build_cmd" = "xyes"; then
+	cmd=yes
+fi
 
 
-if test "x$build_cmd" = "xyes"; then
+
+if test "x$cmd" = "xyes"; then
   WITH_CMD_TRUE=
   WITH_CMD_FALSE='#'
 else
@@ -21950,7 +22201,7 @@
 
 
 
-                                                                                          ac_config_files="$ac_config_files Makefile hocr.spec libhocr.pc src/Makefile po/Makefile.in tests/Makefile examples/Makefile examples/hocr-gtk/Makefile examples/cmd/Makefile"
+                                                                                ac_config_files="$ac_config_files Makefile libhocr.pc src/Makefile po/Makefile.in tests/Makefile examples/Makefile examples/hocr-gtk/Makefile examples/hocr/Makefile"
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
 # tests run on this system so they can be shared between configure
@@ -22488,14 +22739,13 @@
   case "$ac_config_target" in
   # Handling of arguments.
   "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
-  "hocr.spec" ) CONFIG_FILES="$CONFIG_FILES hocr.spec" ;;
   "libhocr.pc" ) CONFIG_FILES="$CONFIG_FILES libhocr.pc" ;;
   "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
   "po/Makefile.in" ) CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;;
   "tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
   "examples/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;;
   "examples/hocr-gtk/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/hocr-gtk/Makefile" ;;
-  "examples/cmd/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/cmd/Makefile" ;;
+  "examples/hocr/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/hocr/Makefile" ;;
   "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
   "default-2" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-2" ;;
   "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
@@ -22584,6 +22834,18 @@
 s, at ECHO_N@,$ECHO_N,;t t
 s, at ECHO_T@,$ECHO_T,;t t
 s, at LIBS@,$LIBS,;t t
+s, at build@,$build,;t t
+s, at build_cpu@,$build_cpu,;t t
+s, at build_vendor@,$build_vendor,;t t
+s, at build_os@,$build_os,;t t
+s, at host@,$host,;t t
+s, at host_cpu@,$host_cpu,;t t
+s, at host_vendor@,$host_vendor,;t t
+s, at host_os@,$host_os,;t t
+s, at target@,$target,;t t
+s, at target_cpu@,$target_cpu,;t t
+s, at target_vendor@,$target_vendor,;t t
+s, at target_os@,$target_os,;t t
 s, at INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
 s, at INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
 s, at INSTALL_DATA@,$INSTALL_DATA,;t t
@@ -22608,14 +22870,6 @@
 s, at OBJEXT@,$OBJEXT,;t t
 s, at CPP@,$CPP,;t t
 s, at EGREP@,$EGREP,;t t
-s, at build@,$build,;t t
-s, at build_cpu@,$build_cpu,;t t
-s, at build_vendor@,$build_vendor,;t t
-s, at build_os@,$build_os,;t t
-s, at host@,$host,;t t
-s, at host_cpu@,$host_cpu,;t t
-s, at host_vendor@,$host_vendor,;t t
-s, at host_os@,$host_os,;t t
 s, at LN_S@,$LN_S,;t t
 s, at ECHO@,$ECHO,;t t
 s, at AR@,$AR,;t t
@@ -22633,6 +22887,10 @@
 s, at ac_ct_F77@,$ac_ct_F77,;t t
 s, at LIBTOOL@,$LIBTOOL,;t t
 s, at PKG_CONFIG@,$PKG_CONFIG,;t t
+s, at WINDRES@,$WINDRES,;t t
+s, at ac_ct_WINDRES@,$ac_ct_WINDRES,;t t
+s, at WITH_WIN32_TRUE@,$WITH_WIN32_TRUE,;t t
+s, at WITH_WIN32_FALSE@,$WITH_WIN32_FALSE,;t t
 s, at GETTEXT_PACKAGE@,$GETTEXT_PACKAGE,;t t
 s, at USE_NLS@,$USE_NLS,;t t
 s, at MSGFMT@,$MSGFMT,;t t
@@ -22649,11 +22907,17 @@
 s, at POFILES@,$POFILES,;t t
 s, at POSUB@,$POSUB,;t t
 s, at MKINSTALLDIRS@,$MKINSTALLDIRS,;t t
+s, at PO_DIR@,$PO_DIR,;t t
 s, at ac_pt_PKG_CONFIG@,$ac_pt_PKG_CONFIG,;t t
 s, at gtk_CFLAGS@,$gtk_CFLAGS,;t t
 s, at gtk_LIBS@,$gtk_LIBS,;t t
 s, at WITH_GTK_TRUE@,$WITH_GTK_TRUE,;t t
 s, at WITH_GTK_FALSE@,$WITH_GTK_FALSE,;t t
+s, at gtkspell_CFLAGS@,$gtkspell_CFLAGS,;t t
+s, at gtkspell_LIBS@,$gtkspell_LIBS,;t t
+s, at WITH_GTKSPELL_TRUE@,$WITH_GTKSPELL_TRUE,;t t
+s, at WITH_GTKSPELL_FALSE@,$WITH_GTKSPELL_FALSE,;t t
+s, at WITH_GTKSPELL@,$WITH_GTKSPELL,;t t
 s, at WITH_CMD_TRUE@,$WITH_CMD_TRUE,;t t
 s, at WITH_CMD_FALSE@,$WITH_CMD_FALSE,;t t
 s, at PACKAGE_CFLAGS@,$PACKAGE_CFLAGS,;t t
@@ -23279,13 +23543,10 @@
 
 	prefix:				${prefix}
 	compiler:			${CC}
+	native language support		${nls}
 
-	build hocr			${build_cmd}
-	build hocr-gtk			${build_gtk}
-
-	you need ${gtk_pkg_modules} development libs
-		to build the gtk interface.
+	build hocr			${cmd}
+	build hocr-gtk			${gtk}
+		with spellchecker	${gtkspell}
 
-	you need QT-4 development library to build hocr-qt
-		you can build hocr-qt manualy using qmake.
 "

Modified: pkg/hocr/branches/upstream/current/configure.in
==============================================================================
--- pkg/hocr/branches/upstream/current/configure.in	(original)
+++ pkg/hocr/branches/upstream/current/configure.in	Sat Dec 24 18:37:24 2005
@@ -1,11 +1,12 @@
 dnl Process this file with autoconf to produce a configure script.
 
 AC_INIT(configure.in)
-AM_INIT_AUTOMAKE(hocr, 0.4.6)
-AM_MAINTAINER_MODE
+AC_CANONICAL_SYSTEM
+AM_INIT_AUTOMAKE(hocr, 0.6.4)
 AM_CONFIG_HEADER(config.h)
-VERSION_INFO=0:0:0
+AM_MAINTAINER_MODE
 
+VERSION_INFO=0:0:0
 AC_SUBST(VERSION_INFO)
 
 AC_ISC_POSIX
@@ -19,41 +20,77 @@
 PACKAGE_CFLAGS=
 PACKAGE_LIBS=-lm
 
-GETTEXT_PACKAGE=hocr
-AC_SUBST(GETTEXT_PACKAGE)
-AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
-
-dnl Add the languages which your application supports here.
-ALL_LINGUAS="he"
-AM_GLIB_GNU_GETTEXT
+win32=no
+case "${host_os}" in
+  *mingw* | pw32* | cygwin*)
+	win32="yes"
+    AC_CHECK_TOOL(WINDRES, windres, :)
+    PACKAGE_CFLAGS="$PACKAGE_CFLAGS -mms-bitfields -mno-cygwin"
+esac
+AM_CONDITIONAL(WITH_WIN32, test x"$win32" = "xyes")
+
+AC_ARG_ENABLE(nls, [  --disable-nls		disable native language support], nls="$enableval", nls=yes)
+
+if test "x$nls" = "xyes"; then
+	GETTEXT_PACKAGE=hocr-gtk
+	AC_SUBST(GETTEXT_PACKAGE)
+	AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
+	
+	dnl Add the languages which your application supports here.
+	ALL_LINGUAS="he"
+	AM_GLIB_GNU_GETTEXT
+	
+	PO_DIR=po
+	AC_SUBST(PO_DIR)
+fi
 
 dnl =======================================================================================
 
 build_gtk=yes
+gtk=no
+
+AC_ARG_ENABLE(gtk, [  --disable-gtk		do not build hocr-gtk program], build_gtk="$enableval", build_gtk=yes)
 
-AC_ARG_ENABLE(gtk, [  --disable-gtk		build hocr-gtk program [[default=yes]]], build_gtk="$enableval", build_gtk=yes)
+if test "x$build_gtk" = "xyes"; then
+	gtk_pkg_modules="gtk+-2.0"
+	PKG_CHECK_MODULES(gtk, [$gtk_pkg_modules], gtk=yes, gtk=no)
+	AC_SUBST(gtk_CFLAGS)
+	AC_SUBST(gtk_LIBS)
+fi
+
+AM_CONDITIONAL(WITH_GTK, test "x$gtk" = "xyes")
+
+dnl =======================================================================================
 
-gtk_pkg_modules="gtk+-2.0 gtkspell-2.0"
-PKG_CHECK_MODULES(gtk, [$gtk_pkg_modules], gtk=yes, gtk=no)
-AC_SUBST(gtk_CFLAGS)
-AC_SUBST(gtk_LIBS)
+build_gtkspell=yes
+gtkspell=no
+
+AC_ARG_ENABLE(gtkspell, [  --disable-gtkspell	do not build hocr-gtk spellchecker], build_gtkspell="$enableval", build_gtkspell=yes)
 
 if test "x$gtk" = "xyes"; then
-          AC_MSG_RESULT(yes)
-else
-		  AC_MSG_RESULT(no)
-		  build_gtk=no
+	if test "x$build_gtkspell" = "xyes"; then
+		gtkspell_pkg_modules="gtkspell-2.0"
+		PKG_CHECK_MODULES(gtkspell, [$gtkspell_pkg_modules], gtkspell=yes, gtkspell=no)
+		AC_SUBST(gtkspell_CFLAGS)
+		AC_SUBST(gtkspell_LIBS)
+	fi
 fi
 
-AM_CONDITIONAL(WITH_GTK, test "x$build_gtk" = "xyes")
+AM_CONDITIONAL(WITH_GTKSPELL, test "x$gtkspell" = "xyes")
+AC_SUBST(WITH_GTKSPELL)
 
 dnl =======================================================================================
 
 build_cmd=yes
+cmd=no
+
+AC_ARG_ENABLE(cmd, [  --disable-cmd		do not build hocr program], build_cmd="$enableval", build_cmd=yes)
 
-AC_ARG_ENABLE(cmd, [  --disable-cmd		build hocr program [[default=yes]]], build_cmd="$enableval", build_cmd=yes)
+if test "x$build_cmd" = "xyes"; then
+	cmd=yes
+fi
 
-AM_CONDITIONAL(WITH_CMD, test "x$build_cmd" = "xyes")
+AM_CONDITIONAL(WITH_CMD, test "x$cmd" = "xyes")
 
 dnl =======================================================================================
 
@@ -64,14 +101,13 @@
 
 AC_OUTPUT([
 Makefile
-hocr.spec
 libhocr.pc
 src/Makefile
 po/Makefile.in
 tests/Makefile
 examples/Makefile
 examples/hocr-gtk/Makefile
-examples/cmd/Makefile
+examples/hocr/Makefile
 ])
 
 dnl ===========================================================================================
@@ -80,13 +116,10 @@
 
 	prefix:				${prefix}
 	compiler:			${CC}
+	native language support		${nls}
 	
-	build hocr			${build_cmd}
-	build hocr-gtk			${build_gtk}
-	
-	you need ${gtk_pkg_modules} development libs 
-		to build the gtk interface.
+	build hocr			${cmd}
+	build hocr-gtk			${gtk}
+		with spellchecker	${gtkspell}
 
-	you need QT-4 development library to build hocr-qt
-		you can build hocr-qt manualy using qmake.
 "

Modified: pkg/hocr/branches/upstream/current/examples/Makefile.am
==============================================================================
--- pkg/hocr/branches/upstream/current/examples/Makefile.am	(original)
+++ pkg/hocr/branches/upstream/current/examples/Makefile.am	Sat Dec 24 18:37:24 2005
@@ -1,10 +1,3 @@
 ## Process this file with automake to produce Makefile.in
 
-EXTRA_DIST = README_examples \
-	COPYING_examples \
-	hocr-qt/hocr_qt.pro \
-	hocr-qt/hocr_qt.cpp \
-	hocr-qt/hocr_qt.h \
-	hocr-qt/main.cpp
-
-SUBDIRS = hocr-gtk cmd
+SUBDIRS = hocr-gtk hocr

Modified: pkg/hocr/branches/upstream/current/examples/Makefile.in
==============================================================================
--- pkg/hocr/branches/upstream/current/examples/Makefile.in	(original)
+++ pkg/hocr/branches/upstream/current/examples/Makefile.in	Sat Dec 24 18:37:24 2005
@@ -57,8 +57,12 @@
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+build_alias = @build_alias@
+build_triplet = @build@
 host_alias = @host_alias@
 host_triplet = @host@
+target_alias = @target_alias@
+target_triplet = @target@
 AR = @AR@
 AS = @AS@
 CATALOGS = @CATALOGS@
@@ -95,6 +99,7 @@
 PKG_CONFIG = @PKG_CONFIG@
 POFILES = @POFILES@
 POSUB = @POSUB@
+PO_DIR = @PO_DIR@
 PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@
 PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@
 RANLIB = @RANLIB@
@@ -103,13 +108,14 @@
 USE_NLS = @USE_NLS@
 VERSION = @VERSION@
 VERSION_INFO = @VERSION_INFO@
+WINDRES = @WINDRES@
+WITH_GTKSPELL = @WITH_GTKSPELL@
 gtk_CFLAGS = @gtk_CFLAGS@
 gtk_LIBS = @gtk_LIBS@
+gtkspell_CFLAGS = @gtkspell_CFLAGS@
+gtkspell_LIBS = @gtkspell_LIBS@
 
-EXTRA_DIST = README_examples 	COPYING_examples 	hocr-qt/hocr_qt.pro 	hocr-qt/hocr_qt.cpp 	hocr-qt/hocr_qt.h 	hocr-qt/main.cpp
-
-
-SUBDIRS = hocr-gtk cmd
+SUBDIRS = hocr-gtk hocr
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_HEADER = ../config.h
 CONFIG_CLEAN_FILES = 
@@ -224,7 +230,6 @@
 subdir = examples
 
 distdir: $(DISTFILES)
-	$(mkinstalldirs) $(distdir)/hocr-qt
 	@for file in $(DISTFILES); do \
 	  d=$(srcdir); \
 	  if test -d $$d/$$file; then \

Modified: pkg/hocr/branches/upstream/current/examples/hocr-gtk/Makefile.am
==============================================================================
--- pkg/hocr/branches/upstream/current/examples/hocr-gtk/Makefile.am	(original)
+++ pkg/hocr/branches/upstream/current/examples/hocr-gtk/Makefile.am	Sat Dec 24 18:37:24 2005
@@ -4,13 +4,28 @@
 
 if WITH_GTK
 
+if WITH_GTKSPELL
+
+INCLUDES = \
+        -DPACKAGE_DATA_DIR=\""$(datadir)"\" -DWITH_GTKSPELL\
+        -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
+        @PACKAGE_CFLAGS@ @gtk_CFLAGS@ @gtkspell_CFLAGS@ -I$(top_srcdir)/src
+
+hocr_gtk_LDADD = ../../src/*.o @PACKAGE_LIBS@ @gtk_LIBS@ @gtkspell_LIBS@ $(INTLLIBS)
+
+else
+
 INCLUDES = \
         -DPACKAGE_DATA_DIR=\""$(datadir)"\" \
         -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
-        @gtk_CFLAGS@ -I$(top_srcdir)/src
+        @PACKAGE_CFLAGS@ @gtk_CFLAGS@ -I$(top_srcdir)/src
+
+hocr_gtk_LDADD = ../../src/*.o @PACKAGE_LIBS@ @gtk_LIBS@ $(INTLLIBS)
+
+endif
 
 DEPS= $(top_builddir)/src/libhocr.la
-ldadd= $(top_builddir)/src/libhocr.la -lm
+ldadd= $(top_builddir)/src/libhocr.la
 
 bin_PROGRAMS = hocr-gtk
 
@@ -20,7 +35,10 @@
 	callbacks.c callbacks.h 
 
 hocr_gtk_DEPENDENCIES = $(DEPS)
-hocr_gtk_LDADD = $(ldadd) @gtk_LIBS@ $(INTLLIBS)
+
+hocr-gtk$(EXEEXT): $(hocr_gtk_OBJECTS) $(hocr_gtk_DEPENDENCIES)
+	@rm -f hocr-gtk$(EXEEXT)
+	$(CC) -o hocr-gtk$(EXEEXT) $(hocr_gtk_LDFLAGS) $(hocr_gtk_OBJECTS) $(hocr_gtk_LDADD) $(LIBS)
 
 hocrdesktopdir = ${prefix}/share/applications
 hocrdesktop_DATA = \

Modified: pkg/hocr/branches/upstream/current/examples/hocr-gtk/Makefile.in
==============================================================================
--- pkg/hocr/branches/upstream/current/examples/hocr-gtk/Makefile.in	(original)
+++ pkg/hocr/branches/upstream/current/examples/hocr-gtk/Makefile.in	Sat Dec 24 18:37:24 2005
@@ -57,8 +57,12 @@
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+build_alias = @build_alias@
+build_triplet = @build@
 host_alias = @host_alias@
 host_triplet = @host@
+target_alias = @target_alias@
+target_triplet = @target@
 AR = @AR@
 AS = @AS@
 CATALOGS = @CATALOGS@
@@ -95,6 +99,7 @@
 PKG_CONFIG = @PKG_CONFIG@
 POFILES = @POFILES@
 POSUB = @POSUB@
+PO_DIR = @PO_DIR@
 PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@
 PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@
 RANLIB = @RANLIB@
@@ -103,22 +108,29 @@
 USE_NLS = @USE_NLS@
 VERSION = @VERSION@
 VERSION_INFO = @VERSION_INFO@
+WINDRES = @WINDRES@
+WITH_GTKSPELL = @WITH_GTKSPELL@
 gtk_CFLAGS = @gtk_CFLAGS@
 gtk_LIBS = @gtk_LIBS@
+gtkspell_CFLAGS = @gtkspell_CFLAGS@
+gtkspell_LIBS = @gtkspell_LIBS@
 
 EXTRA_DIST = hocr.desktop
 
- at WITH_GTK_TRUE@INCLUDES =         -DPACKAGE_DATA_DIR=\""$(datadir)"\"         -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\"         @gtk_CFLAGS@ -I$(top_srcdir)/src
+ at WITH_GTK_TRUE@@WITH_GTKSPELL_TRUE at INCLUDES =         -DPACKAGE_DATA_DIR=\""$(datadir)"\" -DWITH_GTKSPELL        -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\"         @PACKAGE_CFLAGS@ @gtk_CFLAGS@ @gtkspell_CFLAGS@ -I$(top_srcdir)/src
+ at WITH_GTK_TRUE@@WITH_GTKSPELL_FALSE at INCLUDES =         -DPACKAGE_DATA_DIR=\""$(datadir)"\"         -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\"         @PACKAGE_CFLAGS@ @gtk_CFLAGS@ -I$(top_srcdir)/src
+
+ at WITH_GTK_TRUE@@WITH_GTKSPELL_TRUE at hocr_gtk_LDADD = ../../src/*.o @PACKAGE_LIBS@ @gtk_LIBS@ @gtkspell_LIBS@ $(INTLLIBS)
+ at WITH_GTK_TRUE@@WITH_GTKSPELL_FALSE at hocr_gtk_LDADD = ../../src/*.o @PACKAGE_LIBS@ @gtk_LIBS@ $(INTLLIBS)
 
 @WITH_GTK_TRUE at DEPS = $(top_builddir)/src/libhocr.la
- at WITH_GTK_TRUE@ldadd = $(top_builddir)/src/libhocr.la -lm
+ at WITH_GTK_TRUE@ldadd = $(top_builddir)/src/libhocr.la
 
 @WITH_GTK_TRUE at bin_PROGRAMS = hocr-gtk
 
 @WITH_GTK_TRUE at hocr_gtk_SOURCES = 	hocr-gtk.c 	interface.c interface.h 	callbacks.c callbacks.h 
 
 @WITH_GTK_TRUE at hocr_gtk_DEPENDENCIES = $(DEPS)
- at WITH_GTK_TRUE@hocr_gtk_LDADD = $(ldadd) @gtk_LIBS@ $(INTLLIBS)
 
 @WITH_GTK_TRUE at hocrdesktopdir = ${prefix}/share/applications
 @WITH_GTK_TRUE at hocrdesktop_DATA = 	hocr.desktop
@@ -135,6 +147,10 @@
 LIBS = @LIBS@
 @WITH_GTK_TRUE at hocr_gtk_OBJECTS =  hocr-gtk.$(OBJEXT) \
 @WITH_GTK_TRUE at interface.$(OBJEXT) callbacks.$(OBJEXT)
+ at WITH_GTK_TRUE@@WITH_GTKSPELL_FALSE at hocr_gtk_DEPENDENCIES =  \
+ at WITH_GTK_TRUE@@WITH_GTKSPELL_FALSE at ../../src/*.o
+ at WITH_GTK_TRUE@@WITH_GTKSPELL_TRUE at hocr_gtk_DEPENDENCIES =  \
+ at WITH_GTK_TRUE@@WITH_GTKSPELL_TRUE at ../../src/*.o
 hocr_gtk_LDFLAGS = 
 CFLAGS = @CFLAGS@
 COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -233,10 +249,6 @@
 
 maintainer-clean-libtool:
 
-hocr-gtk$(EXEEXT): $(hocr_gtk_OBJECTS) $(hocr_gtk_DEPENDENCIES)
-	@rm -f hocr-gtk$(EXEEXT)
-	$(LINK) $(hocr_gtk_LDFLAGS) $(hocr_gtk_OBJECTS) $(hocr_gtk_LDADD) $(LIBS)
-
 install-hocrdesktopDATA: $(hocrdesktop_DATA)
 	@$(NORMAL_INSTALL)
 	$(mkinstalldirs) $(DESTDIR)$(hocrdesktopdir)
@@ -301,7 +313,8 @@
 	  fi; \
 	done
 callbacks.o: callbacks.c ../../config.h callbacks.h interface.h \
-	../../src/hocr.h
+	../../src/hocr.h ../../src/consts.h ../../src/hocr_textbuffer.h \
+	../../src/hocr_pixbuf.h ../../src/hocr_object.h
 hocr-gtk.o: hocr-gtk.c ../../config.h interface.h
 interface.o: interface.c ../../config.h callbacks.h interface.h
 
@@ -381,6 +394,10 @@
 mostlyclean distclean maintainer-clean
 
 
+ at WITH_GTK_TRUE@hocr-gtk$(EXEEXT): $(hocr_gtk_OBJECTS) $(hocr_gtk_DEPENDENCIES)
+ at WITH_GTK_TRUE@	@rm -f hocr-gtk$(EXEEXT)
+ at WITH_GTK_TRUE@	$(CC) -o hocr-gtk$(EXEEXT) $(hocr_gtk_LDFLAGS) $(hocr_gtk_OBJECTS) $(hocr_gtk_LDADD) $(LIBS)
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:

Modified: pkg/hocr/branches/upstream/current/examples/hocr-gtk/callbacks.c
==============================================================================
--- pkg/hocr/branches/upstream/current/examples/hocr-gtk/callbacks.c	(original)
+++ pkg/hocr/branches/upstream/current/examples/hocr-gtk/callbacks.c	Sat Dec 24 18:37:24 2005
@@ -1,3 +1,4 @@
+
 /***************************************************************************
  *            callbacks.c
  *
@@ -27,9 +28,12 @@
 #endif
 
 #include <gtk/gtk.h>
-#include <gtkspell/gtkspell.h>
 #include <glib/gprintf.h>
 
+#ifdef WITH_GTKSPELL
+#include <gtkspell/gtkspell.h>
+#endif
+
 #include "callbacks.h"
 #include "interface.h"
 #include "hocr.h"
@@ -40,23 +44,85 @@
 int
 do_ocr (GdkPixbuf * pixbuf, GtkTextBuffer * text_buffer)
 {
-	hocr_pixbuf hocr_pix;
-	char text[3500];
+	hocr_pixbuf *hocr_pix;
+	hocr_text_buffer *text;
 	GtkTextIter iter;
+
+	hocr_pix = hocr_pixbuf_new ();	/* get an empty hocr_pix */
+	if (!hocr_pix)
+	{
+		printf ("hocr-gtk: can\'t allocate memory for picture\n");
+		return 0;
+	}
+
+	/* clear text before ocr ? */
+	if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (clear_text)))
+		gtk_text_buffer_set_text (text_buffer, "", -1);
+
+	/* init command */
+	hocr_pix->command = 0;
+
+	/* color boxes ? */
+	if (gtk_check_menu_item_get_active
+	    (GTK_CHECK_MENU_ITEM (color_text_box)))
+		hocr_pix->command |= HOCR_COMMAND_COLOR_BOXES;
+
+	/* color misread fonts ? */
+	if (gtk_check_menu_item_get_active
+	    (GTK_CHECK_MENU_ITEM (color_misread)))
+		hocr_pix->command |= HOCR_COMMAND_COLOR_MISREAD;
+
+	/* do ocr ? */
+	if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (ocr)))
+		hocr_pix->command |= HOCR_COMMAND_OCR;
+
+	/* use dict ? */
+	if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM
+						       (use_dict)))
+		  hocr_pix->command |= HOCR_COMMAND_DICT;
+
+	/* use nikud ? */
+	if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM
+						       (use_nikud)))
+		  hocr_pix->command |= HOCR_COMMAND_NIKUD;
 	
-	hocr_pix.n_channels = gdk_pixbuf_get_n_channels (pixbuf);
-	hocr_pix.height = gdk_pixbuf_get_height (pixbuf);
-	hocr_pix.width = gdk_pixbuf_get_width (pixbuf);
-	hocr_pix.rowstride = gdk_pixbuf_get_rowstride (pixbuf);
-	hocr_pix.pixels = (unsigned char*)(gdk_pixbuf_get_pixels (pixbuf));
-	hocr_pix.brightness = 100;
+	/* use spaces ? */
+	if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM
+						       (use_spaces)))
+		  hocr_pix->command |= HOCR_COMMAND_USE_SPACE_FOR_TAB;
 	
-	g_strlcpy (text, "", 3500);
-	hocr_do_ocr (&hocr_pix, text, 3500);
+	/* use indentation ? */
+	if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM
+						       (use_indent)))
+		  hocr_pix->command |= HOCR_COMMAND_USE_INDENTATION;
+	
+	hocr_pix->n_channels = gdk_pixbuf_get_n_channels (pixbuf);
+	hocr_pix->height = gdk_pixbuf_get_height (pixbuf);
+	hocr_pix->width = gdk_pixbuf_get_width (pixbuf);
+	hocr_pix->rowstride = gdk_pixbuf_get_rowstride (pixbuf);
+	hocr_pix->pixels = (unsigned char *) (gdk_pixbuf_get_pixels (pixbuf));
+
+	/* create text buffer */
+	text = hocr_text_buffer_new ();
+	if (!text)
+	{
+		printf ("hocr-gtk: can\'t allocate memory for text out\n");
+		return 0;
+	}
+
+	hocr_do_ocr (hocr_pix, text);
 
 	gtk_text_buffer_get_end_iter (text_buffer, &iter);
-	gtk_text_buffer_insert (text_buffer, &iter, text, -1);
-	
+	gtk_text_buffer_insert (text_buffer, &iter, text->text, -1);
+
+	/* unref hocr_pixbuf */
+	hocr_pix->pixels = NULL;	/* do not unreff the original GTK
+					 * picture */
+	hocr_pixbuf_unref (hocr_pix);
+
+	/* unref text_buffer */
+	hocr_text_buffer_unref (text);
+
 	return 1;
 }
 
@@ -67,16 +133,16 @@
 	char *filename;
 	gboolean have_preview;
 	GdkPixbuf *prev_pixbuf = NULL;
-	
+
 	preview = GTK_WIDGET (data);
 	filename = gtk_file_chooser_get_preview_filename (file_chooser);
-	
+
 	prev_pixbuf =
 		gdk_pixbuf_new_from_file_at_size (filename, 128, 128, NULL);
 	have_preview = (prev_pixbuf != NULL);
-	
+
 	g_free (filename);
-	
+
 	if (prev_pixbuf)
 	{
 		gtk_image_set_from_pixbuf (GTK_IMAGE (preview), prev_pixbuf);
@@ -84,8 +150,7 @@
 		vis_pixbuf = NULL;
 	}
 
-	gtk_file_chooser_set_preview_widget_active (file_chooser,
-						    have_preview);
+	gtk_file_chooser_set_preview_widget_active (file_chooser, have_preview);
 }
 
 void
@@ -94,7 +159,7 @@
 	gint result;
 	char *filename;
 	char title[255];
-	
+
 	GtkWidget *preview_frame = gtk_frame_new ("preview");
 	GtkWidget *preview = gtk_image_new ();
 	GtkWidget *my_file_chooser =
@@ -109,10 +174,10 @@
 
 	gtk_widget_show (preview);
 	gtk_container_add (GTK_CONTAINER (preview_frame), preview);
-	
+
 	gtk_file_chooser_set_preview_widget
 		(GTK_FILE_CHOOSER (my_file_chooser), preview_frame);
-	
+
 	g_signal_connect (my_file_chooser, "update-preview",
 			  G_CALLBACK (update_preview_cb), preview);
 
@@ -128,13 +193,13 @@
 			g_object_unref (pixbuf);
 			pixbuf = NULL;
 		}
-		
+
 		pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
-		
+
 		/* set the window title */
-		g_snprintf (title,255,"%s - %s", _("hocr-gtk"), filename);
+		g_snprintf (title, 255, "%s - %s", _("hocr-gtk"), filename);
 		gtk_window_set_title (GTK_WINDOW (window1), title);
-		
+
 		g_free (filename);
 
 		on_toolbutton_zoom_fit_clicked (NULL, NULL);
@@ -202,7 +267,7 @@
 {
 	GtkTextBuffer *text_buffer;
 	int width, height;
-	
+
 	height = gdk_pixbuf_get_height (vis_pixbuf);
 	width = gdk_pixbuf_get_width (vis_pixbuf);
 
@@ -238,38 +303,19 @@
 		NULL
 	};
 
-	gtk_show_about_dialog (GTK_WINDOW (window1), "name", _("HOCR"),
+	gtk_show_about_dialog (GTK_WINDOW (window1), "name", _("HOCR-GTK"),
 			       "version", VERSION,
 			       "copyright",
 			       "Copyright \xc2\xa9 2005 Yaacov Zamir",
 			       "comments",
 			       _
-			       ("HOCR - Hebrew character recognition software"),
+			       ("HOCR-GTK - Hebrew character recognition software"),
 			       "authors", authors, "documenters", documenters,
 			       "translator-credits", _("translator_credits"),
 			       NULL);
 }
 
 void
-on_toolbutton_spell_clicked (GtkToolButton * toolbutton, gpointer user_data)
-{
-	GtkSpell *spell = NULL;
-
-	spell = gtkspell_get_from_text_view (GTK_TEXT_VIEW (textview));
-
-	if (spell)
-	{
-		gtkspell_detach (spell);
-	}
-	else
-	{
-		spell = gtkspell_new_attach (GTK_TEXT_VIEW (textview), NULL,
-					     NULL);
-		gtkspell_set_language (spell, "he_IL", NULL);
-	}
-}
-
-void
 on_toolbutton_zoom_in_clicked (GtkToolButton * toolbutton, gpointer user_data)
 {
 	int width, height;
@@ -297,8 +343,7 @@
 }
 
 void
-on_toolbutton_zoom_out_clicked (GtkToolButton * toolbutton,
-				gpointer user_data)
+on_toolbutton_zoom_out_clicked (GtkToolButton * toolbutton, gpointer user_data)
 {
 	int width, height;
 
@@ -325,8 +370,7 @@
 }
 
 void
-on_toolbutton_zoom_fit_clicked (GtkToolButton * toolbutton,
-				gpointer user_data)
+on_toolbutton_zoom_fit_clicked (GtkToolButton * toolbutton, gpointer user_data)
 {
 	int width, height, window_width, window_height;
 
@@ -357,6 +401,27 @@
 	}
 }
 
+#ifdef WITH_GTKSPELL
+void
+on_toolbutton_spell_clicked (GtkToolButton * toolbutton, gpointer user_data)
+{
+	GtkSpell *spell = NULL;
+
+	spell = gtkspell_get_from_text_view (GTK_TEXT_VIEW (textview));
+
+	if (spell)
+	{
+		gtkspell_detach (spell);
+	}
+	else
+	{
+		spell = gtkspell_new_attach (GTK_TEXT_VIEW (textview), NULL,
+					     NULL);
+		gtkspell_set_language (spell, "he_IL", NULL);
+	}
+}
+#endif
+
 gboolean
 on_window1_delete_event (GtkWidget * widget,
 			 GdkEvent * event, gpointer user_data)
@@ -372,7 +437,7 @@
 		g_object_unref (vis_pixbuf);
 		vis_pixbuf = NULL;
 	}
-	
+
 	gtk_main_quit ();
 	return FALSE;
 }
@@ -392,5 +457,103 @@
 		vis_pixbuf = NULL;
 	}
 
+	g_free (font_name);
+
 	gtk_main_quit ();
 }
+
+/* menu */
+void
+on_open_activate (GtkMenuItem * menuitem, gpointer user_data)
+{
+	on_toolbutton_open_clicked (NULL, NULL);
+}
+
+void
+on_apply_activate (GtkMenuItem * menuitem, gpointer user_data)
+{
+	on_toolbutton_apply_clicked (NULL, NULL);
+}
+
+void
+on_save_activate (GtkMenuItem * menuitem, gpointer user_data)
+{
+	on_toolbutton_save_clicked (NULL, NULL);
+}
+
+void
+on_quit_activate (GtkMenuItem * menuitem, gpointer user_data)
+{
+	on_toolbutton_quit_clicked (NULL, NULL);
+}
+
+void
+on_font_activate (GtkMenuItem * menuitem, gpointer user_data)
+{
+	GtkWidget *fsd;
+	PangoFontDescription *font_desc;
+	gint result;
+
+	/* create font dialog */
+	fsd = gtk_font_selection_dialog_new (_("Set text font"));
+	gtk_font_selection_dialog_set_font_name (GTK_FONT_SELECTION_DIALOG
+						 (fsd), font_name);
+
+	/* run dialog */
+	result = gtk_dialog_run (GTK_DIALOG (fsd));
+	switch (result)
+	{
+	case GTK_RESPONSE_OK:
+		/* get the new font name */
+		g_free (font_name);
+		font_name = g_strdup (gtk_font_selection_dialog_get_font_name
+			 (GTK_FONT_SELECTION_DIALOG (fsd)));
+		
+		/* Change default font throughout the text widget */
+		font_desc = pango_font_description_from_string
+			(font_name);
+
+		gtk_widget_modify_font (textview, font_desc);
+		pango_font_description_free (font_desc);
+
+		break;
+	default:
+		/* do nothing since dialog was cancelled */
+		break;
+	}
+
+	/* free dialog */
+	gtk_widget_destroy (fsd);
+}
+
+#ifdef WITH_GTKSPELL
+void
+on_spell_check_activate (GtkMenuItem * menuitem, gpointer user_data)
+{
+	on_toolbutton_spell_clicked (NULL, NULL);
+}
+#endif
+
+void
+on_zoom_in_activate (GtkMenuItem * menuitem, gpointer user_data)
+{
+	on_toolbutton_zoom_in_clicked (NULL, NULL);
+}
+
+void
+on_zoom_out_activate (GtkMenuItem * menuitem, gpointer user_data)
+{
+	on_toolbutton_zoom_out_clicked (NULL, NULL);
+}
+
+void
+on_normal_size_activate (GtkMenuItem * menuitem, gpointer user_data)
+{
+	on_toolbutton_zoom_fit_clicked (NULL, NULL);
+}
+
+void
+on_about_activate (GtkMenuItem * menuitem, gpointer user_data)
+{
+	on_toolbutton_about_clicked (NULL, NULL);
+}

Modified: pkg/hocr/branches/upstream/current/examples/hocr-gtk/callbacks.h
==============================================================================
--- pkg/hocr/branches/upstream/current/examples/hocr-gtk/callbacks.h	(original)
+++ pkg/hocr/branches/upstream/current/examples/hocr-gtk/callbacks.h	Sat Dec 24 18:37:24 2005
@@ -1,3 +1,4 @@
+
 /***************************************************************************
  *            callbacks.h
  *
@@ -21,13 +22,14 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
-  
+
 #include <gtk/gtk.h>
 
 gboolean
 on_window1_delete_event (GtkWidget * widget,
 			 GdkEvent * event, gpointer user_data);
 
+/* toolbar */
 void
 on_toolbutton_open_clicked (GtkToolButton * toolbutton, gpointer user_data);
 
@@ -49,8 +51,33 @@
 void
 on_toolbutton_about_clicked (GtkToolButton * toolbutton, gpointer user_data);
 
+#ifdef WITH_GTKSPELL
 void
 on_toolbutton_spell_clicked (GtkToolButton * toolbutton, gpointer user_data);
+#endif
 
 void
 on_toolbutton_quit_clicked (GtkToolButton * toolbutton, gpointer user_data);
+
+/* menu */
+void on_open_activate (GtkMenuItem * menuitem, gpointer user_data);
+
+void on_apply_activate (GtkMenuItem * menuitem, gpointer user_data);
+
+void on_save_activate (GtkMenuItem * menuitem, gpointer user_data);
+
+void on_quit_activate (GtkMenuItem * menuitem, gpointer user_data);
+
+void on_font_activate (GtkMenuItem * menuitem, gpointer user_data);
+
+#ifdef WITH_GTKSPELL
+void on_spell_check_activate (GtkMenuItem * menuitem, gpointer user_data);
+#endif
+
+void on_zoom_in_activate (GtkMenuItem * menuitem, gpointer user_data);
+
+void on_zoom_out_activate (GtkMenuItem * menuitem, gpointer user_data);
+
+void on_normal_size_activate (GtkMenuItem * menuitem, gpointer user_data);
+
+void on_about_activate (GtkMenuItem * menuitem, gpointer user_data);

Modified: pkg/hocr/branches/upstream/current/examples/hocr-gtk/hocr-gtk.c
==============================================================================
--- pkg/hocr/branches/upstream/current/examples/hocr-gtk/hocr-gtk.c	(original)
+++ pkg/hocr/branches/upstream/current/examples/hocr-gtk/hocr-gtk.c	Sat Dec 24 18:37:24 2005
@@ -1,3 +1,4 @@
+
 /***************************************************************************
  *            hocr-gui.c
  *
@@ -20,7 +21,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */ 
+ */
 
 #ifdef HAVE_CONFIG_H
 #  include <config.h>

Modified: pkg/hocr/branches/upstream/current/examples/hocr-gtk/interface.c
==============================================================================
--- pkg/hocr/branches/upstream/current/examples/hocr-gtk/interface.c	(original)
+++ pkg/hocr/branches/upstream/current/examples/hocr-gtk/interface.c	Sat Dec 24 18:37:24 2005
@@ -1,3 +1,28 @@
+
+/***************************************************************************
+ *            interface.c
+ *
+ *  Fri Aug 12 20:15:06 2005
+ *  Copyright  2005  Yaacov Zamir
+ *  <kzamir at walla.co.il>
+ ****************************************************************************/
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Library General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
 /***************************************************************************
  *            interface.c
  *
@@ -37,12 +62,37 @@
 #include "callbacks.h"
 #include "interface.h"
 
-#define TEXT_FONT_NAME "Miriam Mono CLM 15"
-
 GtkWidget *
 create_window1 (void)
 {
 	GtkWidget *vbox1;
+
+	/* menu */
+	GtkWidget *menubar1;
+	GtkWidget *menuitem1;
+	GtkWidget *menuitem1_menu;
+	GtkWidget *open;
+	GtkWidget *apply;
+	GtkWidget *save;
+	GtkWidget *separatormenuitem1;
+	GtkWidget *quit;
+	GtkWidget *menuitem2;
+	GtkWidget *menuitem2_menu;
+	GtkWidget *font;
+	GtkWidget *separator2;
+	GtkWidget *spell_check;
+	GtkWidget *separator3;
+	GtkWidget *menuitem3;
+	GtkWidget *menuitem3_menu;
+	GtkWidget *zoom_in;
+	GtkWidget *zoom_out;
+	GtkWidget *normal_size;
+	GtkWidget *menuitem4;
+	GtkWidget *menuitem4_menu;
+	GtkWidget *about;
+	GtkAccelGroup *accel_group;
+
+	/* toolbar */
 	GtkWidget *toolbar;
 	GtkIconSize tmp_toolbar_icon_size;
 	GtkWidget *toolbutton_open;
@@ -51,6 +101,8 @@
 	GtkWidget *toolitem1;
 	GtkWidget *vseparator1;
 	GtkWidget *toolbutton_spell;
+	GtkWidget *toolitem2;
+	GtkWidget *vseparator2;
 	GtkWidget *toolbutton_zoom_in;
 	GtkWidget *toolbutton_zoom_out;
 	GtkWidget *toolbutton_zoom_fit;
@@ -60,8 +112,12 @@
 	GtkWidget *toolitem4;
 	GtkWidget *vseparator4;
 	GtkWidget *toolbutton_quit;
+
+	/* image */
 	GtkWidget *vpaned1;
 	GtkWidget *scrolledwindow_image;
+
+	/* text */
 	GtkWidget *viewport1;
 	GtkWidget *scrolledwindow_text;
 	GtkTooltips *tooltips;
@@ -69,15 +125,181 @@
 	PangoFontDescription *font_desc;
 
 	tooltips = gtk_tooltips_new ();
+	accel_group = gtk_accel_group_new ();
 
 	window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-	gtk_widget_set_size_request (window1, 800, 600);
-	gtk_window_set_title (GTK_WINDOW (window1), _("hocr-gtk"));
+	gtk_widget_set_size_request (window1, 600, 300);
+	gtk_window_maximize (GTK_WINDOW (window1));
+	gtk_window_set_title (GTK_WINDOW (window1), _("hocr-gui"));
 
 	vbox1 = gtk_vbox_new (FALSE, 0);
 	gtk_widget_show (vbox1);
 	gtk_container_add (GTK_CONTAINER (window1), vbox1);
 
+	/* menu */
+
+	menubar1 = gtk_menu_bar_new ();
+	gtk_widget_show (menubar1);
+	gtk_box_pack_start (GTK_BOX (vbox1), menubar1, FALSE, FALSE, 0);
+
+	menuitem1 = gtk_menu_item_new_with_mnemonic (_("_File"));
+	gtk_widget_show (menuitem1);
+	gtk_container_add (GTK_CONTAINER (menubar1), menuitem1);
+
+	menuitem1_menu = gtk_menu_new ();
+	gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem1), menuitem1_menu);
+
+	open = gtk_image_menu_item_new_from_stock ("gtk-open", accel_group);
+	gtk_widget_show (open);
+	gtk_container_add (GTK_CONTAINER (menuitem1_menu), open);
+
+	apply = gtk_image_menu_item_new_from_stock ("gtk-apply", accel_group);
+	gtk_widget_show (apply);
+	gtk_container_add (GTK_CONTAINER (menuitem1_menu), apply);
+
+	save = gtk_image_menu_item_new_from_stock ("gtk-save", accel_group);
+	gtk_widget_show (save);
+	gtk_container_add (GTK_CONTAINER (menuitem1_menu), save);
+
+	separatormenuitem1 = gtk_separator_menu_item_new ();
+	gtk_widget_show (separatormenuitem1);
+	gtk_container_add (GTK_CONTAINER (menuitem1_menu), separatormenuitem1);
+	gtk_widget_set_sensitive (separatormenuitem1, FALSE);
+
+	quit = gtk_image_menu_item_new_from_stock ("gtk-quit", accel_group);
+	gtk_widget_show (quit);
+	gtk_container_add (GTK_CONTAINER (menuitem1_menu), quit);
+
+	menuitem2 = gtk_menu_item_new_with_mnemonic (_("_Edit"));
+	gtk_widget_show (menuitem2);
+	gtk_container_add (GTK_CONTAINER (menubar1), menuitem2);
+
+	menuitem2_menu = gtk_menu_new ();
+	gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem2), menuitem2_menu);
+
+	font = gtk_image_menu_item_new_from_stock ("gtk-select-font",
+						   accel_group);
+	gtk_widget_show (font);
+	gtk_container_add (GTK_CONTAINER (menuitem2_menu), font);
+
+	separator2 = gtk_separator_menu_item_new ();
+	gtk_widget_show (separator2);
+	gtk_container_add (GTK_CONTAINER (menuitem2_menu), separator2);
+	gtk_widget_set_sensitive (separator2, FALSE);
+
+#ifdef WITH_GTKSPELL
+	spell_check =
+		gtk_image_menu_item_new_from_stock ("gtk-spell-check",
+						    accel_group);
+	gtk_widget_show (spell_check);
+	gtk_container_add (GTK_CONTAINER (menuitem2_menu), spell_check);
+
+	separator3 = gtk_separator_menu_item_new ();
+	gtk_widget_show (separator3);
+	gtk_container_add (GTK_CONTAINER (menuitem2_menu), separator3);
+	gtk_widget_set_sensitive (separator3, FALSE);
+#endif
+
+	color_text_box =
+		gtk_check_menu_item_new_with_mnemonic (_("Color boxes"));
+	gtk_widget_show (color_text_box);
+	gtk_container_add (GTK_CONTAINER (menuitem2_menu), color_text_box);
+	gtk_tooltips_set_tip (tooltips, color_text_box, _("Color text boxes"),
+			      NULL);
+	gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (color_text_box),
+					TRUE);
+
+	color_misread =
+		gtk_check_menu_item_new_with_mnemonic (_("Color misread"));
+	gtk_widget_show (color_misread);
+	gtk_container_add (GTK_CONTAINER (menuitem2_menu), color_misread);
+	gtk_tooltips_set_tip (tooltips, color_misread, _("Color misread fonts"),
+			      NULL);
+	gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (color_misread),
+					TRUE);
+
+	clear_text = gtk_check_menu_item_new_with_mnemonic (_("Clear"));
+	gtk_widget_show (clear_text);
+	gtk_container_add (GTK_CONTAINER (menuitem2_menu), clear_text);
+	gtk_tooltips_set_tip (tooltips, clear_text,
+			      _("Clear text each time you ocr new scan"), NULL);
+	gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (clear_text), TRUE);
+
+	ocr = gtk_check_menu_item_new_with_mnemonic (_("Ocr"));
+	gtk_widget_show (ocr);
+	gtk_container_add (GTK_CONTAINER (menuitem2_menu), ocr);
+	gtk_tooltips_set_tip (tooltips, ocr,
+			      _("Try to recognize fonts in scaned text"), NULL);
+	gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (ocr), TRUE);
+
+	use_dict = gtk_check_menu_item_new_with_mnemonic (_("Use dictionary"));
+	gtk_widget_show (use_dict);
+	gtk_container_add (GTK_CONTAINER (menuitem2_menu), use_dict);
+	gtk_tooltips_set_tip (tooltips, use_dict,
+			      _("Try to guess unrecognized fonts in scaned text using internal dictionary"),
+			      NULL);
+	gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (use_dict), FALSE);
+
+	use_nikud = gtk_check_menu_item_new_with_mnemonic (_("Use nikud"));
+	gtk_widget_show (use_nikud);
+	gtk_container_add (GTK_CONTAINER (menuitem2_menu), use_nikud);
+	gtk_tooltips_set_tip (tooltips, use_nikud,
+			      _("Try to guess nikud"),
+			      NULL);
+	gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (use_nikud), TRUE);
+
+	use_spaces = gtk_check_menu_item_new_with_mnemonic (_("Use spaces"));
+	gtk_widget_show (use_spaces);
+	gtk_container_add (GTK_CONTAINER (menuitem2_menu), use_spaces);
+	gtk_tooltips_set_tip (tooltips, use_spaces,
+			      _("Use spaces for tabs"),
+			      NULL);
+	gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (use_spaces), FALSE);
+
+	use_indent = gtk_check_menu_item_new_with_mnemonic (_("Use indentation"));
+	gtk_widget_show (use_indent);
+	gtk_container_add (GTK_CONTAINER (menuitem2_menu), use_indent);
+	gtk_tooltips_set_tip (tooltips, use_indent,
+			      _("Try to guess line indentation"),
+			      NULL);
+	gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (use_indent), FALSE);
+	
+	menuitem3 = gtk_menu_item_new_with_mnemonic (_("_View"));
+	gtk_widget_show (menuitem3);
+	gtk_container_add (GTK_CONTAINER (menubar1), menuitem3);
+
+	menuitem3_menu = gtk_menu_new ();
+	gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem3), menuitem3_menu);
+
+	zoom_in =
+		gtk_image_menu_item_new_from_stock ("gtk-zoom-in", accel_group);
+	gtk_widget_show (zoom_in);
+	gtk_container_add (GTK_CONTAINER (menuitem3_menu), zoom_in);
+
+	zoom_out =
+		gtk_image_menu_item_new_from_stock ("gtk-zoom-out",
+						    accel_group);
+	gtk_widget_show (zoom_out);
+	gtk_container_add (GTK_CONTAINER (menuitem3_menu), zoom_out);
+
+	normal_size =
+		gtk_image_menu_item_new_from_stock ("gtk-zoom-100",
+						    accel_group);
+	gtk_widget_show (normal_size);
+	gtk_container_add (GTK_CONTAINER (menuitem3_menu), normal_size);
+
+	menuitem4 = gtk_menu_item_new_with_mnemonic (_("_Help"));
+	gtk_widget_show (menuitem4);
+	gtk_container_add (GTK_CONTAINER (menubar1), menuitem4);
+
+	menuitem4_menu = gtk_menu_new ();
+	gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem4), menuitem4_menu);
+
+	about = gtk_menu_item_new_with_mnemonic (_("_About"));
+	gtk_widget_show (about);
+	gtk_container_add (GTK_CONTAINER (menuitem4_menu), about);
+
+	/* toolbar */
 	toolbar = gtk_toolbar_new ();
 	gtk_widget_show (toolbar);
 	gtk_box_pack_start (GTK_BOX (vbox1), toolbar, FALSE, FALSE, 0);
@@ -104,8 +326,7 @@
 	gtk_widget_show (toolbutton_save);
 	gtk_container_add (GTK_CONTAINER (toolbar), toolbutton_save);
 	gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_save), tooltips,
-				   _("Save the text created by the OCR"),
-				   NULL);
+				   _("Save the text created by the OCR"), NULL);
 
 	toolitem1 = (GtkWidget *) gtk_tool_item_new ();
 	gtk_widget_show (toolitem1);
@@ -114,6 +335,7 @@
 	gtk_widget_show (vseparator1);
 	gtk_container_add (GTK_CONTAINER (toolitem1), vseparator1);
 
+#ifdef WITH_GTKSPELL
 	toolbutton_spell =
 		(GtkWidget *)
 		gtk_tool_button_new_from_stock ("gtk-spell-check");
@@ -122,6 +344,14 @@
 	gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_spell), tooltips,
 				   _("Spell check the text"), NULL);
 
+	toolitem2 = (GtkWidget *) gtk_tool_item_new ();
+	gtk_widget_show (toolitem2);
+	gtk_container_add (GTK_CONTAINER (toolbar), toolitem2);
+	vseparator2 = gtk_vseparator_new ();
+	gtk_widget_show (vseparator2);
+	gtk_container_add (GTK_CONTAINER (toolitem2), vseparator2);
+#endif
+
 	toolbutton_zoom_in =
 		(GtkWidget *) gtk_tool_button_new_from_stock ("gtk-zoom-in");
 	gtk_widget_show (toolbutton_zoom_in);
@@ -150,7 +380,7 @@
 	gtk_container_add (GTK_CONTAINER (toolbar), toolbutton_about);
 	gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_about), tooltips,
 				   _("About this application"), NULL);
-
+/*
 	toolitem4 = (GtkWidget *) gtk_tool_item_new ();
 	gtk_widget_show (toolitem4);
 	gtk_container_add (GTK_CONTAINER (toolbar), toolitem4);
@@ -164,11 +394,12 @@
 	gtk_container_add (GTK_CONTAINER (toolbar), toolbutton_quit);
 	gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_quit), tooltips,
 				   _("Quit this program"), NULL);
-
+*/
+	/* image */
 	vpaned1 = gtk_vpaned_new ();
 	gtk_widget_show (vpaned1);
 	gtk_container_add (GTK_CONTAINER (vbox1), vpaned1);
-											 
+
 	scrolledwindow_image = gtk_scrolled_window_new (NULL, NULL);
 	gtk_scrolled_window_set_policy ((GtkScrolledWindow *)
 					scrolledwindow_image,
@@ -185,6 +416,7 @@
 	gtk_widget_show (image);
 	gtk_container_add (GTK_CONTAINER (viewport1), image);
 
+	/* text */
 	scrolledwindow_text = gtk_scrolled_window_new (NULL, NULL);
 	gtk_scrolled_window_set_policy ((GtkScrolledWindow *)
 					scrolledwindow_text,
@@ -199,36 +431,68 @@
 	textview = gtk_text_view_new ();
 	gtk_widget_show (textview);
 	gtk_container_add (GTK_CONTAINER (scrolledwindow_text), textview);
-
-	/* Change default font throughout the widget */
-	font_desc = pango_font_description_from_string (TEXT_FONT_NAME);
+	font_desc = pango_font_description_from_string
+			(font_name);
 	gtk_widget_modify_font (textview, font_desc);
-	pango_font_description_free (font_desc);
 
+	font_name = g_strdup (TEXT_FONT_NAME);
+
+	/* main window */
 	g_signal_connect ((gpointer) window1, "delete_event",
 			  G_CALLBACK (on_window1_delete_event), NULL);
 
+	/* toolbar */
 	g_signal_connect ((gpointer) toolbutton_open, "clicked",
 			  G_CALLBACK (on_toolbutton_open_clicked), NULL);
 	g_signal_connect ((gpointer) toolbutton_apply, "clicked",
 			  G_CALLBACK (on_toolbutton_apply_clicked), NULL);
 	g_signal_connect ((gpointer) toolbutton_save, "clicked",
 			  G_CALLBACK (on_toolbutton_save_clicked), NULL);
-			  
+
 	g_signal_connect ((gpointer) toolbutton_zoom_in, "clicked",
 			  G_CALLBACK (on_toolbutton_zoom_in_clicked), NULL);
 	g_signal_connect ((gpointer) toolbutton_zoom_out, "clicked",
 			  G_CALLBACK (on_toolbutton_zoom_out_clicked), NULL);
 	g_signal_connect ((gpointer) toolbutton_zoom_fit, "clicked",
 			  G_CALLBACK (on_toolbutton_zoom_fit_clicked), NULL);
-			  
+
 	g_signal_connect ((gpointer) toolbutton_about, "clicked",
 			  G_CALLBACK (on_toolbutton_about_clicked), NULL);
+#ifdef WITH_GTKSPELL
 	g_signal_connect ((gpointer) toolbutton_spell, "clicked",
 			  G_CALLBACK (on_toolbutton_spell_clicked), NULL);
+#endif
 
+/*
 	g_signal_connect ((gpointer) toolbutton_quit, "clicked",
 			  G_CALLBACK (on_toolbutton_quit_clicked), NULL);
+ */
+ 
+	/* menu */
+	g_signal_connect ((gpointer) open, "activate",
+			  G_CALLBACK (on_open_activate), NULL);
+	g_signal_connect ((gpointer) apply, "activate",
+			  G_CALLBACK (on_apply_activate), NULL);
+	g_signal_connect ((gpointer) save, "activate",
+			  G_CALLBACK (on_save_activate), NULL);
+	g_signal_connect ((gpointer) quit, "activate",
+			  G_CALLBACK (on_quit_activate), NULL);
+	g_signal_connect ((gpointer) font, "activate",
+			  G_CALLBACK (on_font_activate), NULL);
+#ifdef WITH_GTKSPELL
+	g_signal_connect ((gpointer) spell_check, "activate",
+			  G_CALLBACK (on_spell_check_activate), NULL);
+#endif
+	g_signal_connect ((gpointer) zoom_in, "activate",
+			  G_CALLBACK (on_zoom_in_activate), NULL);
+	g_signal_connect ((gpointer) zoom_out, "activate",
+			  G_CALLBACK (on_zoom_out_activate), NULL);
+	g_signal_connect ((gpointer) normal_size, "activate",
+			  G_CALLBACK (on_normal_size_activate), NULL);
+	g_signal_connect ((gpointer) about, "activate",
+			  G_CALLBACK (on_about_activate), NULL);
+
+	gtk_window_add_accel_group (GTK_WINDOW (window1), accel_group);
 
 	return window1;
 }

Modified: pkg/hocr/branches/upstream/current/examples/hocr-gtk/interface.h
==============================================================================
--- pkg/hocr/branches/upstream/current/examples/hocr-gtk/interface.h	(original)
+++ pkg/hocr/branches/upstream/current/examples/hocr-gtk/interface.h	Sat Dec 24 18:37:24 2005
@@ -1,3 +1,4 @@
+
 /***************************************************************************
  *            interface.h
  *
@@ -48,8 +49,27 @@
 #  define N_(String) (String)
 #endif
 
+#define TEXT_FONT_NAME "Sans 12"
+
+/* main window */
 GtkWidget *window1;
+
+/* menu check boxs */
+GtkWidget *color_text_box;
+GtkWidget *color_misread;
+GtkWidget *clear_text;
+GtkWidget *ocr;
+GtkWidget *use_dict;
+GtkWidget *use_nikud;
+GtkWidget *use_spaces;
+GtkWidget *use_indent;
+
+/* image and text of main window */
 GtkWidget *image;
 GtkWidget *textview;
 
+/* user font */
+char * font_name;
+
+/* user interface for window */
 GtkWidget *create_window1 (void);

Modified: pkg/hocr/branches/upstream/current/examples/hocr/Makefile.am
==============================================================================
--- pkg/hocr/branches/upstream/current/examples/hocr/Makefile.am	(original)
+++ pkg/hocr/branches/upstream/current/examples/hocr/Makefile.am	Sat Dec 24 18:37:24 2005
@@ -7,10 +7,10 @@
 INCLUDES = \
         -DPACKAGE_DATA_DIR=\""$(datadir)"\" \
         -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
-        -I$(top_srcdir)/src
+        -I$(top_srcdir)/src @PACKAGE_CFLAGS@ 
 
 DEPS= $(top_builddir)/src/libhocr.la
-ldadd= $(top_builddir)/src/libhocr.la -lm
+ldadd= $(top_builddir)/src/libhocr.la
 
 bin_PROGRAMS = hocr
 
@@ -18,7 +18,11 @@
 	hocr-cmd.c
 
 hocr_DEPENDENCIES = $(DEPS)
-hocr_LDADD = $(ldadd) $(INTLLIBS)
+hocr_LDADD = ../../src/*.o $(INTLLIBS)
+
+hocr$(EXEEXT): $(hocr_OBJECTS) $(hocr_DEPENDENCIES)
+	@rm -f hocr$(EXEEXT)
+	$(CC) -o hocr$(EXEEXT) @PACKAGE_LIBS@ $(hocr_LDFLAGS) $(hocr_OBJECTS) $(hocr_LDADD) $(LIBS)
 
 man_MANS = hocr.1
 

Modified: pkg/hocr/branches/upstream/current/examples/hocr/Makefile.in
==============================================================================
--- pkg/hocr/branches/upstream/current/examples/hocr/Makefile.in	(original)
+++ pkg/hocr/branches/upstream/current/examples/hocr/Makefile.in	Sat Dec 24 18:37:24 2005
@@ -57,8 +57,12 @@
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+build_alias = @build_alias@
+build_triplet = @build@
 host_alias = @host_alias@
 host_triplet = @host@
+target_alias = @target_alias@
+target_triplet = @target@
 AR = @AR@
 AS = @AS@
 CATALOGS = @CATALOGS@
@@ -95,6 +99,7 @@
 PKG_CONFIG = @PKG_CONFIG@
 POFILES = @POFILES@
 POSUB = @POSUB@
+PO_DIR = @PO_DIR@
 PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@
 PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@
 RANLIB = @RANLIB@
@@ -103,22 +108,26 @@
 USE_NLS = @USE_NLS@
 VERSION = @VERSION@
 VERSION_INFO = @VERSION_INFO@
+WINDRES = @WINDRES@
+WITH_GTKSPELL = @WITH_GTKSPELL@
 gtk_CFLAGS = @gtk_CFLAGS@
 gtk_LIBS = @gtk_LIBS@
+gtkspell_CFLAGS = @gtkspell_CFLAGS@
+gtkspell_LIBS = @gtkspell_LIBS@
 
 EXTRA_DIST = hocr.1
 
- at WITH_CMD_TRUE@INCLUDES =         -DPACKAGE_DATA_DIR=\""$(datadir)"\"         -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\"         -I$(top_srcdir)/src
+ at WITH_CMD_TRUE@INCLUDES =         -DPACKAGE_DATA_DIR=\""$(datadir)"\"         -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\"         -I$(top_srcdir)/src @PACKAGE_CFLAGS@ 
 
 @WITH_CMD_TRUE at DEPS = $(top_builddir)/src/libhocr.la
- at WITH_CMD_TRUE@ldadd = $(top_builddir)/src/libhocr.la -lm
+ at WITH_CMD_TRUE@ldadd = $(top_builddir)/src/libhocr.la
 
 @WITH_CMD_TRUE at bin_PROGRAMS = hocr
 
 @WITH_CMD_TRUE at hocr_SOURCES = 	hocr-cmd.c
 
 @WITH_CMD_TRUE at hocr_DEPENDENCIES = $(DEPS)
- at WITH_CMD_TRUE@hocr_LDADD = $(ldadd) $(INTLLIBS)
+ at WITH_CMD_TRUE@hocr_LDADD = ../../src/*.o $(INTLLIBS)
 
 @WITH_CMD_TRUE at man_MANS = hocr.1
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -157,7 +166,7 @@
 .SUFFIXES:
 .SUFFIXES: .S .c .lo .o .obj .s
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
-	cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps examples/cmd/Makefile
+	cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps examples/hocr/Makefile
 
 Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status
 	cd $(top_builddir) \
@@ -233,10 +242,6 @@
 
 maintainer-clean-libtool:
 
-hocr$(EXEEXT): $(hocr_OBJECTS) $(hocr_DEPENDENCIES)
-	@rm -f hocr$(EXEEXT)
-	$(LINK) $(hocr_LDFLAGS) $(hocr_OBJECTS) $(hocr_LDADD) $(LIBS)
-
 install-man1:
 	$(mkinstalldirs) $(DESTDIR)$(man1dir)
 	@list='$(man1_MANS)'; \
@@ -307,7 +312,7 @@
 
 distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
 
-subdir = examples/cmd
+subdir = examples/hocr
 
 distdir: $(DISTFILES)
 	@for file in $(DISTFILES); do \
@@ -320,7 +325,9 @@
 	    || cp -p $$d/$$file $(distdir)/$$file || :; \
 	  fi; \
 	done
-hocr-cmd.o: hocr-cmd.c ../../config.h ../../src/hocr.h
+hocr-cmd.o: hocr-cmd.c ../../config.h ../../src/hocr.h \
+	../../src/consts.h ../../src/hocr_textbuffer.h \
+	../../src/hocr_pixbuf.h ../../src/hocr_object.h
 
 info-am:
 info: info-am
@@ -398,6 +405,10 @@
 mostlyclean distclean maintainer-clean
 
 
+ at WITH_CMD_TRUE@hocr$(EXEEXT): $(hocr_OBJECTS) $(hocr_DEPENDENCIES)
+ at WITH_CMD_TRUE@	@rm -f hocr$(EXEEXT)
+ at WITH_CMD_TRUE@	$(CC) -o hocr$(EXEEXT) @PACKAGE_LIBS@ $(hocr_LDFLAGS) $(hocr_OBJECTS) $(hocr_LDADD) $(LIBS)
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:

Modified: pkg/hocr/branches/upstream/current/examples/hocr/hocr-cmd.c
==============================================================================
--- pkg/hocr/branches/upstream/current/examples/hocr/hocr-cmd.c	(original)
+++ pkg/hocr/branches/upstream/current/examples/hocr/hocr-cmd.c	Sat Dec 24 18:37:24 2005
@@ -1,3 +1,4 @@
+
 /***************************************************************************
  *            hocr-cmd.c
  *
@@ -38,131 +39,154 @@
 int
 print_help ()
 {
-        printf ("hocr %s - Hebrew OCR program\n", VERSION);
-        printf ("http://hocr.berlios.de\n");
-        printf ("USAGE: hocr -i pic_filename [-o text_filename] [-f html/text]\n");
-        printf ("\n");
+	printf ("hocr %s - Hebrew OCR program\n", VERSION);
+	printf ("http://hocr.berlios.de\n");
+	printf ("USAGE: hocr [OPTION]... -i pic_filename [-o text_filename] [-f html/text]\n");
+	printf ("  -d,  Use internal dictionary to guess misread fonts.\n");
+	printf ("  -n,  Try to guess nikud for fonts.\n");
+	printf ("  -s,  Use spaces for tabs.\n");
+	printf ("  -t,  Indent indented lines.\n");
+	printf ("\n");
 
-        return 0;
+	return 0;
 }
 
 int
 save_text (char *filename, char *format_out, char *text)
 {
-        FILE *file;
+	FILE *file;
 
-        /* if format string begin with 'h' assume html output */
-        if (filename)
-        {
-                /* save to file */
-                file = fopen (filename, "w");
-
-                /* can't open file */
-                if (!file)
-                {
-                        printf ("hocr: can\'t save file as %s\n", filename);
-                        exit (0);
-                }
-
-                if (format_out[0] == 'h')
-                        fprintf (file,
-                                 "<html>\n<meta http-equiv=\"Content-Type\" \
+	/* 
+	 * if format string begin with 'h' assume html output 
+	 */
+	if (filename)
+	{
+		/* 
+		 * save to file 
+		 */
+		file = fopen (filename, "w");
+
+		/* 
+		 * can't open file 
+		 */
+		if (!file)
+		{
+			printf ("hocr: can\'t save file as %s\n", filename);
+			exit (0);
+		}
+
+		if (format_out[0] == 'h')
+			fprintf (file,
+				 "<html>\n<meta http-equiv=\"Content-Type\" \
 content=\"text/html; charset=UTF-8\">\n \
 <body dir=\"rtl\"><pre>\n");
 
-                fprintf (file, "%s", text);
+		fprintf (file, "%s", text);
 
-                if (format_out[0] == 'h')
-                        fprintf (file, "</pre></body>\n</html>\n");
-                fclose (file);
-        }
-        else
-        {
-                /* no file name - print to std output */
-                if (format_out[0] == 'h')
-                        printf ("<html>\n<meta http-equiv=\"Content-Type\" \
+		if (format_out[0] == 'h')
+			fprintf (file, "</pre></body>\n</html>\n");
+		fclose (file);
+	}
+	else
+	{
+		/* 
+		 * no file name - print to std output 
+		 */
+		if (format_out[0] == 'h')
+			printf ("<html>\n<meta http-equiv=\"Content-Type\" \
 content=\"text/html; charset=UTF-8\">\n \
 <body dir=\"rtl\"><pre>\n");
 
-                printf ("%s", text);
+		printf ("%s", text);
 
-                if (format_out[0] == 'h')
-                        printf ("</pre></body>\n</html>\n");
-        }
+		if (format_out[0] == 'h')
+			printf ("</pre></body>\n</html>\n");
+	}
 
-        return 0;
+	return 0;
 }
 
 int
 main (int argc, char *argv[])
 {
-        int opt_i = 0;
-        int opt_o = 0;
-        int opt_f = 0;
-        char c;
-
-        char filename_in[STRING_MAX_SIZE];
-        char filename_out[STRING_MAX_SIZE];
-        char format_out[STRING_MAX_SIZE];
-
-        hocr_pixbuf *pix;
-	char text[3500];
-
-        /* default output is text file */
-        format_out[0] = 't';
-
-        while ((c = getopt (argc, argv, "hi:o:f:")) != EOF)
-        {
-                switch (c)
-                {
-                case 'i':
-                        if (optarg && strlen (optarg) < STRING_MAX_SIZE)
-                        {
-                                strcpy (filename_in, optarg);
-                                opt_i = 1;
-                        }
-                        break;
-                case 'o':
-                        if (optarg && strlen (optarg) < STRING_MAX_SIZE)
-                        {
-                                strcpy (filename_out, optarg);
-                                opt_o = 1;
-                        }
-                        break;
-                case 'f':
-                        if (optarg && strlen (optarg) < STRING_MAX_SIZE)
-                        {
-                                strcpy (format_out, optarg);
-                                opt_f = 1;
-                        }
-                        break;
-                case 'h':
-                        print_help ();
-                        exit (0);
-                        break;
-                default:
-                        print_help ();
-                        exit (0);
-                        break;
-                }
-        }
-
-        if (opt_i == 0)
-        {
-                print_help ();
-                exit (0);
-        }
-
-        /* create a new pixbuf from pbm file */
-        pix = hocr_pixbuf_new_from_file (filename_in);
-
-        if (!pix)
-        {
-                printf ("hocr: can\'t read file %s\n", filename_in);
-                exit (0);
-        }
+	int opt_i = 0;
+	int opt_o = 0;
+	int opt_f = 0;
+	int opt_d = 0;
+	int opt_n = 0;
+	int opt_s = 0;
+	int opt_t = 0;
+	char c;
+
+	char filename_in[STRING_MAX_SIZE];
+	char filename_out[STRING_MAX_SIZE];
+	char format_out[STRING_MAX_SIZE];
+
+	hocr_pixbuf *pix;
+	hocr_text_buffer *text;
+
+	/* 
+	 * default output is text file 
+	 */
+	format_out[0] = 't';
+
+	while ((c = getopt (argc, argv, "dnsthi:o:f:")) != EOF)
+	{
+		switch (c)
+		{
+		case 'i':
+			if (optarg && strlen (optarg) < STRING_MAX_SIZE)
+			{
+				strcpy (filename_in, optarg);
+				opt_i = 1;
+			}
+			break;
+		case 'o':
+			if (optarg && strlen (optarg) < STRING_MAX_SIZE)
+			{
+				strcpy (filename_out, optarg);
+				opt_o = 1;
+			}
+			break;
+		case 'f':
+			if (optarg && strlen (optarg) < STRING_MAX_SIZE)
+			{
+				strcpy (format_out, optarg);
+				opt_f = 1;
+			}
+			break;
+		case 'd':
+			opt_d = 1;
+			break;
+		case 'n':
+			opt_n = 1;
+			break;
+		case 's':
+			opt_s = 1;
+			break;
+		case 't':
+			opt_t = 1;
+			break;
+		case 'h':
+			print_help ();
+			exit (0);
+			break;
+		default:
+			print_help ();
+			exit (0);
+			break;
+		}
+	}
+
+	if (opt_i == 0)
+	{
+		print_help ();
+		exit (0);
+	}
 
- 	/* create a new pixbuf from pbm file */
+	/* 
+	 * create a new pixbuf from pbm file 
+	 */
 	pix = hocr_pixbuf_new_from_file (filename_in);
 
 	if (!pix)
@@ -170,19 +194,59 @@
 		printf ("hocr: can\'t read file %s\n", filename_in);
 		exit (0);
 	}
+
+	/** do ocr */
+
+	/* 
+	 * build ocr command 
+	 */
+	pix->command = HOCR_COMMAND_OCR;
+
+	/* use dict ? */
+	if (opt_d)
+		  pix->command |= HOCR_COMMAND_DICT;
+
+	/* use nikud ? */
+	if (opt_n)
+		  pix->command |= HOCR_COMMAND_NIKUD;
+	
+	/* use spaces ? */
+	if (opt_s)
+		  pix->command |= HOCR_COMMAND_USE_SPACE_FOR_TAB;
 	
-	/* do ocr */
-	strcpy (text, "");
-	hocr_do_ocr (pix, text, 3500);
+	/* use indentation ? */
+	if (opt_t)
+		  pix->command |= HOCR_COMMAND_USE_INDENTATION;
 	
-	/* unref memory */
+	/* create text buffer */
+	text = hocr_text_buffer_new ();
+
+	if (!text)
+	{
+		printf ("hocr-gnome: can\'t allocate memory for text out\n");
+		return 0;
+	}
+
+	/* 
+	 * run the ocr 
+	 */
+	hocr_do_ocr (pix, text);
+
+	/* 
+	 * unref memory 
+	 */
 	hocr_pixbuf_unref (pix);
 
-         /* print out the text */
-        if (opt_o == 1)
-                save_text (filename_out, format_out, text);
-        else
-                save_text (NULL, format_out, text);
+	/* 
+	 * print out the text 
+	 */
+	if (opt_o == 1)
+		save_text (filename_out, format_out, text->text);
+	else
+		save_text (NULL, format_out, text->text);
+
+	/* unref text_buffer */
+	hocr_text_buffer_unref (text);
 
-        return 0;
+	return 0;
 }

Modified: pkg/hocr/branches/upstream/current/examples/hocr/hocr.1
==============================================================================
--- pkg/hocr/branches/upstream/current/examples/hocr/hocr.1	(original)
+++ pkg/hocr/branches/upstream/current/examples/hocr/hocr.1	Sat Dec 24 18:37:24 2005
@@ -25,6 +25,17 @@
 \fB\-o\fR \fIfile\fR
 send output to \fIfile\fR instead of \fBstdout\fR
 .TP
+\fB\-d\fR
+use internal dictionary to guess misread fonts.
+.TP
+\fB\-n\fR
+try to guess nikud for fonts.
+.TP
+\fB\-s\fR
+use spaces for tabs.
+.TP
+\fB\-t\fR
+indent indented lines.
 .TP
 \fB\-f\fR \fIformat\fR
 output \fIformat\fR (html text)

Modified: pkg/hocr/branches/upstream/current/libhocr.pc
==============================================================================
--- pkg/hocr/branches/upstream/current/libhocr.pc	(original)
+++ pkg/hocr/branches/upstream/current/libhocr.pc	Sat Dec 24 18:37:24 2005
@@ -5,6 +5,6 @@
 
 Name: libhocr
 Description: A c library for hebrew optical character recognition
-Version: 0.4.6
+Version: 0.6.4
 Libs: -L${libdir} -lm -lhocr
 Cflags: -I${includedir}

Modified: pkg/hocr/branches/upstream/current/mkinstalldirs
==============================================================================
--- pkg/hocr/branches/upstream/current/mkinstalldirs	(original)
+++ pkg/hocr/branches/upstream/current/mkinstalldirs	Sat Dec 24 18:37:24 2005
@@ -4,108 +4,37 @@
 # Created: 1993-05-16
 # Public domain
 
-errstatus=0
-dirmode=""
-
-usage="\
-Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
+# $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $
 
-# process command line arguments
-while test $# -gt 0 ; do
-  case $1 in
-    -h | --help | --h*)         # -h for help
-      echo "$usage" 1>&2
-      exit 0
-      ;;
-    -m)                         # -m PERM arg
-      shift
-      test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
-      dirmode=$1
-      shift
-      ;;
-    --)                         # stop option processing
-      shift
-      break
-      ;;
-    -*)                         # unknown option
-      echo "$usage" 1>&2
-      exit 1
-      ;;
-    *)                          # first non-opt arg
-      break
-      ;;
-  esac
-done
-
-for file
-do
-  if test -d "$file"; then
-    shift
-  else
-    break
-  fi
-done
-
-case $# in
-  0) exit 0 ;;
-esac
-
-case $dirmode in
-  '')
-    if mkdir -p -- . 2>/dev/null; then
-      echo "mkdir -p -- $*"
-      exec mkdir -p -- "$@"
-    fi
-    ;;
-  *)
-    if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
-      echo "mkdir -m $dirmode -p -- $*"
-      exec mkdir -m "$dirmode" -p -- "$@"
-    fi
-    ;;
-esac
+errstatus=0
 
 for file
 do
-  set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
-  shift
+   set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+   shift
 
-  pathcomp=
-  for d
-  do
-    pathcomp="$pathcomp$d"
-    case $pathcomp in
-      -*) pathcomp=./$pathcomp ;;
-    esac
-
-    if test ! -d "$pathcomp"; then
-      echo "mkdir $pathcomp"
-
-      mkdir "$pathcomp" || lasterr=$?
-
-      if test ! -d "$pathcomp"; then
-  	errstatus=$lasterr
-      else
-  	if test ! -z "$dirmode"; then
-	  echo "chmod $dirmode $pathcomp"
-    	  lasterr=""
-  	  chmod "$dirmode" "$pathcomp" || lasterr=$?
-
-  	  if test ! -z "$lasterr"; then
-  	    errstatus=$lasterr
-  	  fi
-  	fi
-      fi
-    fi
+   pathcomp=
+   for d
+   do
+     pathcomp="$pathcomp$d"
+     case "$pathcomp" in
+       -* ) pathcomp=./$pathcomp ;;
+     esac
+
+     if test ! -d "$pathcomp"; then
+        echo "mkdir $pathcomp"
+
+        mkdir "$pathcomp" || lasterr=$?
+
+        if test ! -d "$pathcomp"; then
+  	  errstatus=$lasterr
+        fi
+     fi
 
-    pathcomp="$pathcomp/"
-  done
+     pathcomp="$pathcomp/"
+   done
 done
 
 exit $errstatus
 
-# Local Variables:
-# mode: shell-script
-# sh-indentation: 2
-# End:
 # mkinstalldirs ends here

Modified: pkg/hocr/branches/upstream/current/po/he.gmo
==============================================================================
Binary files. No diff available.

Modified: pkg/hocr/branches/upstream/current/po/he.po
==============================================================================
--- pkg/hocr/branches/upstream/current/po/he.po	(original)
+++ pkg/hocr/branches/upstream/current/po/he.po	Sat Dec 24 18:37:24 2005
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: hocr 0.4.0\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2005-11-21 13:05+0200\n"
+"POT-Creation-Date: 2005-12-21 11:56+0200\n"
 "PO-Revision-Date: 2005-08-17 02:49+0300\n"
 "Last-Translator: kzamir <kzamir at walla.co.il>\n"
 "Language-Team: Hebrew <LL at li.org>\n"
@@ -16,43 +16,137 @@
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#. set the window title
-#: examples/hocr-gtk/interface.c:75 examples/hocr-gtk/callbacks.c:135
-msgid "hocr-gtk"
+#: examples/hocr-gtk/interface.c:133
+msgid "hocr-gui"
+msgstr ""
+
+#: examples/hocr-gtk/interface.c:145
+msgid "_File"
+msgstr "קובץ"
+
+#: examples/hocr-gtk/interface.c:173
+msgid "_Edit"
+msgstr "עריכה"
+
+#: examples/hocr-gtk/interface.c:204
+msgid "Color boxes"
+msgstr "צבע מסגרות"
+
+#: examples/hocr-gtk/interface.c:207
+msgid "Color text boxes"
+msgstr "צבע מסגרות של אזורי טקסט"
+
+#: examples/hocr-gtk/interface.c:213
+msgid "Color misread"
+msgstr "צבע אותיות"
+
+#: examples/hocr-gtk/interface.c:216
+msgid "Color misread fonts"
+msgstr "צבע אותיות שלא פענחו"
+
+#: examples/hocr-gtk/interface.c:221
+msgid "Clear"
+msgstr "נקה"
+
+#: examples/hocr-gtk/interface.c:225
+msgid "Clear text each time you ocr new scan"
+msgstr "נקה את אזור הטקסט לפני פענוח טקסט חדש"
+
+#: examples/hocr-gtk/interface.c:228
+msgid "Ocr"
 msgstr ""
 
-#: examples/hocr-gtk/interface.c:93
+#: examples/hocr-gtk/interface.c:232
+msgid "Try to recognize fonts in scaned text"
+msgstr "נסה לפענח אותיות"
+
+#: examples/hocr-gtk/interface.c:235
+msgid "Use dictionary"
+msgstr "מילון"
+
+#: examples/hocr-gtk/interface.c:239
+#, fuzzy
+msgid ""
+"Try to guess unrecognized fonts in scaned text using internal dictionary"
+msgstr "נסה לתקן מילים שגויות בעזרת מילון פנימי"
+
+#: examples/hocr-gtk/interface.c:243
+msgid "Use nikud"
+msgstr "ניקוד"
+
+#: examples/hocr-gtk/interface.c:247
+msgid "Try to guess nikud"
+msgstr "נסה לנחש את הניקוד של האות המזוהה"
+
+#: examples/hocr-gtk/interface.c:251
+msgid "Use spaces"
+msgstr "רווח"
+
+#: examples/hocr-gtk/interface.c:255
+msgid "Use spaces for tabs"
+msgstr "השתמש ברווחים במקום סימני טאב"
+
+#: examples/hocr-gtk/interface.c:259
+msgid "Use indentation"
+msgstr "עימוד"
+
+#: examples/hocr-gtk/interface.c:263
+msgid "Try to guess line indentation"
+msgstr "נסה לנחש את העימוד של השורה המזוהה"
+
+#: examples/hocr-gtk/interface.c:267
+msgid "_View"
+msgstr "מראה"
+
+#: examples/hocr-gtk/interface.c:291
+msgid "_Help"
+msgstr "עזרה"
+
+#: examples/hocr-gtk/interface.c:298
+msgid "_About"
+msgstr "אודות"
+
+#: examples/hocr-gtk/interface.c:315
 msgid "Open a new picture for the OCR"
-msgstr "פתח תמונה חדשה"
+msgstr "פתח תמונה חדשה לצורך פענוח"
 
-#: examples/hocr-gtk/interface.c:100
+#: examples/hocr-gtk/interface.c:322
 msgid "Convert picture to text"
-msgstr "תרגם תמונה לטקסט"
+msgstr "נסה לפענח תמונה"
 
-#: examples/hocr-gtk/interface.c:107
+#: examples/hocr-gtk/interface.c:329
 msgid "Save the text created by the OCR"
-msgstr "שמור את הטקסט"
+msgstr "שמור את הטקסט המפוענח"
 
-#: examples/hocr-gtk/interface.c:123
+#: examples/hocr-gtk/interface.c:345
 msgid "Spell check the text"
-msgstr "בדוק איות של הטקסט"
+msgstr "בדוק איות"
 
-#: examples/hocr-gtk/interface.c:152
+#: examples/hocr-gtk/interface.c:382
 msgid "About this application"
 msgstr "אודות ישום זה"
 
-#: examples/hocr-gtk/interface.c:166
-msgid "Quit this program"
-msgstr "צא מהתוכנה"
+#. set the window title
+#: examples/hocr-gtk/callbacks.c:200
+msgid "hocr-gtk"
+msgstr ""
 
-#: examples/hocr-gtk/callbacks.c:241
-msgid "HOCR"
+#: examples/hocr-gtk/callbacks.c:306
+msgid "HOCR-GTK"
 msgstr ""
 
-#: examples/hocr-gtk/callbacks.c:247
-msgid "HOCR - Hebrew character recognition software"
-msgstr "HOCR - זיהוי תווים אופטי עברי"
+#: examples/hocr-gtk/callbacks.c:312
+msgid "HOCR-GTK - Hebrew character recognition software"
+msgstr "HOCR-GTK - מזהה אותיות אופטי עברי"
 
-#: examples/hocr-gtk/callbacks.c:249
+#: examples/hocr-gtk/callbacks.c:314
 msgid "translator_credits"
 msgstr "יעקב זמיר"
+
+#. create font dialog
+#: examples/hocr-gtk/callbacks.c:498
+msgid "Set text font"
+msgstr "קבע את אותיות אזור הטקסט"
+
+#~ msgid "Quit this program"
+#~ msgstr "סגור ישום זה"

Modified: pkg/hocr/branches/upstream/current/po/hocr-gtk.pot
==============================================================================
--- pkg/hocr/branches/upstream/current/po/hocr-gtk.pot	(original)
+++ pkg/hocr/branches/upstream/current/po/hocr-gtk.pot	Sat Dec 24 18:37:24 2005
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2005-11-21 13:05+0200\n"
+"POT-Creation-Date: 2005-12-21 11:56+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -16,43 +16,133 @@
 "Content-Type: text/plain; charset=CHARSET\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#. set the window title
-#: examples/hocr-gtk/interface.c:75 examples/hocr-gtk/callbacks.c:135
-msgid "hocr-gtk"
+#: examples/hocr-gtk/interface.c:133
+msgid "hocr-gui"
+msgstr ""
+
+#: examples/hocr-gtk/interface.c:145
+msgid "_File"
+msgstr ""
+
+#: examples/hocr-gtk/interface.c:173
+msgid "_Edit"
+msgstr ""
+
+#: examples/hocr-gtk/interface.c:204
+msgid "Color boxes"
+msgstr ""
+
+#: examples/hocr-gtk/interface.c:207
+msgid "Color text boxes"
+msgstr ""
+
+#: examples/hocr-gtk/interface.c:213
+msgid "Color misread"
+msgstr ""
+
+#: examples/hocr-gtk/interface.c:216
+msgid "Color misread fonts"
+msgstr ""
+
+#: examples/hocr-gtk/interface.c:221
+msgid "Clear"
+msgstr ""
+
+#: examples/hocr-gtk/interface.c:225
+msgid "Clear text each time you ocr new scan"
+msgstr ""
+
+#: examples/hocr-gtk/interface.c:228
+msgid "Ocr"
+msgstr ""
+
+#: examples/hocr-gtk/interface.c:232
+msgid "Try to recognize fonts in scaned text"
+msgstr ""
+
+#: examples/hocr-gtk/interface.c:235
+msgid "Use dictionary"
 msgstr ""
 
-#: examples/hocr-gtk/interface.c:93
+#: examples/hocr-gtk/interface.c:239
+msgid ""
+"Try to guess unrecognized fonts in scaned text using internal dictionary"
+msgstr ""
+
+#: examples/hocr-gtk/interface.c:243
+msgid "Use nikud"
+msgstr ""
+
+#: examples/hocr-gtk/interface.c:247
+msgid "Try to guess nikud"
+msgstr ""
+
+#: examples/hocr-gtk/interface.c:251
+msgid "Use spaces"
+msgstr ""
+
+#: examples/hocr-gtk/interface.c:255
+msgid "Use spaces for tabs"
+msgstr ""
+
+#: examples/hocr-gtk/interface.c:259
+msgid "Use indentation"
+msgstr ""
+
+#: examples/hocr-gtk/interface.c:263
+msgid "Try to guess line indentation"
+msgstr ""
+
+#: examples/hocr-gtk/interface.c:267
+msgid "_View"
+msgstr ""
+
+#: examples/hocr-gtk/interface.c:291
+msgid "_Help"
+msgstr ""
+
+#: examples/hocr-gtk/interface.c:298
+msgid "_About"
+msgstr ""
+
+#: examples/hocr-gtk/interface.c:315
 msgid "Open a new picture for the OCR"
 msgstr ""
 
-#: examples/hocr-gtk/interface.c:100
+#: examples/hocr-gtk/interface.c:322
 msgid "Convert picture to text"
 msgstr ""
 
-#: examples/hocr-gtk/interface.c:107
+#: examples/hocr-gtk/interface.c:329
 msgid "Save the text created by the OCR"
 msgstr ""
 
-#: examples/hocr-gtk/interface.c:123
+#: examples/hocr-gtk/interface.c:345
 msgid "Spell check the text"
 msgstr ""
 
-#: examples/hocr-gtk/interface.c:152
+#: examples/hocr-gtk/interface.c:382
 msgid "About this application"
 msgstr ""
 
-#: examples/hocr-gtk/interface.c:166
-msgid "Quit this program"
+#. set the window title
+#: examples/hocr-gtk/callbacks.c:200
+msgid "hocr-gtk"
 msgstr ""
 
-#: examples/hocr-gtk/callbacks.c:241
-msgid "HOCR"
+#: examples/hocr-gtk/callbacks.c:306
+msgid "HOCR-GTK"
 msgstr ""
 
-#: examples/hocr-gtk/callbacks.c:247
-msgid "HOCR - Hebrew character recognition software"
+#: examples/hocr-gtk/callbacks.c:312
+msgid "HOCR-GTK - Hebrew character recognition software"
 msgstr ""
 
-#: examples/hocr-gtk/callbacks.c:249
+#: examples/hocr-gtk/callbacks.c:314
 msgid "translator_credits"
 msgstr ""
+
+#. create font dialog
+#: examples/hocr-gtk/callbacks.c:498
+msgid "Set text font"
+msgstr ""

Modified: pkg/hocr/branches/upstream/current/src/Makefile.am
==============================================================================
--- pkg/hocr/branches/upstream/current/src/Makefile.am	(original)
+++ pkg/hocr/branches/upstream/current/src/Makefile.am	Sat Dec 24 18:37:24 2005
@@ -8,7 +8,10 @@
 
 libhocr_la_SOURCES = \
 	hocr.c hocr.h \
-	font_markers.c font_markers.h \
+	hocr_textbuffer.c hocr_textbuffer.h \
+	hocr_pixbuf.c hocr_pixbuf.h \
+	hocr_object.c hocr_object.h \
+	font_recognition.c font_recognition.h \
 	page_layout.c page_layout.h \
 	font_layout.c font_layout.h \
 	consts.h
@@ -17,4 +20,4 @@
 
 libhocr_la_LIBADD = 
 
-include_HEADERS = hocr.h hocrpp.h
+include_HEADERS = hocr.h hocr_pixbuf.h hocr_object.h hocr_textbuffer.h

Modified: pkg/hocr/branches/upstream/current/src/Makefile.in
==============================================================================
--- pkg/hocr/branches/upstream/current/src/Makefile.in	(original)
+++ pkg/hocr/branches/upstream/current/src/Makefile.in	Sat Dec 24 18:37:24 2005
@@ -57,8 +57,12 @@
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+build_alias = @build_alias@
+build_triplet = @build@
 host_alias = @host_alias@
 host_triplet = @host@
+target_alias = @target_alias@
+target_triplet = @target@
 AR = @AR@
 AS = @AS@
 CATALOGS = @CATALOGS@
@@ -95,6 +99,7 @@
 PKG_CONFIG = @PKG_CONFIG@
 POFILES = @POFILES@
 POSUB = @POSUB@
+PO_DIR = @PO_DIR@
 PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@
 PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@
 RANLIB = @RANLIB@
@@ -103,22 +108,26 @@
 USE_NLS = @USE_NLS@
 VERSION = @VERSION@
 VERSION_INFO = @VERSION_INFO@
+WINDRES = @WINDRES@
+WITH_GTKSPELL = @WITH_GTKSPELL@
 gtk_CFLAGS = @gtk_CFLAGS@
 gtk_LIBS = @gtk_LIBS@
+gtkspell_CFLAGS = @gtkspell_CFLAGS@
+gtkspell_LIBS = @gtkspell_LIBS@
 
 libhocr_la_CFLAGS =  	 -Wall      -g
 
 
 lib_LTLIBRARIES = libhocr.la
 
-libhocr_la_SOURCES =  	hocr.c hocr.h 	font_markers.c font_markers.h 	page_layout.c page_layout.h 	font_layout.c font_layout.h 	consts.h
+libhocr_la_SOURCES =  	hocr.c hocr.h 	hocr_textbuffer.c hocr_textbuffer.h 	hocr_pixbuf.c hocr_pixbuf.h 	hocr_object.c hocr_object.h 	font_recognition.c font_recognition.h 	page_layout.c page_layout.h 	font_layout.c font_layout.h 	consts.h
 
 
 libhocr_la_LDFLAGS = -version-info $(VERSION_INFO)
 
 libhocr_la_LIBADD = 
 
-include_HEADERS = hocr.h hocrpp.h
+include_HEADERS = hocr.h hocr_pixbuf.h hocr_object.h hocr_textbuffer.h
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_HEADER = ../config.h
 CONFIG_CLEAN_FILES = 
@@ -130,8 +139,8 @@
 LDFLAGS = @LDFLAGS@
 LIBS = @LIBS@
 libhocr_la_DEPENDENCIES = 
-libhocr_la_OBJECTS =  hocr.lo font_markers.lo page_layout.lo \
-font_layout.lo
+libhocr_la_OBJECTS =  hocr.lo hocr_textbuffer.lo hocr_pixbuf.lo \
+hocr_object.lo font_recognition.lo page_layout.lo font_layout.lo
 CFLAGS = @CFLAGS@
 COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -292,13 +301,19 @@
 	  fi; \
 	done
 font_layout.lo font_layout.o : font_layout.c hocr.h consts.h \
-	font_layout.h
-font_markers.lo font_markers.o : font_markers.c hocr.h consts.h \
-	font_markers.h
-hocr.lo hocr.o : hocr.c consts.h page_layout.h hocr.h font_layout.h \
-	font_markers.h
+	hocr_textbuffer.h hocr_pixbuf.h hocr_object.h font_layout.h
+font_recognition.lo font_recognition.o : font_recognition.c hocr.h \
+	consts.h hocr_textbuffer.h hocr_pixbuf.h hocr_object.h \
+	font_recognition.h
+hocr.lo hocr.o : hocr.c consts.h page_layout.h hocr.h hocr_textbuffer.h \
+	hocr_pixbuf.h hocr_object.h font_layout.h font_recognition.h
+hocr_object.lo hocr_object.o : hocr_object.c consts.h hocr_object.h
+hocr_pixbuf.lo hocr_pixbuf.o : hocr_pixbuf.c consts.h hocr_pixbuf.h \
+	hocr_object.h
+hocr_textbuffer.lo hocr_textbuffer.o : hocr_textbuffer.c consts.h \
+	hocr_textbuffer.h
 page_layout.lo page_layout.o : page_layout.c hocr.h consts.h \
-	page_layout.h
+	hocr_textbuffer.h hocr_pixbuf.h hocr_object.h page_layout.h
 
 info-am:
 info: info-am

Modified: pkg/hocr/branches/upstream/current/src/consts.h
==============================================================================
--- pkg/hocr/branches/upstream/current/src/consts.h	(original)
+++ pkg/hocr/branches/upstream/current/src/consts.h	Sat Dec 24 18:37:24 2005
@@ -1,3 +1,4 @@
+
 /***************************************************************************
  *            consts.c
  *
@@ -22,15 +23,23 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-
 #ifndef __CONSTS_H__
 #define __CONSTS_H__
 
+#ifndef TRUE
+#define TRUE -1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
 /* FIXME: this is a hack for normal pages 
    no more then 200 lines and 200 fonts per line
    better to use dynamic aloocation */
 
 /* in units */
+#define MAX_COLUMNS 4
 #define MAX_LINES 200
 #define MAX_FONTS_IN_LINE 200
 
@@ -46,8 +55,10 @@
 #define MIN_LINE_HIGHT 20
 
 /* FIXME: this is in pixel convert to 1/1000 ? */
-#define MIN_DISTANCE_BETWEEN_LINES 5
-#define MIN_DISTANCE_BETWEEN_WORDS 10
+#define MIN_DISTANCE_BETWEEN_COLUMNS 4
+#define MIN_DISTANCE_BETWEEN_LINES 15
+#define MIN_DISTANCE_BETWEEN_WORDS 8
+#define MIN_DISTANCE_BETWEEN_FONTS 3
 
 /* in 1/1000 cover units */
 #define NOT_IN_A_LINE 33
@@ -59,7 +70,25 @@
 #define LONG_FONT 1200
 #define THIN_FONT 900
 
-#define FONT_ASSEND 100
+#define FONT_ASSEND 150
+
+#define MIN_COLUMN_WIDTH 100
+
+#define MAX_OBJECTS_IN_PAGE 100000
+#define MAX_OBJECTS_IN_FONT 6
+#define MIN_OBJECT_WEIGHT 6
+
+/* how many fonts to avg when geussing line equation */
+
+/* used in font_layout.c to calculate line equation */
+#define NUM_OF_FONTS_TO_AVG 2
+
+/* how much memory will hocr_text_buffer will allocate when it nead memory */
+#define MEMORY_CHANK_FOR_TEXT_BUFFER 500
+
+/* indentation */
+#define NUM_OF_FONTS_IN_INDENT 3
+#define NUM_OF_FONTS_IN_TAB 6
 
 /* end of consts part
  */

Modified: pkg/hocr/branches/upstream/current/src/font_layout.c
==============================================================================
--- pkg/hocr/branches/upstream/current/src/font_layout.c	(original)
+++ pkg/hocr/branches/upstream/current/src/font_layout.c	Sat Dec 24 18:37:24 2005
@@ -1,3 +1,4 @@
+
 /***************************************************************************
  *            font_layout.c
  *
@@ -27,11 +28,12 @@
 #include "font_layout.h"
 
 int
-find_font_baseline (box * fonts, int avg_hight, int index, int num_of_fonts)
+find_font_baseline (hocr_box * fonts, int avg_hight, int index,
+		    int num_of_fonts)
 {
 	if (fonts[index].hight < 2 || fonts[index].width < 2)
 		return 0;
-	
+
 	/* font in the middle of line */
 	if (index > 1 && index < (num_of_fonts - 2))
 	{
@@ -84,11 +86,11 @@
 }
 
 int
-find_font_topline (box * fonts, int avg_hight, int index, int num_of_fonts)
+find_font_topline (hocr_box * fonts, int avg_hight, int index, int num_of_fonts)
 {
 	if (fonts[index].hight < 2 || fonts[index].width < 2)
 		return 0;
-	
+
 	/* font in the middle of line */
 	if (index > 1 && index < (num_of_fonts - 2))
 	{
@@ -136,7 +138,6 @@
 			return fonts[index - 2].y1;
 	}
 
-
 	/* if no other regular font is near then base on yourself */
 	return fonts[index].y1;
 }
@@ -196,3 +197,120 @@
 
 	return 0;
 }
+
+int
+find_font_baseline_eq (hocr_box line, hocr_box * fonts,
+		       hocr_line_eq * base_line, hocr_line_eq * top_line,
+		       int avg_font_hight, int num_of_fonts)
+{
+	int i;
+	int start_counter, end_counter;
+	int x_start, x_end;
+	int y_start, y_end;
+	int font_hight;
+
+	/* skip first two letters, they may be line numbering */
+	int start_at = (num_of_fonts > NUM_OF_FONTS_TO_AVG * 4) ? 2 : 0;
+
+	/* if not enogh fonts then just return the line */
+	if (num_of_fonts < NUM_OF_FONTS_TO_AVG)
+	{
+		/* top line is more aqurate in most hebrew textst */
+		base_line->a = 0;
+		base_line->b = line.y1 + avg_font_hight + 1;
+		top_line->a = 0;
+		top_line->b = line.y1;
+		return 1;
+	}
+
+	/* avg over NUM_OF_FONTS_TO_AVG fonts */
+	y_start = 0;
+	y_end = 0;
+	x_start = 0;
+	x_end = 0;
+	font_hight = 0;
+
+	start_counter = 0;
+	end_counter = 0;
+	/* skip first two letters, they may be line numbering */
+	i = start_at;
+	while (i < num_of_fonts)
+	{
+		if (fonts[i].hight <
+		    ((1000 + FONT_ASSEND) * avg_font_hight / 1000)
+		    && fonts[i].hight >
+		    ((1000 - FONT_ASSEND) * avg_font_hight / 1000))
+		{
+			/* take only first NUM_OF_FONTS_TO_AVG to avg */
+			if (start_counter < NUM_OF_FONTS_TO_AVG)
+			{
+				y_start += fonts[i].y1;
+				x_start += fonts[i].x2;
+				font_hight += fonts[i].hight;
+				start_counter++;
+			}
+		}
+		i++;
+	}
+
+	/* skip first two letters, they may be line numbering */
+	i = num_of_fonts - start_at;
+	while (i > 0)
+	{
+		i--;
+		if (fonts[i].hight <
+		    ((1000 + FONT_ASSEND) * avg_font_hight / 1000)
+		    && fonts[i].hight >
+		    ((1000 - FONT_ASSEND) * avg_font_hight / 1000))
+		{
+			/* take only last NUM_OF_FONTS_TO_AVG to avg */
+			if (end_counter < NUM_OF_FONTS_TO_AVG)
+			{
+				y_end += fonts[i].y1;
+				x_end += fonts[i].x1;
+				font_hight += fonts[i].hight;
+				end_counter++;
+			}
+		}
+	}
+
+	/* if can't any font use the first font for horizontal lines */
+	if (start_counter == 0 || end_counter == 0)
+	{
+		/* top line is more aqurate in most hebrew textst */
+		base_line->a = 0;
+		base_line->b = line.y1 + avg_font_hight + 1;
+		top_line->a = 0;
+		top_line->b = line.y1;
+		return 1;
+	}
+
+	/* if here then counter is not zero, i can avarage */
+	y_start /= start_counter;
+	x_start /= start_counter;
+	y_end /= end_counter;
+	x_end /= end_counter;
+	font_hight /= (end_counter + start_counter);
+
+	/* delta x is small return horizontal line */
+	if ((x_end - x_start) == 0)
+	{
+		/* top line is more aqurate in most hebrew textst */
+		base_line->a = 0;
+		base_line->b = line.y1 + font_hight + 1;
+		top_line->a = 0;
+		top_line->b = line.y1;
+		return 1;
+	}
+
+	/* make line equation (x_end - x_start) is not zero */
+	top_line->a = (double) (y_end - y_start) / (double) (x_end - x_start);
+
+	/* FIXME: assume line is horizonatal and parallel ? */
+	base_line->a = top_line->a;
+
+	top_line->b = y_start - top_line->a * x_start;
+	base_line->b = top_line->b + font_hight + 1;
+
+	return 0;
+}

Modified: pkg/hocr/branches/upstream/current/src/font_layout.h
==============================================================================
--- pkg/hocr/branches/upstream/current/src/font_layout.h	(original)
+++ pkg/hocr/branches/upstream/current/src/font_layout.h	Sat Dec 24 18:37:24 2005
@@ -1,3 +1,4 @@
+
 /***************************************************************************
  *            font_layout.h
  *
@@ -23,6 +24,7 @@
  */
 
 #include "hocr.h"
+#include "consts.h"
 
 #ifndef __FONT_LAYOUT_H__
 #define __FONT_LAYOUT_H__
@@ -32,29 +34,33 @@
  */
 
 int
-find_font_baseline (box * fonts, int avg_hight, int index, int num_of_fonts);
+find_font_baseline_eq (hocr_box line, hocr_box * fonts,
+		       hocr_line_eq * base_line, hocr_line_eq * top_line,
+		       int avg_font_hight, int num_of_fonts);
+
+int
+find_font_baseline (hocr_box * fonts, int avg_hight, int index,
+		    int num_of_fonts);
 
 int
-find_font_topline (box * fonts, int avg_hight, int index, int num_of_fonts);
+find_font_topline (hocr_box * fonts, int avg_hight, int index,
+		   int num_of_fonts);
 
 /*
  font position classes
  */
 
 /* -1 assend 0 normal 1 sunk */
-int
-get_font_top_class (int font_top, int font_topline, int avg_font_hight);
+int get_font_top_class (int font_top, int font_topline, int avg_font_hight);
 
 /* -1 assend 0 normal 1 sunk */
 int
 get_font_base_class (int font_bottom, int font_baseline, int avg_font_hight);
 
 /* -1 short 0 normal 1 ling */
-int
-get_font_hight_class (int font_hight, int avg_font_hight);
+int get_font_hight_class (int font_hight, int avg_font_hight);
 
 /* -1 thin 0 normal 1 wide */
-int
-get_font_width_class (int font_width, int avg_font_width);
+int get_font_width_class (int font_width, int avg_font_width);
 
 #endif

Modified: pkg/hocr/branches/upstream/current/src/hocr.c
==============================================================================
--- pkg/hocr/branches/upstream/current/src/hocr.c	(original)
+++ pkg/hocr/branches/upstream/current/src/hocr.c	Sat Dec 24 18:37:24 2005
@@ -1,3 +1,4 @@
+
 /***************************************************************************
  *            hocr.c
  *
@@ -29,270 +30,103 @@
 #include "consts.h"
 #include "page_layout.h"
 #include "font_layout.h"
-#include "font_markers.h"
+#include "font_recognition.h"
 #include "hocr.h"
 
 /* 
- internal pixbuf stractures 
+ visualization helper finction
  */
 
 int
-hocr_pixbuf_get_n_channels (hocr_pixbuf * pix)
-{
-	return pix->n_channels;
-}
-
-int
-hocr_pixbuf_get_height (hocr_pixbuf * pix)
-{
-	return pix->height;
-}
-
-int
-hocr_pixbuf_get_width (hocr_pixbuf * pix)
-{
-	return pix->width;
-}
-
-int
-hocr_pixbuf_get_rowstride (hocr_pixbuf * pix)
-{
-	return pix->rowstride;
-}
-
-int
-hocr_pixbuf_get_brightness (hocr_pixbuf * pix)
-{
-	return pix->brightness;
-}
-
-unsigned char *
-hocr_pixbuf_get_pixels (hocr_pixbuf * pix)
-{
-	return pix->pixels;
-}
-
-int
-hocr_pixbuf_get_pixel (hocr_pixbuf * pix, int x, int y)
-{
-	unsigned char *pixel;
-
-	if (x < 0 || x >= pix->width || y < 0 || y >= pix->height)
-		return 0;
-
-	pixel = pix->pixels + x * pix->n_channels + y * pix->rowstride;
-
-	return (pixel[0] < pix->brightness) ? 1 : 0;
-}
-
-int
-hocr_pixbuf_set_pixel (hocr_pixbuf * pix, int x, int y, int channel,
-		       int value)
-{
-	unsigned char *pixel;
-
-	if (x < 0 || x >= pix->width || y < 0 || y >= pix->height)
-		return 0;
-
-	pixel = pix->pixels + x * pix->n_channels + y * pix->rowstride;
-	pixel[channel] = value;
-
-	return (pixel[channel] < pix->brightness) ? 1 : 0;
-}
-
-/* hocr_pixbuf file utils */
-
-unsigned char
-hocr_pbm_getc (FILE * file)
+print_font (hocr_pixbuf * pix, hocr_box font)
 {
-	unsigned char ch;
-	int comment = FALSE;
+	int x, y;
+	int new_color;
 
-	do
+	for (x = font.x1; x <= font.x2; x++)
 	{
-		ch = getc (file);
-		if (ch == '\n')
-			comment = FALSE;
-		else if (ch == '#')
-			comment = TRUE;
+		printf ("---");
 	}
-	while (comment);
-
-	return ch;
-}
-
-int
-hocr_pbm_getint (FILE * file)
-{
-	unsigned char ch;
-	int i = 0;
+	printf ("\n");
 
-	do
+	for (y = font.y1; y <= font.y2; y++)
 	{
-		ch = hocr_pbm_getc (file);
+		for (x = font.x1; x <= font.x2; x++)
+		{
+			if (new_color = hocr_pixbuf_get_object (pix, x, y))
+				printf ("%3d", new_color);
+			else
+				printf ("   ");
+		}
+		printf ("\n");
 	}
-	while (ch == ' ' || ch == '\n' || ch == '\t');
 
-	do
+	for (x = font.x1; x <= font.x2; x++)
 	{
-		i = (i * 10) + (ch - '0');
-		ch = hocr_pbm_getc (file);
+		printf ("---");
 	}
-	while (ch >= '0' && ch <= '9');
+	printf ("\n");
+
+	printf ("\n");
 
-	return i;
+	return 0;
 }
 
 int
-hocr_pbm_getbit (FILE * file, int gray_scale)
+color_hocr_box_full (hocr_pixbuf * pix, hocr_box rect, int chanell, int value,
+		     int only_main_object)
 {
+	int x, y;
+	unsigned int obj = 0;
+	unsigned int object_array[MAX_OBJECTS_IN_FONT];
 
-	static unsigned char byte = 0;
-	static unsigned char mask = 0;
-	int return_bit;
-
-	if (gray_scale)
+	if (only_main_object)
 	{
-		return_bit = getc (file);
+		obj = hocr_pixbuf_get_objects_in_box (pix, rect, object_array);
 	}
-	else
-	{
-		if (mask == 0)
-		{
-			mask = 0x80;
-			byte = getc (file);
-		}
 
-		return_bit = (byte & mask) ? 0 : 255;
-
-		mask >>= 1;
-	}
-	
-	return return_bit;
-}
-
-hocr_pixbuf *
-hocr_pixbuf_new_from_file (const char *filename)
-{
-	int x, y;
-	unsigned char *pixel;
-	int bit_read;
-	char char_read;
-	hocr_pixbuf *new_pixbuf;
-	FILE *file = NULL;
-	int gray_scale = FALSE;
-	int dippnes = 1;
-	
-	/* open file */
-	file = fopen (filename, "r");
-	if (!file)
-		return NULL;
-
-	/* allocate memory for pixbuf */
-	new_pixbuf = (hocr_pixbuf *) malloc (sizeof (hocr_pixbuf));
-	if (!new_pixbuf)
-		return NULL;
-
-	/* read magic number "P4" for pbm file */
-	char_read = hocr_pbm_getc (file);
-	if (char_read != 'P')
-		return NULL;
-	char_read = hocr_pbm_getc (file);
-	if (char_read == '4')
-		gray_scale = FALSE;
-	else if (char_read == '5')
-		gray_scale = TRUE;
-	else
-		return NULL;
-
-	/* read header */
-	new_pixbuf->n_channels = 3;
-	new_pixbuf->brightness = 100;
-	new_pixbuf->pixels = NULL;
-
-	/* read width and height */
-	new_pixbuf->width = hocr_pbm_getint (file);
-	new_pixbuf->height = hocr_pbm_getint (file);
-	new_pixbuf->rowstride = new_pixbuf->width * 3;
-
-	/* read gray_scale dippnes */
-	if (gray_scale)
-		dippnes = hocr_pbm_getint (file);
-	if (dippnes > 255)
-		return NULL;
-	
-	/* allocate memory for data */
-	new_pixbuf->pixels =
-		malloc (new_pixbuf->height * new_pixbuf->rowstride);
-	if (!(new_pixbuf->pixels))
-		return NULL;
-
-	/* read data */
-	for (y = 0; y < new_pixbuf->height; y++)
-	{
-		for (x = 0; x < new_pixbuf->width; x++)
+	for (y = rect.y1 + 1; y <= (rect.y2 - 1); y++)
+		for (x = rect.x1 + 1; x <= (rect.x2 - 1); x++)
 		{
-			bit_read = hocr_pbm_getbit (file, gray_scale);
-			pixel = new_pixbuf->pixels +
-				x * new_pixbuf->n_channels +
-				y * new_pixbuf->rowstride;
-			pixel[0] = bit_read;
-			pixel[1] = bit_read;
-			pixel[2] = bit_read;
+			if (!obj || obj == hocr_pixbuf_get_object (pix, x, y))
+				hocr_pixbuf_set_pixel (pix, x, y, chanell,
+						       value);
 		}
-	}
 
-	/* return the new pixbuf to user */
-	return new_pixbuf;
+	return 0;
 }
 
 int
-hocr_pixbuf_unref (hocr_pixbuf * pix)
-{
-	if (pix->pixels)
-		free (pix->pixels);
-
-	if (pix)
-		free (pix);
-
-	return 1;
-}
-
-/* 
- visualization helper finction
- */
-
-int
-print_font (hocr_pixbuf * pix, box font)
+color_hocr_box (hocr_pixbuf * pix, hocr_box rect, int chanell, int value)
 {
 	int x, y;
-	int new_color;
 
-	for (y = font.y1; y < (font.y2 + 0); y++)
+	for (y = rect.y1; y <= rect.y2; y++)
 	{
-		for (x = font.x1; x < (font.x2 + 1); x++)
-		{
-			new_color = hocr_pixbuf_get_pixel (pix, x, y);
-			printf ("%d", new_color);
-		}
-		printf ("\n");
+		hocr_pixbuf_set_pixel (pix, rect.x1, y, chanell, value);
+		hocr_pixbuf_set_pixel (pix, rect.x2, y, chanell, value);
 	}
 
-	printf ("\n");
+	for (x = rect.x1; x <= rect.x2; x++)
+	{
+		hocr_pixbuf_set_pixel (pix, x, rect.y1, chanell, value);
+		hocr_pixbuf_set_pixel (pix, x, rect.y2, chanell, value);
+	}
 
 	return 0;
 }
 
 int
-color_box (hocr_pixbuf * pix, box rect, int chanell, int value)
+color_hocr_line_eq (hocr_pixbuf * pix, hocr_line_eq * line, int x1, int x2,
+		    int chanell, int value)
 {
 	int x, y;
 
-	for (y = rect.y1; y < rect.y2; y++)
-		for (x = rect.x1; x < rect.x2; x++)
-		{
-			hocr_pixbuf_set_pixel (pix, x, y, chanell, value);
-		}
+	for (x = x1; x < x2; x++)
+	{
+		y = hocr_line_eq_get_y (*line, x);
+		hocr_pixbuf_set_pixel (pix, x, y, chanell, value);
+	}
 
 	return 0;
 }
@@ -301,453 +135,534 @@
  */
 
 int
-hocr_do_ocr (hocr_pixbuf * pix, char *text_buffer, int max_buffer_size)
+hocr_do_ocr (hocr_pixbuf * pix, hocr_text_buffer * text_buffer)
 {
-	box column;
-	/* box column; is a place holder to a time when we add column support */
-	box lines[MAX_LINES];
-	box fonts[MAX_LINES][MAX_FONTS_IN_LINE];
-
-	int num_of_fonts[MAX_LINES];
-	int num_of_lines;
-	int num_of_fonts_in_page;
-
-	int avg_font_hight_in_page;
-	int avg_font_width_in_page;
+	hocr_box *columns;	// [MAX_COLUMNS];
+	hocr_box *lines;	// [MAX_COLUMNS][MAX_LINES];
+	hocr_box *fonts;	// [MAX_COLUMNS][MAX_LINES][MAX_FONTS_IN_LINE];
+
+	hocr_line_eq line_eqs[MAX_COLUMNS][MAX_LINES][2];
+
+	int num_of_fonts[MAX_COLUMNS][MAX_LINES];
+	int num_of_lines[MAX_COLUMNS];
+
+	int num_of_columns_in_page = 0;
+	int num_of_lines_in_page = 0;
+	int num_of_fonts_in_page = 0;
+	int num_of_regular_fonts_in_page = 0;
+
+	int avg_line_hight_in_page = 0;
+	int avg_line_x_start_in_column[MAX_COLUMNS];
+	int avg_diff_between_lines_in_page = 0;
+	int avg_diff_between_fonts_in_page = 0;
+	int avg_font_width_in_page = 0;
+	int avg_font_hight_in_page = 0;
+	int avg_regular_font_width_in_page = 0;
+	int avg_regular_font_hight_in_page = 0;
 
+	int c;
 	int i, j, k;
 	int y1, y2;
 
-	/* font position classes */
-	int base_class;
-	int top_class;
-	int hight_class;
-	int width_class;
-	int end_of_line;
-	int end_of_word;
-	int end_of_paragraph;
-
-	/* font shape markers */
-
-	/* an array of font marks */
-	int font_mark[50];
-
-	/* an array of function for detecting font marks */
-	has_font_mark_function has_font_mark[50];
-
 	/* need this to put in the text_buffer */
-	int len;
-	int last_was_quot = 0;
 	char chars[10];
 
-	/* create an array of all has_font_mark_functions */
-	init_has_font_mark_functions (has_font_mark);
+	/* format args */
+	int end_of_word = 0;
+	int tabs = 0;
+	int indent = 0;
 
-	/* get all lines in this column */
-	fill_lines_array (pix, column, lines, &num_of_lines, MAX_LINES);
+	/* memory allocation */
+	columns = malloc (sizeof (hocr_box) * MAX_COLUMNS);
+	if (!columns)
+		return -1;
 
-	/* get all fonts for all the lines */
-	for (i = 0; i < num_of_lines; i++)
+	lines = malloc (sizeof (hocr_box) * MAX_COLUMNS * MAX_LINES);
+	if (!lines)
 	{
-		/* visual aids to see line box on screen */
-		/* color_box (pix, lines[i], 1, 0); */
-		fill_fonts_array (pix, lines[i],
-				  fonts[i],
-				  &(num_of_fonts[i]), MAX_FONTS_IN_LINE);
-	}
-	
-	/* get size statistics for all fonts for all the lines */
-	num_of_fonts_in_page = 0;
-	avg_font_hight_in_page = 0;
-	avg_font_width_in_page = 0;
-	for (i = 0; i < num_of_lines; i++)
-	{
-		for (j = 0; j < num_of_fonts[i]; j++)
-		{
-			num_of_fonts_in_page++;
-			avg_font_width_in_page += fonts[i][j].width;
-			avg_font_hight_in_page += fonts[i][j].hight;
-		}
+		free (columns);
+		return -1;
 	}
 
-	if (num_of_fonts_in_page != 0)
+	fonts = malloc (sizeof (hocr_box) * MAX_COLUMNS * MAX_LINES *
+			MAX_FONTS_IN_LINE);
+	if (!fonts)
 	{
-		avg_font_width_in_page /= num_of_fonts_in_page;
-		avg_font_hight_in_page /= num_of_fonts_in_page;
+		free (lines);
+		free (columns);
+		return -1;
 	}
 
-	/* get all fonts for all the lines */
-	for (i = 0; i < num_of_lines; i++)
+	/* create and fill the object map */
+	hocr_pixbuf_create_object_map (pix);
+
+	/* get columns for this page */
+	fill_columns_array (pix, columns, &num_of_columns_in_page, MAX_COLUMNS);
+
+	/* get lines in this column */
+	num_of_lines_in_page = 0;
+
+	for (c = 0; c < num_of_columns_in_page; c++)
 	{
-		for (j = 0; j < num_of_fonts[i]; j++)
-		{
-			y1 = find_font_topline (fonts[i],
-						avg_font_hight_in_page,
-						j, num_of_fonts[i]);
-			y2 = find_font_baseline (fonts[i],
-						 avg_font_hight_in_page,
-						 j, num_of_fonts[i]);
-
-			/* font position and size markers 
-			 */
-			base_class =
-				get_font_base_class (fonts[i][j].y2,
-						     y2,
-						     avg_font_hight_in_page);
-			top_class =
-				get_font_top_class (fonts[i][j].y1,
-						    y1,
-						    avg_font_hight_in_page);
-			hight_class =
-				get_font_hight_class (fonts[i][j].
-						      hight,
-						      avg_font_hight_in_page);
-			width_class =
-				get_font_width_class (fonts[i][j].
-						      width,
-						      avg_font_width_in_page);
-
-			/* line markers */
-			end_of_line = (j == (num_of_fonts[i] - 1)) ? 1 : 0;
-			end_of_paragraph = 0;
-			if (end_of_line == 0)
-			{
-				end_of_word =
-					(fonts[i][j].x1 -
-					 fonts[i][j + 1].x2) >
-					MIN_DISTANCE_BETWEEN_WORDS;
-			}
-			else
-			{
-				if ((i < num_of_lines - 1)
-				    && ((lines[i + 1].y1 - lines[i].y2) >
-					(int) (1.5 *
-					       (double)
-					       avg_font_hight_in_page)))
-					end_of_paragraph = 1;
+		num_of_lines[c] = 0;
 
-				end_of_word = 1;
-			}
+		fill_lines_array (pix, columns[c], &(lines[c * MAX_LINES]),
+				  &(num_of_lines[c]), MAX_LINES);
+		num_of_lines_in_page += num_of_lines[c];
+	}
 
-			/* font shape markers */
+	/* get avg_line_hight_in_page */
+	avg_line_hight_in_page = 0;
+	avg_diff_between_lines_in_page = 0;
 
-			/* TODO: this shuld be moved to the right place 
-			 * and not doen unnesseraly for all fonts */
+	for (c = 0; c < num_of_columns_in_page; c++)
+	{
+		avg_line_x_start_in_column[c] = 0;
 
-			for (k = 1; k < 35; k++)
-			{
-				font_mark[k] =
-					(has_font_mark[k]) (pix, fonts[i][j]);
-			}
+		for (i = 0; i < num_of_lines[c]; i++)
+		{
+			avg_line_x_start_in_column[c] +=
+				lines[c * MAX_LINES + i].x2;
+			avg_line_hight_in_page +=
+				lines[c * MAX_LINES + i].hight;
+			if (i < (num_of_lines[c] - 1))
+				avg_diff_between_lines_in_page +=
+					(lines[c * MAX_LINES + i + 1].y1 -
+					 lines[c * MAX_LINES + i].y2);
+		}
 
-			font_mark[0] = 0;
+		if (num_of_lines[c] != 0)
+		{
+			avg_line_x_start_in_column[c] =
+				avg_line_x_start_in_column[c] / num_of_lines[c];
+		}
+	}
 
-			/* if wide then arteffact */
+	if (num_of_lines_in_page != 0)
+		avg_line_hight_in_page =
+			avg_line_hight_in_page / num_of_lines_in_page;
+	if ((num_of_lines_in_page - num_of_columns_in_page + 1) != 0)
+		avg_diff_between_lines_in_page =
+			avg_diff_between_lines_in_page /
+			(num_of_lines_in_page - num_of_columns_in_page + 1);
 
-			if (width_class == 1)
-			{
-				/* arteffact */
-				sprintf (chars, "--");
-				font_mark[0] = 1;
-			}
+	/* get all fonts for all the lines */
+	for (c = 0; c < num_of_columns_in_page; c++)
+	{
+		for (i = 0; i < num_of_lines[c]; i++)
+		{
+			fill_fonts_array (pix, lines[c * MAX_LINES + i],
+					  &(fonts[c * MAX_LINES * MAX_FONTS_IN_LINE +
+						 i * MAX_FONTS_IN_LINE]),
+					  &(num_of_fonts[c][i]),
+					  MAX_FONTS_IN_LINE);
+		}
+	}
 
-			/* small fonts */
+	/* get size statistics for all fonts for all the lines */
+	num_of_regular_fonts_in_page = 0;
+	avg_font_hight_in_page = 0;
+	avg_font_width_in_page = 0;
+	avg_diff_between_fonts_in_page = 0;
 
-			else if (hight_class == -1
-				 && top_class == 1 && base_class == 1)
-			{
-				/* '-' */
-				sprintf (chars, "-");
-			}
-			else if (hight_class == -1 && top_class == 0)
-			{
-				if (font_mark[34] == 1)
-				{
-					/* '-' */
-					sprintf (chars, "-");
-				}
-				else if (font_mark[10] == 1)
-				{
-					/* yud */
-					sprintf (chars, "י");
-				}
-				else if (font_mark[31] == 1)
-				{
-					sprintf (chars, "\"");
-				}
-				else if (font_mark[30] == 1)
-				{
-					sprintf (chars, "\'");
-				}
-				else
-				{
-					sprintf (chars, "*");
-					font_mark[0] = 1;
+	for (c = 0; c < num_of_columns_in_page; c++)
+	{
+		for (i = 0; i < num_of_lines[c]; i++)
+		{
+			if (lines[c * MAX_LINES + i].hight >
+			    (avg_line_hight_in_page -
+			     1.5 * MIN_DISTANCE_BETWEEN_LINES))
+			{
+				for (j = 0; j < num_of_fonts[c][i]; j++)
+				{
+
+					num_of_regular_fonts_in_page++;
+					avg_font_width_in_page +=
+						fonts[c * MAX_LINES *
+						      MAX_FONTS_IN_LINE +
+						      i * MAX_FONTS_IN_LINE + j].width;
+					avg_font_hight_in_page +=
+						fonts[c * MAX_LINES *
+						      MAX_FONTS_IN_LINE +
+						      i * MAX_FONTS_IN_LINE + j].hight;
+					if (j < (num_of_fonts[c][i] - 1))
+					{
+						avg_diff_between_fonts_in_page
+							+=
+							(fonts
+							 [c * MAX_LINES *
+							  MAX_FONTS_IN_LINE +
+							  i * MAX_FONTS_IN_LINE +
+							  j].x1 -
+							 fonts[c * MAX_LINES *
+							       MAX_FONTS_IN_LINE +
+							       i * MAX_FONTS_IN_LINE +
+							       j + 1].x2);
+					}
 				}
 			}
-			else if ((hight_class == -1) && (top_class == 1)
-				 && (base_class == 0))
-			{
-				/* period */
-				sprintf (chars, ".");
-			}
-			else if ((hight_class == -1)
-				 && (top_class == 1) && (base_class == -1))
+			/* this line is too thin */
+			else
 			{
-				/* we assume comma */
-				sprintf (chars, ",");
+				num_of_fonts[c][i] = 0;
 			}
+		}
+	}
 
-			/* high fonts desending from top */
+	if (num_of_regular_fonts_in_page != 0)
+	{
+		avg_font_width_in_page /= num_of_regular_fonts_in_page;
+		avg_font_hight_in_page /= num_of_regular_fonts_in_page;
 
-			else if (hight_class == 1 && top_class == -1)
-			{
-				/* lamed */
-				sprintf (chars, "ל");
+		if (num_of_regular_fonts_in_page != 1)
+			avg_diff_between_fonts_in_page /=
+				(num_of_regular_fonts_in_page - 1);
+	}
+
+	/* avg over regular fonts only to get better avg_font_hight_in_page */
+	num_of_regular_fonts_in_page = 0;
+	avg_regular_font_hight_in_page = 0;
+	avg_regular_font_hight_in_page = 0;
+	for (c = 0; c < num_of_columns_in_page; c++)
+	{
+		for (i = 0; i < num_of_lines[c]; i++)
+		{
+			if (lines[c * MAX_LINES + i].hight >
+			    (avg_line_hight_in_page -
+			     1.5 * MIN_DISTANCE_BETWEEN_LINES))
+			{
+				for (j = 0; j < num_of_fonts[c][i]; j++)
+				{
+					if (fonts
+					    [c * MAX_LINES * MAX_FONTS_IN_LINE +
+					     i * MAX_FONTS_IN_LINE + j].hight <
+					    ((1000 +
+					      FONT_ASSEND) *
+					     avg_font_hight_in_page / 1000)
+					    && fonts[c * MAX_LINES *
+						     MAX_FONTS_IN_LINE + i * MAX_FONTS_IN_LINE +
+						     j].hight >
+					    ((1000 -
+					      FONT_ASSEND) *
+					     avg_font_hight_in_page / 1000))
+					{
+						num_of_regular_fonts_in_page++;
+						avg_regular_font_width_in_page
+							+=
+							fonts[c * MAX_LINES *
+							      MAX_FONTS_IN_LINE +
+							      i * MAX_FONTS_IN_LINE +
+							      j].width;
+						avg_regular_font_hight_in_page
+							+=
+							fonts[c * MAX_LINES *
+							      MAX_FONTS_IN_LINE +
+							      i * MAX_FONTS_IN_LINE +
+							      j].hight;
+					}
+				}
 			}
+		}
+	}
 
-			/* high and thin fonts desending from buttom */
+	if (num_of_regular_fonts_in_page != 0)
+	{
+		avg_regular_font_width_in_page /= num_of_regular_fonts_in_page;
+		avg_regular_font_hight_in_page /= num_of_regular_fonts_in_page;
+	}
 
-			else if (hight_class == 1 && width_class == -1
-				 && top_class == 0)
+	/* get line equations for non horizontal lines */
+	for (c = 0; c < num_of_columns_in_page; c++)
+	{
+		for (i = 0; i < num_of_lines[c]; i++)
+		{
+			if (num_of_fonts[c][i] == 0)
+				continue;
+			find_font_baseline_eq (lines[c * MAX_LINES + i],
+					       &(fonts[c * MAX_LINES *
+						      MAX_FONTS_IN_LINE +
+						      i * MAX_FONTS_IN_LINE]),
+					       &(line_eqs[c][i][0]),
+					       &(line_eqs[c][i][1]),
+					       avg_regular_font_hight_in_page,
+					       num_of_fonts[c][i]);
+			/* if line is very not horizontal return error */
+			if ((line_eqs[c][i][0].a *
+			     line_eqs[c][i][0].a) > (1.0 / 1000.0))
 			{
-				/* nun sofit */
-				sprintf (chars, "ן");
+				num_of_fonts[c][i] = 0;
 			}
+		}
+	}
 
-			/* high fonts desending from buttom */
-
-			else if (hight_class == 1 && width_class == 0
-				 && top_class == 0)
+	/* color the results of page layout functions */
+	if (pix->command & HOCR_COMMAND_COLOR_BOXES)
+	{
+		for (c = 0; c < num_of_columns_in_page; c++)
+		{
+			color_hocr_box (pix, columns[c], 1, 0);
+			for (i = 0; i < num_of_lines[c]; i++)
 			{
-				if (font_mark[12] == 1)
-				{
-					/* kaf sofit */
-					sprintf (chars, "ך");
-				}
-				else if (font_mark[19] == 1)
-				{
-					/*  ayin */
-					sprintf (chars, "ע");
-				}
-				else if (font_mark[21] == 1)
-				{
-					/*  pe sofit */
-					sprintf (chars, "ף");
-				}
-				else if (font_mark[23] == 1)
-				{
-					/* tzadi */
-
-					sprintf (chars, "ץ");
-				}
-				else if (font_mark[24] == 1)
-				{
-					/* kuf */
-					sprintf (chars, "ק");
-				}
-				else
-				{
-					sprintf (chars, "*");
-					font_mark[0] = 1;
+				if (num_of_fonts[c][i] == 0)
+					continue;
+				/* color line boxes */
+				color_hocr_line_eq (pix,
+						    &(line_eqs
+						      [c][i]
+						      [0]),
+						    lines[c * MAX_LINES +
+							  i].x1,
+						    lines[c * MAX_LINES +
+							  i].x2, 2, 0);
+				color_hocr_line_eq (pix, &(line_eqs[c][i][1]),
+						    lines[c * MAX_LINES +
+							  i].x1,
+						    lines[c * MAX_LINES +
+							  i].x2, 2, 100);
+				/* color individual font boxes */
+				for (j = 0; j < num_of_fonts[c][i]; j++)
+				{
+					/* if arteffact do not recognize */
+					if (fonts
+					    [c * MAX_LINES * MAX_FONTS_IN_LINE +
+					     i * MAX_FONTS_IN_LINE + j].width < 3
+					    || fonts[c * MAX_LINES *
+						     MAX_FONTS_IN_LINE + i * MAX_FONTS_IN_LINE +
+						     j].hight < 3)
+						continue;
+					if (fonts
+					    [c * MAX_LINES * MAX_FONTS_IN_LINE +
+					     i * MAX_FONTS_IN_LINE + j].width >
+					    (3.5 *
+					     (double)
+					     avg_regular_font_width_in_page)
+					    || fonts[c * MAX_LINES *
+						     MAX_FONTS_IN_LINE + i * MAX_FONTS_IN_LINE +
+						     j].hight >
+					    (3.5 *
+					     (double)
+					     avg_regular_font_hight_in_page))
+						continue;
+					color_hocr_box (pix,
+							fonts[c * MAX_LINES *
+							      MAX_FONTS_IN_LINE +
+							      i * MAX_FONTS_IN_LINE +
+							      j], 1, 0);
 				}
 			}
+		}
+	}
 
-			/* thin fonts */
-
-			else if (width_class == -1)
+	/* do ocr ? */
+	if ((pix->command & HOCR_COMMAND_OCR))
+	{
+		/* get all fonts for all the lines */
+		for (c = 0; c < num_of_columns_in_page; c++)
+		{
+			for (i = 0; i < num_of_lines[c]; i++)
 			{
-				/* gimel 2, vav 5, zayin 6, tet 8, nun 15 */
-
-				if (font_mark[32] == 1)
-				{
-					/* tet */
-					sprintf (chars, "!");
-				}
-				else if (font_mark[33] == 1)
-				{
-					/* gimel */
-					sprintf (chars, "?");
-				}
-				else if (font_mark[3] == 1)
-				{
-					/* gimel */
-					sprintf (chars, "ג");
-				}
-				else if (font_mark[9] == 1)
-				{
-					/* tet */
-					sprintf (chars, "ט");
-				}
-				else if (font_mark[19] == 1)
-				{
-					/* ayin */
-					sprintf (chars, "ע");
-				}
-				else if (font_mark[16] == 1)
-				{
-					/* nun */
-					sprintf (chars, "נ");
-				}
-				else if (font_mark[6] == 1)
-				{
-					/* vav */
-					sprintf (chars, "ו");
-				}
-				else if (font_mark[25] == 1)
-				{
-					/* resh */
-					sprintf (chars, "ר");
-				}
-				else if (font_mark[7] == 1)
-				{
-					/* zayin */
-					sprintf (chars, "ז");
+				/* check for indentation */
+				if (fonts
+				    [c * MAX_LINES * MAX_FONTS_IN_LINE +
+				     i * MAX_FONTS_IN_LINE + 0].x2 <
+				    (avg_line_x_start_in_column[c] -
+				     NUM_OF_FONTS_IN_INDENT *
+				     avg_font_width_in_page))
+				{
+					indent = TRUE;
+
+					if ((pix->
+					     command &
+					     HOCR_COMMAND_USE_INDENTATION) != 0)
+					{
+						if ((pix->
+						     command &
+						     HOCR_COMMAND_USE_SPACE_FOR_TAB)
+						    != 0)
+						{
+							hocr_text_buffer_add_string
+								(text_buffer,
+								 "    ");
+						}
+						else
+						{
+							hocr_text_buffer_add_string
+								(text_buffer,
+								 "\t");
+						}
+					}
 				}
 				else
 				{
-					sprintf (chars, "*");
-					font_mark[0] = 1;
+					indent = FALSE;
 				}
-			}
-			/* regular fonts */
-			/* TODO: sort fonts by statistical number of appearences in text */
-			else
-			{
 
-				if (font_mark[1] == 1)
-				{
-					sprintf (chars, "א");
-				}
-				else if (font_mark[2] == 1)
-				{
-					sprintf (chars, "ב");
-				}
-				else if (font_mark[3] == 1)
-				{
-					sprintf (chars, "ג");
-				}
-				else if (font_mark[4] == 1)
-				{
-					sprintf (chars, "ד");
-				}
-				else if (font_mark[5] == 1)
+				for (j = 0; j < num_of_fonts[c][i]; j++)
 				{
-					sprintf (chars, "ה");
-				}
-				else if (font_mark[8] == 1)
-				{
-					sprintf (chars, "ח");
-				}
-				else if (font_mark[9] == 1)
-				{
-					sprintf (chars, "ט");
-				}
-				else if (font_mark[11] == 1)
-				{
-					sprintf (chars, "כ");
-				}
-				else if (font_mark[14] == 1)
-				{
-					sprintf (chars, "מ");
-				}
-				else if (font_mark[15] == 1)
-				{
-					sprintf (chars, "ם");
-				}
-				//else if (nun_mark == 1)
-				//{
-				//      sprintf (chars, "נ");
-				//}
-				else if (font_mark[18] == 1)
-				{
-					sprintf (chars, "ס");
-				}
-				else if (font_mark[19])
-				{
-					sprintf (chars, "ע");
-				}
-				else if (font_mark[20] == 1)
-				{
-					sprintf (chars, "פ");
-				}
-				else if (font_mark[22])
-				{
-					sprintf (chars, "צ");
-				}
-				else if (font_mark[25] == 1)
-				{
-					sprintf (chars, "ר");
-				}
-				else if (font_mark[26] == 1)
-				{
-					sprintf (chars, "ש");
-				}
-				else if (font_mark[27] == 1)
-				{
-					sprintf (chars, "ת");
-				}
-				else
-				{
-					sprintf (chars, "*");
-					font_mark[0] = 1;
-				}
+					if ((j + 1) < num_of_fonts[c][i])
+					{
+						/* check for end of word */
+						end_of_word =
+							((fonts
+							  [c * MAX_LINES *
+							   MAX_FONTS_IN_LINE +
+							   i * MAX_FONTS_IN_LINE +
+							   j].x1 -
+							  fonts[c *
+								MAX_LINES *
+								MAX_FONTS_IN_LINE +
+								i * MAX_FONTS_IN_LINE +
+								j + 1].x2) >
+							 MIN_DISTANCE_BETWEEN_WORDS);
+
+						/* check for tabs */
+						if (avg_regular_font_width_in_page)
+							tabs = (fonts
+								[c *
+								 MAX_LINES *
+								 MAX_FONTS_IN_LINE +
+								 i * MAX_FONTS_IN_LINE +
+								 j].x1 -
+								fonts[c *
+								      MAX_LINES
+								      *
+								      MAX_FONTS_IN_LINE
+								      +
+								      i *
+								      MAX_FONTS_IN_LINE
+								      + j +
+								      1].x2) /
+								(NUM_OF_FONTS_IN_TAB
+								 *
+								 avg_regular_font_width_in_page);
+						else
+							tabs = 0;
+					}
+
+					/* if arteffact do not recognize */
+					if (fonts
+					    [c * MAX_LINES * MAX_FONTS_IN_LINE +
+					     i * MAX_FONTS_IN_LINE + j].width < 3
+					    || fonts[c * MAX_LINES *
+						     MAX_FONTS_IN_LINE + i * MAX_FONTS_IN_LINE +
+						     j].hight < 3)
+					{
+						/* check for end of word */
+						if (end_of_word)
+							hocr_text_buffer_add_string
+								(text_buffer,
+								 " ");
+						continue;
+					}
+
+					if (fonts
+					    [c * MAX_LINES * MAX_FONTS_IN_LINE +
+					     i * MAX_FONTS_IN_LINE + j].width >
+					    (3.5 *
+					     (double)
+					     avg_regular_font_width_in_page)
+					    || fonts[c * MAX_LINES *
+						     MAX_FONTS_IN_LINE + i * MAX_FONTS_IN_LINE +
+						     j].hight >
+					    (3.5 *
+					     (double)
+					     avg_regular_font_hight_in_page))
+					{
+						/* check for end of word */
+						if (end_of_word)
+							hocr_text_buffer_add_string
+								(text_buffer,
+								 " ");
+						continue;
+					}
+
+					/* recognize font */
+					hocr_recognize_font (pix,
+							     &(fonts[c *
+								    MAX_LINES
+								    *
+								    MAX_FONTS_IN_LINE +
+								    i *
+								    MAX_FONTS_IN_LINE]),
+							     num_of_fonts[c][i],
+							     j, line_eqs[c][i],
+							     avg_regular_font_hight_in_page,
+							     avg_regular_font_width_in_page,
+							     chars,
+							     pix->command);
+
+					/* color unknown fonts in the pixbuf */
+					if (!chars[0] || chars[0] == '*'
+					    && (pix->
+						command &
+						HOCR_COMMAND_COLOR_MISREAD))
+						color_hocr_box_full (pix,
+								     fonts[c *
+									   MAX_LINES
+									   *
+									   MAX_FONTS_IN_LINE
+									   +
+									   i *
+									   MAX_FONTS_IN_LINE
+									   + j],
+								     1, 255,
+								     TRUE);
+
+					/* add new recognizzed fonts to text */
+					hocr_text_buffer_add_string
+						(text_buffer, chars);
+
+					/* check for end of word */
+					if (end_of_word)
+						hocr_text_buffer_add_string
+							(text_buffer, " ");
+
+					/* check for tabs */
+					if ((pix->
+					     command &
+					     HOCR_COMMAND_USE_SPACE_FOR_TAB) !=
+					    0)
+					{
+						for (k = 0; k < tabs; k++)
+						{
+							hocr_text_buffer_add_string
+								(text_buffer,
+								 "    ");
+						}
+					}
+					else
+					{
+						for (k = 0; k < tabs; k++)
+						{
+							hocr_text_buffer_add_string
+								(text_buffer,
+								 "\t");
+						}
+					}
+				}
+
+				/* end of line */
+				hocr_text_buffer_add_string (text_buffer, "\n");
+
+				/* check for end of paragraph */
+				if (num_of_lines[c] > (i + 1) && 2 *
+				    avg_diff_between_lines_in_page
+				    <
+				    (lines[c * MAX_LINES + i + 1].y1 -
+				     lines[c * MAX_LINES + i].y2))
+					hocr_text_buffer_add_string
+						(text_buffer, "\n");
 			}
 
-
-			/* if quat mark check for doubel quat */
-			len = strlen (text_buffer);
-
-			/* if buffer is full do not add more chars */
-			if (len >= max_buffer_size)
-				continue;
-
-			if (chars[0] == '\'' && chars[1] == '\0'
-			    && last_was_quot == 0)
-			{
-				last_was_quot = 1;
-				if (fonts[i][j].width > 2
-				    && fonts[i][j].hight > 2)
-					strcat (text_buffer, chars);
-			}
-			else if (chars[0] == '\'' && chars[1] == '\0'
-				 && last_was_quot == 1)
-			{
-				last_was_quot = 0;
-				text_buffer[len - 1] = '\"';
-			}
-			else
-			{
-				last_was_quot = 0;
-				if (fonts[i][j].width > 2
-				    && fonts[i][j].hight > 2)
-					strcat (text_buffer, chars);
-			}
-
-			/* color unknown fonts in the pixbuf */
-			if (font_mark[0] == 1)
-				color_box (pix, fonts[i][j], 1, 255);
-
-			/* check for end of word and end of line */
-			if (end_of_word == 1)
-			{
-				strcat (text_buffer, " ");
-			}
-			if (end_of_line == 1)
-			{
-				strcat (text_buffer, "\n");
-			}
-			if (end_of_paragraph == 1)
-			{
-				strcat (text_buffer, "\n");
-			}
-
-			/* visual aids to see font box on screen */
-			/* color_box (pix, lines[i], 1, 0); */
-			/* print_font (pix, fonts[i][j]); */
+			/* end of column */
+			hocr_text_buffer_add_string (text_buffer, "\n");
 		}
-
 	}
 
+	/* free memory */
+	free (fonts);
+	free (lines);
+	free (columns);
+
 	return 0;
 }

Modified: pkg/hocr/branches/upstream/current/src/hocr.h
==============================================================================
--- pkg/hocr/branches/upstream/current/src/hocr.h	(original)
+++ pkg/hocr/branches/upstream/current/src/hocr.h	Sat Dec 24 18:37:24 2005
@@ -1,3 +1,4 @@
+
 /***************************************************************************
  *            hocr.h
  *
@@ -22,6 +23,11 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
+#include "consts.h"
+#include "hocr_textbuffer.h"
+#include "hocr_pixbuf.h"
+#include "hocr_object.h"
+
 #ifndef __HOCR_H__
 #define __HOCR_H__
 
@@ -30,132 +36,61 @@
 {
 #endif
 
-#ifndef TRUE
-#define TRUE -1
-#endif
-
-#ifndef FALSE
-#define FALSE 0
-#endif
-
-typedef struct
-{
-	int x1;
-	int y1;
-	int x2;
-	int y2;
-	int hight;
-	int width;
-} box;
-
-/** pixbuf structore used by hocr
-
-*/
-typedef struct
-{
-	/** number of color channels in the pixpuf (e.g. 3 for red,green,blue). */
-	int n_channels;
-	/** get height in pixels. */
-	int height;
-	/** get width in pixels. */
-	int width;
-	/** get number of bytes in a raw of pixels. */
-	int rowstride;
-	/** value from which a gray-scale pixel is considered white. */
-	int brightness;
-	/** raw pixpuf data. */
-	unsigned char *pixels;
-} hocr_pixbuf;
-
-/**
- @brief get number of channels
-
- @param pix pointer to hocr_pixbuf struct.
- @return number of color channels in the pixpuf (e.g. 3 for red,green,blue).
- */
-int hocr_pixbuf_get_n_channels (hocr_pixbuf * pix);
-
-/**
- @brief get height in pixels
-
- @param pix pointer to hocr_pixbuf struct.
- @return height of pixpuf in pixels.
- */
-int hocr_pixbuf_get_height (hocr_pixbuf * pix);
-
-/**
- @brief get width in pixels
-
- @param pix pointer to hocr_pixbuf struct.
- @return width of pixpuf in pixels.
- */
-int hocr_pixbuf_get_width (hocr_pixbuf * pix);
-
-/**
- @brief get number of bytes in a raw of pixels
-
- @param pix pointer to hocr_pixbuf struct.
- @return how many bytes are used by the struct for one raw.
- */
-int hocr_pixbuf_get_rowstride (hocr_pixbuf * pix);
-
-/**
- @brief get value from which a gray-scale pixel is considered white
-
- @param pix pointer to hocr_pixbuf struct.
- @return value from which a gray-scale pixel is considered white.
- */
-int hocr_pixbuf_get_brightness (hocr_pixbuf * pix);
+#define HOCR_COMMAND_COLOR_BOXES 1
+#define HOCR_COMMAND_COLOR_MISREAD 2
+#define HOCR_COMMAND_OCR 4
+#define HOCR_COMMAND_DICT 8
+#define HOCR_COMMAND_NIKUD 16
+#define HOCR_COMMAND_USE_SPACE_FOR_TAB 32
+#define HOCR_COMMAND_USE_INDENTATION 64
 
 /**
- @brief get pointer to raw pixpuf data
+ @brief print the font to std out
 
  @param pix pointer to hocr_pixbuf struct.
- @return pointer to raw pixpuf data
+ @param font the font to print
+ @return 1
  */
-unsigned char *hocr_pixbuf_get_pixels (hocr_pixbuf * pix);
+	int print_font (hocr_pixbuf * pix, hocr_box font);
 
 /**
- @brief get color of pixel
+ @brief fill a box on hocr_pixbuf
 
  @param pix pointer to hocr_pixbuf struct.
- @param x position of pixel on x axis
- @param y position of pixel on y axis
- @return 1 - if pixel is black, 0 - if pixel is white
+ @param rect the rectangle to color
+ @param chanell the color channel to color
+ @param value set the channel to this value
+ @param only_main_object if set to TRUE color only main object
+ @return 1
  */
-int hocr_pixbuf_get_pixel (hocr_pixbuf * pix, int x, int y);
+	int color_hocr_box_full (hocr_pixbuf * pix, hocr_box rect, int chanell,
+				 int value, int only_main_object);
 
 /**
- @brief set color of pixel color channel
+ @brief drow box borders on hocr_pixbuf
 
  @param pix pointer to hocr_pixbuf struct.
- @param x position of pixel on x axis
- @param y position of pixel on y axis
- @param channel the color chanell to set
- @param value the value to set the chanell to
- @return the color set
- */
-int hocr_pixbuf_set_pixel (hocr_pixbuf * pix, int x, int y, int channel, int value);
-
-/* hocr_pixbuf_new_from_file function can only open pnm file 
- of type "P4/5" Portable Any Map (PNM) binary, black/white format
- */
-
-/**
- @brief creats a new hocr_pixbuf struct from file 
-
- @param filename path to a pbm file, file must be binary b/w pnm file ("P4/5").
- @return pointer to a newly allocate hocr_pixbuf, or null if can not open file.
+ @param rect the rectangle to color
+ @param chanell the color channel to color
+ @param value set the channel to this value
+ @return 1
  */
-hocr_pixbuf *hocr_pixbuf_new_from_file (const char *filename);
+	int color_hocr_box (hocr_pixbuf * pix, hocr_box rect, int chanell,
+			    int value);
 
 /**
- @brief free a hocr_pixbuf struct from memory
+ @brief drow a nearly horizontal line on hocr_pixbuf
 
  @param pix pointer to hocr_pixbuf struct.
+ @param line the line to color
+ @param x1 from x
+ @param x2 to x
+ @param chanell the color channel to color
+ @param value set the channel to this value
  @return 1
  */
-int hocr_pixbuf_unref (hocr_pixbuf * pix);
+	int color_hocr_line_eq (hocr_pixbuf * pix, hocr_line_eq * line, int x1,
+				int x2, int chanell, int value);
 
 /* user only use this function */
 
@@ -167,7 +102,7 @@
  @param max_buffer_size site of allocated memory for text_buffer.
  @return 1
  */
-int hocr_do_ocr (hocr_pixbuf * pix, char *text_buffer, int max_buffer_size);
+	int hocr_do_ocr (hocr_pixbuf * pix, hocr_text_buffer * text_buffer);
 
 #ifdef __cplusplus
 }

Modified: pkg/hocr/branches/upstream/current/src/page_layout.c
==============================================================================
--- pkg/hocr/branches/upstream/current/src/page_layout.c	(original)
+++ pkg/hocr/branches/upstream/current/src/page_layout.c	Sat Dec 24 18:37:24 2005
@@ -1,3 +1,4 @@
+
 /***************************************************************************
  *            page_layout.c
  *
@@ -26,11 +27,65 @@
 #include "consts.h"
 #include "page_layout.h"
 
-/* TODO: add support for more then one squre qulumn */
+int
+get_next_column_extention (hocr_pixbuf * pix, int current_pos,
+			   int *column_start, int *column_end)
+{
+	int x, y, i;
+	int sum;
+	int inside_column = FALSE;
+
+	int hight, hight_1_3, hight_2_3;
+
+	*column_end = current_pos;
+	*column_start = 0;
+
+	hight = pix->height;
+	hight_1_3 = hight / 3;
+	hight_2_3 = 2 * hight / 3;
+
+	for (x = current_pos - MIN_DISTANCE_BETWEEN_WORDS; x > 0;
+	     x -= MIN_DISTANCE_BETWEEN_WORDS / 2)
+	{
+		/* get presentage coverage for this pixel line */
+		sum = 0;
+		for (y = 0; y < hight_1_3; y++)
+		{
+			for (i = 0; i < 2 * MIN_DISTANCE_BETWEEN_WORDS; i++)
+			{
+				sum += hocr_pixbuf_get_pixel (pix, x + i, y);
+				sum += hocr_pixbuf_get_pixel (pix, x + i,
+							      y + hight_1_3);
+				sum += hocr_pixbuf_get_pixel (pix, x + i,
+							      y + hight_2_3);
+			}
+		}
+
+		/* if presantage above minmun for not in a line then we are in
+		 * aline */
+		if (!inside_column
+		    && (x <= MIN_DISTANCE_BETWEEN_WORDS || sum > 0))
+		{
+			*column_end = x + MIN_DISTANCE_BETWEEN_WORDS;
+			inside_column = TRUE;
+		}
+		/* if presantage below maximum for in a line then we need to
+		 * find the end of the line by looking to the end of the down
+		 * slop */
+		else if ((x <= MIN_DISTANCE_BETWEEN_WORDS || sum == 0) &&
+			 inside_column)
+		{
+			*column_start = x;
+			return 0;
+		}
+	}
+
+	return 1;
+}
 
 int
-get_next_line_extention (hocr_pixbuf * pix, int current_pos, int *line_start,
-			 int *line_end)
+get_next_line_extention (hocr_pixbuf * pix, hocr_box column, int current_pos,
+			 int *line_start, int *line_end)
 {
 	int x, y;
 	int last_raw_sum;
@@ -38,153 +93,168 @@
 	int inside_line = FALSE;
 
 	int width, width_1_3, width_2_3;
-	
-	*line_end = 0;
+
+	*line_end = column.y2;
 	*line_start = current_pos;
 
-	width = pix->width;
+	width = column.width;
 	width_1_3 = width / 3;
 	width_2_3 = 2 * width / 3;
-	
-	for (y = current_pos; y < pix->height; y++)
+
+	inside_line = FALSE;
+	*line_start = current_pos;
+
+	for (y = current_pos; y < column.y2; y++)
 	{
 		/* get presentage coverage for this pixel line */
 		last_raw_sum = sum;
 		sum = 0;
-		for (x = 0; x < width_1_3; x++)
+		for (x = column.x1; x < (column.x1 + width_1_3); x++)
 		{
 			sum += hocr_pixbuf_get_pixel (pix, x, y);
-			sum += hocr_pixbuf_get_pixel (pix,
-						       x + width_1_3, y);
-			sum += hocr_pixbuf_get_pixel (pix,
-						       x + width_2_3,
-						       y);
+			sum += hocr_pixbuf_get_pixel (pix, x + width_1_3, y);
+			sum += hocr_pixbuf_get_pixel (pix, x + width_2_3, y);
 		}
-		
+
 		/* check only the part with the most color on it */
-		sum = 1000 * sum / width;
+		if (width > 0)
+			sum = 1000 * sum / width;
+
+		/* if presantage below maximum for in a line then we need to
+		 * find the end of the line by looking to the end of the down
+		 * slop */
+		if (sum <= IN_A_LINE &&
+		    inside_line &&
+		    (y - *line_start) > MIN_LINE_HIGHT &&
+		    (last_raw_sum - sum) <= 0)
+		{
+			*line_end = y;
+			return 0;
+		}
 
-		/* if presantage above minmun for not in a line then we are in aline */
+		/* if presantage above minmun for not in a line then we are in
+		 * aline */
 		if (sum >= NOT_IN_A_LINE && !inside_line)
 		{
 			*line_start = y;
 			inside_line = TRUE;
 		}
-		/* if presantage below maximum for in a line then we need to find 
-		   the end of the line by looking to the end of the down slop */
-		else if (sum <= IN_A_LINE && 
-				 inside_line && 
-				 (y - *line_start) > MIN_LINE_HIGHT &&
-				 (last_raw_sum - sum) <= 0)
-		{
-			*line_end = y;
-			
-			/* if here and this line has logical width then found a new line */
-			/* FIXME: do we want to read BIG fonts ? 
-			          see consts.h for details about MAX_LINE_HIGHT */
-			if ((*line_end - *line_start) > MAX_LINE_HIGHT)
-				return 1;
-			
-			return 0;
-		}
 	}
-	
+
+	*line_end = column.y2;
 	return 1;
 }
 
 int
 get_next_font_extention (hocr_pixbuf * pix, int line_start, int line_end,
-			 int current_pos, int *font_start, int *font_end)
+			 int current_pos, int *font_start,
+			 int *font_end, int *top, int *bottom)
 {
 	int x, y;
 	int sum;
 	int inside_font = FALSE;
-	/* we have to calculate line hight, we do not get it from caller */
-	int line_hight = line_end - line_start;
+	unsigned int object;
 
-	/* read line from right to left */
-	for (x = current_pos - 1; x > 0; x--)
+	for (x = current_pos - MIN_DISTANCE_BETWEEN_FONTS; x > 0; x--)
 	{
 		/* get presentage coverage for this pixel line */
 		sum = 0;
 		for (y = line_start; y < line_end; y++)
 		{
-			sum += hocr_pixbuf_get_pixel (pix, x, y);
-		}
-		sum = 1000 * sum / line_hight;
+			object = hocr_pixbuf_get_object (pix, x, y);
 
-		/* if presantage covarage is less then 1 we are between text fonts */
-		if (sum >= NOT_IN_A_FONT && !inside_font)
-		{
-			*font_start = x;
-			inside_font = TRUE;
-		}
-		else if (sum <= NOT_IN_A_FONT && inside_font)
-		{
-			*font_end = x + 1;
+			if (object)
+			{
+				*font_start = pix->objects[object].x2;
+				*font_end = pix->objects[object].x1;
+				*bottom = pix->objects[object].y2;
+				*top = pix->objects[object].y1;
+
+				/* check that font is inside picture */
+				if (pix->objects[object].weight == 0
+				    || (*font_start - *font_end) < 3
+				    || (*bottom - *top) < 3
+				    || *bottom > (pix->height - 5) || *top < 5
+				    || *font_start > (pix->width - 5)
+				    || *font_end < 5)
+					continue;
 
-			/* if here then found a new line */
-			return 0;
+				return 0;
+			}
 		}
+
 	}
 
 	return 1;
 }
 
 int
-adjust_font_box (hocr_pixbuf * pix, box * font)
+fill_columns_array (hocr_pixbuf * pix, hocr_box * columns,
+		    int *num_of_columns, int max_columns)
 {
-	int x, y;
-	int sum;
+	/* for line detection */
+	int column_start;
+	int column_end;
+	int return_value;
+	int counter;
 
-	sum = 0;
-	/* read line from right to left */
-	for (y = (font->y1 - MIN_DISTANCE_BETWEEN_LINES);
-	     y < (font->y2 + MIN_DISTANCE_BETWEEN_LINES) && sum == 0; y++)
-	{
-		/* get presentage coverage for this pixel line */
-		sum = 0;
-		for (x = font->x1; x < font->x2; x++)
-		{
-			sum += hocr_pixbuf_get_pixel (pix, x, y);
-		}
-	}
-	font->y1 = y - 1;
+	counter = 0;
 
-	sum = 0;
+	/* get all lines in this column */
+	return_value = get_next_column_extention
+		(pix, pix->width, &column_start, &column_end);
 
-	/* read line from right to left */
-	for (y = (font->y2 + MIN_DISTANCE_BETWEEN_LINES);
-	     y > (font->y1 - MIN_DISTANCE_BETWEEN_LINES) && sum == 0; y--)
+	while (return_value == 0 && counter < max_columns)
 	{
-		/* get presentage coverage for this pixel line */
-		sum = 0;
-		for (x = font->x1; x < font->x2; x++)
+		/* a thin column is not a "real" column */
+		if ((column_end - column_start) > MIN_COLUMN_WIDTH)
 		{
-			sum += hocr_pixbuf_get_pixel (pix, x, y);
+			/* insert this line to lines array */
+			columns[counter].y1 = 0;
+			columns[counter].y2 = pix->height;
+			columns[counter].x1 = column_start;
+			columns[counter].x2 = column_end;
+			columns[counter].width = (column_end - column_start);
+			columns[counter].hight =
+				(columns[counter].y2 - columns[counter].y1);
+
+			counter++;
+		}
+		/* a thin column is probably a part of the last column */
+		else
+		{
+			columns[counter].x1 = column_start;
+			columns[counter].width = (column_end - column_start);
 		}
+
+		/* get some lee way from the end of last line */
+		column_end += MIN_DISTANCE_BETWEEN_COLUMNS;
+
+		return_value = get_next_column_extention
+			(pix, column_start, &column_start, &column_end);
 	}
-	font->y2 = y + 1;
 
-	return 1;
-}
+	/* if no column found, return page */
+	if (!counter)
+	{
+		counter = 1;
+		columns[0].x1 = 0;
+		columns[0].y1 = 0;
+		columns[0].x2 = pix->width;
+		columns[0].y2 = pix->height;
+		columns[0].width = pix->width;
+		columns[0].hight = pix->height;
+	}
 
-int
-adjust_line_box (hocr_pixbuf * pix, box * line)
-{
-	/* TODO: make this more intelegent */
-	line->x1 = 0;
-	line->x2 = pix->width;
+	*num_of_columns = counter;
 
-	return 1;
+	return 0;
 }
 
 int
-fill_lines_array (hocr_pixbuf * pix, box column, box * lines,
+fill_lines_array (hocr_pixbuf * pix, hocr_box column, hocr_box * lines,
 		  int *num_of_lines, int max_lines)
 {
-	/* FIXME: column is just a place holder, it does nothing now ! */
-
 	/* for line detection */
 	int line_start;
 	int line_end;
@@ -195,19 +265,17 @@
 
 	/* get all lines in this column */
 	return_value = get_next_line_extention
-		(pix, 0, &line_start, &line_end);
+		(pix, column, column.y1, &line_start, &line_end);
 
 	while (return_value == 0 && counter < max_lines)
 	{
 		/* insert this line to lines array */
 		lines[counter].y1 = line_start;
 		lines[counter].y2 = line_end;
-		lines[counter].hight = (line_end - line_start);
-
-		adjust_line_box (pix, &(lines[counter]));
-
-		lines[counter].width =
-			(lines[counter].x2 - lines[counter].x1);
+		lines[counter].x2 = column.x2;
+		lines[counter].x1 = column.x1;
+		lines[counter].hight = (lines[counter].y2 - lines[counter].y1);
+		lines[counter].width = (lines[counter].x2 - lines[counter].x1);
 
 		counter++;
 
@@ -215,7 +283,7 @@
 		line_end += MIN_DISTANCE_BETWEEN_LINES;
 
 		return_value = get_next_line_extention
-			(pix, line_end, &line_start, &line_end);
+			(pix, column, line_end, &line_start, &line_end);
 	}
 
 	*num_of_lines = counter;
@@ -224,12 +292,14 @@
 }
 
 int
-fill_fonts_array (hocr_pixbuf * pix, box line, box * fonts,
+fill_fonts_array (hocr_pixbuf * pix, hocr_box line, hocr_box * fonts,
 		  int *num_of_fonts, int max_fonts)
 {
 	/* for gliphs detection */
 	int font_start;
 	int font_end;
+	int top;
+	int bottom;
 	int return_value;
 	int counter;
 
@@ -240,19 +310,17 @@
 						line.y1,
 						line.y2,
 						line.x2,
-						&font_start, &font_end);
+						&font_start, &font_end, &top,
+						&bottom);
 
-	while (return_value == 0 && counter < max_fonts)
+	while (return_value == 0 && font_start > line.x1 && counter < max_fonts)
 	{
 		/* insert this font to fonts array */
 		fonts[counter].x1 = font_end;	/* this is right to left sweep */
 		fonts[counter].x2 = font_start;
-		fonts[counter].y1 = line.y1;
-		fonts[counter].y2 = line.y2;
+		fonts[counter].y1 = top;
+		fonts[counter].y2 = bottom;
 		fonts[counter].width = (font_start - font_end);
-
-		/* adjust font hight top and bottom borders */
-		adjust_font_box (pix, &(fonts[counter]));
 		fonts[counter].hight = fonts[counter].y2 - fonts[counter].y1;
 
 		counter++;
@@ -261,8 +329,8 @@
 							line.y1,
 							line.y2,
 							font_end,
-							&font_start,
-							&font_end);
+							&font_start, &font_end,
+							&top, &bottom);
 	}
 
 	*num_of_fonts = counter;

Modified: pkg/hocr/branches/upstream/current/src/page_layout.h
==============================================================================
--- pkg/hocr/branches/upstream/current/src/page_layout.h	(original)
+++ pkg/hocr/branches/upstream/current/src/page_layout.h	Sat Dec 24 18:37:24 2005
@@ -1,3 +1,4 @@
+
 /***************************************************************************
  *            page_layout.c
  *
@@ -27,9 +28,6 @@
 #ifndef __PAGE_LAYOUT_H__
 #define __PAGE_LAYOUT_H__
 
-
-/* TODO: add support for more then one squre column */
-
 /**
  @brief adjust lines y borders
 
@@ -39,8 +37,8 @@
  @param line_end return y end of next line
  */
 int
-get_next_line_extention (hocr_pixbuf * pix, int current_pos, int *line_start,
-			 int *line_end);
+get_next_line_extention (hocr_pixbuf * pix, hocr_box column, int current_pos,
+			 int *line_start, int *line_end);
 
 /**
  @brief adjust fonts x borders
@@ -54,50 +52,45 @@
  */
 int
 get_next_font_extention (hocr_pixbuf * pix, int line_start, int line_end,
-			 int current_pos, int *font_start, int *font_end);
+			 int current_pos, int *font_start, int *font_end,
+			 int *top, int *bottom);
 
 /**
- @brief adjust fonts y borders
+ @brief fils an array of hocr_boxes with this page lines
 
  @param pix pointer the page hocr_pixbuf
- @param font pointer to the fonts extentions
+ @param column the column hocr_box extentions
+ @param lines the array of lines to be filled
+ @param num_of_lines return the number of lines in this column
+ @param max_lines maximum size of lines array
  */
 int
-adjust_font_box (hocr_pixbuf * pix, box * font);
+fill_lines_array (hocr_pixbuf * pix, hocr_box column, hocr_box * lines,
+		  int *num_of_lines, int max_lines);
 
 /**
- @brief adjust line x borders
+ @brief fils an array of hocr_boxes with this page columns
 
  @param pix pointer the page hocr_pixbuf
- @param line pointer to the lines extentions
+ @param columns the array of columns to be filled
+ @param num_of_columns return the number of columns in this page
+ @param max_columns maximum size of columns array
  */
 int
-adjust_line_box (hocr_pixbuf * pix, box * line);
+fill_columns_array (hocr_pixbuf * pix, hocr_box * columns,
+		    int *num_of_columns, int max_columns);
 
 /**
- @brief fils an array of boxes with this page lines
+ @brief fils an array of hocr_boxs with this page fonts
 
  @param pix pointer the page hocr_pixbuf
- @param column the column box extentions
- @param lines the array of lines to be filled
- @param num_of_lines return the number of lines in this column
- @param max_lines maximum size of lines array
- */
-int
-fill_lines_array (hocr_pixbuf * pix, box column, box * lines,
-		  int *num_of_lines, int max_lines);
-
-		  /**
- @brief fils an array of boxs with this page fonts
-
- @param pix pointer the page hocr_pixbuf
- @param line the line box extentions
+ @param line the line hocr_box extentions
  @param fonts the array of fonts to be filled
  @param num_of_fonts return the number of fonts in this line
  @param max_fonts maximum size of fonts array
  */
 int
-fill_fonts_array (hocr_pixbuf * pix, box line, box * fonts,
+fill_fonts_array (hocr_pixbuf * pix, hocr_box line, hocr_box * fonts,
 		  int *num_of_fonts, int max_fonts);
-		  
+
 #endif

Modified: pkg/hocr/branches/upstream/current/tests/Makefile.am
==============================================================================
--- pkg/hocr/branches/upstream/current/tests/Makefile.am	(original)
+++ pkg/hocr/branches/upstream/current/tests/Makefile.am	Sat Dec 24 18:37:24 2005
@@ -1,10 +1,8 @@
 ## Process this file with automake to produce Makefile.in
 
 EXTRA_DIST = \
-	test1.pnm \
-	test2.pnm
-	
-hocrdocdir = ${prefix}/share/misc/hocr
+	test*
+
+hocrdocdir = ${prefix}/share/hocr/tests
 hocrdoc_DATA = \
-	test1.pnm \
-	test2.pnm
+	test*

Modified: pkg/hocr/branches/upstream/current/tests/Makefile.in
==============================================================================
--- pkg/hocr/branches/upstream/current/tests/Makefile.in	(original)
+++ pkg/hocr/branches/upstream/current/tests/Makefile.in	Sat Dec 24 18:37:24 2005
@@ -57,8 +57,12 @@
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+build_alias = @build_alias@
+build_triplet = @build@
 host_alias = @host_alias@
 host_triplet = @host@
+target_alias = @target_alias@
+target_triplet = @target@
 AR = @AR@
 AS = @AS@
 CATALOGS = @CATALOGS@
@@ -95,6 +99,7 @@
 PKG_CONFIG = @PKG_CONFIG@
 POFILES = @POFILES@
 POSUB = @POSUB@
+PO_DIR = @PO_DIR@
 PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@
 PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@
 RANLIB = @RANLIB@
@@ -103,14 +108,18 @@
 USE_NLS = @USE_NLS@
 VERSION = @VERSION@
 VERSION_INFO = @VERSION_INFO@
+WINDRES = @WINDRES@
+WITH_GTKSPELL = @WITH_GTKSPELL@
 gtk_CFLAGS = @gtk_CFLAGS@
 gtk_LIBS = @gtk_LIBS@
+gtkspell_CFLAGS = @gtkspell_CFLAGS@
+gtkspell_LIBS = @gtkspell_LIBS@
 
-EXTRA_DIST =  	test1.pnm 	test2.pnm
+EXTRA_DIST =  	test*
 
 
-hocrdocdir = ${prefix}/share/misc/hocr
-hocrdoc_DATA =  	test1.pnm 	test2.pnm
+hocrdocdir = ${prefix}/share/hocr/tests
+hocrdoc_DATA =  	test*
 
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_HEADER = ../config.h



More information about the Debian-hebrew-package mailing list