Using gnuplot 5.2 patchlevel 7, and those before, I have often found that "set key title 'hello' box" would result in a strange choice for the size of the box drawn around 'hello'. Sometimes the line of the box would go through the title. Increasing 'spacing' or 'height' work perfectly for the key elements, but does not affect the size of the title box, perhaps rightly. I hoped that "title '{/=20 hello'}" would increase the size of the box around 'hello', but only the font increased, not the box, resulting in lines going through 'hello'. I often use subscripts and superscripts in the key titles, but have to avoid using the key box option beacuse the lines will go through the key title. Some control of the box size around the key title would be helpful.
I don't think this is a problem in general, so please tell us what terminal you are using and what font it selects by default.
It might also help diagnose the problem if issue the "test" command in that same terminal and inspect the text in the center and the two surrounding boxes, one solid the other empty. This compares two ways of estimated text size.
using x11, try:
gnuplot> set key title '{/=20 sin(x)}' box
gnuplot> p sin(x)
My apologies. I misunderstood. I thought you were referring to the plot title, despite that you did say "key title". You are quite corrent. The key box is generated as a single thing and makes no allowance for font variation within the various key elements. There is no general mechanism at present for drawing a box around a larger grouping of multiple text elements. The only workaround I can suggest is to add manual markup, in this case extra linefeeds:
set key title "\n{/=20 sin(x)}\n" box
Last edit: Ethan Merritt 2019-12-08
Fixed, or at least improved, for the development version and something of the sort will be in 5.4.