static gboolean textobj_transform(Textobj *textobj, const DiaMatrix *m) { real a, sx, sy; g_return_val_if_fail(m != NULL, FALSE); if (!dia_matrix_get_angle_and_scales (m, &a, &sx, &sy)) { dia_log_message ("textobj_transform() can't convert given matrix"); return FALSE; } else { /* XXX: what to do if width!=height */ real height = text_get_height (textobj->text) * MIN(sx,sy); real angle = a*180/G_PI; Point p = textobj->object.position; /* rotation is invariant to the handle position */ transform_point (&p, m); text_set_height (textobj->text, height); textobj->text_angle = angle; textobj->object.position = p; } textobj_update_data(textobj); return TRUE; }
void text_set_attributes(Text *text, TextAttributes *attr) { if (text->font != attr->font) { text_set_font(text, attr->font); } text_set_height(text, attr->height); text->position = attr->position; text->color = attr->color; text->alignment = attr->alignment; }
static void fontsizeprop_set_from_offset(FontsizeProperty *prop, void *base, guint offset, guint offset2) { PropNumData *numdata = prop->common.descr->extra_data; real value = prop->fontsize_data; if (numdata) { if (value < numdata->min) value = numdata->min; else if (value > numdata->max) value = numdata->max; } if (offset2 == 0) { struct_member(base,offset,real) = value; } else { void *base2 = struct_member(base,offset,void*); struct_member(base2,offset2,real) = value; g_return_if_fail (offset2 == offsetof(Text, height)); text_set_height ((Text*)base2, value); } }