Skip to content

re-enable pango, use fontconfig and floats for drawImage() #490

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 21, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion src/CanvasRenderingContext2d.cc
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ NAN_METHOD(Context2d::DrawImage) {
if (args.Length() < 3)
return NanThrowTypeError("invalid arguments");

int sx = 0
float sx = 0
, sy = 0
, sw = 0
, sh = 0
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