Skip to content

Commit

Permalink
with_pango to true and use fontconfig to load fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
jakeg committed Dec 9, 2014
1 parent 14e8b6c commit 7522aca
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion binding.gyp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
'with_jpeg%': '<!(./util/has_lib.sh jpeg)',
'with_gif%': '<!(./util/has_lib.sh gif)',
# disable pango as it causes issues with freetype.
'with_pango%': 'false',
'with_pango%': '<!(./util/has_lib.sh pangocairo)',
'with_freetype%': '<!(./util/has_cairo_freetype.sh)'
}
}]
Expand Down
10 changes: 10 additions & 0 deletions src/FontFace.cc
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

#include "FontFace.h"

#include <fontconfig/fontconfig.h>

Persistent<FunctionTemplate> FontFace::constructor;

/*
Expand Down Expand Up @@ -79,6 +81,14 @@ NAN_METHOD(FontFace::New) {
return NanThrowError("Could not load font file");
}

#if HAVE_PANGO
// Load the font file in fontconfig
FcBool ok = FcConfigAppFontAddFile(FcConfigGetCurrent(), (FcChar8 *)(*filePath));
if (!ok) {
return NanThrowError("Could not load font in FontConfig");
}
#endif

// Create new cairo font face.
crFace = cairo_ft_font_face_create_for_ft_face(ftFace, 0);

Expand Down

0 comments on commit 7522aca

Please sign in to comment.