label.drawInto gives different line height

I’m using a label and drawInto in a canvas to export my PNG files. Everything is working except the line height is different from what i would expect. Even though I have an identical canvas and label in the user interface, the canvas I’m using for the Picture export is putting more space between lines and bumping the text off the bottom of the label. All basic settings for both the canvas and the label are exactly the same and the canvas and label for the export is using the same settings as the one in the user interface. I couldn’t find a way to control the line height in the LR and I don’t know why it would be different.

canvas3 is the export canvas. captionLabel is the one in the user interface and captionLabel1 is the one used for the export in canavas3:

[code]captionLabel1.text = caption
captionLabel1.textColor = captionLabel.textColor
captionLabel1.textSize = captionLabel.textSize
captionLabel1.height = captionlabel.height
captionLabel1.left = captionLabel.left
captionLabel1.width = captionLabel.width

p.graphics.ForeColor = RGB(c.red,c.green,c.blue,opacity)
g.FillRect(0, 0, Me.Width, Me.Height)
p.graphics.fillRect(0,0,app.backgroundWidth,app.backgroundHeight)

captionLabel1.DrawInto(p.Graphics, (canvas3.width-captionLabel1.width)/2,(canvas3.height-captionLabel1.height)/2)
[/code]

make sure you clone all the property settings - text size, text unit, etc
that said by clone everything and not just use drawinto with captionLabel ?

i tried setting captionLabel1.TextUnit = FontUnits.Pixel but it made the text a lot smaller when it exported. Both were set to pixels.
All other settings are exact as to the interface, in fact it accesses its properties.

i tried all different options for TextUnit. nothing seemed to do the trick.

Are you seeing this on TargetWindows, TargetMacOS, TargetLinux - or all of them?

My suspiction (*) is that you are seeing this on Windows… And if this really is about Windows… then read this post.
Be aware that the Label (a Control) is being GDI (compatible) rendered.

captionLabel1.DrawInto(p.Graphics

So this question is: how did you create the p which you’re drawing into? Is p.Graphics a GDI rendering context, or a Direct2D rendering context?
Try to draw into a Picture with GDI rendering: New Picture(width,height,32) Note: the 3rd param is what makes the difference - again: read the other post. For HiDPI/Retina support, set then the Picture’s .ScaleX/Y appropriately. What happens if you then .DrawInto a Picture created like this (GDI)? It should render the same as the Label.

(*) In your attached Picture, the Text above looks “crisp” (GDI), the Text below looks “blurry” (Direct2D). Seems like a different rendering-type, e.g. differences in character-widths. So that’s why this is my suspiction.

This is a mac only app.

Dim p As New Picture(app.backgroundWidth, app.backgroundHeight)

The text in the image below is being added to a movie and therefore loses some quality when the new movie is rendered. Probably also why there is a difference in the background color. More worried about the line spacing right now though.

Maybe I should try using textArea.drawInto instead. It looks like there is a lineheight property there that doesn’t exist with label.drawInto.

Or just Graphics.DrawText where you have complete control over how it draws. Just sayin’.

I thought using label or text area might simplify centering the text and auto-wrapping it too.

doesn’t look like I can have a translucent or transparent backColor with a textArea though. Might have to go back to Graphics.DrawText after all.

DrawText will handle wrapping for you as well.