From 93cdb907c30c7c2000799bf2b5440fbf24d3b6e6 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Tue, 11 Aug 2020 11:45:22 -0700 Subject: [PATCH] improve error messages for font-subset (#20410) --- tools/font-subset/main.cc | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/tools/font-subset/main.cc b/tools/font-subset/main.cc index cbacb46d23c04..cd162d664eefc 100644 --- a/tools/font-subset/main.cc +++ b/tools/font-subset/main.cc @@ -63,14 +63,18 @@ int main(int argc, char** argv) { hb_blob_create_from_file(input_file_path.c_str())); if (!hb_blob_get_length(font_blob.get())) { std::cerr << "Failed to load input font " << input_file_path - << "; aborting." << std::endl; + << "; aborting. This error indicates that the font is invalid or " + "the current version of Harfbuzz is unable to process it." + << std::endl; return -1; } HarfbuzzWrappers::HbFacePtr font_face(hb_face_create(font_blob.get(), 0)); if (font_face.get() == hb_face_get_empty()) { std::cerr << "Failed to load input font face " << input_file_path - << "; aborting." << std::endl; + << "; aborting. This error indicates that the font is invalid or " + "the current version of Harfbuzz is unable to process it." + << std::endl; return -1; } @@ -103,13 +107,18 @@ int main(int argc, char** argv) { HarfbuzzWrappers::HbFacePtr new_face(hb_subset(font_face.get(), input.get())); if (new_face.get() == hb_face_get_empty()) { - std::cerr << "Failed to subset font; aborting." << std::endl; + std::cerr + << "Failed to subset font; aborting. This error normally indicates " + "the current version of Harfbuzz is unable to process it." + << std::endl; return -1; } HarfbuzzWrappers::HbBlobPtr result(hb_face_reference_blob(new_face.get())); if (!hb_blob_get_length(result.get())) { - std::cerr << "Failed get new font bytes; aborting" << std::endl; + std::cerr << "Failed get new font bytes; aborting. This error may indicate " + "low availability of memory or a bug in Harfbuzz." + << std::endl; return -1; }