From 27e095a613ed0a753231405cab887da19e9aecd1 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Mon, 15 Oct 2018 12:04:14 +0330 Subject: [PATCH] [dump-emoji] better explaination of the usage --- src/dump-emoji.cc | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/dump-emoji.cc b/src/dump-emoji.cc index b5ec30ead..f14dbdbf2 100644 --- a/src/dump-emoji.cc +++ b/src/dump-emoji.cc @@ -211,10 +211,29 @@ static void dump_glyphs (cairo_font_face_t *cairo_face, unsigned int upem, int main (int argc, char **argv) { if (argc != 2) { - fprintf (stderr, "usage: %s font-file.ttf\n", argv[0]); + fprintf (stderr, "usage: %s font-file.ttf\n" + "run it like `rm -rf out && mkdir out && src/dump-emoji font-file.ttf`\n", + argv[0]); exit (1); } + + FILE *font_name_file = fopen ("out/_font_name_file.txt", "r"); + if (font_name_file != nullptr) + { + fprintf (stderr, "Purge or move ./out folder in order to run a new dump\n"); + exit (1); + } + + font_name_file = fopen ("out/_font_name_file.txt", "w"); + if (font_name_file == nullptr) + { + fprintf (stderr, "./out is not accessible, create it please\n"); + exit (1); + } + fwrite (argv[0], 1, strlen (argv[1]), font_name_file); + fclose (font_name_file); + hb_blob_t *blob = hb_blob_create_from_file (argv[1]); hb_face_t *face = hb_face_create (blob, 0); hb_font_t *font = hb_font_create (face);