|
|
@ -822,23 +822,29 @@ Context2d::StrokeText(const Arguments &args) { |
|
|
|
|
|
|
|
Context2d *context = ObjectWrap::Unwrap<Context2d>(args.This()); |
|
|
|
cairo_t *ctx = context->getContext(); |
|
|
|
// Save path
|
|
|
|
cairo_save(ctx); |
|
|
|
cairo_path_t *path = cairo_copy_path_flat(ctx); |
|
|
|
cairo_new_path(ctx); |
|
|
|
|
|
|
|
// Text path
|
|
|
|
context->savePath(); |
|
|
|
context->setTextPath(*str, x, y); |
|
|
|
SET_SOURCE(context->state->stroke); |
|
|
|
cairo_stroke(ctx); |
|
|
|
|
|
|
|
// Restore path
|
|
|
|
cairo_restore(ctx); |
|
|
|
cairo_append_path(ctx, path); |
|
|
|
context->restorePath(); |
|
|
|
|
|
|
|
return Undefined(); |
|
|
|
} |
|
|
|
|
|
|
|
void |
|
|
|
Context2d::savePath() { |
|
|
|
cairo_save(_context); |
|
|
|
_path = cairo_copy_path_flat(_context); |
|
|
|
cairo_new_path(_context); |
|
|
|
} |
|
|
|
|
|
|
|
void |
|
|
|
Context2d::restorePath() { |
|
|
|
cairo_restore(_context); |
|
|
|
cairo_append_path(_context, _path); |
|
|
|
} |
|
|
|
|
|
|
|
void |
|
|
|
Context2d::setTextPath(const char *str, double x, double y) { |
|
|
|
// Text extents
|
|
|
|