~ubuntu-branches/ubuntu/precise/cuneiform/precise

« back to all changes in this revision

Viewing changes to cuneiform_src/Kern/rselstr/sources/src/chstr/vertical/testforvertical.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jakub Wilk, c-assert.diff, slovenian-slv.diff
  • Date: 2011-01-26 21:53:07 UTC
  • mfrom: (5.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20110126215307-62x61mcesr607qb7
Tags: 1.0.0+dfsg-2
* Upload to unstable.
* Explicitly build-depend on pkg-config. Thanks to Stefano Rivera for the
  bug report.
* Add Vcs-* fields.
* Use the standard C assert() macro, rather than custom Cuneiform one.
  [c-assert.diff]
* Pass CFLAGS, CXXFLAGS and LDFLAGS (get from dpkg-buildflags) to cmake
  (closes: #608345). Thanks to Sami Liedes for the bug report.
  + Build depend on dpkg-dev (>= 1.15.7).
* Pass --parallel to dh.
  + Bump debhelper minimum version to 7.4.10.
* Update debian/copyright to the latest DEP-5 version.
* Bump year in debian/copyright.
* Explicitly link to GraphicsMagick (rather than via the ImageMagick
  compatibility layer).
* Don't ship /usr/lib/cuneiform/*.so symlinks. These libraries are
  considered private, at least until #598616 is fixed.
* Rename some private variables in debian/rules to make them lowercase.
* Update patch headers.
* Provide proper ‘build-arch’ and ‘build-indep’ targets in debian/rules.
* Document input format in the manual page (closes: #572061). Thanks to
  Janusz S. Bień for the bug report.
* Use ‘slv’ (rather than ‘slo’) as language code for Slovenian.
  [slovenian-slv.diff]
* Fix package description: Slovenian is supported, Slovak is not.
* Improve documentation of the language (-l) option (closes: #602512).
  Thanks to Jari Aalto for the bug report.
* Install reasons file for vrms.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
Copyright (c) 1993-2008, Cognitive Technologies
3
3
All rights reserved.
4
4
 
5
 
����������� ��������� ��������������� � ������������� ��� � ���� ��������� ����,
6
 
��� � � �������� �����, � ����������� ��� ���, ��� ���������� ��������� �������:
7
 
 
8
 
      * ��� ��������� ��������������� ��������� ���� ������ ���������� ���������
9
 
        ���� ����������� �� ��������� �����, ���� ������ ������� � �����������
10
 
        ����� �� ��������.
11
 
      * ��� ��������� ��������������� ��������� ���� � ������������ �/��� �
12
 
        ������ ����������, ������������ ��� ���������������, ������ �����������
13
 
        ��������� ���� ���������� �� ��������� �����, ���� ������ ������� �
14
 
        ����������� ����� �� ��������.
15
 
      * �� �������� Cognitive Technologies, �� ����� �� ����������� �� �����
16
 
        ���� ������������ � �������� �������� ��������� �/��� �����������
17
 
        ���������, ���������� �� ���� ��, ��� ���������������� �����������
18
 
        ����������.
19
 
 
20
 
��� ��������� ������������� ����������� ��������� ���� �/��� ������� ������ "���
21
 
��� ����" ��� ������-���� ���� ��������, ���������� ���� ��� ���������������,
22
 
������� �������� ������������ �������� � ����������� ��� ���������� ����, �� ��
23
 
������������� ���. �� �������� ��������� ���� � �� ���� ������ ����, �������
24
 
����� �������� �/��� �������� �������������� ���������, �� � ���� ������ ��
25
 
��Ѩ� ���������������, ������� ����� �����, ���������, ����������� ���
26
 
������������� ������, ��������� � �������������� ��� ���������� ����������
27
 
������������� ������������� ��������� (������� ������ ������, ��� ������,
28
 
������� ���������, ��� ������ �/��� ������ �������, ���������� ��-�� ��������
29
 
������� ��� �/��� ������ ��������� �������� ��������� � ������� �����������,
30
 
�� �� ������������� ����� ��������), �� �� ������������� ���, ���� ���� �����
31
 
�������� ��� ������ ���� ���� �������� � ����������� ����� ������� � ������.
 
5
Разрешается повторное распространение и использование как в виде исходного кода,
 
6
так и в двоичной форме, с изменениями или без, при соблюдении следующих условий:
 
7
 
 
8
      * При повторном распространении исходного кода должны оставаться указанное
 
9
        выше уведомление об авторском праве, этот список условий и последующий
 
10
        отказ от гарантий.
 
11
      * При повторном распространении двоичного кода в документации и/или в
 
12
        других материалах, поставляемых при распространении, должны сохраняться
 
13
        указанная выше информация об авторском праве, этот список условий и
 
14
        последующий отказ от гарантий.
 
15
      * Ни название Cognitive Technologies, ни имена ее сотрудников не могут
 
16
        быть использованы в качестве средства поддержки и/или продвижения
 
17
        продуктов, основанных на этом ПО, без предварительного письменного
 
18
        разрешения.
 
19
 
 
20
ЭТА ПРОГРАММА ПРЕДОСТАВЛЕНА ВЛАДЕЛЬЦАМИ АВТОРСКИХ ПРАВ И/ИЛИ ДРУГИМИ ЛИЦАМИ "КАК
 
21
ОНА ЕСТЬ" БЕЗ КАКОГО-ЛИБО ВИДА ГАРАНТИЙ, ВЫРАЖЕННЫХ ЯВНО ИЛИ ПОДРАЗУМЕВАЕМЫХ,
 
22
ВКЛЮЧАЯ ГАРАНТИИ КОММЕРЧЕСКОЙ ЦЕННОСТИ И ПРИГОДНОСТИ ДЛЯ КОНКРЕТНОЙ ЦЕЛИ, НО НЕ
 
23
ОГРАНИЧИВАЯСЬ ИМИ. НИ ВЛАДЕЛЕЦ АВТОРСКИХ ПРАВ И НИ ОДНО ДРУГОЕ ЛИЦО, КОТОРОЕ
 
24
МОЖЕТ ИЗМЕНЯТЬ И/ИЛИ ПОВТОРНО РАСПРОСТРАНЯТЬ ПРОГРАММУ, НИ В КОЕМ СЛУЧАЕ НЕ
 
25
НЕСЁТ ОТВЕТСТВЕННОСТИ, ВКЛЮЧАЯ ЛЮБЫЕ ОБЩИЕ, СЛУЧАЙНЫЕ, СПЕЦИАЛЬНЫЕ ИЛИ
 
26
ПОСЛЕДОВАВШИЕ УБЫТКИ, СВЯЗАННЫЕ С ИСПОЛЬЗОВАНИЕМ ИЛИ ПОНЕСЕННЫЕ ВСЛЕДСТВИЕ
 
27
НЕВОЗМОЖНОСТИ ИСПОЛЬЗОВАНИЯ ПРОГРАММЫ (ВКЛЮЧАЯ ПОТЕРИ ДАННЫХ, ИЛИ ДАННЫЕ,
 
28
СТАВШИЕ НЕГОДНЫМИ, ИЛИ УБЫТКИ И/ИЛИ ПОТЕРИ ДОХОДОВ, ПОНЕСЕННЫЕ ИЗ-ЗА ДЕЙСТВИЙ
 
29
ТРЕТЬИХ ЛИЦ И/ИЛИ ОТКАЗА ПРОГРАММЫ РАБОТАТЬ СОВМЕСТНО С ДРУГИМИ ПРОГРАММАМИ,
 
30
НО НЕ ОГРАНИЧИВАЯСЬ ЭТИМИ СЛУЧАЯМИ), НО НЕ ОГРАНИЧИВАЯСЬ ИМИ, ДАЖЕ ЕСЛИ ТАКОЙ
 
31
ВЛАДЕЛЕЦ ИЛИ ДРУГОЕ ЛИЦО БЫЛИ ИЗВЕЩЕНЫ О ВОЗМОЖНОСТИ ТАКИХ УБЫТКОВ И ПОТЕРЬ.
32
32
 
33
33
Redistribution and use in source and binary forms, with or without modification,
34
34
are permitted provided that the following conditions are met:
61
61
#include "rneg.h"
62
62
 
63
63
 
64
 
extern Int32 my_top;
65
 
extern Int32 my_left;
66
 
extern Int32 my_right;
67
 
extern Int32 my_bottom;
 
64
extern int32_t my_top;
 
65
extern int32_t my_left;
 
66
extern int32_t my_right;
 
67
extern int32_t my_bottom;
68
68
 
69
69
extern int inf_let_h;
70
70
extern int min_let_w;
88
88
// if(!prelist)
89
89
//       return FALSE;
90
90
 
91
 
// LDPUMA_ConsoleN("�������������� CHSTR");
 
91
// LDPUMA_ConsoleN("Активизируется CHSTR");
92
92
 int TIME=clock();
93
93
 int code_strd=1;
94
 
 Int16* begx=NULL;
95
 
 Int16* movey=NULL;
 
94
 int16_t* begx=NULL;
 
95
 int16_t* movey=NULL;
96
96
 int* hi=NULL;
97
 
 Word8* flmovey=NULL;
 
97
 uchar* flmovey=NULL;
98
98
 
99
99
 MainWindowD=NULL;
100
 
 MainWindowD=LDPUMA_GetWindowHandle ("����������� ����� ���������");
 
100
 MainWindowD=LDPUMA_GetWindowHandle ("Изображение после разворота");
101
101
 if(!MainWindowD)
102
102
    MainWindowD=LDPUMA_GetWindowHandle ("Main");
103
103
 
115
115
 
116
116
 DPIX=info.DPIX;
117
117
 DPIY=info.DPIY;
118
 
 Word8 ImageName[CPAGE_MAXNAME];
 
118
 uchar ImageName[CPAGE_MAXNAME];
119
119
 
120
120
 
121
121
 inf_str_h=inf_str_h*((int)(DPIY)+1)/300;
125
125
 min_let_w=min_let_w*((int)(DPIY)+1)/300;
126
126
 min_let_h=min_let_h*((int)(DPIY)+1)/300;
127
127
 
128
 
 Word8* pmaspold;
129
 
 Word8* pmasp;
130
 
 Word8 Data[1000];
 
128
 uchar* pmaspold;
 
129
 uchar* pmasp;
 
130
 uchar Data[1000];
131
131
 memset (Data, 0, sizeof (Data));
132
132
 
133
133
 
170
170
 if(!hStrCCOM)
171
171
         return FALSE;
172
172
 
173
 
//����� �� ������ �� �������� ��������������
 
173
//Резка на строки по гипотезе вертикальности
174
174
 
175
175
  my_str->vertical=TRUE;
176
176
  Rc.top=my_str->top;
209
209
  int w=Rc.right-Rc.left+1;
210
210
  int h=Rc.bottom-Rc.top+1;
211
211
  pmasp=NULL;
212
 
  if(!(pmasp= new Word8[w*h/8+w+h]))
 
212
  if(!(pmasp= new uchar[w*h/8+w+h]))
213
213
  {
214
214
   // GF: killed memory leak on 2004.01.29
215
215
         DelStrMas(&pRc); pRc = NULL;
282
282
  }
283
283
*/
284
284
 
285
 
//������ �������� ������, ���� ��������� ����������
 
285
//Первая проверка прошла, надо сохранить информацию
286
286
  CPrepHstr* temp=new CPrepHstr;
287
287
  temp->begx=begx;
288
288
  temp->fl_rotate=fl_rotate;
317
317
 
318
318
 
319
319
 
320
 
//����� �� ������ �� �������� ����������������
 
320
//Резка на строки по гипотезе горизонтальности
321
321
 
322
322
  my_str->vertical=FALSE;
323
323
  nRc=1;
394
394
/*
395
395
  if(IfBadCut((Handle)HCCOM,pRc,Rc,nRc,pmasp,my_str))
396
396
  {
397
 
//������ ����������� ��������: ��������� �������������� ��������
 
397
//Прошла тривиальная проверка: добавляем приготовленный фрагмент
398
398
 
399
399
         if(temp->fl_rotate)
400
400
         {
419
419
  }
420
420
*/
421
421
 
422
 
//������������� ������ ���������
 
422
//Нетривиальный анализ структуры
423
423
  if(MainVertDiagnostic(hCPage,hCCOM,temp,pRc,nRc,param))
424
424
  {
425
425
     if(temp->fl_rotate)
500
500
  return hCCOM_new;
501
501
}
502
502
 
503
 
BOOL AddToCpage(Handle hCPAGE,CPrepHstr* temp)
 
503
Bool AddToCpage(Handle hCPAGE,CPrepHstr* temp)
504
504
{
505
505
 int size_phstr=sizeof(CPrepHstr);
506
506
 int i;
529
529
         return FALSE;
530
530
}
531
531
 
532
 
BOOL InitPrepList(Handle hCPAGE)
 
532
Bool InitPrepList(Handle hCPAGE)
533
533
{
534
534
 prelist=NULL;
535
535
 prelist=new CLPrepHstr;
637
637
}
638
638
 
639
639
 
640
 
BOOL AddToPrepList(CPrepHstr* temp)
 
640
Bool AddToPrepList(CPrepHstr* temp)
641
641
{
642
642
 CPrepHstr* add=prelist->Add();
643
643
 if(!add)
677
677
 return TRUE;
678
678
}
679
679
 
680
 
Bool32 Filter(Int32 upper, Int32 left, Int32 w, Int32 h)
 
680
Bool32 Filter(int32_t upper, int32_t left, int32_t w, int32_t h)
681
681
{
682
682
        if( (upper+(h>>1)<my_top) ||
683
683
                (left+(w>>1)<my_left) ||
691
691
}
692
692
 
693
693
/*
694
 
BOOL IfBadCut(Handle hCCOM,Rect16* pRc,Rect16 Rc,int nRc,Word8* pmasp,CHstr* my_str)
 
694
Bool IfBadCut(Handle hCCOM,Rect16* pRc,Rect16 Rc,int nRc,uchar* pmasp,CHstr* my_str)
695
695
{
696
696
 if(my_str->neg)
697
697
         return FALSE;
746
746
}
747
747
*/
748
748
 
749
 
int GetMediumSize(CCOM_handle hCCOM,Rect16 Rc,int& num,BOOL vert)
 
749
int GetMediumSize(CCOM_handle hCCOM,Rect16 Rc,int& num,Bool vert)
750
750
{
751
751
        int sum_size=0;
752
752
        num=0;
777
777
                return sum_size/num;
778
778
}
779
779
 
780
 
int GetMaxSize(CCOM_handle hCCOM,Rect16 Rc,int& num,BOOL vert)
 
780
int GetMaxSize(CCOM_handle hCCOM,Rect16 Rc,int& num,Bool vert)
781
781
{
782
782
        int max_size=0;
783
783
        num=0;
814
814
                return max_size;
815
815
}
816
816
 
817
 
int GetMinCol(CCOM_comp** pC,int nN,BOOL vert)
 
817
int GetMinCol(CCOM_comp** pC,int nN,Bool vert)
818
818
{
819
819
 int max=0;
820
820
 int min=1000000;
838
838
 }
839
839
}
840
840
 
841
 
BOOL MainVertDiagnostic(Handle hCPage,CCOM_handle hCCOM,CPrepHstr* temp,Rect16* pRc,int nRc,int param)
 
841
Bool MainVertDiagnostic(Handle hCPage,CCOM_handle hCCOM,CPrepHstr* temp,Rect16* pRc,int nRc,int param)
842
842
{
843
843
 
844
844
 PAGEINFO info = {0};
921
921
              return FALSE;
922
922
         }
923
923
 
924
 
                 if(medium_size_v>2*inf_let_h&&medium_size_v>2*medium_size_h)//��������� ����� � ������
 
924
                 if(medium_size_v>2*inf_let_h&&medium_size_v>2*medium_size_h)//склеились буквы в строке
925
925
                         return FALSE;
926
926
                 else
927
927
                 return TRUE;
933
933
// int max_size=GetMaxSize((CCOM_handle)hCCOM,Rc,num,my_str->vertical);
934
934
 
935
935
 
936
 
//������ �����
 
936
//анализ строк
937
937
 
938
938
 int* h_top= new int[nRc];
939
939
 int* h_bottom= new int[nRc];
944
944
 
945
945
 Recstr.top=Rect.top;
946
946
 Recstr.bottom=Rect.bottom;
947
 
 
948
 
 int i(0);
 
947
 
 
948
 int i(0);
949
949
 for(i=0;i<temp->nRc;i++)
950
950
 {
951
951
         GetStrBounds(HCCOM,temp->pRc,temp->nRc,i,&(v_top[i]),&(v_bottom[i]),TRUE,Rc);
1078
1078
 Rect->right=right;
1079
1079
}
1080
1080
 
1081
 
void GetStrBounds(CCOM_handle hCCOM,Rect16* pRc,int nRc,int num,int* ptop,int* pbottom,BOOL vert,Rect16 Rc)
 
1081
void GetStrBounds(CCOM_handle hCCOM,Rect16* pRc,int nRc,int num,int* ptop,int* pbottom,Bool vert,Rect16 Rc)
1082
1082
{
1083
1083
 int min_top=10000;
1084
1084
 int max_bottom=0;
1151
1151
 
1152
1152
}
1153
1153
 
1154
 
BOOL NotIn(CCOM_handle hCCOM,Rect16 Rc,Rect16* pRc,int nRc,BOOL vert,int medium_size)
 
1154
Bool NotIn(CCOM_handle hCCOM,Rect16 Rc,Rect16* pRc,int nRc,Bool vert,int medium_size)
1155
1155
{
1156
1156
        my_top=Rc.top;
1157
1157
        my_bottom=Rc.bottom;
1161
1161
        int right;
1162
1162
        int top;
1163
1163
        int bottom;
1164
 
        BOOL fl_in;
 
1164
        Bool fl_in;
1165
1165
        CCOM_comp* comp;
1166
1166
 
1167
1167
   if(!vert)
1218
1218
 return FALSE;
1219
1219
}
1220
1220
 
1221
 
BOOL NotInAll(CCOM_handle hCCOM,Rect16 Rc,Rect16* pRc,int& nRc,BOOL vert)
 
1221
Bool NotInAll(CCOM_handle hCCOM,Rect16 Rc,Rect16* pRc,int& nRc,Bool vert)
1222
1222
{
1223
1223
        my_top=Rc.top;
1224
1224
        my_bottom=Rc.bottom;
1231
1231
        CCOM_comp* comp;
1232
1232
        int i(0);
1233
1233
 
1234
 
        BOOL* fl_in = new BOOL[nRc];
 
1234
        Bool* fl_in = new Bool[nRc];
1235
1235
        for(i=0;i<nRc;i++)
1236
1236
        fl_in[i]=FALSE;
1237
1237
 
1280
1280
        }
1281
1281
   }
1282
1282
 
1283
 
 BOOL ret=FALSE;
 
1283
 Bool ret=FALSE;
1284
1284
 for(i=nRc-1;i>=0;i--)
1285
1285
 {
1286
1286
         if(fl_in[i]==FALSE)
1292
1292
 return ret;
1293
1293
}
1294
1294
 
1295
 
BOOL IfOneRowComp(CCOM_handle hCCOM,Rect16 Rc,BOOL vert)
 
1295
Bool IfOneRowComp(CCOM_handle hCCOM,Rect16 Rc,Bool vert)
1296
1296
{
1297
1297
        my_top=Rc.top;
1298
1298
        my_bottom=Rc.bottom;