Add fileName to the incorrect font logging.

This commit is contained in:
vng 2012-09-14 15:01:11 +03:00 committed by Alex Zolotarev
parent 6ce479310a
commit 4ca2fd2105
3 changed files with 10 additions and 6 deletions

View file

@ -30,11 +30,12 @@ char const * FT_Error_Description(FT_Error error)
return ft_errors[i].err_msg;
}
void CheckError(FT_Error error)
void CheckError(FT_Error error, char const * msg)
{
if (error != 0)
{
LOG(LINFO, ("FT_Error : ", FT_Error_Description(error)));
if (msg == 0) msg = "";
LOG(LWARNING, ("FT_Error:", FT_Error_Description(error), msg));
}
}

View file

@ -12,8 +12,11 @@
namespace ft2_impl
{
void CheckError(FT_Error error);
void CheckError(FT_Error error, char const * msg = 0);
}
#define FTCHECK(x) do { FT_Error e = (x); ft2_impl::CheckError(e); } while (false)
#define FTCHECKRETURN(x) do { FT_Error e = (x); if (e != 0) { ft2_impl::CheckError(e); return; } } while (false)
#define FTCHECKRETURN(x, msg) \
do { FT_Error e = (x); \
if (e != 0) { ft2_impl::CheckError(e, msg); return; } } \
while (false)

View file

@ -247,7 +247,7 @@ namespace yg
// from routine, so add font to fonts array only in the end.
FT_Face face;
FTCHECKRETURN(pFont->CreateFaceID(m_lib, &face));
FTCHECKRETURN(pFont->CreateFaceID(m_lib, &face), fileName);
vector<FT_ULong> charcodes;
@ -259,7 +259,7 @@ namespace yg
sort(charcodes.begin(), charcodes.end());
charcodes.erase(unique(charcodes.begin(), charcodes.end()), charcodes.end());
FTCHECKRETURN(FT_Done_Face(face));
FTCHECKRETURN(FT_Done_Face(face), fileName);
m_fonts.push_back(pFont);