### ImageMagick version

7.1.1

### Operating system

Windows

### Operating system, version and so on

Windows 11

### Description

& "magick.exe" -size 1400x600 -font "Comfortaa-Medium.ttf" -gravity center -fill black caption:"CONSPIRACY THEORY WITH JESSE VENTURA" -format "%[caption:pointsize]" info:

returns a size of 161

Which then when applied to the poster with:

"magick.exe" "Conspiracy Theory with Jesse Ventura (2009) _imdb-tt1572498_.jpg" -gravity center -background None -layers Flatten ( -font "Comfortaa-Medium.ttf" -pointsize "161" -fill "white" -size "1400x600" -background none caption:"CONSPIRACY THEORY WITH JESSE VENTURA" -trim -gravity south -extent "1400x600" ) -gravity south -geometry "+0+400" -quality 92% -composite "Conspiracy Theory with Jesse Ventura (2009) _imdb-tt1572498_-out.jpg"

gives you:
![Conspiracy_Theory_with_Jesse_Ventura_2009__imdb-tt1572498_](https://github.com/ImageMagick/ImageMagick/assets/12549033/6ef2bc43-4199-4055-9478-c2deabb3b4c7)

Here are some other values when we just adjust text string slightly and see how the value changed significantly:
![image (1)](https://github.com/ImageMagick/ImageMagick/assets/12549033/524ecfc1-b5cb-46a8-bc65-e941529c19af)

Also adjusting the box by 1 or 2 pixels will also fix the issue. 

As we are creating thousands of text overlay images, we encounter this problem. There is also a similar issue whereby the returned value is way too small (47) for when we want to perform the same caption command for the following text: "THE LORD OF THE RINGS: THE FELLOWSHIP OF THE RING". It should be around 106

& "magick" -size 1200x485 -font "Comfortaa-Medium.ttf" -gravity center -fill black caption:"THE LORD OF THE RINGS: THE FELLOWSHIP OF THE RING" -format "%[caption:pointsize]" info:
![LOTR](https://github.com/ImageMagick/ImageMagick/assets/12549033/aa620880-e248-4a4b-8a0a-7772d757f585)

[Comfortaa-Medium.zip](https://github.com/ImageMagick/ImageMagick/files/15269633/Comfortaa-Medium.zip)


### Steps to Reproduce

Steps outlined above

### Images

images and font shown above
Using caption: to perform a "best fit" is not always working and causes text truncation
This is a GitHub Issue
repo:ImageMagick
owner:ImageMagick
Title : Using caption: to perform a "best fit" is not always working and causes text truncation
Issue date:

--- start body ---
### ImageMagick version

7.1.1

### Operating system

Windows

### Operating system, version and so on

Windows 11

### Description

& "magick.exe" -size 1400x600 -font "Comfortaa-Medium.ttf" -gravity center -fill black caption:"CONSPIRACY THEORY WITH JESSE VENTURA" -format "%[caption:pointsize]" info:

returns a size of 161

Which then when applied to the poster with:

"magick.exe" "Conspiracy Theory with Jesse Ventura (2009) _imdb-tt1572498_.jpg" -gravity center -background None -layers Flatten ( -font "Comfortaa-Medium.ttf" -pointsize "161" -fill "white" -size "1400x600" -background none caption:"CONSPIRACY THEORY WITH JESSE VENTURA" -trim -gravity south -extent "1400x600" ) -gravity south -geometry "+0+400" -quality 92% -composite "Conspiracy Theory with Jesse Ventura (2009) _imdb-tt1572498_-out.jpg"

gives you:
![Conspiracy_Theory_with_Jesse_Ventura_2009__imdb-tt1572498_](https://github.com/ImageMagick/ImageMagick/assets/12549033/6ef2bc43-4199-4055-9478-c2deabb3b4c7)

Here are some other values when we just adjust text string slightly and see how the value changed significantly:
![image (1)](https://github.com/ImageMagick/ImageMagick/assets/12549033/524ecfc1-b5cb-46a8-bc65-e941529c19af)

Also adjusting the box by 1 or 2 pixels will also fix the issue. 

As we are creating thousands of text overlay images, we encounter this problem. There is also a similar issue whereby the returned value is way too small (47) for when we want to perform the same caption command for the following text: "THE LORD OF THE RINGS: THE FELLOWSHIP OF THE RING". It should be around 106

& "magick" -size 1200x485 -font "Comfortaa-Medium.ttf" -gravity center -fill black caption:"THE LORD OF THE RINGS: THE FELLOWSHIP OF THE RING" -format "%[caption:pointsize]" info:
![LOTR](https://github.com/ImageMagick/ImageMagick/assets/12549033/aa620880-e248-4a4b-8a0a-7772d757f585)

[Comfortaa-Medium.zip](https://github.com/ImageMagick/ImageMagick/files/15269633/Comfortaa-Medium.zip)


### Steps to Reproduce

Steps outlined above

### Images

images and font shown above
--- end body ---
