GetGenerationSettings Alternative for TextMesh?

As per Unity’s recommendations for new projects for ongoing support, I am converting everything over to use TextMeshPro, but I’ve hit a bit of a wall.

I have a system that requires getting the width and height of the text space in character length.
Until now, I’ve been using the GetGenerationSettings using the following methods to calculate the maximum line length and height, but this settings method is absent in the TextMesh class and I can’t find any alternatives online.

static int GetMaxLineCount(Text text)
    {
        var textGenerator = new TextGenerator();
        var generationSettings = text.GetGenerationSettings(text.rectTransform.rect.size);
        var lineCount = 0;
        var s = new StringBuilder();
        while (true)
        {
            s.Append("\n");
            textGenerator.Populate(s.ToString(), generationSettings);
            var nextLineCount = textGenerator.lineCount;
            if (lineCount == nextLineCount) break;
            lineCount = nextLineCount;
        }
        return lineCount;
    }

    static int GetMaxLineLength(Text text)
    {
        var textGenerator = new TextGenerator();
        var generationSettings = text.GetGenerationSettings(text.rectTransform.rect.size);
        var charCount = 0;
        var s = new StringBuilder();
        while (true)
        {
            s.Append("A");
            textGenerator.Populate(s.ToString(), generationSettings);
            var nextLineCount = textGenerator.characterCount;
            if (charCount == nextLineCount) break;
            charCount = nextLineCount;
        }
        return charCount;
    }

Is there a built-in method that returns the TextGenerationSettings or am I out of luck? Should I just stick with the legacy Text component for this?

According to everything I’m seeing, Unity says TMPro has everything Text has and more. as far as size, and if UI the container looks like it’s:
https://docs.unity.cn/Packages/com.unity.textmeshpro@3.2/manual/Settings.html
TextMeshPro UI Set the default size of text containers for new TextMesh Pro UI GameObjects, in Unity units.”
And the component is called “TMP_Settings”.

I don’t see anything particular for line count though.

found line count:
https://docs.unity3d.com/Packages/com.unity.textmeshpro@1.1/api/TMPro.TMP_TextInfo.html

Ah wonderful, I totally missed this, thank you so much!