Skip to content

Commit 9a3bde4

Browse files
committed
Merge pull request #490 from AllYearbooks/master
re-enable pango, use fontconfig and floats for drawImage()
2 parents 745cfdc + 36bd649 commit 9a3bde4

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
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/CanvasRenderingContext2d.cc

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ NAN_METHOD(Context2d::DrawImage) {
606606
if (args.Length() < 3)
607607
return NanThrowTypeError("invalid arguments");
608608

609-
int sx = 0
609+
float sx = 0
610610
, sy = 0
611611
, sw = 0
612612
, sh = 0

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)