Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 12:31:53 +0000



[Programming Help] - ACSIL/drawing text : How to know the font height in pixels ?

View Count: 6181

[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
[2022-04-08 01:23:05]
Tony - Posts: 519
I don't think we have access to that number (I could be wrong though), one possible solution is setting an input value instead of a constant one, if you want to make your study more general purpose.
[2023-08-05 07:56:25]
daniel.lee - Posts: 3
hello do you have a solution yet?

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account