Text line spacing control

Hi,

I use Text() call of Figure() object for writing text. Because my text is long, I use line breaker (\n) to write multiple lines with a single call. This works fine except the line spacing is really tight and I wish I could set a bigger line spacing. Does anyone know if this is possible? Thanks for your time.

Jianfu

Currently not, the pad between the newline is hard coded, but we could
expose it as a parameter w/o too much work.

JDH

···

On 7/10/07, Jianfu Pan <Jianfu.Pan@...245...> wrote:

Hi,

I use Text() call of Figure() object for writing text. Because my text is
long, I use line breaker (\n) to write multiple lines with a single
call. This works fine except the line spacing is really tight and I wish I
could set a bigger line spacing. Does anyone know if this is
possible? Thanks for your time.

John Hunter wrote:

Hi,

I use Text() call of Figure() object for writing text. Because my text is
long, I use line breaker (\n) to write multiple lines with a single
call. This works fine except the line spacing is really tight and I wish I
could set a bigger line spacing. Does anyone know if this is
possible? Thanks for your time.

Currently not, the pad between the newline is hard coded, but we could
expose it as a parameter w/o too much work.

It looks to me like it is all in the text._get_layout() method, where a 2-pixel pad is specified in one place, and an additional 3-pixel pad in another; both seem to be used for vertical spacing, so it is 5 pixels.

Certainly for line spacing, and probably in other places related to text positioning, I would think pads usually should be in fractions of the font size, not fixed numbers of pixels. Comments?

Unless someone else would like to do it, I can take care of this at least as far as putting an rcParam entry for inter-line spacing as a fraction of font height, and a corresponding kwarg in Text and TextWithDash.

Eric

···

On 7/10/07, Jianfu Pan <Jianfu.Pan@...245...> wrote:

My first thought is that it should be in points, but I'm open to
arguments that it should be a fraction of font size. It should
definitely not be in pixels -- wonder what fool wrote that :slight_smile:

JDH

···

On 7/10/07, Eric Firing <efiring@...202...> wrote:

John Hunter wrote:

It looks to me like it is all in the text._get_layout() method, where a
2-pixel pad is specified in one place, and an additional 3-pixel pad in
another; both seem to be used for vertical spacing, so it is 5 pixels.

Certainly for line spacing, and probably in other places related to text
positioning, I would think pads usually should be in fractions of the
font size, not fixed numbers of pixels. Comments?

John Hunter wrote:

John Hunter wrote:

It looks to me like it is all in the text._get_layout() method, where a
2-pixel pad is specified in one place, and an additional 3-pixel pad in
another; both seem to be used for vertical spacing, so it is 5 pixels.

Certainly for line spacing, and probably in other places related to text
positioning, I would think pads usually should be in fractions of the
font size, not fixed numbers of pixels. Comments?

My first thought is that it should be in points, but I'm open to
arguments that it should be a fraction of font size. It should
definitely not be in pixels -- wonder what fool wrote that :slight_smile:

JDH

John,

My argument for fraction of font size is that this is the norm for setting text; in a word processor, or in LaTeX (preferred, of course), when you increase the font size, the physical spacing between lines (and between characters) increases proportionally. Shouldn't it work the same way in a plot?

Eric

···

On 7/10/07, Eric Firing <efiring@...202...> wrote:

Well, if that's how latex does it, that's how we should do it too....
Thanks for the offer to add this -- shouldn't be too hard. I don't
mind also having an rc parameter for this, but probably a text
property will suffice.

JDH

···

On 7/10/07, Eric Firing <efiring@...202...> wrote:

My argument for fraction of font size is that this is the norm for
setting text; in a word processor, or in LaTeX (preferred, of course),