20 #ifndef TESSERACT_TRAINING_PANGO_FONT_INFO_H_
21 #define TESSERACT_TRAINING_PANGO_FONT_INFO_H_
24 #include <unordered_map>
29 #include "pango/pango-font.h"
30 #include "pango/pango.h"
31 #include "pango/pangocairo.h"
79 std::vector<std::string>* graphemes)
const;
87 int* x_bearing,
int* x_advance)
const;
96 const std::string& cache_dir);
114 bool ParseFontDescription(
const PangoFontDescription* desc);
117 PangoFont* ToPangoFont()
const;
120 std::string family_name_;
124 PangoFontDescription* desc_;
134 static std::string fonts_dir_;
137 static std::string cache_dir_;
156 static bool IsAvailableFont(
const char* font_desc, std::string* best_match);
163 static bool SelectFont(
const char* utf8_word,
const int utf8_len,
164 std::string* font_name, std::vector<std::string>* graphemes);
169 static bool SelectFont(
const char* utf8_word,
const int utf8_len,
170 const std::vector<std::string>& all_fonts,
171 std::string* font_name, std::vector<std::string>* graphemes);
178 std::vector<bool>* unichar_bitmap);
180 std::vector<bool>* unichar_bitmap);
192 const std::unordered_map<char32, int64_t>& ch_map,
193 std::vector<std::pair<
const char*, std::vector<bool> > >* font_flag);
200 static int FontScore(
const std::unordered_map<char32, int64_t>& ch_map,
201 const std::string& fontname,
int* raw_score,
202 std::vector<bool>* ch_flags);
209 static std::vector<std::string> available_fonts_;
void set_resolution(const int resolution)
int DropUncoveredChars(std::string *utf8_text) const
FontTypeEnum font_type() const
bool CoversUTF8Text(const char *utf8_text, int byte_length) const
bool ParseFontDescriptionName(const std::string &name)
std::string DescriptionName() const
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
const std::string & family_name() const
static void SoftInitFontConfig()
static void HardInitFontConfig(const std::string &fonts_dir, const std::string &cache_dir)
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 std::string BestFonts(const std::unordered_map< char32, int64_t > &ch_map, std::vector< std::pair< const char *, std::vector< bool > > > *font_flag)
static bool SelectFont(const char *utf8_word, const int utf8_len, std::string *font_name, std::vector< std::string > *graphemes)
static void GetAllRenderableCharacters(std::vector< bool > *unichar_bitmap)
static bool IsAvailableFont(const char *font_desc)
static void PangoFontTypeInfo()
static const std::vector< std::string > & ListAvailableFonts()