コード例 #1
0
ファイル: pango_font_info.cpp プロジェクト: 11110101/tess-two
/* static */
bool FontUtils::SelectFont(const char* utf8_word, const int utf8_len,
                           const vector<string>& all_fonts,
                           string* font_name, vector<string>* graphemes) {
  if (font_name) font_name->clear();
  if (graphemes) graphemes->clear();
  for (int i = 0; i < all_fonts.size(); ++i) {
    PangoFontInfo font;
    vector<string> found_graphemes;
    ASSERT_HOST_MSG(font.ParseFontDescriptionName(all_fonts[i]),
                    "Could not parse font desc name %s\n",
                    all_fonts[i].c_str());
    if (font.CanRenderString(utf8_word, utf8_len, &found_graphemes)) {
      if (graphemes) graphemes->swap(found_graphemes);
      if (font_name) *font_name = all_fonts[i];
      return true;
    }
  }
  return false;
}
コード例 #2
0
ファイル: normstrngs.cpp プロジェクト: hoiqs/tesseract-ocr
bool IsWhitespace(const char32 ch) {
  ASSERT_HOST_MSG(IsValidCodepoint(ch),
                  "Invalid Unicode codepoint: 0x%x\n", ch);
  return u_isUWhiteSpace(static_cast<UChar32>(ch));
}
コード例 #3
0
ファイル: fileio.cpp プロジェクト: 0xkasun/tesseract
void File::ReadFileToStringOrDie(const string& filename, string* out) {
  ASSERT_HOST_MSG(ReadFileToString(filename, out),
                  "Failed to read file: %s\n", filename.c_str());
}