50 return this->SerializeClasses(fp);
56 return this->DeSerializeClasses(fp);
64 for (
int f = 0; f < font_set.
size(); ++f) {
65 if (
get(font_set[f].fontinfo_id).properties ==
properties)
74 if (font_set.
empty())
return false;
75 int first_font = font_set[0].fontinfo_id;
77 for (
int f = 1; f < font_set.
size(); ++f) {
78 if (
get(font_set[f].fontinfo_id).properties !=
properties)
88 for (
int i = 0; i < other->
size(); ++i) {
90 if (spacing_vec != NULL) {
91 int target_index = get_index(other->
get(i));
92 if (target_index < 0) {
94 push_back(other->
get(i));
95 other->
get(i).name = NULL;
97 delete []
get(target_index).spacing_vec;
98 get(target_index).spacing_vec = other->
get(i).spacing_vec;
100 other->
get(i).spacing_vec = NULL;
110 for (
int i = 0; i <
size(); ++i) {
125 return strcmp(fi1.
name, fi2.
name) == 0;
131 for (
int i = 0; i < fs1.
size; ++i) {
154 if (f->
FReadEndian(&size,
sizeof(size), 1) != 1)
return false;
155 char* font_name =
new char[size + 1];
156 fi->
name = font_name;
157 if (f->
FRead(font_name,
sizeof(*font_name), size) !=
size)
return false;
158 font_name[
size] =
'\0';
166 if (fwrite(&size,
sizeof(size), 1, f) != 1)
return false;
167 if (static_cast<int>(fwrite(fi.
name,
sizeof(*fi.
name), size, f)) != size)
174 inT32 vec_size, kern_size;
175 if (f->
FReadEndian(&vec_size,
sizeof(vec_size), 1) != 1)
return false;
177 if (vec_size == 0)
return true;
179 for (
int i = 0; i < vec_size; ++i) {
183 f->
FReadEndian(&kern_size,
sizeof(kern_size), 1) != 1) {
203 if (fwrite(&vec_size,
sizeof(vec_size), 1, f) != 1)
return false;
204 inT16 x_gap_invalid = -1;
205 for (
int i = 0; i < vec_size; ++i) {
210 if (fwrite(&(x_gap_invalid),
sizeof(x_gap_invalid), 1, f) != 1 ||
211 fwrite(&(x_gap_invalid),
sizeof(x_gap_invalid), 1, f) != 1 ||
212 fwrite(&kern_size,
sizeof(kern_size), 1, f) != 1) {
218 fwrite(&kern_size,
sizeof(kern_size), 1, f) != 1) {
239 if (fwrite(&fs.
size,
sizeof(fs.
size), 1, f) != 1)
return false;
240 for (
int i = 0; i < fs.
size; ++i) {
241 if (fwrite(&fs.
configs[i],
sizeof(fs.
configs[i]), 1, f) != 1)
return false;
void MoveTo(UnicityTable< FontInfo > *target)
bool DeSerialize(bool swap, FILE *fp)
void add_spacing(UNICHAR_ID uch_id, FontSpacingInfo *spacing_info)
bool read_spacing_info(TFile *f, FontInfo *fi)
int push_back(T object)
Add an element in the table.
bool read_set(TFile *f, FontSet *fs)
_ConstTessMemberResultCallback_0_0< false, R, T1 >::base * NewPermanentTessCallback(const T1 *obj, R(T2::*member)() const)
bool write_set(FILE *f, const FontSet &fs)
GenericVector< FontSpacingInfo * > * spacing_vec
GenericVector< UNICHAR_ID > kerned_unichar_ids
int FReadEndian(void *buffer, int size, int count)
bool CompareFontInfo(const FontInfo &fi1, const FontInfo &fi2)
bool DeSerialize(TFile *fp)
void init_spacing(int unicharset_size)
bool write_info(FILE *f, const FontInfo &fi)
bool read_info(TFile *f, FontInfo *fi)
void MoveSpacingInfoFrom(FontInfoTable *other)
GenericVector< inT16 > kerned_x_gaps
bool write_spacing_info(FILE *f, const FontInfo &fi)
bool CompareFontSet(const FontSet &fs1, const FontSet &fs2)
bool Serialize(FILE *fp) const
bool Serialize(FILE *fp) const
void FontInfoDeleteCallback(FontInfo f)
void set_compare_callback(TessResultCallback2< bool, T const &, T const &> *cb)
bool Serialize(FILE *fp) const
void set_clear_callback(TessCallback1< T > *cb)
bool SetContainsFontProperties(int font_id, const GenericVector< ScoredFont > &font_set) const
bool SetContainsMultipleFontProperties(const GenericVector< ScoredFont > &font_set) const
void FontSetDeleteCallback(FontSet fs)
bool DeSerialize(TFile *fp)
int FRead(void *buffer, int size, int count)