using caption, the text will never be too long as you specified a given width and let IM make the height as big as needed. The only issue might be if your width is too small to fit a single word given your pointsize specification.
I had not noticed the number of digits in the hex value, but I think you need to specify it according the IM specs at
http://www.imagemagick.org/script/color.php
I had not noticed, but I do get an error message after the verbose info: about
convert: unable to open image `#12345': No such file or directory @ error/blob.c/OpenBlob/2589.
convert: no decode delegate for this image format `#12345' @ error/constitute.c/ReadImage/532.
Which is probably complaining about the the number of digits.
Doing it properly with one more digit gives no error message:
convert \( -background none -pointsize 12 -font Fonts/font.ttf -size 100x -fill '#123456' -gravity North caption:'text' \) -verbose info:
And the verbose information shows:
Geometry: 100x14+0+0
This matches the actual size generated from:
convert \( -background none -pointsize 12 -font Fonts/font.ttf -size 100x -fill '#123456' -gravity North caption:'text' \) tmp.png
identify tmp.png
tmp.png PNG 100x14 100x14+0+0 8-bit PseudoClass 2c 240B 0.000u 0:00.000
What version of IM are you using and what platform? Perhaps your IM needs upgrading?
Note that caption has recently been changed to support Pango. But there are bug reports when using Pango. See
viewtopic.php?f=3&t=19868