how to change width of box when input sprites? TextMeshPro.preferedWidth doesn't work well with sprite assets, is there any solution for that?

hey guys, I’m try to make a chat box with the sprite asset in TMPro, to show something like that
the text in the box is “Hey,guys!< sprite = “emoji” index=1>”

I have some code to control the chat box’s width

 float height = Text.preferredHeight + 56;
 float width = Text.preferredWidth + 37.4f + 37.4f;
 box_transform.sizeDelta = new Vector2(width, height);

the problem is when I change the scale of the emoji, what I actually need to do, the preferedHeight didn’t change, cause a terrible result like this
Is there any way to get a right preferedWidth when i change the scale of the emoji? any help would be greatly appreciated!

I finnal calculate the width manually to fix this problem, but i still think there should be a better and smarter way to solve it.