From: handa Date: Wed, 4 Nov 2009 02:28:06 +0000 (+0000) Subject: (debug_flag): New variable X-Git-Tag: REL-0-9-11~53 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68034fc3c5f9715ef78780d55e985bb10a880a74;p=m17n%2Flibotf.git (debug_flag): New variable (set_debug_flag): New function. (OTF_open, OTF_open_ft_face): Check debug flag if not yet done. --- 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));