mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-24 11:09:06 +08:00
Check that pango's suggested font name is not an empty string
On msys2 pango seems to always returns empty string for the suggested font. It's a good idea to check that the string is not empty before printing it - on all platforms.
This commit is contained in:
parent
96720c785d
commit
724fb894ac
@ -441,9 +441,11 @@ int main(int argc, char** argv) {
|
||||
if (!FLAGS_find_fonts && !FontUtils::IsAvailableFont(FLAGS_font.c_str())) {
|
||||
string pango_name;
|
||||
if (!FontUtils::IsAvailableFont(FLAGS_font.c_str(), &pango_name)) {
|
||||
tprintf("Could not find font named %s. Pango suggested font %s\n"
|
||||
"Please correct --font arg.\n",
|
||||
FLAGS_font.c_str(), pango_name.c_str());
|
||||
tprintf("Could not find font named %s.", FLAGS_font.c_str());
|
||||
if (!pango_name.empty()) {
|
||||
tprintf("Pango suggested font %s.\n", pango_name.c_str());
|
||||
}
|
||||
tprintf("Please correct --font arg.\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user