[osg-users] osgText inconsistant size
    Romain Ouabdelkader 
    romain.ouabdelkader at gmail.com
       
    Wed Jan  6 10:16:48 PST 2016
    
    
  
Hi,
I have discovered an issue with osgText: under certain conditions,
Text::getBoundingBox() returns different values with the same text, font,
font resolution, etc.
You can reproduce the issue with this example:
int main() {
  const char *font_path = "museo500.ttf";
  osg::ref_ptr<osgText::Text> text0 = new osgText::Text;
  text0->setFont(font_path);
  text0->setFontResolution(128, 128);
  text0->setText("V");
  text0->setText("a");
  osg::ref_ptr<osgText::Text> text1 = new osgText::Text;
  text1->setFont(font_path);
  text1->setText("p");
  text0->setText("Va");
  float first_call = text0->getBoundingBox().xMax();
  text0->setText("c");
  text0->setText("Va");
  float second_call = text0->getBoundingBox().xMax();
  std::cout << first_call << std::endl;
  std::cout << second_call << std::endl;
  if (first_call != second_call) {
    std::cout << "Error!" << std::endl;
    return 1;
  }
  return 0;
}
Output:
36.4961
35.9961
Error!
The issue seems to be very specific, if I remove any of these lines the
issue doesn't appear.
I've attached the font if you want to reproduce it.
Regards,
Romain Ouabdelkader.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20160106/4d10ef53/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: museo500.ttf
Type: application/x-font-ttf
Size: 128172 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20160106/4d10ef53/attachment-0001.bin>
    
    
More information about the osg-users
mailing list