| 178 | | text->setCharacterSize(40.0f); // tiny |
| 179 | | |
| 180 | | text->setText("text->setCharacterSize(40.0f); // big, but can go much bigger :-)"); |
| 181 | | geode->addDrawable(text); |
| 182 | | } |
| 183 | | |
| 184 | | |
| 185 | | |
| 186 | | if (0) |
| 187 | | { |
| 188 | | osgText::Text* text2 = new osgText::Text; |
| 189 | | text2->setPosition(osg::Vec3(0.0f,50.0f,0.0f)); |
| 190 | | text2->setCharacterSize(12.0f); |
| 191 | | text2->setText("10 PRINT \"Hello World\""); |
| 192 | | geode->addDrawable(text2); |
| 193 | | |
| 194 | | osgText::Text* text3 = new osgText::Text; |
| 195 | | text3->setFont(osgText::readFontFile("fonts/arial.ttf")); |
| 196 | | text3->setPosition(osg::Vec3(100.0f,100.0f,0.0f)); |
| 197 | | text3->setText("This is a test of text AVAV/.|¬!£$%^&*() - fonts/arial.ttf"); |
| 198 | | geode->addDrawable(text3); |
| 199 | | |
| 200 | | osgText::Text* text4 = new osgText::Text; |
| 201 | | text4->setFont(osgText::readFontFile("fonts/times.ttf")); |
| 202 | | text4->setFontSize(128,128); |
| 203 | | text4->setPosition(osg::Vec3(200.0f,200.0f,0.0f)); |
| 204 | | text4->setLayout(osgText::Text::RIGHT_TO_LEFT); |
| 205 | | text4->setDrawMode(osgText::Text::TEXT|osgText::Text::ALIGNMENT|osgText::Text::BOUNDINGBOX); |
| 206 | | text4->setText("This is a test of text AVAV/.|¬!£$%^&*() - fonts/times.ttf"); |
| 207 | | geode->addDrawable(text4); |
| 208 | | |
| 209 | | osgText::Text* text5 = new osgText::Text; |
| 210 | | text5->setFont(osgText::readFontFile("fonts/dirtydoz.ttf")); |
| 211 | | text5->setPosition(osg::Vec3(300.0f,300.0f,0.0f)); |
| 212 | | text5->setColor(osg::Vec4(1.0f,0.0f,0.0f,1.0f)); |
| 213 | | text5->setLayout(osgText::Text::VERTICAL); |
| 214 | | text5->setDrawMode(osgText::Text::TEXT|osgText::Text::ALIGNMENT|osgText::Text::BOUNDINGBOX); |
| 215 | | text5->setText("This is a test of text AVAV/.|¬!£$%^&*() - fonts/dirtydoz.ttf"); |
| 216 | | geode->addDrawable(text5); |
| 217 | | } |
| 218 | | |
| 219 | | // osgText::Text::TextString string; |
| 220 | | // for(int i=0;i<2048;++i) |
| 221 | | // string.push_back(i); |
| 222 | | // |
| 223 | | // osgText::Text* text6 = new osgText::Text; |
| 224 | | // text6->setFont(osgText::readFontFile("/home/robert/Documents/GuopingSun/msmincho.ttc")); |
| 225 | | // text6->setFontSize(64,64); |
| 226 | | // text6->setText(string); |
| 227 | | // text6->setPosition(osg::Vec3(00.0f,400.0f,0.0f)); |
| 228 | | // geode->addDrawable(text6); |
| 229 | | |
| 230 | | |
| 231 | | |
| 232 | | |
| 233 | | osg::Group* rootNode = new osg::Group; |
| 234 | | rootNode->addChild(geode); |
| 235 | | |
| | 185 | text->setCharacterSize(60.0f); // large |
| | 186 | |
| | 187 | text->setText("text->setCharacterSize(60.0f); // large"); |
| | 188 | geode->addDrawable(text); |
| | 189 | } |
| | 190 | |
| | 191 | |
| | 192 | cursor.x() = 500; |
| | 193 | cursor.y() = margin; |
| | 194 | |
| | 195 | osg::Sequence* sequence = new osg::Sequence; |
| | 196 | |
| | 197 | sequence->setMode(osg::Sequence::START); |
| | 198 | sequence->setInterval(osg::Sequence::LOOP, 0, -1); |
| | 199 | sequence->setDuration(1.0f, -1); |
| | 200 | |
| | 201 | // osg::Group* sequence = new osg::Group; |
| | 202 | // rootNode->addChild(sequence); |
| | 203 | |
| | 204 | { |
| | 205 | for(unsigned int i=osgText::Text::LEFT_TOP;i<=osgText::Text::BASE_LINE;i++) |
| | 206 | { |
| | 207 | osg::Geode* alignmentGeode = new osg::Geode; |
| | 208 | sequence->addChild(alignmentGeode); |
| | 209 | sequence->setTime(i, 1.0f); |
| | 210 | |
| | 211 | osgText::Text* text = new osgText::Text; |
| | 212 | text->setFont(font); |
| | 213 | text->setColor(characterSizeColor); |
| | 214 | text->setPosition(cursor); |
| | 215 | text->setDrawMode(osgText::Text::TEXT|osgText::Text::ALIGNMENT|osgText::Text::BOUNDINGBOX); |
| | 216 | |
| | 217 | text->setAlignment((osgText::Text::AlignmentType)i); |
| | 218 | |
| | 219 | text->setText("text->setAlignment();"); |
| | 220 | alignmentGeode->addDrawable(text); |
| | 221 | |
| | 222 | cursor.y() += 40.0f; |
| | 223 | |
| | 224 | |
| | 225 | } |
| | 226 | |
| | 227 | } |
| | 228 | rootNode->addChild(sequence); |
| | 229 | |