diff --git a/lib/canvas.js b/lib/canvas.js index 139c579..9425057 100644 --- a/lib/canvas.js +++ b/lib/canvas.js @@ -56,6 +56,14 @@ if (canvas.gifVersion) { exports.gifVersion = canvas.gifVersion.replace(/[^.\d]/g, ''); } +/** + * freetype version. + */ + +if (canvas.freetypeVersion) { + exports.freetypeVersion = canvas.freetypeVersion; +} + /** * Expose constructors. */ diff --git a/src/init.cc b/src/init.cc index e5f44fc..c48e16c 100755 --- a/src/init.cc +++ b/src/init.cc @@ -15,6 +15,7 @@ #ifdef HAVE_FREETYPE #include "FontFace.h" +#include FT_FREETYPE_H #endif // Compatibility with Visual Studio versions prior to VS2015 @@ -70,6 +71,12 @@ NAN_MODULE_INIT(init) { target->Set(Nan::New("gifVersion").ToLocalChecked(), Nan::New(GIF_LIB_VERSION).ToLocalChecked()); #endif #endif + +#ifdef HAVE_FREETYPE + char freetype_version[10]; + snprintf(freetype_version, 10, "%d.%d.%d", FREETYPE_MAJOR, FREETYPE_MINOR, FREETYPE_PATCH); + target->Set(Nan::New("freetypeVersion").ToLocalChecked(), Nan::New(freetype_version).ToLocalChecked()); +#endif } NODE_MODULE(canvas,init);