Modifying the distance between lines (\n) in DirectLabel

When working with DirectLabels, I’ve run into a configuration issue which seems unsupported:

Is it possible to change the distance between two lines of text in one DirectLabel?

If I create the label like this:

dl = DirectLabel(text="Sample \n Text",
                                  text_fg = (1, 1, 1, 1),
                                  relief = FLAT,
                                  frameColor = (.8, .8, .8, .2),
                                  text_pos=(-1.2, .90),
                                  text_scale=(0.05, 0.05),
                                  text_align=TextNode.ALeft,
                                  pad = (.05,.05))

The vertical distance seems to be only affected by changing either the scale or the text_scale, which both affect the scale of the text itself as well. I haven’t been able to find anything applicable in OnscreenText.py or any other relevant file or manual entry (like this one or this one). Is there any way to do this, that does not involve creating a vertically distorted font?

Thanks,
Roel

Of course there is a way through embedding text properties, at font level.

tpLHeight = TextProperties()
tpLHeight.getFont().setLineHeight(.5)   # set the desired lineheight

tpMgr = TextPropertiesManager.getGlobalPtr()
tpMgr.setProperties("Lheight", tpLHeight)

dl = DirectLabel(text="\1Lheight\1Sample \n Text",.....

Have fun !

Hey thank :slight_smile:

This was exactly what I was looking for :slight_smile: – I didn’t consider the fact that extended use of these tags included lineHeight. Great!

Roel