tesseract  3.03
tesseract::FontInfoTable Class Reference

#include <fontinfo.h>

Inheritance diagram for tesseract::FontInfoTable:
GenericVector< FontInfo >

List of all members.

Public Member Functions

 FontInfoTable ()
 ~FontInfoTable ()
bool Serialize (FILE *fp) const
bool DeSerialize (bool swap, FILE *fp)
bool SetContainsFontProperties (int font_id, const GenericVector< int > &font_set) const
bool SetContainsMultipleFontProperties (const GenericVector< int > &font_set) const
void MoveSpacingInfoFrom (FontInfoTable *other)
void MoveTo (UnicityTable< FontInfo > *target)

Detailed Description

Definition at line 130 of file fontinfo.h.


Constructor & Destructor Documentation

Definition at line 45 of file fontinfo.cpp.

                              {
}

Member Function Documentation

bool tesseract::FontInfoTable::DeSerialize ( bool  swap,
FILE *  fp 
)

Reimplemented from GenericVector< FontInfo >.

Definition at line 54 of file fontinfo.cpp.

                                                   {
  truncate(0);
  return this->DeSerializeClasses(swap, fp);
}

Definition at line 85 of file fontinfo.cpp.

                                                            {
  set_compare_callback(NewPermanentTessCallback(CompareFontInfo));
  set_clear_callback(NewPermanentTessCallback(FontInfoDeleteCallback));
  for (int i = 0; i < other->size(); ++i) {
    GenericVector<FontSpacingInfo*>* spacing_vec = other->get(i).spacing_vec;
    if (spacing_vec != NULL) {
      int target_index = get_index(other->get(i));
      if (target_index < 0) {
        // Bit copy the FontInfo and steal all the pointers.
        push_back(other->get(i));
        other->get(i).name = NULL;
      } else {
        delete [] get(target_index).spacing_vec;
        get(target_index).spacing_vec = other->get(i).spacing_vec;
      }
      other->get(i).spacing_vec = NULL;
    }
  }
}

Definition at line 106 of file fontinfo.cpp.

                                                         {
  target->clear();
  target->set_compare_callback(NewPermanentTessCallback(CompareFontInfo));
  target->set_clear_callback(NewPermanentTessCallback(FontInfoDeleteCallback));
  for (int i = 0; i < size(); ++i) {
    // Bit copy the FontInfo and steal all the pointers.
    target->push_back(get(i));
    get(i).name = NULL;
    get(i).spacing_vec = NULL;
  }
}
bool tesseract::FontInfoTable::Serialize ( FILE *  fp) const

Reimplemented from GenericVector< FontInfo >.

Definition at line 49 of file fontinfo.cpp.

                                            {
  return this->SerializeClasses(fp);
}
bool tesseract::FontInfoTable::SetContainsFontProperties ( int  font_id,
const GenericVector< int > &  font_set 
) const

Definition at line 61 of file fontinfo.cpp.

                                                           {
  uinT32 properties = get(font_id).properties;
  for (int f = 0; f < font_set.size(); ++f) {
    if (get(font_set[f]).properties == properties)
      return true;
  }
  return false;
}

Definition at line 72 of file fontinfo.cpp.

                                              {
  if (font_set.empty()) return false;
  int first_font = font_set[0];
  uinT32 properties = get(first_font).properties;
  for (int f = 1; f < font_set.size(); ++f) {
    if (get(font_set[f]).properties != properties)
      return true;
  }
  return false;
}

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