X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=sym-text.c;h=ffcfc421d78a516ddd446644ac0a86a312368d41;hb=a8cc108c3efad9fb7f42b9871ac60a48cce0d335;hp=2666acd9f5d2e6f5984183750ad77b0a1ef2b7c8;hpb=44b0ec8816c3cf1a5858fec0c51e075cedefc3eb;p=leo.git diff --git a/sym-text.c b/sym-text.c index 2666acd..ffcfc42 100644 --- a/sym-text.c +++ b/sym-text.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include FT_FREETYPE_H @@ -241,10 +242,16 @@ static void sym_text_draw(struct symbol *sym, struct svg *svg) 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) @@ -292,7 +299,7 @@ static void sym_text_draw(struct symbol *sym, struct svg *svg) svg_pop(svg); #endif - if (t->opacity != 1) + if (use_group) svg_pop(svg); }