00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef OCRROW_H
00021 #define OCRROW_H
00022
00023 #include <stdio.h>
00024
00025 #include "quspline.h"
00026 #include "werd.h"
00027
00028 class TO_ROW;
00029
00030 class PARA;
00031
00032 class ROW:public ELIST_LINK
00033 {
00034 friend void tweak_row_baseline(ROW *, double, double);
00035 public:
00036 ROW() {
00037 }
00038 ROW(
00039 inT32 spline_size,
00040 inT32 *xstarts,
00041 double *coeffs,
00042 float x_height,
00043 float ascenders,
00044 float descenders,
00045 inT16 kern,
00046 inT16 space);
00047 ROW(
00048 TO_ROW *row,
00049 inT16 kern,
00050 inT16 space);
00051
00052 WERD_LIST *word_list() {
00053 return &words;
00054 }
00055
00056 float base_line(
00057 float xpos) const {
00058
00059 return (float) baseline.y (xpos);
00060 }
00061 float x_height() const {
00062 return xheight;
00063 }
00064 void set_x_height(float new_xheight) {
00065 xheight = new_xheight;
00066 }
00067 inT32 kern() const {
00068 return kerning;
00069 }
00070 float body_size() const {
00071 return bodysize;
00072 }
00073 void set_body_size(float new_size) {
00074 bodysize = new_size;
00075 }
00076 inT32 space() const {
00077 return spacing;
00078 }
00079 float ascenders() const {
00080 return ascrise;
00081 }
00082 float descenders() const {
00083 return descdrop;
00084 }
00085 TBOX bounding_box() const {
00086 return bound_box;
00087 }
00088
00089 void set_lmargin(inT16 lmargin) {
00090 lmargin_ = lmargin;
00091 }
00092 void set_rmargin(inT16 rmargin) {
00093 rmargin_ = rmargin;
00094 }
00095 inT16 lmargin() const {
00096 return lmargin_;
00097 }
00098 inT16 rmargin() const {
00099 return rmargin_;
00100 }
00101
00102 void set_has_drop_cap(bool has) {
00103 has_drop_cap_ = has;
00104 }
00105 bool has_drop_cap() const {
00106 return has_drop_cap_;
00107 }
00108
00109 void set_para(PARA *p) {
00110 para_ = p;
00111 }
00112 PARA *para() const {
00113 return para_;
00114 }
00115
00116 void recalc_bounding_box();
00117
00118 void move(
00119 const ICOORD vec);
00120
00121 void print(
00122 FILE *fp);
00123
00124 void plot(
00125 ScrollView* window,
00126 ScrollView::Color colour);
00127 void plot(
00128 ScrollView* window);
00129
00130 #ifndef GRAPHICS_DISABLED
00131 void plot_baseline(
00132 ScrollView* window,
00133 ScrollView::Color colour) {
00134
00135 baseline.plot (window, colour);
00136 }
00137 #endif
00138 ROW& operator= (const ROW & source);
00139
00140 private:
00141 inT32 kerning;
00142 inT32 spacing;
00143 TBOX bound_box;
00144 float xheight;
00145 float ascrise;
00146 float descdrop;
00147 float bodysize;
00148
00149 WERD_LIST words;
00150 QSPLINE baseline;
00151
00152
00153 bool has_drop_cap_;
00154 inT16 lmargin_;
00155 inT16 rmargin_;
00156
00157
00158 PARA *para_;
00159 };
00160
00161 ELISTIZEH (ROW)
00162 #endif