How to get the default fontSize used on TextElement

Hi, is there any similar api like EditorGUIUtility.singleLineHeight for a font size on a TextElement?
Note, this is for custom editor, so we’d like for the font size to be consistent between multiple displays for a use case such as this:

var label = new Label{text = "first line text + "\n" + "<size=8>second line text</size>""};

/////////will be displayed as : //////////
first line text
second line test // but smaller due to custom font size tag used

Now after we switched to a different pc with a different resolution, custom size there way waaaay off due to different default fontSize.

If we know the default size used for the fontSize then we can just do our own math pretty easily. So how can we fix this?

thanks in advance.
~cheers

Hi @stevphie123 , internally, we use the following to compute the lineHeight.

fontAsset.faceInfo.lineHeight / fontAsset.faceInfo.pointSize * fontSize;

Let me know if this is what you were looking for.

1 Like

that works :), thanks!

1 Like