tesseract  3.03
tesseract::FontInfo Struct Reference

#include <fontinfo.h>

List of all members.

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 FontSpacingInfoget_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

Detailed Description

Definition at line 46 of file fontinfo.h.


Constructor & Destructor Documentation

Definition at line 47 of file fontinfo.h.

: name(NULL), properties(0), universal_id(0), spacing_vec(NULL) {}

Definition at line 48 of file fontinfo.h.

{}

Member Function Documentation

void tesseract::FontInfo::add_spacing ( UNICHAR_ID  uch_id,
FontSpacingInfo spacing_info 
) [inline]

Definition at line 64 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 70 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 77 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 57 of file fontinfo.h.

bool tesseract::FontInfo::is_bold ( ) const [inline]

Definition at line 96 of file fontinfo.h.

{ return (properties & 2) != 0; }
bool tesseract::FontInfo::is_fixed_pitch ( ) const [inline]

Definition at line 97 of file fontinfo.h.

{ return (properties & 4) != 0; }
bool tesseract::FontInfo::is_fraktur ( ) const [inline]

Definition at line 99 of file fontinfo.h.

{ return (properties & 16) != 0; }
bool tesseract::FontInfo::is_italic ( ) const [inline]

Definition at line 95 of file fontinfo.h.

{ return properties & 1; }
bool tesseract::FontInfo::is_serif ( ) const [inline]

Definition at line 98 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;
}

Member Data Documentation

Definition at line 101 of file fontinfo.h.


The documentation for this struct was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines