Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

ocd

  • Loading branch information...
commit ef897a2a2cda5b1e793234f38f3fc8d01cb5f289 1 parent dce07d5
@tj tj authored
Showing with 15 additions and 9 deletions.
  1. +4 −1 src/CanvasRenderingContext2d.cc
  2. +11 −8 src/FontFace.cc
View
5 src/CanvasRenderingContext2d.cc
@@ -1720,6 +1720,10 @@ Context2d::MoveTo(const Arguments &args) {
return Undefined();
}
+/*
+ * Set font face.
+ */
+
#ifdef HAVE_FREETYPE
Handle<Value>
Context2d::SetFontFace(const Arguments &args) {
@@ -1735,7 +1739,6 @@ Context2d::SetFontFace(const Arguments &args) {
if (!FontFace::constructor->HasInstance(obj))
return ThrowException(Exception::TypeError(String::New("FontFace expected")));
-
FontFace *face = ObjectWrap::Unwrap<FontFace>(obj);
double size = args[1]->NumberValue();
View
19 src/FontFace.cc
@@ -16,7 +16,7 @@ FontFace::~FontFace() {
// Decrement extra reference count added in ::New(...).
// Once there is no reference left to crFace, cairo will release the
// free type font face as well.
- cairo_font_face_destroy (_crFace);
+ cairo_font_face_destroy(_crFace);
}
/*
@@ -45,21 +45,24 @@ FT_Library library; /* handle to library */
bool FontFace::_initLibrary = true;
static cairo_user_data_key_t key;
+/*
+ * Initialize a new FontFace.
+ */
+
Handle<Value>
FontFace::New(const Arguments &args) {
HandleScope scope;
if (!args[0]->IsString()
- || !args[1]->IsNumber())
- {
+ || !args[1]->IsNumber()) {
return ThrowException(Exception::Error(String::New("Wrong argument types passed to FontFace constructor")));
}
String::AsciiValue filePath(args[0]);
int faceIdx = int(args[1]->NumberValue());
- FT_Face ftFace;
- FT_Error ftError;
+ FT_Face ftFace;
+ FT_Error ftError;
cairo_font_face_t *crFace;
if (_initLibrary) {
@@ -83,9 +86,9 @@ FontFace::New(const Arguments &args) {
int status = cairo_font_face_set_user_data (crFace, &key,
ftFace, (cairo_destroy_func_t) FT_Done_Face);
if (status) {
- cairo_font_face_destroy (crFace);
- FT_Done_Face (ftFace);
- return ThrowException(Exception::Error(String::New("Failed to setup cairo font face user data")));
+ cairo_font_face_destroy (crFace);
+ FT_Done_Face (ftFace);
+ return ThrowException(Exception::Error(String::New("Failed to setup cairo font face user data")));
}
// Explicit reference count the cairo font face. Otherwise the font face might
Please sign in to comment.
Something went wrong with that request. Please try again.