From e91908206baf0535934a985f8e0d54db2d67ea88 Mon Sep 17 00:00:00 2001 From: artemp Date: Mon, 18 Mar 2013 14:31:38 +0000 Subject: [PATCH] cairo halo patch via @springmeyer ( #1624 ) --- src/cairo_context.cpp | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/src/cairo_context.cpp b/src/cairo_context.cpp index a810534ca..4bb569185 100644 --- a/src/cairo_context.cpp +++ b/src/cairo_context.cpp @@ -457,19 +457,46 @@ void cairo_context::add_text(text_path const& path, matrix.yy = text_size * std::cos(angle); matrix.x0 = 0; matrix.y0 = 0; - set_font_matrix(matrix); - set_font_face(manager, glyph->get_face()); - glyph_path(glyph->get_index(), sx + x, sy - y); set_line_width(2.0 * c->format->halo_radius * scale_factor); set_line_join(ROUND_JOIN); set_color(c->format->halo_fill); stroke(); + } + } + + path.rewind(); + + for (int iii = 0; iii < path.num_nodes(); iii++) + { + char_info_ptr c; + double x, y, angle; + + path.vertex(c, x, y, angle); + + face_set_ptr faces = font_manager.get_face_set(c->format->face_name, c->format->fontset); + double text_size = c->format->text_size * scale_factor; + faces->set_character_sizes(text_size); + + glyph_ptr glyph = faces->get_glyph(c->c); + + if (glyph) + { + cairo_matrix_t matrix; + matrix.xx = text_size * std::cos(angle); + matrix.xy = text_size * std::sin(angle); + matrix.yx = text_size * -std::sin(angle); + matrix.yy = text_size * std::cos(angle); + matrix.x0 = 0; + matrix.y0 = 0; + set_font_matrix(matrix); + set_font_face(manager, glyph->get_face()); set_color(c->format->fill); show_glyph(glyph->get_index(), sx + x, sy - y); } } + } }