1 /* GemRB - Infinity Engine Emulator
2  * Copyright (C) 2011 The GemRB Project
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  *
19  */
20 
21 #include "Freetype.h"
22 #include "System/Logging.h"
23 
24 namespace GemRB {
25 
LogFTError(FT_Error errCode)26 void LogFTError(FT_Error errCode)
27 {
28 #undef __FTERRORS_H__
29 #define FT_ERRORDEF( e, v, s )  { e, s },
30 #define FT_ERROR_START_LIST     {
31 #define FT_ERROR_END_LIST       { 0, 0 } };
32 
33 	static const struct
34 	{
35 		int          err_code;
36 		const char*  err_msg;
37 	} ft_errors[] =
38 #include FT_ERRORS_H
39 	int i;
40 	const char *err_msg;
41 
42 	err_msg = NULL;
43 	for ( i=0; i < (int)((sizeof ft_errors)/(sizeof ft_errors[0])); ++i ) {
44 		if ( errCode == ft_errors[i].err_code ) {
45 			err_msg = ft_errors[i].err_msg;
46 			break;
47 		}
48 	}
49 	if ( !err_msg ) {
50 		err_msg = "unknown FreeType error";
51 	}
52 	Log(ERROR, "FreeType", "%s", err_msg);
53 }
54 
55 }
56