20 #ifndef TESSERACT_TRAINING_PANGO_FONT_INFO_H_ 21 #define TESSERACT_TRAINING_PANGO_FONT_INFO_H_ 24 #include <unordered_map> 30 #include "pango/pango-font.h" 31 #include "pango/pango.h" 32 #include "pango/pangocairo.h" 83 std::vector<std::string>* graphemes)
const;
91 int* x_bearing,
int* x_advance)
const;
100 const std::string& cache_dir);
118 bool ParseFontDescription(
const PangoFontDescription* desc);
121 PangoFont* ToPangoFont()
const;
124 std::string family_name_;
128 PangoFontDescription* desc_;
138 static std::string fonts_dir_;
141 static std::string cache_dir_;
160 static bool IsAvailableFont(
const char* font_desc, std::string* best_match);
167 static bool SelectFont(
const char* utf8_word,
const int utf8_len,
168 std::string* font_name, std::vector<std::string>* graphemes);
173 static bool SelectFont(
const char* utf8_word,
const int utf8_len,
174 const std::vector<std::string>& all_fonts,
175 std::string* font_name, std::vector<std::string>* graphemes);
182 std::vector<bool>* unichar_bitmap);
184 std::vector<bool>* unichar_bitmap);
196 const std::unordered_map<char32, int64_t>& ch_map,
197 std::vector<std::pair<
const char*, std::vector<bool> > >* font_flag);
204 static int FontScore(
const std::unordered_map<char32, int64_t>& ch_map,
205 const std::string& fontname,
int* raw_score,
206 std::vector<bool>* ch_flags);
213 static std::vector<std::string> available_fonts_;
217 #endif // TESSERACT_TRAINING_PANGO_FONT_INFO_H_
static void SoftInitFontConfig()
void set_resolution(const int resolution)
static void PangoFontTypeInfo()
std::string DescriptionName() const
const std::string & family_name() const
static bool IsAvailableFont(const char *font_desc)
bool CanRenderString(const char *utf8_word, int len, std::vector< std::string > *graphemes) const
bool GetSpacingProperties(const std::string &utf8_char, int *x_bearing, int *x_advance) const
static std::string BestFonts(const std::unordered_map< char32, int64_t > &ch_map, std::vector< std::pair< const char *, std::vector< bool > > > *font_flag)
static int FontScore(const std::unordered_map< char32, int64_t > &ch_map, const std::string &fontname, int *raw_score, std::vector< bool > *ch_flags)
static bool SelectFont(const char *utf8_word, const int utf8_len, std::string *font_name, std::vector< std::string > *graphemes)
bool CoversUTF8Text(const char *utf8_text, int byte_length) const
FontTypeEnum font_type() const
bool ParseFontDescriptionName(const std::string &name)
DECLARE_STRING_PARAM_FLAG(fonts_dir)
static void HardInitFontConfig(const std::string &fonts_dir, const std::string &cache_dir)
static void GetAllRenderableCharacters(std::vector< bool > *unichar_bitmap)
static const std::vector< std::string > & ListAvailableFonts()
int DropUncoveredChars(std::string *utf8_text) const