From 55f4830c9c0e68835d05d0aef0f31ef5f2958799 Mon Sep 17 00:00:00 2001 From: Tj Holowaychuk Date: Tue, 2 Nov 2010 15:49:54 -0700 Subject: [PATCH] Implemented textBaseline= --- src/CanvasRenderingContext2d.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/CanvasRenderingContext2d.cc b/src/CanvasRenderingContext2d.cc index 14cd319..d44d7b1 100644 --- a/src/CanvasRenderingContext2d.cc +++ b/src/CanvasRenderingContext2d.cc @@ -949,6 +949,21 @@ Context2d::SetTextPath(const Arguments &args) { break; } + // Baseline approx + // TODO: + switch (context->state->textBaseline) { + case TEXT_BASELINE_TOP: + case TEXT_BASELINE_HANGING: + y += te.height; + break; + case TEXT_BASELINE_MIDDLE: + y += te.height / 2; + break; + case TEXT_BASELINE_BOTTOM: + y -= te.height / 2; + break; + } + cairo_move_to(ctx, x, y); cairo_text_path(ctx, *str);