fix an issue that cannot handle freetype errors properly

This commit is contained in:
falsycat 2022-11-05 00:39:45 +09:00
parent 532fd141e3
commit 95b6160f23

View File

@ -27,7 +27,14 @@ class Queue : public nf7::File::Interface {
}; };
inline void Enforce(FT_Error e) { inline void Enforce(FT_Error e) {
if (e) throw nf7::Exception {FT_Error_String(e)}; # undef FTERRORS_H_
# define FT_ERROR_START_LIST switch (e) {
# define FT_ERRORDEF(e, v, s) case e: throw nf7::Exception {s};
# define FT_ERROR_END_LIST default: throw nf7::Exception {"unknown freetype error"};}
# include FT_ERRORS_H
# undef FT_ERROR_START_LIST
# undef FT_ERRORDEF
# undef FT_ERROR_END_LIST
} }
} // namespace nf7::font } // namespace nf7::font