Hi, I found out ofTrueTypeFont::getSpaceSize() returns zero after loading the font. It only seemed to work once I manually set it with setSpaceSize().
I tried it with several fonts but the results were always the same.
cout << "First : " << font.getSpaceSize() << endl;
cout << "Second : " << font.getSpaceSize() << endl;
First : 0
Second : 20
Is there a specific reason why it returns zero after loading or could this be a bug?
space size is a legacy api cause in the past instead of using the real space size we used the size of a p (if i remember well) so we allowed to set the space size by yourself, when we moved to using the real space size as defined by the font we probably forgot to either remove this function or set it to the correct value when loading the font type.
you can figure out the size of the space using
font.getBoundingBox(" ",0,0).width but can you open an issue on github pointing to this post? thanks!
I tried your suggestion but it doesn’t seemed to be working correctly.
font.getStringBoundingBox(" ", 0.0f, 0.0f).width returns weird value.
Here’s my test code,
font.setSpaceSize(font.getStringBoundingBox(" ", 0.0f, 0.0f).width);
cout << font.getStringBoundingBox(" ", 0.0f, 0.0f).width << endl;
and the result is as below and I see no space between letters.
Could this be a bug ?