tesseract
5.0.0-alpha-619-ge9db
|
Go to the documentation of this file.
40 using namespace std::placeholders;
63 uint32_t 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_t 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)
86 using namespace std::placeholders;
89 for (
int i = 0; i < other->
size(); ++i) {
91 if (spacing_vec !=
nullptr) {
93 if (target_index < 0) {
96 other->
get(i).name =
nullptr;
98 delete get(target_index).spacing_vec;
99 get(target_index).spacing_vec = other->
get(i).spacing_vec;
101 other->
get(i).spacing_vec =
nullptr;
109 using namespace std::placeholders;
112 for (
int i = 0; i <
size(); ++i) {
115 get(i).name =
nullptr;
116 get(i).spacing_vec =
nullptr;
127 return strcmp(fi1.
name, fi2.
name) == 0;
133 for (
int i = 0; i < fs1.
size; ++i) {
159 char* font_name =
new char[
size + 1];
160 fi->
name = font_name;
162 font_name[
size] =
'\0';
174 int32_t vec_size, kern_size;
177 if (vec_size == 0)
return true;
179 for (
int i = 0; i < vec_size; ++i) {
191 if (kern_size > 0 && (!fs->kerned_unichar_ids.DeSerialize(f) ||
192 !fs->kerned_x_gaps.DeSerialize(f))) {
204 int16_t x_gap_invalid = -1;
205 for (
int i = 0; i < vec_size; ++i) {
void FontInfoDeleteCallback(FontInfo f)
void add_spacing(UNICHAR_ID uch_id, FontSpacingInfo *spacing_info)
GenericVector< UNICHAR_ID > kerned_unichar_ids
bool write_set(FILE *f, const FontSet &fs)
bool write_info(FILE *f, const FontInfo &fi)
bool Serialize(FILE *fp) const
bool Serialize(FILE *fp) const
bool read_spacing_info(TFile *f, FontInfo *fi)
void set_clear_callback(std::function< void(FontInfo)> cb)
bool write_spacing_info(FILE *f, const FontInfo &fi)
int push_back(T object)
Add an element in the table.
GenericVector< FontSpacingInfo * > * spacing_vec
bool DeSerializeClasses(bool swap, FILE *fp)
bool SetContainsMultipleFontProperties(const GenericVector< ScoredFont > &font_set) const
int push_back(FontInfo object)
bool SerializeClasses(FILE *fp) const
void set_compare_callback(std::function< bool(const T &, const T &)> cb)
void set_compare_callback(std::function< bool(const FontInfo &, const FontInfo &)> cb)
bool DeSerialize(char *data, size_t count=1)
GenericVector< int16_t > kerned_x_gaps
void FontSetDeleteCallback(FontSet fs)
void MoveTo(UnicityTable< FontInfo > *target)
int get_index(const FontInfo &object) const
bool SetContainsFontProperties(int font_id, const GenericVector< ScoredFont > &font_set) const
bool CompareFontSet(const FontSet &fs1, const FontSet &fs2)
void init_spacing(int unicharset_size)
bool DeSerialize(TFile *fp)
bool read_info(TFile *f, FontInfo *fi)
bool DeSerialize(TFile *fp)
void set_clear_callback(std::function< void(T)> cb)
FontInfo & get(int index) const
bool CompareFontInfo(const FontInfo &fi1, const FontInfo &fi2)
void MoveSpacingInfoFrom(FontInfoTable *other)
bool Serialize(FILE *fp) const
bool Serialize(FILE *fp, const char *data, size_t n=1)
bool read_set(TFile *f, FontSet *fs)