Skip to content

Commit 7522aca

Browse files
committed
with_pango to true and use fontconfig to load fonts
1 parent 14e8b6c commit 7522aca

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

binding.gyp

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
'with_jpeg%': '<!(./util/has_lib.sh jpeg)',
1414
'with_gif%': '<!(./util/has_lib.sh gif)',
1515
# disable pango as it causes issues with freetype.
16-
'with_pango%': 'false',
16+
'with_pango%': '<!(./util/has_lib.sh pangocairo)',
1717
'with_freetype%': '<!(./util/has_cairo_freetype.sh)'
1818
}
1919
}]

src/FontFace.cc

100644100755
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
#include "FontFace.h"
88

9+
#include <fontconfig/fontconfig.h>
10+
911
Persistent<FunctionTemplate> FontFace::constructor;
1012

1113
/*
@@ -79,6 +81,14 @@ NAN_METHOD(FontFace::New) {
7981
return NanThrowError("Could not load font file");
8082
}
8183

84+
#if HAVE_PANGO
85+
// Load the font file in fontconfig
86+
FcBool ok = FcConfigAppFontAddFile(FcConfigGetCurrent(), (FcChar8 *)(*filePath));
87+
if (!ok) {
88+
return NanThrowError("Could not load font in FontConfig");
89+
}
90+
#endif
91+
8292
// Create new cairo font face.
8393
crFace = cairo_ft_font_face_create_for_ft_face(ftFace, 0);
8494

0 commit comments

Comments
 (0)