|
tesseract 3.04.01
|
#include <fontinfo.h>
Public Member Functions | |
| FontInfo () | |
| ~FontInfo () | |
| bool | Serialize (FILE *fp) const |
| bool | DeSerialize (bool swap, FILE *fp) |
| void | init_spacing (int unicharset_size) |
| void | add_spacing (UNICHAR_ID uch_id, FontSpacingInfo *spacing_info) |
| const FontSpacingInfo * | get_spacing (UNICHAR_ID uch_id) const |
| bool | get_spacing (UNICHAR_ID prev_uch_id, UNICHAR_ID uch_id, int *spacing) const |
| bool | is_italic () const |
| bool | is_bold () const |
| bool | is_fixed_pitch () const |
| bool | is_serif () const |
| bool | is_fraktur () const |
Public Attributes | |
| char * | name |
| uinT32 | properties |
| inT32 | universal_id |
| GenericVector< FontSpacingInfo * > * | spacing_vec |
Definition at line 62 of file fontinfo.h.
| tesseract::FontInfo::FontInfo | ( | ) | [inline] |
Definition at line 63 of file fontinfo.h.
: name(NULL), properties(0), universal_id(0), spacing_vec(NULL) {}
| tesseract::FontInfo::~FontInfo | ( | ) | [inline] |
Definition at line 64 of file fontinfo.h.
{}
| void tesseract::FontInfo::add_spacing | ( | UNICHAR_ID | uch_id, |
| FontSpacingInfo * | spacing_info | ||
| ) | [inline] |
Definition at line 80 of file fontinfo.h.
{
ASSERT_HOST(spacing_vec != NULL && spacing_vec->size() > uch_id);
(*spacing_vec)[uch_id] = spacing_info;
}
| bool tesseract::FontInfo::DeSerialize | ( | bool | swap, |
| FILE * | fp | ||
| ) |
Definition at line 34 of file fontinfo.cpp.
{
if (!read_info(fp, this, swap)) return false;
if (!read_spacing_info(fp, this, swap)) return false;
return true;
}
| const FontSpacingInfo* tesseract::FontInfo::get_spacing | ( | UNICHAR_ID | uch_id | ) | const [inline] |
Definition at line 86 of file fontinfo.h.
{
return (spacing_vec == NULL || spacing_vec->size() <= uch_id) ?
NULL : (*spacing_vec)[uch_id];
}
| bool tesseract::FontInfo::get_spacing | ( | UNICHAR_ID | prev_uch_id, |
| UNICHAR_ID | uch_id, | ||
| int * | spacing | ||
| ) | const [inline] |
Definition at line 93 of file fontinfo.h.
{
const FontSpacingInfo *prev_fsi = this->get_spacing(prev_uch_id);
const FontSpacingInfo *fsi = this->get_spacing(uch_id);
if (prev_fsi == NULL || fsi == NULL) return false;
int i = 0;
for (; i < prev_fsi->kerned_unichar_ids.size(); ++i) {
if (prev_fsi->kerned_unichar_ids[i] == uch_id) break;
}
if (i < prev_fsi->kerned_unichar_ids.size()) {
*spacing = prev_fsi->kerned_x_gaps[i];
} else {
*spacing = prev_fsi->x_gap_after + fsi->x_gap_before;
}
return true;
}
| void tesseract::FontInfo::init_spacing | ( | int | unicharset_size | ) | [inline] |
Definition at line 73 of file fontinfo.h.
{
spacing_vec = new GenericVector<FontSpacingInfo *>();
spacing_vec->init_to_size(unicharset_size, NULL);
}
| bool tesseract::FontInfo::is_bold | ( | ) | const [inline] |
Definition at line 112 of file fontinfo.h.
{ return (properties & 2) != 0; }
| bool tesseract::FontInfo::is_fixed_pitch | ( | ) | const [inline] |
Definition at line 113 of file fontinfo.h.
{ return (properties & 4) != 0; }
| bool tesseract::FontInfo::is_fraktur | ( | ) | const [inline] |
Definition at line 115 of file fontinfo.h.
{ return (properties & 16) != 0; }
| bool tesseract::FontInfo::is_italic | ( | ) | const [inline] |
Definition at line 111 of file fontinfo.h.
{ return properties & 1; }
| bool tesseract::FontInfo::is_serif | ( | ) | const [inline] |
Definition at line 114 of file fontinfo.h.
{ return (properties & 8) != 0; }
| bool tesseract::FontInfo::Serialize | ( | FILE * | fp | ) | const |
Definition at line 27 of file fontinfo.cpp.
{
if (!write_info(fp, *this)) return false;
if (!write_spacing_info(fp, *this)) return false;
return true;
}
Definition at line 117 of file fontinfo.h.
Definition at line 118 of file fontinfo.h.
Definition at line 125 of file fontinfo.h.
Definition at line 123 of file fontinfo.h.