35 if (!
read_info(fp,
this, swap))
return false;
63 uinT32 properties =
get(font_id).properties;
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;
76 uinT32 properties =
get(first_font).properties;
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) {
92 if (target_index < 0) {
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) {
114 get(i).spacing_vec = NULL;
125 return strcmp(fi1.
name, fi2.
name) == 0;
131 for (
int i = 0; i < fs1.
size; ++i) {
154 if (fread(&size,
sizeof(size), 1, f) != 1)
return false;
157 char* font_name =
new char[size + 1];
158 fi->
name = font_name;
159 if (static_cast<int>(fread(font_name,
sizeof(*font_name), size, f)) != size)
161 font_name[size] =
'\0';
170 if (fwrite(&size,
sizeof(size), 1, f) != 1)
return false;
171 if (static_cast<int>(fwrite(fi.
name,
sizeof(*fi.
name), size, f)) != size)
178 inT32 vec_size, kern_size;
179 if (fread(&vec_size,
sizeof(vec_size), 1, f) != 1)
return false;
182 if (vec_size == 0)
return true;
184 for (
int i = 0; i < vec_size; ++i) {
188 fread(&kern_size,
sizeof(kern_size), 1, f) != 1) {
213 if (fwrite(&vec_size,
sizeof(vec_size), 1, f) != 1)
return false;
214 inT16 x_gap_invalid = -1;
215 for (
int i = 0; i < vec_size; ++i) {
220 if (fwrite(&(x_gap_invalid),
sizeof(x_gap_invalid), 1, f) != 1 ||
221 fwrite(&(x_gap_invalid),
sizeof(x_gap_invalid), 1, f) != 1 ||
222 fwrite(&kern_size,
sizeof(kern_size), 1, f) != 1) {
228 fwrite(&kern_size,
sizeof(kern_size), 1, f) != 1) {
241 if (fread(&fs->
size,
sizeof(fs->
size), 1, f) != 1)
return false;
245 for (
int i = 0; i < fs->
size; ++i) {
246 if (fread(&fs->
configs[i],
sizeof(fs->
configs[i]), 1, f) != 1)
return false;
254 if (fwrite(&fs.
size,
sizeof(fs.
size), 1, f) != 1)
return false;
255 for (
int i = 0; i < fs.
size; ++i) {
256 if (fwrite(&fs.
configs[i],
sizeof(fs.
configs[i]), 1, f) != 1)
return false;
void init_spacing(int unicharset_size)
bool read_info(FILE *f, FontInfo *fi, bool swap)
GenericVector< UNICHAR_ID > kerned_unichar_ids
void set_clear_callback(TessCallback1< T > *cb)
_ConstTessMemberResultCallback_0_0< false, R, T1 >::base * NewPermanentTessCallback(const T1 *obj, R(T2::*member)() const)
void Reverse32(void *ptr)
void FontInfoDeleteCallback(FontInfo f)
bool Serialize(FILE *fp) const
void FontSetDeleteCallback(FontSet fs)
int get_index(FontInfo object) const
bool DeSerializeClasses(bool swap, FILE *fp)
bool Serialize(FILE *fp) const
void set_compare_callback(TessResultCallback2< bool, FontInfo const &, FontInfo const & > *cb)
void set_compare_callback(TessResultCallback2< bool, T const &, T const &> *cb)
int push_back(FontInfo object)
bool write_spacing_info(FILE *f, const FontInfo &fi)
bool write_set(FILE *f, const FontSet &fs)
void MoveSpacingInfoFrom(FontInfoTable *other)
void MoveTo(UnicityTable< FontInfo > *target)
bool CompareFontSet(const FontSet &fs1, const FontSet &fs2)
void set_clear_callback(TessCallback1< FontInfo > *cb)
GenericVector< FontSpacingInfo * > * spacing_vec
bool DeSerialize(bool swap, FILE *fp)
bool SetContainsMultipleFontProperties(const GenericVector< ScoredFont > &font_set) const
bool CompareFontInfo(const FontInfo &fi1, const FontInfo &fi2)
bool DeSerialize(bool swap, FILE *fp)
GenericVector< inT16 > kerned_x_gaps
bool SerializeClasses(FILE *fp) const
bool SetContainsFontProperties(int font_id, const GenericVector< ScoredFont > &font_set) const
bool Serialize(FILE *fp) const
bool read_spacing_info(FILE *f, FontInfo *fi, bool swap)
void ReverseN(void *ptr, int num_bytes)
int push_back(T object)
Add an element in the table.
void add_spacing(UNICHAR_ID uch_id, FontSpacingInfo *spacing_info)
bool write_info(FILE *f, const FontInfo &fi)
bool DeSerialize(bool swap, FILE *fp)
bool read_set(FILE *f, FontSet *fs, bool swap)