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<string>* graphemes)
const;
91 int* x_bearing,
int* x_advance)
const;
100 const string& cache_dir);
123 bool ParseFontDescription(
const PangoFontDescription* desc);
126 PangoFont* ToPangoFont()
const;
138 PangoFontDescription* desc_;
148 static string fonts_dir_;
151 static string cache_dir_;
165 return IsAvailableFont(font_desc,
nullptr);
170 static bool IsAvailableFont(
const char* font_desc,
string* best_match);
172 static const std::vector<string>& ListAvailableFonts();
177 static bool SelectFont(
const char* utf8_word,
const int utf8_len,
178 string* font_name, std::vector<string>* graphemes);
183 static bool SelectFont(
const char* utf8_word,
const int utf8_len,
184 const std::vector<string>& all_fonts,
185 string* font_name, std::vector<string>* graphemes);
189 static void GetAllRenderableCharacters(std::vector<bool>* unichar_bitmap);
191 static void GetAllRenderableCharacters(
const std::vector<string>& font_names,
192 std::vector<bool>* unichar_bitmap);
193 static void GetAllRenderableCharacters(
const string& font_name,
194 std::vector<bool>* unichar_bitmap);
205 static string BestFonts(
206 const std::unordered_map<char32, inT64>& ch_map,
207 std::vector<std::pair<
const char*, std::vector<bool> > >* font_flag);
214 static int FontScore(
const std::unordered_map<char32, inT64>& ch_map,
215 const string& fontname,
int* raw_score,
216 std::vector<bool>* ch_flags);
219 static void ReInit();
222 static std::vector<string> available_fonts_;
226 #endif // TESSERACT_TRAINING_PANGO_FONT_INFO_H_ static void SoftInitFontConfig()
int DropUncoveredChars(string *utf8_text) const
bool CanRenderString(const char *utf8_word, int len, std::vector< string > *graphemes) const
static void HardInitFontConfig(const string &fonts_dir, const string &cache_dir)
bool is_monospace() const
bool GetSpacingProperties(const string &utf8_char, int *x_bearing, int *x_advance) const
bool CoversUTF8Text(const char *utf8_text, int byte_length) const
bool is_smallcaps() const
string DescriptionName() const
DECLARE_STRING_PARAM_FLAG(fonts_dir)
static bool IsAvailableFont(const char *font_desc)
void set_resolution(const int resolution)
const string & family_name() const
bool ParseFontDescriptionName(const string &name)
FontTypeEnum font_type() const