Page 1 of 1
Clipping text in a shape - Wrapping text
Posted: Sun Mar 29, 2015 7:23 pm
by Zryip TheSlug
I've tried to clip a text in a rectangle and I would have expected the text would have wrapped inside the rectangle.
I do not seen a command for creating a text behaving like the svg "textarea" element.
Maybe I missed something in the documentation. If not, is there any plan to support this behavior in a future version?
Re: Clipping text in a shape - Wrapping text
Posted: Mon Mar 30, 2015 9:02 am
by LCMark
You have a good point - the current 'fill text' syntax could do with some refinement. How about this:
To fill a text string without implicitly breaking the text into lines at a given point use:
Code: Select all
fill text <expr> [ with ( ascent | descent | baseline ) ] at <point>
By default 'point' is taken to be the left-side baseline anchor of the text. 'ascent' makes it the left-side ascent anchor (i.e. ascent above the baseline); and similarly for 'descent'.
To fill a text string with implicit breaking and alignment within a rectangle use:
Code: Select all
fill text <expr> at <alignment> of <rect>
The text will be broken into lines using the width of the rect as the layout widget. The logical size of the text, after being broken into lines, will be taken and then positioned within the rectangle with the given alignment. (Note that there is no clipping down here, the rect is just used for alignment - if you want to clip to the rect, an explicit command will be needed to set the clip).
Re: Clipping text in a shape - Wrapping text
Posted: Wed Apr 01, 2015 11:49 pm
by Zryip TheSlug
@LCMark
Sounds great, thanks.
Btw, any chance to have the "text path" implemented?
Re: Clipping text in a shape - Wrapping text
Posted: Thu Apr 02, 2015 1:54 am
by monte
@LCMark is there any possibility to have both vertical and horizontal alignment options when filling text within a rectangle? So <alignment> would be:
Code: Select all
[ (top | middle | bottom) ] [( left | center | right)]
Re: Clipping text in a shape - Wrapping text
Posted: Thu Apr 02, 2015 10:25 am
by LCMark
@monte: Hmmm - you can do 'top right', 'top left', 'bottom right', 'bottom left', 'left', 'right', 'center' - but not 'middle' it would appear. I think the 'middle' combinations are an oversight. Filed as
http://quality.runrev.com/show_bug.cgi?id=15144.