2
Copyright (c) 1993-2008, Cognitive Technologies
5
����������� ��������� ��������������� � ������������� ��� � ���� ��������� ����,
6
��� � � �������� �����, � ����������� ��� ���, ��� ���������� ��������� �������:
8
* ��� ��������� ��������������� ��������� ���� ������ ���������� ���������
9
���� ����������� �� ��������� �����, ���� ������ ������� � �����������
11
* ��� ��������� ��������������� ��������� ���� � ������������ �/��� �
12
������ ����������, ������������ ��� ���������������, ������ �����������
13
��������� ���� ���������� �� ��������� �����, ���� ������ ������� �
14
����������� ����� �� ��������.
15
* �� �������� Cognitive Technologies, �� ����� �� ����������� �� �����
16
���� ������������ � �������� �������� ��������� �/��� �����������
17
���������, ���������� �� ���� ��, ��� ���������������� �����������
20
��� ��������� ������������� ����������� ��������� ���� �/��� ������� ������ "���
21
��� ����" ��� ������-���� ���� ��������, ���������� ���� ��� ���������������,
22
������� �������� ������������ �������� � ����������� ��� ���������� ����, �� ��
23
������������� ���. �� �������� ��������� ���� � �� ���� ������ ����, �������
24
����� �������� �/��� �������� �������������� ���������, �� � ���� ������ ��
25
��Ѩ� ���������������, ������� ����� �����, ���������, ����������� ���
26
������������� ������, ��������� � �������������� ��� ���������� ����������
27
������������� ������������� ��������� (������� ������ ������, ��� ������,
28
������� ���������, ��� ������ �/��� ������ �������, ���������� ��-�� ��������
29
������� ��� �/��� ������ ��������� �������� ��������� � ������� �����������,
30
�� �� ������������� ����� ��������), �� �� ������������� ���, ���� ���� �����
31
�������� ��� ������ ���� ���� �������� � ����������� ����� ������� � ������.
33
Redistribution and use in source and binary forms, with or without modification,
34
are permitted provided that the following conditions are met:
36
* Redistributions of source code must retain the above copyright notice,
37
this list of conditions and the following disclaimer.
38
* Redistributions in binary form must reproduce the above copyright notice,
39
this list of conditions and the following disclaimer in the documentation
40
and/or other materials provided with the distribution.
41
* Neither the name of the Cognitive Technologies nor the names of its
42
contributors may be used to endorse or promote products derived from this
43
software without specific prior written permission.
45
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
46
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
47
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
48
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
49
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
50
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
51
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
52
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
53
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
54
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
57
/* DIFFR.C : diskrimintion functions for russian language */
65
extern Word8 broken_flag;
66
Word8 rec5_flag=1,font_type=0,omni=1;
67
Int16 NumVertInterval(Word8 *RASTER,Int16 D_X, Int16 dy, Int16 i);
68
Int16 VertSum(Word8 *rastr,Int16 D_X, Int16 dy, Int16 i);
69
Int16 SumBits(Word8 *rastr,Int16 D_X);
70
Int16 NumHorizInterval(Word8 *,Int16);
71
Int16 FOOT(Word8 *raster,Int16 DX,Word8 dx,Word8 Ly,
73
Int16 FOOT3( Word8 *RASTER, Int16 Wx, Word8 START, Word8 NWIDTH, Word8 NLENGTH, Int16 SHIFT);
74
Int16 EndBlackInterval(Word8 *RASTER, Int16 NWIDTH);
75
Int16 FOOT3_2( Word8 *RASTER, Int16 Wx, Word8 NWIDTH, Word8 NLENGTH);
76
Int16 FOOT_HEI( Word8 *RASTER, Int16 Wx, Word8 NWIDTH, Word8 NLENGTH);
78
Int16 MinMaxLeft( Word8 *RASTER, Int16 Wx, Word8 NWIDTH, Word8 NHEIGHT,
79
Int16 *Pmin, Int16 *Pmax);
80
Int16 MinMaxRight( Word8 *RASTER, Int16 Wx, Word8 NWIDTH, Word8 NHEIGHT,
81
Int16 *Pmin, Int16 *Pmax);
82
Int16 DiskrRight(Word8 *RASTR,Int16 D_X,Int16 dx,Int16 dy,Int16 L);
83
Int16 Num2Interval(Word8 *r,Int16 D_X,Int16 dx,Int16 dy);
84
Int16 broken_M(Word8 * r,Int16 D_X,Int16 dy,Int16 left_lim,Int16 ll);
85
Int16 FOOT_A(Word8 *raster,Int16 DX,Word8 dx,Word8 Ly);
86
Int16 fill_center_zone(Word8 *raster,Int16 D_X,Int16 dy,
87
Int16 beg, Int16 end, Int16 II);
88
Int16 up_down_hist_M(Word8 *rastr,Int16 D_X, Int16 Dx,Int16 dy);
89
Int16 small_density(Word8 *RAST,Int16 n,Int16 D_X,Int16 bw);
90
Int16 LeftDistance(Word8 *RASTER,Int16 dx);
91
Int16 RightDistance(Word8 *RASTER,Int16 dx);
92
Int16 SumIntervalBits(Word8 *RASTER,Int16 bx,Int16 ex);
93
Int16 CenterVertInterval(Word8 *,Int16 ,Int16 ,Int16, Int16 *,Int16 *);
94
void init_diskrim(Word8* raster,Int16 height ,Int16 width);
95
Int16 DiskrLeftBig(Word8 *RASTR,Int16 D_X,Int16 dx,Int16 dy, Int16 L);
96
Int16 DiskrRightBig(Word8 *RASTR,Int16 D_X,Int16 dx,Int16 dy,Int16 L);
98
static void DiskrIN(Word8 *RASTR,Int16 D_X,Int16 dy, Int16 wb,Int16 dx);
99
static Int16 DiskrHorizIN(Word8 *RASTR,Int16 D_X,Int16 dy);
100
Int16 no_serific(Word8 *RASTR,Int16 dy,Int16 dx,Int16 wb);
102
#define bytlen(bits) (REC_GW_WORD8(bits))
104
extern Word8 BUFFER[256]; /* ���⨪��쭠� ��o���� */
105
extern Word8 LOCAL[50]; /* ���न���� ��� */
106
extern Word8 LOCAL_W[50]; /* �ਭ� ��� */
107
extern Word8 end1,beg2; /* ����� 1 � ��砫� 2-�� ��� ��� */
108
extern broken_ii; /* 䫠� ���� ����� */
109
extern Int16 dnri_hook; // bottom right hook in small russian italic II,III
110
extern Int16 uple_hook; // bottom left hook in small russian italic II,III
111
extern Int16 up_jack ; // upper jack
113
static Int16 upper_skip_lines,lower_skip_lines;
114
static Int16 diskr_f2,diskr_tsh,diskr_ii,
115
diskr_sh,diskr_g,diskr_tsh,diskr_ju,diskr_m,diskr_ii,diskr_p,diskr_N,
116
diskr_c, diskr_o, diskr_e,diskr_b,diskr_3,
117
IN_N_Bonus,IN_equ,IN_P_Bonus,
118
IN_I_Bonus,IN_IN_Monus,IN_dis,diskr_i,diskr_n,IN_N,IN_I,IN_M,IN_pics,
121
Int16 left_dist[4], right_dist[4], num_foot, c_or_e,d_c,d_e,
122
right_max,left_max,left_line,right_line,
123
left_dist_big[4], right_dist_big[4],lower_long_line;
124
Int16 av_tl, av_bl,av_br, rotate;
125
/* g-�, sh-�, b-B, k-K, ju-�, f2-���, tsh-�, ii-�, o-O, c-C, e-E,
126
h-�, ja-�, z-�, ee-�, d-�, ce-� */
127
Int16 fill_center,up_down_serif,up_down_serif_B,IN_horiz_dis,broken_M_pen;
129
static Int16 DiskrSymSh( Word8 *RASTER, Int16 Wx, Word8 NWIDTH, Word8 NLENGTH);
130
static Int16 DiskrSh(Word8 *RASTR,Int16 D_X,Int16 dx,Int16 Ly);
131
static Int16 DiskrLeft(Word8 *RASTR,Int16 D_X,Int16 dx,Int16 dy, Int16 L);
132
static Int16 DiskrSh0(Word8 *RASTR,Int16 D_X,Int16 dx,Int16 dy,Int16 dx0);
133
static Int16 DiskrJ0(Word8 *RASTR,Int16 D_X,Int16 dx,Int16 Ly,Int16 lim);
134
static Int16 DiskrJ(Word8 *RASTR,Int16 D_X,Int16 dx,Int16 dy);
135
static Int16 DiskrTsh(Word8 *RASTR,Int16 D_X,Int16 dx,Int16 dy,Int16 Dx);
136
static Int16 average_br_angle(Word8 *RASTER, Int16 D_X, Int16 dx, Int16 dy,Int16 t);
137
static Int16 average_angle(Word8 *RASTER, Int16 D_X, Int16 dx, Int16 dy,
138
Int16 (*Distance)(Word8 *, Int16), Int16 t);
139
static Int16 DiskrJu(Word8 *RASTR,Int16 D_X,Int16 dx,Int16 Ly);
140
static Int16 DiskrimM1(Word8 *RAST,Int16 D_X,Int16 dx,Int16 dy);
141
static Int16 DiskrimM(Word8 *RAST,Int16 D_X,Int16 dx,Int16 dy);
142
static Int16 whiteMeanBitRight(Word8 *RAST,Int16 D_X,Int16 dx,Int16 meanBit);
143
static Int16 whiteMeanBitLeft(Word8 *RAST,Int16 D_X,Int16 meanBit);
144
static Int16 up_down_zones(Word8 *raster, Int16 D_X, Int16 dx, Int16 dx0,
145
Int16 start1, Int16 stop1, Int16 start2, Int16 stop2);
146
static Int16 DiskrVertCE(Word8 *RASTR,Int16 D_X,Int16 dx,Int16 dy,Int16 X,
147
Word8 let, Word8 inc);
148
static Int16 AngleBottomRight(Word8 *raster,Int16 D_X,Int16 hei);
149
static Int16 AngleTopRight(Word8 *raster,Int16 D_X,Int16 hei);
150
static Int16 BonusAnglesCurve(Word8 *raster,Int16 D_X,Int16 dy);
151
static Bool32 DiskrJuCut(Int16 nfoot, Int16 dx);
153
/* clear diskrimination flags */
154
void init_diskrim(Word8* raster,Int16 height ,Int16 width)
156
Int16 i, D_X=bytlen(width);
161
diskr_N=diskr_sh=diskr_g=diskr_tsh=diskr_ju=diskr_m=diskr_ii=diskr_p=
162
diskr_c=diskr_o=diskr_e=diskr_b=diskr_3=
163
left_dist_big[1]= right_dist_big[1]= left_dist[1]= right_dist[1]=
164
left_dist_big[2]= right_dist_big[2]= left_dist[2]= right_dist[2]=
165
left_dist_big[3]= right_dist_big[3]= left_dist[3]= right_dist[3]=
166
num_foot= c_or_e=d_c=d_e=
167
fill_center=IN_dis=diskr_i=diskr_n=IN_equ=IN_N=IN_I=IN_M=
168
IN_pics=up_down_serif=up_down_serif_B=IN_horiz_dis=
170
lower_long_line=right_max=left_max=-1;
171
av_tl=av_bl=av_br=-1;
180
for( i=0;i<height && SumBits( r ,D_X)<3;i++,r+=D_X);
181
upper_skip_lines = i;
183
r = raster + D_X*(height-1);
184
for( i=0;i<2 && SumBits( r ,D_X)<3;i++,r-=D_X);
185
lower_skip_lines = i;
190
Bool32 LeftHole(Word8 *rastr, Int16 D_X, Int16 Dx, Int16 Hy)
206
for(;i<Hy;i++,rastr+=D_X)
208
t=LeftDistance(rastr,D_X);
223
return (mi>Dx/2 && abs(mi-ma)<i);
226
/* Diskrim : diskrimination function for diapason 0-255 */
228
/* let - name of letter */
229
/* raster - bit map( work raster ) */
230
/* D_X - whidth of bit map( length bit string ) */
231
/* X,Y - coordinats of first point in raster */
232
/* dx,dy - whidth and height work raster */
234
/* RETURN : 0 - good letter */
235
/* >0 - decreasing code */
237
Int16 Diskrim(Word8 let,Word8* raster,
238
Int16 D_X,Int16 dx,Int16 dy,Word8 cg_flag, Int16 inc)
240
Int16 P=0,F=0,Dx,Hy,bw, n, r;
241
Word8 *rastr,*rastr0;
244
#define step_diskr 20
247
if( upper_skip_lines )
249
raster += bytlen(D_X)*upper_skip_lines;
250
dy-=upper_skip_lines;
252
if( lower_skip_lines )
254
dy-=lower_skip_lines;
258
return(step_diskr*10);
263
rastr0= raster + Y*D_X+(X>>3);
264
rastr = rastr0 + D_X*(dy>>2);
267
d_r = ((bytlen(Dx))<<3)-dx-(X&7)+(dx>>2);
270
// russian small & capital E, Ze, 3
272
case (Word8)'�' : case (Word8)'�' :
273
case (Word8)'�' : case (Word8)'�' :
276
if( LeftHole(rastr, D_X, Dx, Hy) )
277
{ // need mount on the central zone
285
// russian small & capital B
286
case (Word8)'�' : case (Word8)'�' :
289
if( !DiskrRight(rastr0, D_X, Dx, dy,1) )
291
//if( BonusAnglesCurve(rastr0,D_X,dy)<2 )
305
if( (n=DiskrVertCE(rastr0, D_X, dx, dy, X,(Word8)'�',(Word8)inc))>2 )
313
case (Word8)'�' : case (Word8)'�' :
316
if( DiskrRight(rastr0, D_X, Dx, dy, 2) )
323
case (Word8)'�' : case (Word8)'�' :
326
if( !DiskrRight(rastr0, D_X, Dx, dy, 2) )
328
if( (n=DiskrVertCE(rastr0, D_X, dx, dy, X,(Word8)'�',(Word8)inc))!=0 )
341
for(iii=D_X*(dy-1),ii=i=0;i<dy;i++,ii+=D_X,iii-=D_X)
342
memcpy(rasterN+iii,raster+ii,D_X);
343
rastr0= rasterN + Y*D_X+(X>>3);
344
rastr = rastr0 + D_X*(dy>>2);
345
F = FOOT(rastr, D_X,(Word8)Dx, (Word8)Hy,1);
346
if( F!=2 || MIN(LOCAL_W[0],LOCAL_W[1])>3 && beg2-end1<3 )
349
F=FOOT(rastr0+2*D_X, D_X,(Word8)Dx, (Word8)(dy-4),0);
351
F=FOOT(rastr0, D_X,(Word8)Dx, (Word8)dy,0);
355
if( small_density(rastr,Hy,D_X,bw) )
365
DiskrIN(rastr0,D_X,dy,bw,dx);
367
if( 2*LOCAL[0]>5*LOCAL_W[0] && 2*(dx-LOCAL[1])<3*LOCAL_W[1])
370
P += MIN(2*(7-IN_I+IN_equ) * step_diskr,160)/2;
371
else if( IN_I==3 && IN_equ>2 )
372
P += IN_equ*step_diskr;
373
//if( IN_I>10 && IN_M==0 )
377
if( inc>0 ) // OLEG : ERECTION conditions : 09-12-95 07:29pm
389
// capital & small I/I
390
case (Word8)'�' : case (Word8)'�' :
393
F = FOOT(rastr, D_X,(Word8)Dx, (Word8)Hy,1);
394
if( F==2 && LOCAL[1]*2<=Dx )
399
if( F!=2 || MIN(LOCAL_W[0],LOCAL_W[1])>3 && beg2-end1<3 )
402
F=FOOT(rastr0+2*D_X, D_X,(Word8)Dx, (Word8)(dy-4),0);
404
F=FOOT(rastr0, D_X,(Word8)Dx, (Word8)dy,0);
408
if( small_density(rastr,Hy,D_X,bw) )
418
if( rotate && dnri_hook )
419
fill_center_zone(rastr+D_X*(Hy>>2),(Int16)D_X,(Int16)(Hy-(Hy>>2)),(Int16)end1,(Int16)beg2,0);
421
fill_center_zone(rastr,D_X,Hy,end1,beg2,0);
423
DiskrIN(rastr0,D_X,dy,bw,dx);
429
if( IN_I<=3 || IN_pics==0 )
436
if( 2*LOCAL[0]>5*LOCAL_W[0] )
439
P += MIN(2*(7-IN_I+IN_equ) * step_diskr,160)/2;
440
else if( IN_I==3 && IN_equ>2 )
441
P += IN_equ*step_diskr;
444
{ // �祭� ����ਧ��⠫쭠� ��४������
445
if( (F=up_down_hist_M(rastr0+D_X, (Int16)D_X,(Int16)Dx, (Int16)(dy-2)))>0 )
446
P += F*step_diskr>>2;
447
if( LOCAL[1]>(Dx>>1) &&
448
broken_M(rastr0+2*D_X, D_X,(Int16)(dy-4),(Int16)(LOCAL[0]-LOCAL_W[0]/2),
449
(Int16)(LOCAL[1]-LOCAL_W[1]/2)) )
455
if( inc>0 ) // OLEG : ERECTION conditions : 09-12-95 07:29pm
457
if( IN_I_Bonus && broken_flag && (broken_ii ||
459
Num2Interval(rastr0+2*D_X, (Int16)D_X,(Int16)Dx, (Int16)(dy-4))) )
460
P =(IN_I_Bonus==2)?-254:-250;
467
case (Word8)'�' : case (Word8)'�' :
470
F =FOOT(rastr, D_X,(Word8)Dx, (Word8)Hy,1);
471
if( F!=2 || MIN(LOCAL_W[0],LOCAL_W[1])>3 && beg2-end1<3 )
474
F=FOOT(rastr0+2*D_X, D_X,(Word8)Dx,(Word8)(dy-4),0);
476
F=FOOT(rastr0, D_X,(Word8)Dx, (Word8)dy,0);
483
if( rotate && dnri_hook )
484
fill_center_zone(rastr+D_X*(Hy>>2),(Int16)D_X,(Int16)(Hy-(Hy>>2)),(Int16)end1,(Int16)beg2,0);
486
fill_center_zone(rastr,D_X,Hy,end1,beg2,0);
488
DiskrIN(rastr0,D_X,dy,bw,dx);
489
if( DiskrHorizIN(rastr0,D_X,dy) )
499
if( IN_N>=3 || IN_pics==0 )
507
P += MIN(IN_N * step_diskr,160)/2;
509
if( DiskrRight(rastr0, (Int16)D_X, (Int16)Dx, (Int16)dy,(Int16)(dy>22?3:2)) )
513
if( LOCAL_W[0]>(LOCAL_W[1]<<1) &&
514
(LOCAL_W[1]>1 || LOCAL_W[1]==1 && LOCAL_W[0]>3 ) )
520
if( IN_N_Bonus && broken_flag && (broken_ii ||
522
Num2Interval(rastr0+2*D_X, (Int16)D_X,(Int16)Dx, (Int16)(dy-4))) )
523
P =(IN_N_Bonus==2)?-254:-250;
529
// capital & small II
530
case (Word8)'�' : case (Word8)'�' :
534
F=FOOT(rastr0+2*D_X, D_X,(Word8)Dx, (Word8)(dy-4),0);
536
F=FOOT(rastr0, D_X,(Word8)Dx, (Word8)dy,0);
541
if( rotate && (dnri_hook/*||dy<22&&up_jack>1*/) )
542
fill_center_zone(rastr+D_X*(Hy>>2),D_X,(Int16)(Hy-(Hy>>2)),end1,beg2,1);
544
//fill_center_zone(rastr,D_X,Hy,end1,beg2,0);
545
fill_center_zone(rastr+D_X*(Hy>>2),D_X,(Int16)(Hy-(Hy>>2)),end1,beg2,1);
547
Int16 f_c=fill_center;
548
DiskrIN(rastr0,D_X,dy,bw,dx);
549
if( !(rotate && (dnri_hook/*||dy<22&&up_jack>1*/)) )
556
if( (n=up_down_zones(rastr0,D_X,Dx,dx,0,(Int16)(dy>>2),Hy,dy))!=0 )
565
if( !broken_flag || n==2 )
572
if( IN_P_Bonus && broken_flag && (broken_ii ||
574
Num2Interval(rastr0+2*D_X, D_X,Dx, (Int16)(dy-4))) )
575
P =(IN_P_Bonus==2)?-254:-250;
581
// capital & small III
582
case (Word8)'�' : case (Word8)'�' :
585
FOOT(rastr, D_X,(Word8)Dx, (Word8)Hy,0);
586
if( rotate ) // OLEG : ERECTION conditions : 09-20-95
589
F=FOOT3(rastr, D_X, uple_hook?LOCAL[0]-LOCAL_W[0]/2:0 ,
590
dnri_hook?LOCAL[2]+LOCAL_W[2]/2:Dx, Hy,Hy<10?1:2);
597
if( (F=FOOT3(rastr, D_X, 0, (Word8)Dx, (Word8)Hy,2))!=3 )
600
P += (step_diskr>>1)*DiskrSymSh(rastr, D_X, (Word8)Dx, (Word8)Hy);
602
if( inc<=0 && !broken_flag && DiskrSh0(rastr0, D_X, Dx, dy, dx)==0 )
604
F = FOOT(rastr, D_X,(Word8)Dx, (Word8)Hy,0);
605
// OLEG : ERECTION conditions : 09-20-95 08:34pm
606
if( inc>0 && dnri_hook )
608
if( F>1 && DiskrSh(rastr, D_X, (Int16)(LOCAL[2]+LOCAL_W[2]/2), Hy) )
613
if( F>1 && (n=DiskrSh(rastr, D_X, Dx, Hy))!=0 )
618
if( DiskrLeft(rastr0, D_X, Dx, dy,2) )
620
if( DiskrRight(rastr0, D_X, Dx, dy,2) )
622
if( FOOT3_2(rastr0,D_X,(Word8)Dx,(Word8)dy) )
629
// capital & small >I<
630
case (Word8)'�' : case (Word8)'�' :
633
if( !DiskrLeftBig(rastr0, D_X, Dx, dy,2) )
635
if( !DiskrRightBig(rastr0, D_X, Dx, dy,2) )
637
F = FOOT(rastr, D_X,(Word8)Dx, (Word8)Hy,0);
638
if( F!=3 && (n=DiskrJ0(rastr, D_X, Dx, Hy,(Int16)(dy<18?4:5)))!=0 )
639
{ /* middle tail have'nt 3-interval lines */
640
if( !DiskrJ(rastr0, D_X, Dx, dy) )
643
if( F!=3 && (n=DiskrJ0(rastr0, D_X, Dx, Hy,(Int16)(dy<18?2:3)))!=0 )
644
{ /* upper tail have'nt 3-interval lines */
645
if( !DiskrJ(rastr0, D_X, Dx, dy) )
652
// capital & small III,
653
case (Word8)'�' : case (Word8)'�' :
656
F= ((Word8)let==(Word8)'�' )?4:2;
657
if( (F=FOOT(rastr0+F*D_X, D_X,(Word8)Dx,(Word8)Hy,0))!=3 )
661
P += (step_diskr>>1)*DiskrSymSh(rastr, D_X, (Word8)Dx, (Word8)Hy);
662
if( DiskrTsh(rastr0+D_X,D_X,dx,dy,Dx)==1 )
665
if( average_br_angle(rastr0,D_X,Dx,dy,0)>d_r )
672
// capiatl & small IO
673
case (Word8)'�' : case (Word8)'�' :
675
//Int32 ret=DIF_GetNoCutPoint(rastr0, (Word8)dx, (Word8)dy);
679
r=FOOT_HEI( rastr0, D_X, (Word8)dx, (Word8)dy);
680
if( DiskrJuCut(r,dx) && r>1)
682
if( DiskrLeft(rastr0, D_X, Dx, dy,2) )
684
if( DiskrRight(rastr0, D_X, Dx, dy,2) )
686
if( (n=DiskrJu(rastr, D_X, Dx, Hy)) )
693
case (Word8)'�' : case (Word8)'�' :
698
mii = DiskrimM1(rastr0, D_X, dx, dy );
700
mii = DiskrimM(rastr0, D_X, dx, dy );
708
F=FOOT(rastr0+2*D_X, D_X,(Word8)Dx, (Word8)(dy-4),0);
710
F=FOOT(rastr0, D_X, (Word8)Dx, (Word8)dy,0);
714
DiskrIN(rastr0,D_X,dy,bw,dx);
724
// capital & small bl
725
case (Word8)'�' : case (Word8)'�' :
731
mii = DiskrimM1(rastr0, D_X, dx, dy );
733
mii = DiskrimM(rastr0, D_X, dx, dy );
736
P += (-mii)*step_diskr;
752
Int16 small_density(Word8 *RAST,Int16 n,Int16 D_X,Int16 bw)
757
if( !omni && font_type==0 )
760
for(l=i=0;i<n;i++,RAST+=D_X)
762
w = b - RightDistance(RAST,bw) - LeftDistance(RAST,bw);
763
d = SumBits(RAST,bw);
770
Int16 no_serific(Word8 *RASTR,Int16 dy,Int16 dx,Int16 wb)
772
Int16 l0=VertSum(RASTR,wb,dy,0);
773
Int16 l1=VertSum(RASTR,wb,dy,1);
774
Int16 l2=VertSum(RASTR,wb,dy,2);
775
Int16 r0=VertSum(RASTR,wb,dy,(Int16)(dx-1));
776
Int16 r1=VertSum(RASTR,wb,dy,(Int16)(dx-2));
777
Int16 r2=VertSum(RASTR,wb,dy,(Int16)(dx-3));
779
if( l0<dy && l1<=dy && l1>dy-2 && l2>dy )
781
if( r0<dy && r1<=dy && r1>dy-2 && r2>dy )
783
//return ( l0>dy || l1>dy ) && ( r0>dy || r1>dy ) ;
787
Int16 vert_stairs(Int16 arr[], Int16 lim)
790
for(jmp=0,i=1,old=arr[0];i<lim;i++)
803
/***************************************************************************/
805
/* �����頥� �業�� �����⠭�� �।�� ���ࢠ��� ��ફ����� �� */
807
/***************************************************************************/
808
static void DiskrIN(Word8 *RASTR,Int16 D_X,Int16 dy,Int16 bw,Int16 dx)
809
/***************************************************************************/
810
/**** *RASTR 㪠��⥫� �� ���ᨢ ********/
811
/**** dy k�����⢮ ��ப ********/
812
/**** D_X ������⢮ ���⮢ � ��ப� ********/
813
/***************************************************************************/
814
{ Word8 n[256],hist[256];
815
Int16 ua[256],da[256];
816
Int16 i,n2=dy-2*(dy>>2),n4,mean,fine;
817
Int16 incr,decr,old,neue,equ;
818
Int16 l=beg2-end1-1,l_real,t,jump,rmin,rmax;
819
Int16 ol=1,or=1; /* ����� �� � �ࠢ� */
823
n4 = MAX(dy/4,(LOCAL_W[0]+LOCAL_W[1])/4);
824
if( n4>dy/3 ) n4=dy/4;
834
if( l+ol+or<2 && dy>19 )
836
if( small_density(RAST,n2,D_X,bw) )
853
{ /* �⬥���� ������ */
859
Int16 up_space=-1, down_space=-1;
860
Int16 up_fill=0,down_fill=0,d;
861
for(R=RAST,i=n4;i<=dy-2;i++,R+=D_X)
863
d=SumIntervalBits(R,(Int16)(end1+ol),(Int16)(beg2-or+1))/3;
865
if( d==l && !up_fill )
867
if( d==l && i<n4+n2 )
871
if( up_fill && down_fill && up_fill>n4 &&
872
(hist[up_fill-1]==0||hist[up_fill-2]==0) &&
873
(hist[down_fill+1]==0||hist[down_fill+2]==0) )
882
for( old=hist[n4],i=n4+1;i<=n2;i++)
886
if( old==1 && neue>=l && hist[i+1]>=l ||
887
old==0 && neue>=l-1 && hist[i+1]>=l )
889
if( NumHorizInterval(RASTR+D_X*(i+1),bw)==1 )
892
up_space = (neue==l ? 0 : 1);
894
for(j=i+1;j<dy-2 && hist[j]>=l-1;j++);
898
d+=(hist[j]<hist[j-1]);
913
if( neue==1 && old>=l && hist[i-2]>=l ||
914
neue==0 && old>=l-1 && hist[i-2]>=l )
916
if( NumHorizInterval(RASTR+D_X*(i-2),bw)==1 )
917
down_space = (old==l ? 0 : 1);
922
if( up_space!=-1 && down_space!=-1 )
925
IN_I= MIN(up_space,down_space);
930
memset(hist,0,dy<<1);
931
} /* end of horiz study */
933
if( no_serific(RASTR,dy,dx,bw) )
939
memset(ua,0xFF,dy<<1);
940
memset(da,0xFF,dy<<1);
942
n[i] =(Word8) CenterVertInterval( RAST, D_X, n2, i,&ua[i],&da[i] );
943
/* ����᭮� ���� ����� */
944
for(mean=l_real=0,i=end1+ol;i<=beg2-or;i++)
945
{ /* ⠡��� ���⮢ �।�� ���⨪����� ���ࢠ��� */
946
n[i] =(Word8)CenterVertInterval( RAST, D_X, n2, i,&ua[i],&da[i] );
948
if( n[i] ) /* mean - �㬬� ����⮢ */
949
l_real++; /* l_real - � ���㫥��� ����⮢ */
951
n[i] = (Word8)CenterVertInterval( RAST, D_X, n2, i,&ua[i],&da[i]);
953
if( l!=l_real && (l_real==2 || (n[end1]|n[end1+1]) && (n[beg2]|n[beg2-1])) )
954
{ /* ������⢨� ��४������ */
960
if( l_real<=1 && ((n[end1]==0&&n[end1+1]==0) || (n[beg2]==0&&n[beg2-1]==0)) )
961
{ /* ������⢨� ��४������ */
965
if( n[end1]==0 && n[end1+1]==0 && n[beg2]==0 && n[beg2-1]==0 )
973
if( no_serific(RASTR,dy,dx,bw) )
974
{ /* ����� ������ � ���ࢠ� ���� [dy/4,dy-dy/4] */
976
nn4 = MAX(dy>>2,(LOCAL_W[0]+LOCAL_W[1])>>1);
977
if( nn4>dy/3 ) nn4=dy/4;
980
for(mean=l_real=0,i=end1;i<=beg2;i++)
983
if( h<nn4 || h>nn4+nn2 )
987
n[i] += ((nn2+nn4-n2-n4)<<1);
991
(i!=end1||i==end1&&ol==0) &&
992
(i!=beg2||i==beg2&&or==0) )
1005
if( or && n[i] && VertSum(RAST, D_X, n2, i)<n2-1 &&
1006
NumVertInterval(RAST, D_X, n2, i)==1 )
1007
{ /* ���뢠�� ������ ����� */
1014
if( ol && n[i] && VertSum(RAST, D_X, n2, i)<n2-1 &&
1015
NumVertInterval(RAST, D_X, n2, i)==1 )
1016
{ /* ���뢠�� ������ ����� */
1025
Int16 dy1=n2/*dy>>1*/,nn,mm,mm1,minup,mindown,zaz;
1028
for( minup=mindown=zaz, rrrr=RASTR, rrrr1=RASTR+(dy-1)*D_X, i=0;
1029
i<3; i++, rrrr+=D_X, rrrr1-=D_X)
1031
mm = zaz-SumIntervalBits(rrrr,end1,beg2)/3;
1034
mm1 = zaz-SumIntervalBits(rrrr1,end1,beg2)/3;
1037
nn=dx-SumBits(rrrr,bw);
1041
if( i<3 || (minup*2<mindown && minup*3<zaz && zaz>3) )
1042
{ /* ���� ������ ���誠 */
1043
IN_N_Bonus=IN_I_Bonus=1;IN_P_Bonus=2;
1047
if( (nn=n[end1+ol])>0 )
1049
IN_N_Bonus=IN_I_Bonus=IN_P_Bonus=1;
1055
else if( (nn=n[beg2-or])>0 )
1057
IN_N_Bonus=IN_I_Bonus=IN_P_Bonus=1;
1066
Int16 z=beg2-end1+1;
1067
if( z>4 && l_real*2>z )
1068
IN_IN_Monus=1; /* � ��४������ ࠧ�� � �����쪨� ! */
1069
if( l_real>4 || l-l_real<=3 && l>5 ||
1070
l_real==4 && fill_center ||
1071
l_real<2 && z<4 && n4<6 ||
1076
/*IN_P_Bonus=*/IN_I_Bonus=IN_N_Bonus=0;
1083
for(i=end1+ol;i<=beg2-or;i++)
1084
if( (neue=n[i])!=0 )
1087
mean=mean/l_real+((mean%l_real)>(l_real>>1));
1088
/* mean - �।��� ����� */
1090
if( hist[mean-1]>l_real-2 )
1092
if( hist[mean+1]>l_real-2 )
1095
if( l_real!=l && !(l_real==l-1 && (n[end1]==0||n[beg2]==0) ) )
1096
if( !fill_center && l_real<=4 || l_real<=3 )
1098
Int16 an[2],en[2],ll,dy1=n2,san[2],sen[2],z;
1099
/* ���� ���饩 �� '�' �� �।��� ����� */
1110
if( abs(an[i]-dy1)>2 )
1113
n[end1+i]=(Word8)dy1,ll++;
1117
if( abs(en[i]-dy1)>2 )
1120
n[beg2-i]=(Word8)dy1,ll++;
1123
if( IN_I_Bonus==2 && ll==1 )
1125
if( ll>2 || ll==2 && broken_flag )
1130
n[end1+i]=(Word8)dy1;
1132
n[beg2-i]=(Word8)dy1;
1137
IN_P_Bonus=IN_I_Bonus=0;
1143
n[beg2-i]=(Word8)sen[i];
1144
n[end1+i]=(Word8)san[i];
1146
/* ���� ���饩 �� '�' �� ࠧ�� ��� �� �।��� ����� */
1153
z=VertSum(RAST, D_X, n2, (Int16)(end1+i));
1154
if( an[i]>0 && an[i]<dy1-2 && z<n4 )
1156
z=VertSum(RAST, D_X, n2, (Int16)(beg2-i));
1157
if( en[i]>0 && en[i]>dy1+2 && z<n4)
1160
#ifndef Int16ERSEPTOR
1161
if( ll>2 || ll==2 && broken_flag && !rotate)
1163
if( ll>3 || ll==2 && broken_flag && !rotate)
1168
IN_P_Bonus=IN_N_Bonus=0;
1174
if( fill_center && l_real>l-3 && l>2 )
1176
Int16 lim = (beg2-or-end1+ol)>>1;
1177
for(t=0,i=end1+ol;i<=lim;i++)
1178
if( n[i]>((n2-2)<<1) )
1180
if( t>=MAX(2,(l_real>>1)) )
1181
{ /* ��४������ 誮� ��᮪� */
1182
fill_center=0; /* ���४�� ���� �� �������⢨� ��४������ */
1190
if( fill_center && l_real<2 && l>4 )
1191
{ /* ������ ������⢨� ��४������ */
1192
fill_center=0; /* ���४�� ���� �� �������⢨� ��४������ */
1201
for(old=incr=decr=fine=0,i=end1+ol,rmin=dy,rmax=0;i<=beg2-or;i++)
1202
if( (neue=n[i])!=0 )
1203
{ /* fine - �㬬� ����ﭨ� �� �।���� */
1205
old = neue;/* ���� ���㫥��� ����� */
1211
fine += neue - mean;
1215
incr++; /* � ᪠窮� �����⠭�� */
1217
decr++; /* � ᪠窮� �뢠��� */
1220
if( fine && rmax-rmin<=2 && !(l_real==3 && incr==2) )
1221
fine=0; /* �� ������ � 2-� ������ */
1222
if( fine && l_real==3 && incr==2 )
1223
fine+=2; /* 2 ᪠窠 � 3-� �⮫��� */
1226
Int16 fin=fine,inc=incr,dec=decr;
1229
if( ol && neue && neue<n[end1+1] )
1235
inc++; /* � ᪠窮� �����⠭�� */
1239
if( or && neue && neue>n[beg2-1])
1245
inc++; /* � ᪠窮� �����⠭�� */
1247
/* ����讥 �室�⢮ � '�' */
1248
if( fin>10 && inc>3 && dec<1 && LOCAL[0] <= dx/4)
1250
else if( fin>10 && inc>2 && dec==0 && LOCAL[0] <= dx/4)
1255
if( abs(incr-decr)<2 && /* ������� ���祭�� ᪠窮� */
1256
(incr>1 && /* ����� 1 �����⠭�� */
1257
decr>1 || /* ����� 1 �뢠��� */
1258
incr && decr && incr+decr<4 ) && /* ���� ᪠窮� */
1259
fine<=l /* ����� ��ᯥ��� */
1262
if( incr<2 && /* ������� �����⠭�� */
1263
l_real>4 && /* �� �ப�� ��४������ */
1264
decr && incr+decr<4 ) /* ᪠窮� ������� */
1266
if( incr*2<decr && l_real>4 ) /* too many incr */
1268
if( fine>2 && incr<2 && decr>1 && l>3 )
1269
fine -= 2; /* �ᥣ� 1 �����⠭�� */
1270
t = (incr<=1)&&(decr<=1);
1271
for(i=end1+ol; n[i]==0 && i<=beg2-or;i++); /* skip empty columns */
1272
for(equ=incr=0,old=n[i++];i<=beg2-or;i++)
1282
if( t==0 ) /* ����� 1-�� �����⠭�� ��� �뢠��� */
1283
fine += incr ; /* �������� ���� �� �����⠭�� */
1284
for(t=equ=i=0;i<dy;i++)
1287
if( fine>1 && equ>2 && t==mean && or==0 && ol==0 &&
1288
n[end1]<mean && mean<n[beg2] && equ+2==l_real )
1289
fine=0; /* 1-� � ������ ᪠窨 � */
1290
/* ࠧ�ࢠ���� ����, ���ࢠ� */
1291
/* ������⢠ ����� 3 */
1292
if( equ>1 && fine<6 )
1295
t = n4 + n2 - (t>>1);
1296
for( RAST=RASTR+D_X*(t-2),i=t-2;i<=t+2;i++,RAST+=D_X)
1297
if( SumIntervalBits(RAST,end1,(Int16)(beg2+1))==
1299
{ /* ���� ��४������ */
1303
if( equ==2 && (ol&&n[end1+ol] || or&&n[beg2-or]) )
1307
if( l_real<5 && equ>2 )
1308
fine=0; /* 3 �� 4(��� <4) ᮢ������ */
1309
if( l_real>4 && equ>l_real-2 )
1310
fine = 0; /* ᮢ������ l-1 �� l ����⮢ */
1313
{ /* �����⢥��� �ᯫ�� */
1315
if( n[i]!=0 && n[i]<n[i+1] && n[i+2]==n[i+1] )
1317
fine=0; /* �����⢥��� ���� �ᯫ�� */
1323
if( n[i-1]!=0 && n[i]>n[i-1] && n[i-2]==n[i-1] )
1326
/* �����⢥��� �ࠢ� �ᯫ�� */
1332
{ /* ��ନ�� ������������ ���� */
1333
fine <<= 5; /* *32 ????????????? */
1334
fine /= l_real; /* ��⨭��� �ਭ� */
1335
fine /= n2; /* ���� */
1341
fine=0; /* l_real<2 : �� ����� �業��� ��ࠧ */
1346
if( fill_center && l>2 )
1347
fill_center=0; /* ���४�� ���� �� �������⢨� ��४������ */
1348
if( !fill_center && l_real==1 &&
1349
(NumVertInterval(RAST, D_X, n2, end1)==1 &&
1350
VertSum(RAST,D_X,n2,end1)<n4 &&
1351
n[end1] && abs(n[end1]-(dy>>1))<3 ||
1352
NumVertInterval(RAST, D_X, n2, beg2)==1 &&
1353
VertSum(RAST,D_X,n2,beg2)<n4 &&
1354
n[beg2] && abs(n[beg2]-(dy>>1))<3) )
1360
IN_N=IN_I = fine; /* ���� �� �����⠭�� */
1361
if( incr<2 && l_real>5 && decr>4 )
1365
IN_I=1; /* similar to N */
1367
if( incr<1 && l_real>3 && decr>l_real/2 )
1370
IN_I=1; /* similar to N */
1372
if( !fine && IN_M==0 && l_real>3 && decr>=l_real/3 && decr>1 )
1375
IN_I=1; /* similar to M */
1377
if( fine==0 && jump )
1379
if( !fill_center && (l_real>3 || l_real>l-3) && l>2 && mean*4<dy*3 )
1381
if( l_real>2 || n[end1] && n[beg2] )
1382
#ifdef Int16ERSEPTOR
1385
if( !rotate || l_real>3 )
1386
fill_center=1; /* ���४�� ���� �� �������⢨� ��४������ */
1388
if( fine>5 && l_real==2 && !broken_flag && incr==0 && decr==1 )
1396
IN_equ = (equ>0)?2+equ:0; /* IN_equ -���� �� ������⢮ */
1398
if( DiskrHorizIN(RASTR,D_X,dy) )
1399
{ /* ��ୠ� ��४������ */
1404
{ /* '�' ��⠥��� � '�' */
1405
Int16 i,le,ri,nnn=(beg2+end1+ol-or)/2;
1406
if( fine>15 && decr>3 || fine>20 && decr>2 ||
1407
fine>10 && incr<1 && decr>3 ) //RUS_ENG_LANG
1409
if( l_real>4 && fine>9 )
1411
for(old=n[end1+ol],le=0,i=end1+ol;i<nnn;i++)
1421
for(old=n[i],ri=0;i<beg2-or;i++)
1437
Int16 up_skip=vert_stairs(&ua[end1],(Int16)(beg2-end1+1));
1438
Int16 down_skip=vert_stairs(&da[end1],(Int16)(beg2-end1+1));
1441
if( up_skip>3 && down_skip>3 ||
1442
up_skip>1 && down_skip>1 && up_skip+down_skip>4 )
1455
/***************************************************************************/
1456
Int16 DiskrHorizIN(Word8 *RASTR,Int16 D_X,Int16 dy)
1457
/***************************************************************************/
1458
/**** *RASTR 㪠��⥫� �� ���ᨢ ********/
1459
/**** dy k�����⢮ ��ப ********/
1460
/**** D_X ������⢮ ���⮢ � ��ப� ********/
1461
/***************************************************************************/
1463
Int16 i,j,n2=dy-2*(dy>>2),n4=dy>>2,imax,nmax,kmax;
1464
Int16 l = beg2 - end1 ,h;
1465
Word8 *RAST = RASTR+D_X*n4;
1468
if( IN_horiz_dis>=0 )
1469
return(IN_horiz_dis);
1472
{ /* ����� ����ﭨ� */
1474
return(IN_horiz_dis);
1477
for(imax=nmax=kmax=-1,i=n4,j=0;j<=n2;j++,i++,RAST+=D_X)
1478
{ /* ������� ����� */
1479
n[i] = SumIntervalBits(RAST,end1,beg2)/3;
1486
else if( n[i]==nmax )
1490
if( imax>0 && nmax==l && kmax>1 )
1492
for(i=imax;n[i]==nmax;i--);
1493
h = ( n[i-1]==0 && n[i]<3 || n[i]<2 ) ;
1494
for(i=imax;n[i]==nmax;i++);
1495
l = ( n[i+1]==0 && n[i]<3 || n[i]<2 ) ;
1500
return (IN_horiz_dis= (h&&l) ) ;
1501
} /* DiskrHorizIN */
1503
Int16 fill_center_zone(Word8 *raster,Int16 D_X,Int16 dy,
1504
Int16 beg, Int16 end, Int16 II)
1506
Int16 i,num,l,ny,d=((end-beg)>>1),p, white, w;
1514
if( fill_center>=0 )
1515
return( fill_center );
1518
if( rotate ) p=0; // OLEG : ERECTION CONDITION
1521
for(ny=num=i=0;i<dy;i++,r+=D_X)
1523
l = SumIntervalBits(r,beg,(Int16)(end+p))/3;
1531
num += l; // SUM of black bits in critical lines
1534
ny++; // num of critical lines
1540
if( !(rotate && (dnri_hook||II) ) )
1543
fill_center = ( num>ny ) ;
1545
fill_center = ( num>(ny<<1) );
1552
if( white<2 && dnri_hook )
1554
else if( d>2 && white<d )
1561
return( fill_center );
1564
Int16 up_down_hist_M(Word8 *rastr,Int16 D_X, Int16 Dx,Int16 dy)
1566
Int16 i,j,d,h=dy>>1,s,t,n;
1570
for(s=j=0,i=0,r=rastr+i*D_X;i<h;j++,i++,r+=D_X)
1572
n = NumHorizInterval( r, Dx ) ;
1575
if( j>3 && s==0 ) break;
1577
if( s<2 ) return(0);
1579
for(t=d=j=0,i=dy-1,r=rastr+i*D_X; i>=h;i--,j++,r-=D_X)
1581
n = NumHorizInterval( r, Dx ) ;
1586
if( j>3 && t==0 ) break;
1589
if( t<2 ) return(0);
1591
if( s>3 && t>3 ) return( 8 );
1595
Int16 broken_M(Word8 * r,Int16 D_X,Int16 dy,Int16 left_lim,Int16 ll)
1597
Int16 i,old,neue,dest,sign,fc,maxd,incr;
1599
if( broken_M_pen>=0 )
1600
return broken_M_pen;
1601
old=RightDistance(r,D_X);
1602
for(rr=r+D_X,i=1;i<dy;i++,rr+=D_X)
1604
neue=RightDistance(rr,D_X);
1605
if( abs(neue-old)>1 )
1606
return (broken_M_pen=0);/* ����אַ� �ࠢ� ���� */
1610
old=LeftDistance(r,D_X);
1613
for(maxd=fc=sign=incr=0,dest=old,rr=r+D_X,i=1;i<dy;i++,rr+=D_X)
1615
neue=LeftDistance(rr,D_X);
1620
if( sign ) return (broken_M_pen=0);
1624
return(broken_M_pen=0);/* ������⮭����� ������ ���� */
1626
if( neue>=ll ) fc++;
1629
if( neue>=old ) incr++;
1632
dest = neue - dest; /* ᪠箪 ����⮭���� ������ ���� */
1635
return(broken_M_pen= ((dest>left_lim ||
1636
(dest>left_lim-2&&left_lim>5||dest==left_lim&&left_lim>4)&&incr>dy/2)
1637
&& fc<3 && maxd>3) );
1641
Int16 Num2Interval(Word8 *r,Int16 D_X,Int16 dx,Int16 dy)
1646
if( (p=NumHorizInterval(r-D_X*i,d))==1 &&
1647
(n2=SumBits(r-D_X*i,d))>dx-2 )
1649
for(n2=i=0;i<dy; i++, r+=D_X )
1651
p=NumHorizInterval(r,d);
1652
/* NumHorizInterval : number of intervals in line */
1657
/* DiskrRight : check left hole */
1658
Int16 DiskrRight(Word8 *RASTR,Int16 D_X,Int16 dx,Int16 dy,Int16 L)
1660
Int16 sum,p,x,dl,Ly,i,p_old,curr_sum,h;
1661
Int16 minr,maxr,ddy;
1662
Word8 *RASTER=RASTR+D_X*(dy>>2),*R;
1663
if( right_dist[L]>=0 )
1664
return( right_dist[L] );
1670
dl=(((dx+7)>>3)<<3);
1671
ddy = dy>30 ? (dy>>3):(dy>>2);
1672
MinMaxRight(RASTER,D_X,(Word8)dx,(Word8)Ly,&minr,&maxr);
1674
if( maxr-((dx&7)?(8-(dx&7)):0)>(dx>>1) )
1676
right_max = maxr-minr;
1678
return( (right_dist[L]=1) );
1680
right_dist[L] = ( x>=L );
1681
if( right_dist[L] ) /* big hole */
1685
while( VertSum(R,D_X,h,(Int16)(dl-minr))<ddy && minr<maxr)minr++;
1686
for(p_old=-1,sum=curr_sum=0,i=minr ; i<=maxr ; i++ )
1688
p = NumVertInterval(R, D_X, h, (Int16)(dl-i));
1690
{ /* ��begin 2-intervals�series of columns */
1693
else curr_sum++; /* ��account width of hole */
1694
if( curr_sum>L )break;
1697
{ /* end 2-intervals�series of columns */
1704
if( sum==0 && curr_sum )
1706
right_dist[L]=( sum>=L); /* hole */
1711
right_max = maxr-minr;
1712
return( right_dist[L] );
1716
static Int16 DiskrSymSh( Word8 *RASTER, Int16 Wx, Word8 NWIDTH, Word8 NLENGTH)
1719
Word8 c,w,minw=255,maxw=0;
1721
FOOT_A(RASTER,Wx,NWIDTH,NLENGTH); /* projection to horiz axes */
1724
for(i=0;i<NWIDTH;i++)
1725
BUFFER[i] = (BUFFER[i]>=d); /* binarazing */
1727
for(old=l=k=i=0;i<=NWIDTH;i++)
1729
c = (i<NWIDTH) ? BUFFER[i] : 0;
1733
l=i; /* black : ��begin of foot */
1735
{ /* white : end of foot */
1739
LOCAL_W[k]=w; /* width of foot */
1740
LOCAL[k]=(l+i); /* center+1/2. Accuracy 1/2 pixel� */
1747
if ( k != 3 || maxw-minw>1 )
1748
return(0); // enigmatic image
1749
i=LOCAL[2]+LOCAL[0]-(LOCAL[1]<<1); //�assimetry
1753
if( i<3 && NWIDTH>22 ) i=1; //Oleg:02-13-96: too small for wide image
1754
i=(i<<6)/(32+NWIDTH);
1760
static Int16 DiskrSh(Word8 *RASTR,Int16 D_X,Int16 dx,Int16 Ly)
1762
Word8 *RASTER=RASTR;
1763
Int16 i,num,n2,p,ddx;
1765
for(n2=num=i=0;i<Ly; i++, RASTER+=D_X )
1767
p=NumHorizInterval(RASTER,ddx);
1768
/* NumHorizInterval : number of intervals in line */
1774
{ /* 2-interval lines are exist */
1775
Int16 b=(LOCAL[0]+LOCAL[1])/2,dd=(LOCAL[1]-LOCAL[0])+(LOCAL_W[1]+LOCAL_W[0])/2;
1779
for(RASTER=RASTR+D_X*i;i<Ly;i++, RASTER+=D_X)
1781
p = SumIntervalBits(RASTER,b,dx)/3;
1782
if( p>=dd && NumHorizInterval(RASTER,ddx)==2 )
1786
return( num>2?num-2:0 );
1789
/* for letters III */
1790
static Int16 DiskrSh0(Word8 *RASTR,Int16 D_X,Int16 dx,Int16 dy,Int16 dx0)
1792
Word8 *RASTER=RASTR+D_X*(dy-(dy>>2));
1793
Int16 i,num,l=dx0-(dx0>>2);
1794
if( lower_long_line<0 )
1797
for(num=0,i=dy-(dy>>2);i<dy; i++, RASTER+=D_X )
1798
num += ( NumHorizInterval(RASTER,dx)==1 && SumBits(RASTER, dx)>l );
1799
/* num : number of lines haved one long interval */
1800
lower_long_line=num; /* number of filled lines */
1802
return( lower_long_line );
1805
/* DiskrLeft : check left hole */
1806
Int16 DiskrLeft(Word8 *RASTR,Int16 D_X,Int16 dx,Int16 dy, Int16 L)
1808
Int16 sum,p,x,i,Ly,p_old,curr_sum,h;
1810
Word8 *RASTER=RASTR+D_X*(dy>>2),*R;
1811
if( left_dist[L]>=0 )
1812
return( left_dist[L] );
1817
MinMaxLeft(RASTER,D_X,(Word8)dx,(Word8)Ly,&minr,&maxr);
1825
left_max = maxr-minr;
1827
return( (left_dist[L]=1) );
1829
left_dist[L]=(x>=L);
1830
if( left_dist[L] ) /* big hole */
1834
while( VertSum(R,D_X,h,minr)<(dy>>2) && minr<maxr)minr++;
1835
for(p_old=-1,curr_sum=sum=0,i=minr ; i<=maxr ; i++ )
1837
p = NumVertInterval(R, D_X, h, i);
1839
{ /* begin 2-intervals�series of columns */
1842
else curr_sum++; /* ��account width of hole */
1843
if( curr_sum>L )break;
1846
{ /* end 2-intervals�series of columns */
1853
if( sum==0 && curr_sum )
1855
left_dist[L]=( sum>=L); /* hole */
1859
left_max = maxr-minr;
1860
return( left_dist[L] );
1863
/* DiskrLeftBig : check big left hole� */
1864
Int16 DiskrLeftBig(Word8 *RASTR,Int16 D_X,Int16 dx,Int16 dy, Int16 L)
1866
Int16 sum,p,x,i,Ly,p_old,curr_sum,h;
1868
Word8 *RASTER=RASTR+D_X,*R;
1869
if( left_dist_big[L]>=0 )
1870
return( left_dist_big[L] );
1876
MinMaxLeft(RASTER,D_X,(Word8)dx,(Word8)Ly,&minr,&maxr);
1882
left_dist_big[L]=(x>=L);
1883
if( left_dist_big[L] ) /* big hole */
1886
while( VertSum(R,D_X,h,minr)<(dy>>2) && minr<maxr)minr++;
1887
for(p_old=-1,curr_sum=sum=0,i=minr ; i<=maxr ; i++ )
1889
p = NumVertInterval(R, D_X, h, i);
1891
{ /* ��begin 2-intervals�series of columns */
1894
else curr_sum++; /* ��account width of hole */
1895
if( curr_sum>L )break;
1898
{ /* end 2-intervals�series of columns */
1905
if( sum==0 && curr_sum )
1907
left_dist_big[L]=( sum>=L); /* hole */
1910
return( left_dist_big[L] );
1913
/* DiskrRightBig : check big right hole */
1914
Int16 DiskrRightBig(Word8 *RASTR,Int16 D_X,Int16 dx,Int16 dy,Int16 L)
1916
Int16 sum,p,x,dl,Ly,i,p_old,curr_sum,h;
1918
Word8 *RASTER=RASTR+D_X,*R;
1919
if( right_dist_big[L]<0 )
1925
dl=(((dx+7)>>3)<<3);
1926
MinMaxRight(RASTER,D_X,(Word8)dx,(Word8)Ly,&minr,&maxr);
1928
right_dist_big[L] = ( x>=L );
1929
if( right_dist_big[L] ) /* big hole */
1931
if( dy<13 || VertSum(RASTR, D_X, dy, (Int16)(dl-minr))<dy-2)
1934
while( VertSum(R,D_X,h,(Int16)(dl-minr))<(dy>>2) && minr<maxr)minr++;
1935
for(p_old=-1,sum=curr_sum=0,i=minr ; i<=maxr ; i++ )
1937
p = NumVertInterval(R, D_X, h, (Int16)(dl-i));
1939
{ /* begin 2-intervals�series of columns */
1942
else curr_sum++; /* account width of hole */
1950
{ /* end 2-intervals�series of columns */
1957
if( sum==0 && curr_sum )
1959
right_dist_big[L]=( sum>=L); /* hole */
1961
else right_dist_big[L]=0; /* no hole - vert line */
1964
} /* calc right_dist */
1965
return( right_dist_big[L] );
1968
/* for letters >|< */
1969
static Int16 DiskrJ0(Word8 *RASTR,Int16 D_X,Int16 dx,Int16 Ly,Int16 lim)
1971
Word8 *RASTER=RASTR;
1972
Int16 i,three,n,all,ret,one;
1975
for(one=all=three=i=0;i<Ly; i++, RASTER+=D_X )
1977
n = NumHorizInterval(RASTER,dx);
1978
/* NumHorizInterval : number of intervals in line */
1986
ret = (three<lim)?lim-three:0 ;
1987
if( all==Ly && lim>3 ) /* on middle */
1995
ret = (all<lim)?lim-all:0 ;
1997
if( lim<=3 && ret && one+all>Ly-3 )
2002
static Int16 DiskrJ(Word8 *RASTR,Int16 D_X,Int16 dx,Int16 dy)
2004
Int16 i,t,tu,td,Ly=dy>>2,ly=dy-2*Ly,p,l=dy>>1;
2006
for(tu=i=0;i<Ly; i++, RASTR+=D_X )
2007
tu += ( NumHorizInterval(RASTR,dx)==3 );
2008
for(td=t=0;i<ly; i++, RASTR+=D_X )
2010
p = NumHorizInterval(RASTR,dx);
2017
for(;i<dy; i++, RASTR+=D_X )
2018
td += ( NumHorizInterval(RASTR,dx)==3 );
2019
/* NumHorizInterval : number of intervlas in line */
2021
tu>3 && t>=2 && td>3 ||
2022
tu>1 && t>2 && td>1 && tu+td>3
2026
//***************************************************************************
2027
//* return 1 if stick glued to rusian D, otherwise 0 *
2028
//***************************************************************************
2029
static Int16 DiskrTsh(Word8 *RASTR,Int16 D_X,Int16 dx,Int16 dy,Int16 Dx)
2030
{ Word8 j,n4=dy>>2,bool_foot=1;
2031
Word8 bit0,bit1,bit2;
2035
//**************** check existance two hooks ******************
2038
for (RAST=RASTR+(dy-3)*D_X,i=dy-3;;i--,RAST-=D_X){
2039
j=SumIntervalBits( RAST,(Int16)0,(Int16)dx )/3 ;
2040
if( (j > 5*D_X) || (i<2*n4) ) break;
2041
j=(Word8)NumHorizInterval( RAST, D_X );
2042
if( j > 1 ) fine+=20;
2044
if( fine < 30 ){ return ( 0 ); }
2046
//**************** foots configuration ******************
2052
//************ check gluing in upper left angle gluing *************
2055
for (RAST=RASTR,i=0;i<n4;i++,RAST+=D_X){
2056
j=SumIntervalBits(RAST,(Int16)bit0,(Int16)bit1)/3;
2057
if( j > 3*(bit1-bit0)/5 ) fine+=20;
2058
if( j == (bit1-bit0) ) goto end;
2060
if( fine < 40 ) { goto bbb;}//* breaking
2062
//****************** make histogramm ********************************
2064
FOOT_A(RASTR, D_X, (Word8)Dx, (Word8)n4); bool_foot=0;
2066
for(i=bit0+1;i<bit1+1;i++){
2067
if(BUFFER[i]==0) goto bbb;//* breaking
2071
//************ check gluing on upper right angle ************
2074
for (RAST=RASTR,i=0;i<n4;i++,RAST+=D_X){
2075
j=SumIntervalBits(RAST,(Int16)bit1,(Int16)bit2)/3;
2076
if( j > 3*(bit2-bit1)/5 ) fine+=20;
2077
if( j == (bit2-bit1) ) { return(1); }
2079
if( fine < 40 ) goto end;// breaking
2081
//****************** make histogramm ********************************
2083
if( bool_foot ) FOOT_A(RASTR, D_X, (Word8)Dx, (Word8)n4);
2084
for(i=bit1+1;i<bit2+1;i++){
2085
if(BUFFER[i]==0) goto end; // breaking
2087
return( 1 );// gluing
2094
static Int16 average_br_angle(Word8 *RASTER, Int16 D_X, Int16 dx, Int16 dy,
2098
av_br=average_angle(RASTER+D_X*(dy-(dy>>2)),
2099
D_X,dx,(Int16)(dy>>2),RightDistance,t);
2103
static Int16 average_angle(Word8 *RASTER, Int16 D_X, Int16 dx, Int16 dy,
2104
Int16 (*Distance)(Word8 *, Int16), Int16 t)
2108
{ /* cut long lines for finding corners */
2109
while( SumBits(RASTER,(Int16)(bytlen(dx)))>(dx>>1) && i<dy )
2112
RASTER+=D_X; /* black strings */
2115
for(H=n=0;i<dy; i++,RASTER+=D_X)
2116
if( (p=Distance(RASTER,(Int16)(bytlen(dx))))>=0 )
2119
n+=p; /* nonzero string */
2124
static Int16 DiskrJu(Word8 *RASTR,Int16 D_X,Int16 dx,Int16 Ly)
2126
Word8 *RASTER=RASTR;
2127
Int16 i,ret,r,s2,s3,n;
2130
for(n=s2=s3=i=0;i<Ly; i++, RASTER+=D_X,n++ )
2132
r = NumHorizInterval(RASTER,dx);
2136
// NumHorizInterval : � ���ࢠ��� � ��ப�
2140
if( s3<n ) ret += n - s3;
2141
if( !broken_flag && s2==0 ) ret += 2;
2145
static Int16 DiskrimM1(Word8 *RAST,Int16 D_X,Int16 dx,Int16 dy)
2147
Int16 n2,n4=dy>>2,meanBit=dx>>1; /* Oleg & Vova 09.03.94 */
2148
Int16 i,j,k,up=0,down=0,cUp=0,cDown=0;
2149
Int16 prev=0,byte=0;
2152
/* calculate mean of hole */
2153
for(r=RAST+D_X,i=0;i<n4;i++,r+=D_X){
2154
j = NumHorizInterval( r, D_X );
2156
if( ( j = NumHorizInterval( r+D_X, D_X ) ) ==2 ){
2162
byte >>= ( 7- (k % 8) );
2164
if( !byte && prev && !down ) down = k;
2165
if( byte && !prev && down ) up = k;
2168
meanBit = ( up+down+(dx>>1) )/3;
2169
/* for no wide letters */
2170
if( (up-down < 5) || (dx<dy) ) meanBit = ( up+down )/2;
2175
/* calculate heigth of hole */
2178
prev = whiteMeanBitLeft(r,D_X,meanBit);
2179
for(i=1;i<dy-1;i++,r+=D_X){
2180
j = whiteMeanBitLeft(r,D_X,meanBit);
2181
if( (j == 0) && (i > n4+1) ){ break; }
2184
if( (byte < 1) && (i > n4+2) ){
2189
if( i > dy-2 ) i = 2*dy/3;
2190
n4 = i>>1; n2 = 2*n4;
2192
/* calculate symetry of hole */
2193
down = up = byte = 0;
2195
prev = whiteMeanBitLeft(r,D_X,meanBit);
2196
for(i=1;i<=n2;i++,r+=D_X){
2197
j = whiteMeanBitLeft(r,D_X,meanBit);
2198
if( i<=n4 ){ up += j; cUp++; }
2199
else { down += j; cDown++; }
2201
if( (i>n4) && (j>dx/5) ){
2202
if( (cUp==0) || (cDown==0) ) return(0);
2203
if( up*cDown <= down*cUp ) return(4); /* bl - too wide hole */
2204
if( byte < 1 ) return(3); /* bl - too wide hole */
2207
if( (prev-j > 3) && (i>n4) ) return(5); /* bl - too big jump */
2208
if( (byte > 1+dx/8) && (i>n4) ) return( -6 ); /* M - too big angle for cursive */
2212
if( (cUp != cDown) && (cDown) ){ down *= cUp; down /= cDown; }
2213
if( down >= up ) return(5); /* bl - wide hole on the bottom */
2214
if( down < up ) return(-5); /* M - wide hole on the top */
2215
if( !cDown ) return(6); /* bl - hole is absent */
2220
static Int16 DiskrimM(Word8 *RAST,Int16 D_X,Int16 dx,Int16 dy)
2222
Int16 n2,n4=dy>>2,meanBit=dx>>1; /* Oleg & Vova 09.03.94 */
2223
Int16 i,j,k,up=0,down=0,cUp=0,cDown=0;
2224
Int16 prev=0,byte=0;
2227
/* calculate mean of hole */
2228
for(r=RAST+D_X,i=0;i<n4;i++,r+=D_X){
2229
j = NumHorizInterval( r, D_X );
2234
byte >>= ( 7- (k % 8) );
2236
if( !byte && prev && !down ) down = k;
2237
if( byte && !prev && down ) up = k;
2240
meanBit = ( up+down+(dx>>1) )/3;
2241
/* for no wide letters */
2242
if( (up-down < 5) || (dx<dy) ) meanBit = ( up+down )/2;
2246
if( down==0 && up==0 ) return(2); /* M - hole is absent */
2248
/* calculate heigth of hole */
2251
prev = whiteMeanBitLeft(r,D_X,meanBit) +
2252
whiteMeanBitRight(r,D_X,dx,meanBit);
2253
for(i=1;i<dy-1;i++,r+=D_X){
2254
j = whiteMeanBitLeft(r,D_X,meanBit) +
2255
whiteMeanBitRight(r,D_X,dx,meanBit);
2256
if( (j == 0) && (i > n4+1) ){ break; }
2259
if( (byte < 2) && (i > n4+2) ){
2264
if( i > dy-2 ) i = 2*dy/3;
2265
n4 = i>>1; n2 = 2*n4;
2266
/* calculate symetry of hole */
2267
down = up = byte = 0;
2269
prev = whiteMeanBitLeft(r,D_X,meanBit) +
2270
whiteMeanBitRight(r,D_X,dx,meanBit);
2271
for(i=1;i<=n2;i++,r+=D_X){
2272
j = whiteMeanBitLeft(r,D_X,meanBit) +
2273
whiteMeanBitRight(r,D_X,dx,meanBit);
2274
if( i<=n4 ){ up += j; cUp++; }
2275
else { down += j; cDown++; }
2277
if( (i>n4) && (j>dx/3) ){
2278
if( (cUp==0) || (cDown==0) ) return(0);
2279
if( up*cDown <= down*cUp ) return(4); /* bl - too wide hole */
2280
if( byte < 3 ) return(3); /* bl - too wide hole */
2283
if( (prev-j > 3) && (i>n4) ) return(5); /* bl - too big jump */
2284
if( (byte >= dx/4) && (i>n4) ) return( -6 ); /* M - too big angle for cursive */
2288
if( (cUp != cDown) && (cDown) ){ down *= cUp; down /= cDown; }
2289
if( down >= up ) return(5); /* bl - wide hole on the bottom */
2290
if( down < up ) return(-5); /* M - wide hole on the top */
2291
if( !cDown ) return(6); /* bl - hole is absent */
2297
static Int16 whiteMeanBitLeft(Word8 *RAST,Int16 D_X,Int16 meanBit)
2299
Int16 meanByte, byte;
2302
for(i=meanBit;i>=0;i--){
2304
byte = *(RAST+meanByte);
2305
byte >>= ( 7- (i % 8) );
2308
meanByte = (i-1)>>3;
2309
byte = *(RAST+meanByte);
2310
byte >>= ( 7- ((i-1) % 8) );
2315
byte = *(RAST+D_X+meanByte);
2316
byte >>= ( 7- (i % 8) );
2321
byte = *(RAST-D_X+meanByte);
2322
byte >>= ( 7- (i % 8) );
2333
} /* whiteMeanBitLeft */
2335
static Int16 whiteMeanBitRight(Word8 *RAST,Int16 D_X,Int16 dx,Int16 meanBit)
2337
Int16 meanByte, byte;
2340
for(i=meanBit+1;i<dx;i++){
2342
byte = *(RAST+meanByte);
2343
byte >>= ( 7- (i % 8) );
2346
meanByte = (i+1)>>3;
2347
byte = *(RAST+meanByte);
2348
byte >>= ( 7- ((i+1) % 8) );
2353
byte = *(RAST+D_X+meanByte);
2354
byte >>= ( 7- (i % 8) );
2359
byte = *(RAST-D_X+meanByte);
2360
byte >>= ( 7- (i % 8) );
2371
} /* whiteMeanBitRight */
2373
// check gluing roof and down zone for russian capital & small II
2374
Int16 up_down_zones(Word8 *raster, Int16 D_X, Int16 dx, Int16 dx0,
2375
Int16 start1, Int16 stop1,
2376
Int16 start2, Int16 stop2)
2378
Int16 i,num1,num2,l=dx0-(dx0>>3);
2380
if( up_down_serif>=0 )
2381
return( up_down_serif );
2385
for(r=raster+start1*D_X,num1=0,i=start1;i<stop1;i++,r+=D_X)
2387
num1 += ( NumHorizInterval(r,dx)==1 && SumBits(r, dx)>=l );
2388
/* num1 : � ��ப � ����� ������ ���ࢠ��� �� ���� */
2391
for(r=raster+start2*D_X,num2=0,i=start2;i<stop2;i++,r+=D_X)
2393
num2 += ( NumHorizInterval(r,dx)==1 && SumBits(r, dx)>=l );
2394
/* num2 : � ��ப � ����� ������ ���ࢠ��� ����� */
2397
if( num1==0 && num2>=1 ) /* ������ ���� �����, � ���� ࠧ�ࢠ�� */
2398
return( (up_down_serif=2) );
2399
if( num1==0 && num2==0 ) /* ��� ����� */
2400
return( (up_down_serif=1) );
2402
return( (up_down_serif=0) );
2405
/* for letters 'C','c','e' */
2406
static Int16 DiskrVertCE(Word8 *RASTR,Int16 D_X,Int16 dx,Int16 dy,Int16 X,
2407
Word8 let, Word8 inc)
2409
Word8 *RASTER=RASTR;
2410
Int16 i,p,n,s3,d=dx>>2,wid=bytlen(dx);
2412
Word8 *r=RASTR+ody*D_X;
2413
Int16 t1,t2,t3,num1,num2,num3,minnum,n2;
2414
Int16 l = dy -(ody<<1),num,z=dx-(dx>>3);
2420
/* ��ਧ��⠫�� ��������� */
2421
for(minnum=dx,n2=num=num1=num2=num3=0,i=ody;i<l; i++, r+=D_X )
2423
t1=NumHorizInterval(r,wid);
2428
t3 = (wid<<3) - LeftDistance(r,wid) -
2429
RightDistance(r,wid) - t2;
2439
num += (t1==1 && t2>=z);
2440
num1 += (t1==1 && t2>=z-1);
2443
/* num : � ��ப � ����� ������ ���ࢠ��� */
2444
if( num>1 || num1>2 || num2>3 || num3>1 )
2445
{ /* ���� �����뢭�� ��४������ */
2446
c_or_e = 1; /* ��� ����� ������� ��ப */
2449
if( num3 ) d_c += (minnum==1?4:3);
2450
return( (let==(Word8)'�')?d_e:d_c );
2452
if( num==0 && num1==0 && num2==0 && dy<24 )
2453
{ /* ��� ���� ����⨢ ���� �ࠢ��� ண� */
2456
for(i=ody;i<l; i++, r+=D_X )
2458
num1=SumIntervalBits(r,t2,dx);
2460
if( i>ody && num!=0 && num1==0 )
2466
for(t3=t2=0;t2<7;t2++,i++,r+=D_X)
2468
nn[t2]=EndBlackInterval(r,wid);
2469
t3+=(NumHorizInterval(r,wid)==2);
2471
for(t1=t2=nn[0],num=0,num1=1;num1<7;num1++)
2473
if( t1>nn[num1] && nn[num1]>=0 )
2477
if( t2==nn[num1] && num==0 )
2480
for(num1=num-1;num1>=0;num1--)
2483
for(num2=num+1;num2<7;num2++)
2486
if( inc && t2-t1<3 )
2487
t2=t1; // Oleg : ERECTION conditions : 09-08-95 09:47pm
2488
if( t3>2 && t2>t1 && num1>=0 && num2<7 )
2490
c_or_e = 1; /* ��� ����� ������� ��ப */
2493
if( (let==(Word8)'�') )
2497
/* ����� ���⨪���� ��������� */
2501
for(n=s3=0,i=d;i<dx; i++)
2503
p = NumVertInterval(RASTER, D_X, dy, (Int16)(i+X));
2505
if( p==3 || p==2 )n++;
2507
/* NumVertInterval : � ����� � �⮫�� */
2514
d_e = (s3<p)?p-s3:0;
2515
if( s3==0 && d_e<3 )
2517
d_c = MAX(d_c,(s3>n)?s3-n+1:0);
2519
return( (let==(Word8)'�')?d_e:d_c );
2523
Int16 AngleBottomRight(Word8 *raster,Int16 D_X,Int16 hei)
2528
raster += D_X * (hei-2);
2531
old=RightDistance(raster,D_X);
2532
for(inc=0,r=raster-D_X,i=1;i<hei;i++,r-=D_X)
2534
neue = RightDistance(r,D_X);
2535
if( neue<old ) inc++;
2536
if( neue>old ) break;
2542
Int16 AngleTopRight(Word8 *raster,Int16 D_X,Int16 hei)
2550
old=RightDistance(raster,D_X);
2551
for(inc=0,r=raster+D_X,i=1;i<hei;i++,r+=D_X)
2553
neue = RightDistance(r,D_X);
2554
if( neue<old ) inc++;
2555
if( neue>old ) break;
2561
Int16 BonusAnglesCurve(Word8 *raster,Int16 D_X,Int16 hei)
2565
inc = AngleTopRight(raster,D_X,hei);
2566
if( inc>3 || hei<23 && inc>2 ) pen++;
2568
inc = AngleBottomRight(raster,D_X,hei);
2569
if( inc>3 || hei<23 && inc>2 ) pen++;
2574
Bool32 DiskrJuCut(Int16 nfoot, Int16 dx)
2579
for(i=0;i<nfoot;i++)
2580
if( LOCAL[i]>l && LOCAL_W[i]>d )
2585
DIF_FUNC(Int16) DIF_GetNoCutPoint(Word8 *RASTER, Int16 Wx, Word8 NWIDTH, Word8 NLENGTH)
2587
Int16 f=FOOT_HEI( RASTER, Wx, NWIDTH, NLENGTH);
2588
if( f!=2 || f==2 && (LOCAL[0]-(LOCAL_W[0]+1)/2)>(LOCAL_W[0]+1)/2 )
2590
return LOCAL[1]+(LOCAL_W[1]+1)/2;