An question about paintListBoxItem function in FontsDemo.h file!



expanded (-4, 50)
I do not know what the 50 is standing for.
I can change 50 to 5000, there is no effect changing in UI. I can change 50 to arbitrary number, and the UI makes no difference!
os : windows 8.
update: same problem in mac os!

Oh, I know :

the code just ignore the height! is this a bug or intended?


The method expanded returns an expanded rectangle, the first parameter is the horizontal amount to add to each side, the second is the vertical.

The -4 adds a horizontal margin (reducing using a negative number), but the 50 adds a huge safety margin. But you don’t see an effect, because the attributed string is centredLeft and the expand adds the same amount on top and on the bottom. Also the attributed string has a font size set (the sample uses height * 0.7f and the font name uses height * 0.5f).


oh, I see.
Thank you for the explanation!