2007-03-08 04:03:40 +08:00
|
|
|
/**********************************************************************
|
|
|
|
* File: ocrrow.cpp (Formerly row.c)
|
|
|
|
* Description: Code for the ROW class.
|
|
|
|
* Author: Ray Smith
|
|
|
|
* Created: Tue Oct 08 15:58:04 BST 1991
|
|
|
|
*
|
|
|
|
* (C) Copyright 1991, Hewlett-Packard Ltd.
|
|
|
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
** you may not use this file except in compliance with the License.
|
|
|
|
** You may obtain a copy of the License at
|
|
|
|
** http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
** Unless required by applicable law or agreed to in writing, software
|
|
|
|
** distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
** See the License for the specific language governing permissions and
|
|
|
|
** limitations under the License.
|
|
|
|
*
|
|
|
|
**********************************************************************/
|
|
|
|
|
2010-09-30 23:53:40 +08:00
|
|
|
#include "ocrrow.h"
|
|
|
|
#include "blobbox.h"
|
|
|
|
|
2010-05-28 20:03:45 +08:00
|
|
|
// Include automatically generated configuration file if running autoconf.
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config_auto.h"
|
|
|
|
#endif
|
|
|
|
|
2010-11-30 08:56:39 +08:00
|
|
|
ELISTIZE (ROW)
|
2007-03-08 04:03:40 +08:00
|
|
|
/**********************************************************************
|
|
|
|
* ROW::ROW
|
|
|
|
*
|
|
|
|
* Constructor to build a ROW. Only the stats stuff are given here.
|
|
|
|
* The words are added directly.
|
|
|
|
**********************************************************************/
|
|
|
|
ROW::ROW ( //constructor
|
Use POSIX data types and macros (#878)
* api: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccmain: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccstruct: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* classify: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* cutil: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* dict: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* textord: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* training: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* wordrec: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccutil: Replace Tesseract data types by POSIX data types
Now all Tesseract data types which are no longer needed can be removed
from ccutil/host.h.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccmain: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccstruct: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* classify: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* dict: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* lstm: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* textord: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* wordrec: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccutil: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Remove the macros which are now unused from ccutil/host.h.
Remove also the obsolete history comments.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* Fix build error caused by ambiguous ClipToRange
Error message vom Appveyor CI:
C:\projects\tesseract\ccstruct\coutln.cpp(818): error C2672: 'ClipToRange': no matching overloaded function found [C:\projects\tesseract\build\libtesseract.vcxproj]
C:\projects\tesseract\ccstruct\coutln.cpp(818): error C2782: 'T ClipToRange(const T &,const T &,const T &)': template parameter 'T' is ambiguous [C:\projects\tesseract\build\libtesseract.vcxproj]
c:\projects\tesseract\ccutil\helpers.h(122): note: see declaration of 'ClipToRange'
C:\projects\tesseract\ccstruct\coutln.cpp(818): note: could be 'char'
C:\projects\tesseract\ccstruct\coutln.cpp(818): note: or 'int'
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* unittest: Replace Tesseract's MAX_INT8 by POSIX INT8_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* arch: Replace Tesseract's MAX_INT8 by POSIX INT8_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-03-14 04:36:30 +08:00
|
|
|
int32_t spline_size, //no of segments
|
|
|
|
int32_t * xstarts, //segment boundaries
|
2007-03-08 04:03:40 +08:00
|
|
|
double *coeffs, //coefficients
|
|
|
|
float x_height, //line height
|
|
|
|
float ascenders, //ascender size
|
|
|
|
float descenders, //descender drop
|
Use POSIX data types and macros (#878)
* api: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccmain: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccstruct: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* classify: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* cutil: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* dict: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* textord: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* training: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* wordrec: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccutil: Replace Tesseract data types by POSIX data types
Now all Tesseract data types which are no longer needed can be removed
from ccutil/host.h.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccmain: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccstruct: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* classify: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* dict: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* lstm: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* textord: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* wordrec: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccutil: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Remove the macros which are now unused from ccutil/host.h.
Remove also the obsolete history comments.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* Fix build error caused by ambiguous ClipToRange
Error message vom Appveyor CI:
C:\projects\tesseract\ccstruct\coutln.cpp(818): error C2672: 'ClipToRange': no matching overloaded function found [C:\projects\tesseract\build\libtesseract.vcxproj]
C:\projects\tesseract\ccstruct\coutln.cpp(818): error C2782: 'T ClipToRange(const T &,const T &,const T &)': template parameter 'T' is ambiguous [C:\projects\tesseract\build\libtesseract.vcxproj]
c:\projects\tesseract\ccutil\helpers.h(122): note: see declaration of 'ClipToRange'
C:\projects\tesseract\ccstruct\coutln.cpp(818): note: could be 'char'
C:\projects\tesseract\ccstruct\coutln.cpp(818): note: or 'int'
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* unittest: Replace Tesseract's MAX_INT8 by POSIX INT8_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* arch: Replace Tesseract's MAX_INT8 by POSIX INT8_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-03-14 04:36:30 +08:00
|
|
|
int16_t kern, //char gap
|
|
|
|
int16_t space //word gap
|
2012-02-02 11:06:39 +08:00
|
|
|
)
|
|
|
|
: baseline(spline_size, xstarts, coeffs),
|
|
|
|
para_(NULL) {
|
2007-03-08 04:03:40 +08:00
|
|
|
kerning = kern; //just store stuff
|
|
|
|
spacing = space;
|
|
|
|
xheight = x_height;
|
|
|
|
ascrise = ascenders;
|
2012-02-02 11:06:39 +08:00
|
|
|
bodysize = 0.0f;
|
2007-03-08 04:03:40 +08:00
|
|
|
descdrop = descenders;
|
2012-02-02 11:06:39 +08:00
|
|
|
has_drop_cap_ = false;
|
|
|
|
lmargin_ = 0;
|
|
|
|
rmargin_ = 0;
|
2007-03-08 04:03:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* ROW::ROW
|
|
|
|
*
|
|
|
|
* Constructor to build a ROW. Only the stats stuff are given here.
|
|
|
|
* The words are added directly.
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
|
|
ROW::ROW( //constructor
|
|
|
|
TO_ROW *to_row, //source row
|
Use POSIX data types and macros (#878)
* api: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccmain: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccstruct: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* classify: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* cutil: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* dict: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* textord: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* training: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* wordrec: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccutil: Replace Tesseract data types by POSIX data types
Now all Tesseract data types which are no longer needed can be removed
from ccutil/host.h.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccmain: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccstruct: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* classify: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* dict: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* lstm: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* textord: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* wordrec: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccutil: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Remove the macros which are now unused from ccutil/host.h.
Remove also the obsolete history comments.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* Fix build error caused by ambiguous ClipToRange
Error message vom Appveyor CI:
C:\projects\tesseract\ccstruct\coutln.cpp(818): error C2672: 'ClipToRange': no matching overloaded function found [C:\projects\tesseract\build\libtesseract.vcxproj]
C:\projects\tesseract\ccstruct\coutln.cpp(818): error C2782: 'T ClipToRange(const T &,const T &,const T &)': template parameter 'T' is ambiguous [C:\projects\tesseract\build\libtesseract.vcxproj]
c:\projects\tesseract\ccutil\helpers.h(122): note: see declaration of 'ClipToRange'
C:\projects\tesseract\ccstruct\coutln.cpp(818): note: could be 'char'
C:\projects\tesseract\ccstruct\coutln.cpp(818): note: or 'int'
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* unittest: Replace Tesseract's MAX_INT8 by POSIX INT8_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* arch: Replace Tesseract's MAX_INT8 by POSIX INT8_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-03-14 04:36:30 +08:00
|
|
|
int16_t kern, //char gap
|
|
|
|
int16_t space //word gap
|
2012-02-02 11:06:39 +08:00
|
|
|
) : para_(NULL) {
|
2007-03-08 04:03:40 +08:00
|
|
|
kerning = kern; //just store stuff
|
|
|
|
spacing = space;
|
|
|
|
xheight = to_row->xheight;
|
2012-02-02 11:06:39 +08:00
|
|
|
bodysize = to_row->body_size;
|
2007-03-08 04:03:40 +08:00
|
|
|
ascrise = to_row->ascrise;
|
|
|
|
descdrop = to_row->descdrop;
|
|
|
|
baseline = to_row->baseline;
|
2012-02-02 11:06:39 +08:00
|
|
|
has_drop_cap_ = false;
|
|
|
|
lmargin_ = 0;
|
|
|
|
rmargin_ = 0;
|
2007-03-08 04:03:40 +08:00
|
|
|
}
|
|
|
|
|
2015-05-13 07:47:02 +08:00
|
|
|
// Returns the bounding box including the desired combination of upper and
|
|
|
|
// lower noise/diacritic elements.
|
|
|
|
TBOX ROW::restricted_bounding_box(bool upper_dots, bool lower_dots) const {
|
|
|
|
TBOX box;
|
|
|
|
// This is a read-only iteration of the words in the row.
|
|
|
|
WERD_IT it(const_cast<WERD_LIST *>(&words));
|
|
|
|
for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
|
|
|
|
box += it.data()->restricted_bounding_box(upper_dots, lower_dots);
|
|
|
|
}
|
|
|
|
return box;
|
|
|
|
}
|
2007-03-08 04:03:40 +08:00
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* ROW::recalc_bounding_box
|
|
|
|
*
|
|
|
|
* Set the bounding box correctly
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
|
|
void ROW::recalc_bounding_box() { //recalculate BB
|
|
|
|
WERD *word; //current word
|
|
|
|
WERD_IT it = &words; //words of ROW
|
Use POSIX data types and macros (#878)
* api: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccmain: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccstruct: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* classify: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* cutil: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* dict: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* textord: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* training: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* wordrec: Replace Tesseract data types by POSIX data types
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccutil: Replace Tesseract data types by POSIX data types
Now all Tesseract data types which are no longer needed can be removed
from ccutil/host.h.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccmain: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccstruct: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* classify: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* dict: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* lstm: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* textord: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* wordrec: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* ccutil: Replace Tesseract's MIN_*INT, MAX_*INT* by POSIX *INT*_MIN, *INT*_MAX
Remove the macros which are now unused from ccutil/host.h.
Remove also the obsolete history comments.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* Fix build error caused by ambiguous ClipToRange
Error message vom Appveyor CI:
C:\projects\tesseract\ccstruct\coutln.cpp(818): error C2672: 'ClipToRange': no matching overloaded function found [C:\projects\tesseract\build\libtesseract.vcxproj]
C:\projects\tesseract\ccstruct\coutln.cpp(818): error C2782: 'T ClipToRange(const T &,const T &,const T &)': template parameter 'T' is ambiguous [C:\projects\tesseract\build\libtesseract.vcxproj]
c:\projects\tesseract\ccutil\helpers.h(122): note: see declaration of 'ClipToRange'
C:\projects\tesseract\ccstruct\coutln.cpp(818): note: could be 'char'
C:\projects\tesseract\ccstruct\coutln.cpp(818): note: or 'int'
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* unittest: Replace Tesseract's MAX_INT8 by POSIX INT8_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* arch: Replace Tesseract's MAX_INT8 by POSIX INT8_MAX
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-03-14 04:36:30 +08:00
|
|
|
int16_t left; //of word
|
|
|
|
int16_t prev_left; //old left
|
2007-03-08 04:03:40 +08:00
|
|
|
|
|
|
|
if (!it.empty ()) {
|
|
|
|
word = it.data ();
|
|
|
|
prev_left = word->bounding_box ().left ();
|
|
|
|
it.forward ();
|
|
|
|
while (!it.at_first ()) {
|
|
|
|
word = it.data ();
|
|
|
|
left = word->bounding_box ().left ();
|
|
|
|
if (left < prev_left) {
|
|
|
|
it.move_to_first ();
|
|
|
|
//words in BB order
|
|
|
|
it.sort (word_comparator);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
prev_left = left;
|
|
|
|
it.forward ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ()) {
|
|
|
|
word = it.data ();
|
|
|
|
if (it.at_first ())
|
|
|
|
word->set_flag (W_BOL, TRUE);
|
|
|
|
else
|
|
|
|
//not start of line
|
|
|
|
word->set_flag (W_BOL, FALSE);
|
|
|
|
if (it.at_last ())
|
|
|
|
word->set_flag (W_EOL, TRUE);
|
|
|
|
else
|
|
|
|
//not end of line
|
|
|
|
word->set_flag (W_EOL, FALSE);
|
|
|
|
//extend BB as reqd
|
|
|
|
bound_box += word->bounding_box ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* ROW::move
|
|
|
|
*
|
|
|
|
* Reposition row by vector
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
|
|
void ROW::move( // reposition row
|
|
|
|
const ICOORD vec // by vector
|
|
|
|
) {
|
|
|
|
WERD_IT it(&words); // word iterator
|
|
|
|
|
|
|
|
for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ())
|
|
|
|
it.data ()->move (vec);
|
|
|
|
|
|
|
|
bound_box.move (vec);
|
|
|
|
baseline.move (vec);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* ROW::print
|
|
|
|
*
|
|
|
|
* Display members
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
|
|
void ROW::print( //print
|
|
|
|
FILE *fp //file to print on
|
|
|
|
) {
|
2012-02-02 11:06:39 +08:00
|
|
|
tprintf("Kerning= %d\n", kerning);
|
|
|
|
tprintf("Spacing= %d\n", spacing);
|
|
|
|
bound_box.print();
|
|
|
|
tprintf("Xheight= %f\n", xheight);
|
|
|
|
tprintf("Ascrise= %f\n", ascrise);
|
|
|
|
tprintf("Descdrop= %f\n", descdrop);
|
|
|
|
tprintf("has_drop_cap= %d\n", has_drop_cap_);
|
|
|
|
tprintf("lmargin= %d, rmargin= %d\n", lmargin_, rmargin_);
|
2007-03-08 04:03:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* ROW::plot
|
|
|
|
*
|
|
|
|
* Draw the ROW in the given colour.
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
|
|
#ifndef GRAPHICS_DISABLED
|
|
|
|
void ROW::plot( //draw it
|
2008-02-01 08:36:18 +08:00
|
|
|
ScrollView* window, //window to draw in
|
|
|
|
ScrollView::Color colour //colour to draw in
|
2007-03-08 04:03:40 +08:00
|
|
|
) {
|
|
|
|
WERD *word; //current word
|
|
|
|
WERD_IT it = &words; //words of ROW
|
|
|
|
|
|
|
|
for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ()) {
|
|
|
|
word = it.data ();
|
|
|
|
word->plot (window, colour); //all in one colour
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* ROW::plot
|
|
|
|
*
|
|
|
|
* Draw the ROW in rainbow colours.
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
|
|
void ROW::plot( //draw it
|
2008-02-01 08:36:18 +08:00
|
|
|
ScrollView* window //window to draw in
|
2007-03-08 04:03:40 +08:00
|
|
|
) {
|
|
|
|
WERD *word; //current word
|
|
|
|
WERD_IT it = &words; //words of ROW
|
|
|
|
|
|
|
|
for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ()) {
|
|
|
|
word = it.data ();
|
|
|
|
word->plot (window); //in rainbow colours
|
|
|
|
}
|
|
|
|
}
|
2012-09-22 08:59:31 +08:00
|
|
|
#endif // GRAPHICS_DISABLED
|
2007-03-08 04:03:40 +08:00
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* ROW::operator=
|
|
|
|
*
|
|
|
|
* Assign rows by duplicating the row structure but NOT the WERDLIST
|
|
|
|
**********************************************************************/
|
|
|
|
|
2012-02-02 11:06:39 +08:00
|
|
|
ROW & ROW::operator= (const ROW & source) {
|
2007-03-08 04:03:40 +08:00
|
|
|
this->ELIST_LINK::operator= (source);
|
|
|
|
kerning = source.kerning;
|
|
|
|
spacing = source.spacing;
|
|
|
|
xheight = source.xheight;
|
2012-02-02 11:06:39 +08:00
|
|
|
bodysize = source.bodysize;
|
2007-03-08 04:03:40 +08:00
|
|
|
ascrise = source.ascrise;
|
|
|
|
descdrop = source.descdrop;
|
|
|
|
if (!words.empty ())
|
|
|
|
words.clear ();
|
|
|
|
baseline = source.baseline; //QSPLINES must do =
|
|
|
|
bound_box = source.bound_box;
|
2012-02-02 11:06:39 +08:00
|
|
|
has_drop_cap_ = source.has_drop_cap_;
|
|
|
|
lmargin_ = source.lmargin_;
|
|
|
|
rmargin_ = source.rmargin_;
|
|
|
|
para_ = source.para_;
|
2007-03-08 04:03:40 +08:00
|
|
|
return *this;
|
|
|
|
}
|