summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
0f3504c)
There are currently no style properties to control that,
but it will be used in Karry's labelling branch.
Also made formatting of SVG dimensions slightly more systematic.
svg_push_element(svg, "g");
svg_set_attr(svg, "id", "scale");
svg_push_element(svg, "g");
svg_set_attr(svg, "id", "scale");
- svg_set_attr_format(svg, "transform", "translate(%.6g,%.6g)", x * svg->scale, y * svg->scale);
+ svg_set_attr_format(svg, "transform", "translate(%s,%s)", svg_format_dimen(svg, x), svg_format_dimen(svg, y));
for (int outline=1; outline>=0; outline--)
{
for (int outline=1; outline>=0; outline--)
{
svg_set_attr_ref(svg, key, mp_printf(svg->pool, "%.6g", val));
}
svg_set_attr_ref(svg, key, mp_printf(svg->pool, "%.6g", val));
}
+char *svg_format_dimen(struct svg *svg, double val)
+{
+ return mp_printf(svg->pool, "%.6g", val * svg->scale);
+}
+
void svg_set_attr_dimen(struct svg *svg, const char *key, double val)
{
void svg_set_attr_dimen(struct svg *svg, const char *key, double val)
{
- svg_set_attr_ref(svg, key, mp_printf(svg->pool, "%.6g", val * svg->scale));
+ svg_set_attr_ref(svg, key, svg_format_dimen(svg, val));
}
void svg_set_attr_color(struct svg *svg, const char *key, color_t color)
}
void svg_set_attr_color(struct svg *svg, const char *key, color_t color)
void svg_path_line_to_rel(struct svg *svg, double x, double y);
void svg_path_close(struct svg *svg);
void svg_path_line_to_rel(struct svg *svg, double x, double y);
void svg_path_close(struct svg *svg);
+char *svg_format_dimen(struct svg *svg, double val);
+
/* svg-icon.c */
struct svg_icon {
/* svg-icon.c */
struct svg_icon {
#include <ucw/lib.h>
#include <ucw/stkstring.h>
#include <ucw/lib.h>
#include <ucw/stkstring.h>
#include <stdio.h>
#include <ft2build.h>
#include FT_FREETYPE_H
#include <stdio.h>
#include <ft2build.h>
#include FT_FREETYPE_H
+ bool use_group = 0;
+ bool want_rotate = (fabs(t->rotate) > 1e-5);
+ if (t->opacity != 1 || want_rotate)
svg_push_element(svg, "g");
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));
color_t text_color;
double x;
double y;
color_t text_color;
double x;
double y;
+ double rotate; // Rotation in degrees CCW
struct text_font *font;
double opacity;
color_t halo_color;
struct text_font *font;
double opacity;
color_t halo_color;