|
|
@ -59,6 +59,19 @@ using namespace node; |
|
|
|
int width = args[2]->Int32Value(); \ |
|
|
|
int height = args[3]->Int32Value(); |
|
|
|
|
|
|
|
/*
|
|
|
|
* Text baselines. |
|
|
|
*/ |
|
|
|
|
|
|
|
enum { |
|
|
|
TEXT_BASELINE_ALPHABETIC |
|
|
|
, TEXT_BASELINE_TOP |
|
|
|
, TEXT_BASELINE_BOTTOM |
|
|
|
, TEXT_BASELINE_MIDDLE |
|
|
|
, TEXT_BASELINE_IDEOGRAPHIC |
|
|
|
, TEXT_BASELINE_HANGING |
|
|
|
}; |
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialize Context2d. |
|
|
|
*/ |
|
|
@ -88,6 +101,7 @@ Context2d::Initialize(Handle<Object> target) { |
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "strokeRect", StrokeRect); |
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "clearRect", ClearRect); |
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "rect", Rect); |
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "setTextBaseline", SetTextBaseline); |
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "setTextAlignment", SetTextAlignment); |
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "setTextPath", SetTextPath); |
|
|
|
NODE_SET_PROTOTYPE_METHOD(t, "measureText", MeasureText); |
|
|
@ -868,6 +882,21 @@ Context2d::MeasureText(const Arguments &args) { |
|
|
|
return scope.Close(obj); |
|
|
|
} |
|
|
|
|
|
|
|
/*
|
|
|
|
* Set text baseline. |
|
|
|
*/ |
|
|
|
|
|
|
|
Handle<Value> |
|
|
|
Context2d::SetTextBaseline(const Arguments &args) { |
|
|
|
HandleScope scope; |
|
|
|
|
|
|
|
if (!args[0]->IsInt32()) return Undefined(); |
|
|
|
Context2d *context = ObjectWrap::Unwrap<Context2d>(args.This()); |
|
|
|
context->state->textBaseline = args[0]->Int32Value(); |
|
|
|
|
|
|
|
return Undefined(); |
|
|
|
} |
|
|
|
|
|
|
|
/*
|
|
|
|
* Set text alignment. -1 0 1 |
|
|
|
*/ |
|
|
@ -883,7 +912,6 @@ Context2d::SetTextAlignment(const Arguments &args) { |
|
|
|
return Undefined(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set text path at x, y. |
|
|
|
*/ |
|
|
|