/* 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; }
bool IsWhitespace(const char32 ch) { ASSERT_HOST_MSG(IsValidCodepoint(ch), "Invalid Unicode codepoint: 0x%x\n", ch); return u_isUWhiteSpace(static_cast<UChar32>(ch)); }
void File::ReadFileToStringOrDie(const string& filename, string* out) { ASSERT_HOST_MSG(ReadFileToString(filename, out), "Failed to read file: %s\n", filename.c_str()); }