--- /dev/null
+/*
+ freetype-error.cc -- implement freetype error messages
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2007 Han-Wen Nienhuys <hanwen@lilypond.org>
+
+*/
+
+#include "freetype.hh"
+
+#undef __FTERRORS_H__
+#define FT_ERRORDEF( e, v, s ) { e, s },
+#define FT_ERROR_START_LIST {
+#define FT_ERROR_END_LIST { 0, 0 } };
+
+const struct Freetype_error_message
+{
+ int err_code;
+ const char* err_msg;
+} ft_errors[] =
+
+#include <freetype/fterrors.h>
+
+ ;
+
+
+#include <string>
+
+string
+freetype_error_string (int code)
+{
+ for (Freetype_error_message const *p = ft_errors;
+ p->err_msg; p ++)
+ {
+ if (p->err_code == code)
+ return p->err_msg;
+ }
+
+ return "<unknown error>";
+}
+
if (error_code == FT_Err_Unknown_File_Format)
error (_f ("unsupported font format: %s", str.c_str ()));
else if (error_code)
- error (_f ("unknown error: %d reading font file: %s", error_code,
- str.c_str ()));
+ error (_f ("error reading font file %s: %s",
+ str.c_str (),
+ freetype_error_string (error_code).c_str ()
+ ));
return face;
}