Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 14:40:04 +0000



Post From: ACSIL/drawing text : How to know the font height in pixels ?

[2022-04-07 15:45:08]
Trader & Sierra++ developer - Posts: 109
Hi,

I need to draw several lines of text one above the other. The ability to draw a single multiline text with \n is not what I'm looking for.

To do this accurately i'm working in pixels, using sc.StudyRegionBottomCoordinate and sc.StudyRegionTopCoordinate, then I convert to a price value using sc.YPixelCoordinateToGraphValue() so that I can set Tool.BeginValue to the appropriate value.

This is ok but I need to control the vertical distance between two lines, so I need the information of the height in pixels of a line of text.

Currently I'm using a constant (set to 22 with the help of a print screen), but of course this is a temporary solution that works only on my computer and with my current FontSize settings.

How to retrieve the current font height or text line height in pixels ?

I didn't find anything about that in the documentation nor in the support board.

Thank you