From 68034fc3c5f9715ef78780d55e985bb10a880a74 Mon Sep 17 00:00:00 2001 From: handa Date: Wed, 4 Nov 2009 02:28:06 +0000 Subject: [PATCH] (debug_flag): New variable (set_debug_flag): New function. (OTF_open, OTF_open_ft_face): Check debug flag if not yet done. --- src/otfopen.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/otfopen.c b/src/otfopen.c index aacbc30..c49eb1d 100644 --- a/src/otfopen.c +++ b/src/otfopen.c @@ -57,6 +57,15 @@ write to the Free Software Foundation, Inc., 59 Temple Place, Suite (5) API miscellaneous */ + +int debug_flag = -1; + +static void +set_debug_flag () +{ + debug_flag = getenv ("LIBOTF_DEBUG") != NULL; +} + /* (0) Stream handler @@ -2933,6 +2942,9 @@ OTF_open (const char *otf_name) int len = strlen (otf_name); const char *ext = otf_name + (len - 4); + if (debug_flag < 0) + set_debug_flag (); + if (len < 4 || ext[0] != '.' || (ext[1] != 'O' && ext[1] != 'T' && ext[1] != 'o' && ext[1] != 't') @@ -2983,6 +2995,9 @@ OTF_open_ft_face (FT_Face face) OTF *otf; OTF_InternalData *internal_data; + if (debug_flag < 0) + set_debug_flag (); + if (! FT_IS_SFNT (face)) OTF_ERROR (OTF_ERROR_FILE, (char *) face->family_name); otf = calloc (1, sizeof (OTF)); -- 1.7.10.4