move but not reshape text during transform?

Post questions on how to use or achieve an effect in Inkscape.
User avatar
ottadini
Posts: 34
Joined: Thu Sep 24, 2009 4:27 pm
Location: Australia

move but not reshape text during transform?

Postby ottadini » Sat Jun 26, 2010 4:12 pm

Hi,

I have many vector images of simple x,y plots imported from gnuplot. the plots need scaled dimensions, which gnuplot doesn't achieve, but which i can use inkscape to get close to. i want to be able to scale my plots in inkscape without scaling line thicknesses or text size. Line thicknesses is handled very well, but text gets reshaped during transforms (either squished or stretched). the text is not within 'text boxes' or frames, and i am not aware of any scripts/extensions that can automate converting all the text into flowed text.

how can i transform (usually by scale in either/or x and y directions) my plots without stretching or shrinking the text? i DO want the text to move with the transform, just not change its shape or size.

on the other side of the problem, is there a simple way to remove such size/skew transforms from text objects, without removing the movement part of the transform?

cheers,
ben

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: move but not reshape text during transform?

Postby ~suv » Sat Jun 26, 2010 5:23 pm

Can you attach an example SVG file exported from gnuplot you want to rescale?

User avatar
tomh
Posts: 218
Joined: Sat Feb 14, 2009 10:14 pm

Re: move but not reshape text during transform?

Postby tomh » Sun Jun 27, 2010 11:33 am

on the other side of the problem, is there a simple way to remove such size/skew transforms from text objects, without removing the movement part of the transform?


If you keep things simple (eg just one scale operation per direction, then it can be easy enough to do. Basically you want to apply the matrix transformation (including scale/offset ect) to the x,y position attributes of the text and not the whole text object itself. (eg calculate x-y position of text on canvas, then delete the transformation matrix)

Examples:
Simple situation: Have scaled drawing by 2 along x axis without any other transformations. (Drawing starts from origin)
To get correct x-coordinate: multiply the x coordinate by 2 and delete the transform matrix.

More complex situation: Have scaled different regions by different amounts, moved graph around in Inkscape. Same principle
1)find objects x-y, coordinates
2)calculate new x-y coordinates by applying the transformation matrix as given in the object (see here
3)replace the objects coordinates with the ones just calculated
4)delete the transformation matrix from the object
5)RESULT.text should now be in correct position, without the scaling.

User avatar
ottadini
Posts: 34
Joined: Thu Sep 24, 2009 4:27 pm
Location: Australia

Re: move but not reshape text during transform?

Postby ottadini » Sun Jun 27, 2010 12:34 pm

hi hi,
gnuplot plot is attached.
i don't have the exact gnuplot command i used for this, but i think it was:

Code: Select all

set term svg dynamic linewidth 0.5  size 1000,1414

tom, bit of a hangover this morning, so i'm not going to even try to follow that example just yet. one question though, any comments on how to do that to all text elements at once? it looks like it'll be quite time-intensive to apply it to every axis and tic label.
at the moment i'm ungrouping everything, separating all the elements into separate layers (e.g., axis labels, titles, tic labels, and plot), then transforming the plot area to scale, then adding the other elements back in, and fudging them with alignment tools and so on.

on a related note, is there a smart selection tool for text, i.e.: "select everything that is text"?

ben
Attachments
Holey Plains 185.svg
gnuplot svg output
(37.81 KiB) Downloaded 202 times

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: move but not reshape text during transform?

Postby ~suv » Sun Jun 27, 2010 10:46 pm

ottadini wrote:how can i transform (usually by scale in either/or x and y directions) my plots without stretching or shrinking the text? i DO want the text to move with the transform, just not change its shape or size.

Not yet implemented, see feature request for Inkscape “hold font size constant when resizing group

ottadini wrote:is there a smart selection tool for text, i.e.: "select everything that is text"?

For normal text, use 'Edit > Find…' and deselect all types except 'Text'.

In your example file however I would not yet recommend to go this way: looking at the source, gnuplot neatly wraps each text in a group and applies any transformation to the group (in preserved, explicit form), not to the text. Thus it might offer you a chance to (manually) edit the transforms to your needs without actually scaling, stretching or rotating the text object itself:

Code: Select all

   <g transform="translate(25.9,723.3) rotate(270)" style="…">
      <text>Depth (m)</text>
   </g>

Code: Select all

   <g transform="translate(529.6,1405.9)" style="…">
      <text>Temperature (°C)</text>
   </g>

Not sure yet what to recommend as best practice to scale the diagram as a whole including the text insertion points but unchanged text object dimensions (be it of the wrapping group, the text object itself or by changed font-size).


Return to “Help with using Inkscape”