X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=sym-text.c;h=6622fd61fbd2b56b9c769b6be16484a7d2f10a07;hb=3eccb27b874cf751c7c807ce444b8bcb37ecf768;hp=3188938a38fd151c92998fce6005a493b3cb7904;hpb=70499d5526dc622c9d452981519455cf7618efc0;p=leo.git diff --git a/sym-text.c b/sym-text.c index 3188938..6622fd6 100644 --- a/sym-text.c +++ b/sym-text.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include FT_FREETYPE_H @@ -244,10 +245,16 @@ printf("Drawing %s at [%.2f; %.2f]\n", osm_val_decode(t->text), t->x, t->y); t->y = sy / nn; } - if (t->opacity != 1) + bool use_group = 0; + bool want_rotate = (fabs(t->rotate) > 1e-5); + if (t->opacity != 1 || want_rotate) { + use_group = 1; svg_push_element(svg, "g"); - svg_set_attr_float(svg, "opacity", t->opacity); + if (t->opacity != 1) + svg_set_attr_float(svg, "opacity", t->opacity); + if (want_rotate) + svg_set_attr_format(svg, "transform", "rotate(%.2f %s %s)", -t->rotate, svg_format_dimen(svg, t->x), svg_format_dimen(svg, t->y)); } if (t->halo_radius) @@ -295,7 +302,7 @@ printf("Drawing %s at [%.2f; %.2f]\n", osm_val_decode(t->text), t->x, t->y); svg_pop(svg); #endif - if (t->opacity != 1) + if (use_group) svg_pop(svg); }