X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=sym-text.c;h=159f00ebe911a8a0ae5d828bfc92ea7374ddcab4;hb=c343d14479295d517ae64ccee5a7e83d3ce0fc42;hp=f2f901e978270a7e364569750020842a0f483891;hpb=2dda46b6d1cebc5205f7f98b4db4dcae40c11e55;p=leo.git diff --git a/sym-text.c b/sym-text.c index f2f901e..159f00e 100644 --- a/sym-text.c +++ b/sym-text.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include FT_FREETYPE_H @@ -16,7 +17,6 @@ #include "osm.h" #include "sym.h" #include "map.h" - #include "labeller.h" /*** Fonts ***/ @@ -243,10 +243,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) @@ -294,7 +300,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); } @@ -441,8 +447,6 @@ static void sym_text_node(struct osm_object *o, struct style_info *si, osm_val_t msg(L_DEBUG, "Text <%s> dropped as duplicate", osm_val_decode(text)); return; } - - //sym_plan(&st->s, sym_zindex(o, si, 5)); } static void sym_text_center(struct osm_object *o, struct style_info *si, osm_val_t text, double x, double y) @@ -457,16 +461,7 @@ static void sym_text_center(struct osm_object *o, struct style_info *si, osm_val st->x -= st->tw / 2; st->y += st->th - (st->th + st->td) / 2; text_fix_placement(st); - if (o->type == OSM_TYPE_WAY && !osm_way_cyclic_p((struct osm_way *) o)) - { - //sym_plan(&st->s, sym_zindex(o, si, 4.9)); - labeller_add_linelabel(&st->s, o, sym_zindex(o, si, 4.9)); - } - else - { - //sym_plan(&st->s, sym_zindex(o, si, 4.9)); - labeller_add_arealabel(&st->s, o, sym_zindex(o, si, 4.9)); - } + labeller_add_label(&st->s, o, sym_zindex(o, si, 4.9)); } static void sym_text_way(struct osm_object *o, struct style_info *si, osm_val_t text)