InfoPath - Auto Width Text Box

The textbox with auto width based on the value can be obtained as follows:

1)  Insert an expression box into your form

2)  Set the field you want to display in this text box

3)  Right-Click on expression box => Expression box Properties... => Display

4)  Uncheck "Wrap Text" option

5)  Go to Size tab => Remove the value in the Width

6)  Click Apply

7)  Publish the form and test the output.