Exemplo n.º 1
0
GLFont::GLFont(const char* fontName)
	:firstCharacter(0),numCharacters(0),maxAscent(0),maxDescent(0),
	 maxLeftLap(0),maxRightLap(0),characters(0),
	 numRasterLines(0),rasterLines(0),
	 numSpans(0),spans(0),
	 fontHeight(0),textureHeight(0),
	 textHeight(1.0),hAlignment(Left),vAlignment(Baseline),
	 antialiasing(false)
	{
	/* Read the font from file: */
	char fontFileName[1024];
	try
		{
		/* Try given directory first: */
		snprintf(fontFileName,sizeof(fontFileName),"%s.fnt",fontName);
		Misc::File fontFile(fontFileName,"rb",Misc::File::LittleEndian);
		loadFont(fontFile);
		return;
		}
	catch(...)
		{
		/* Ignore the error and continue: */
		}
	
	/* Try GL font directory set in environment next: */
	if(getenv("GLFONTDIR")!=0)
		{
		try
			{
			/* Try the GLFONTDIR directory next: */
			snprintf(fontFileName,sizeof(fontFileName),"%s/%s.fnt",getenv("GLFONTDIR"),fontName);
			Misc::File fontFile(fontFileName,"rb",Misc::File::LittleEndian);
			loadFont(fontFile);
			return;
			}
		catch(...)
			{
			/* Ignore the error and continue: */
			}
		}
	
	try
		{
		/* Try system-wide GL font directory last: */
		snprintf(fontFileName,sizeof(fontFileName),"%s/%s.fnt",SYSGLFONTDIR,fontName);
		Misc::File fontFile(fontFileName,"rb",Misc::File::LittleEndian);
		loadFont(fontFile);
		return;
		}
	catch(...)
		{
		/* Ignore the error and continue: */
		}
	
	/* Give up: */
	Misc::throwStdErr("GLFont::GLFont: Font %s not found",fontName);
	}
Exemplo n.º 2
0
Font::Font(FontName fontName)
	: characters()
{
	// Load the font file for this font name.
	const std::string &filename = FontFilenames.at(fontName);
	FontFile fontFile(filename);

	const int elementHeight = fontFile.getHeight();
	this->characterHeight = elementHeight;

	// There are 95 characters, plus space.
	this->characters.resize(96);

	// Create an SDL surface for each character image. Start with space (ASCII 32), 
	// and end with delete (ASCII 127).
	for (int i = 0; i < 96; ++i)
	{
		const char c = i + 32;
		const int elementWidth = fontFile.getWidth(c);
		const uint32_t *elementPixels = fontFile.getPixels(c);

		SDL_Surface *surface = Surface::createSurfaceWithFormat(elementWidth,
			elementHeight, Renderer::DEFAULT_BPP, Renderer::DEFAULT_PIXELFORMAT);

		uint32_t *pixels = static_cast<uint32_t*>(surface->pixels);
		const int pixelCount = surface->w * surface->h;

		for (int index = 0; index < pixelCount; ++index)
		{
			pixels[index] = elementPixels[index];
		}

		this->characters.at(i) = surface;
	}
}
Exemplo n.º 3
0
bool QWebOSFontDatabase::createFileWithFontData(QString& fileName, const QByteArray &fontData)
{
    QDir fontDir(appFontDir());
    if (!fontDir.mkpath(fontDir.path())) {
        qDebug("Couldn't make directory (%s) to hold application fonts", qPrintable(fontDir.path()));
        return false;
    }
    QByteArray fontDataHash = QCryptographicHash::hash(fontData, QCryptographicHash::Sha1);
    fileName = appFontDir() + "/" + QString(fontDataHash.toHex()) + ".fnt";

    QFile fontFile(fileName);
    if (!fontFile.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
        qDebug("Couldn't open font file (%s) to store the font data", qPrintable(fileName));
        return false;
    }

    qint64 bytesWritten = fontFile.write(fontData.constData(), fontData.size());
    fontFile.close();
    if (bytesWritten < 0) {
        qDebug("Error writing font data to %s", qPrintable(fileName));
        return false;
    } else if (bytesWritten < fontData.size()) {
        qDebug("Wrote %d bytes to %s.  Expected %d.", bytesWritten, qPrintable(fileName), fontData.size());
        return false;
    }

    return true;
}
Exemplo n.º 4
0
Font* Font::load(const QString& family) {
    if (!LOADED_FONTS.contains(family)) {

        static const QString SDFF_COURIER_PRIME_FILENAME{ ":/CourierPrime.sdff" };
        static const QString SDFF_INCONSOLATA_MEDIUM_FILENAME{ ":/InconsolataMedium.sdff" };
        static const QString SDFF_ROBOTO_FILENAME{ ":/Roboto.sdff" };
        static const QString SDFF_TIMELESS_FILENAME{ ":/Timeless.sdff" };

        QString loadFilename;

        if (family == MONO_FONT_FAMILY) {
            loadFilename = SDFF_COURIER_PRIME_FILENAME;
        } else if (family == INCONSOLATA_FONT_FAMILY) {
            loadFilename = SDFF_INCONSOLATA_MEDIUM_FILENAME;
        } else if (family == SANS_FONT_FAMILY) {
            loadFilename = SDFF_ROBOTO_FILENAME;
        } else {
            if (!LOADED_FONTS.contains(SERIF_FONT_FAMILY)) {
                loadFilename = SDFF_TIMELESS_FILENAME;
            } else {
                LOADED_FONTS[family] = LOADED_FONTS[SERIF_FONT_FAMILY];
            }
        }

        if (!loadFilename.isEmpty()) {
            QFile fontFile(loadFilename);
            fontFile.open(QIODevice::ReadOnly);

            qCDebug(renderutils) << "Loaded font" << loadFilename << "from Qt Resource System.";

            LOADED_FONTS[family] = load(fontFile);
        }
    }
    return LOADED_FONTS[family];
}
Exemplo n.º 5
0
Arquivo: SDL2.cpp Projeto: craley/Poky
        void SDL2::LoadFont(Gwen::Font* font)
        {
            font->realsize = font->size*Scale();
            std::string fontFile(font->facename);

            if (fontFile.find(".ttf") == std::string::npos)
                fontFile += ".ttf";

            TTF_Font *tfont = TTF_OpenFont(fontFile.c_str(), font->realsize);
            if (!tfont)
            {
                printf("Font load error: %s\n", TTF_GetError());
            }            
            
            font->data = tfont;
        }
Exemplo n.º 6
0
static bool loadFontFace(const std::string& _fontname, int _fontSize, FT_Face & face, std::string& filename){
	std::string fontname = _fontname;
	filename = ofToDataPath(fontname,true);
	ofFile fontFile(filename,ofFile::Reference);
	int fontID = 0;
	if(!fontFile.exists()){
#ifdef TARGET_LINUX
		filename = linuxFontPathByName(fontname);
#elif defined(TARGET_OSX)
		if(fontname==OF_TTF_SANS){
			fontname = "Helvetica Neue";
			fontID = 4;
		}else if(fontname==OF_TTF_SERIF){
			fontname = "Times New Roman";
		}else if(fontname==OF_TTF_MONO){
			fontname = "Menlo Regular";
		}
		filename = osxFontPathByName(fontname);
#elif defined(TARGET_WIN32)
		if(fontname==OF_TTF_SANS){
			fontname = "Arial";
		}else if(fontname==OF_TTF_SERIF){
			fontname = "Times New Roman";
		}else if(fontname==OF_TTF_MONO){
			fontname = "Courier New";
		}
        filename = winFontPathByName(fontname);
#endif
		if(filename == "" ){
			ofLogError("ofTrueTypeFont") << "loadFontFace(): couldn't find font \"" << fontname << "\"";
			return false;
		}
		ofLogVerbose("ofTrueTypeFont") << "loadFontFace(): \"" << fontname << "\" not a file in data loading system font from \"" << filename << "\"";
	}
	FT_Error err;
	err = FT_New_Face( library, filename.c_str(), fontID, &face );
	if (err) {
		// simple error table in lieu of full table (see fterrors.h)
		string errorString = "unknown freetype";
		if(err == 1) errorString = "INVALID FILENAME";
		ofLogError("ofTrueTypeFont") << "loadFontFace(): couldn't create new face for \"" << fontname << "\": FT_Error " << err << " " << errorString;
		return false;
	}

	return true;
}
Exemplo n.º 7
0
        void SDL2Renderer::LoadFont(Gwen::Font* font)
        {
            std::wstring_convert<std::codecvt_utf8<wchar_t>> myconv;

            font->realsize = font->size*Scale();
            std::string fontFile(myconv.to_bytes(font->facename));

            if (fontFile.find(".ttf") == std::string::npos)
                fontFile += ".ttf";

            TTF_Font *tfont = TTF_OpenFont(fontFile.c_str(), font->realsize);
            if (!tfont)
            {
                printf("Font load error: %s\n", TTF_GetError());
            }            
            
            font->data = tfont;
        }
Exemplo n.º 8
0
/* Returns the line in place to draw
 * ARGS:
 *      arg 1: place -- varies from 1-11. Defines which line of letter to print
 * RETURN: a string from font text file that is to be printed
 */
std::string isoLetters::lineToDraw( int place ){
    std::ifstream fontFile( "fonts/isometric4.txt" );
    std::string line;
    if(!fontFile) std::cerr << "Could not open the file!" << std::endl;

    int ascii = this->letter - ASCII_BUF;
    int position = (ascii*MAXHEIGHT)+place;     // location to copy
    int count = 0;

    while( std::getline(fontFile, line) ){
        if( count == position ){
            fontFile.close();
            return line;
        }
        count++;
    }
    fontFile.close();
    return line;
}
Exemplo n.º 9
0
/* Prints out one line from the text font file of a letter
 * ARGS: 
 *      arg 1: place -- varies from 1-11. Defines which line of letter to print 
 */
void isoLetters::drawHoriz( int place ){
    std::ifstream fontFile( "fonts/isometric4.txt" );
    std::string line;

    if (!fontFile) std::cerr << "Could not open the file!" << std::endl;

    int ascii = this->letter - ASCII_BUF;
    int position = (ascii*MAXHEIGHT)+place;		// location to copy
    int count = 0;

    // copying line from font file into output file
    while( std::getline(fontFile, line) ){
    	if( count == position ){
    		std::cout<< line;
    		break;
    	}
    	count++;
    }
    fontFile.close();
}
Exemplo n.º 10
0
std::shared_ptr<std::vector<unsigned char>> FontManager::loadFontFile(
		const std::string& fileName) const
{
	std::vector<unsigned char> data;

	std::ifstream fontFile(fileName, std::ios::binary | std::ios::in | std::ios::ate);

	if(!fontFile.is_open())
	{
		throw FileIoException(fileName, "Unable to open file");
	}
	size_t fileSize = fontFile.tellg();
	//Don't use std::make_shared here so the file data can be deallocated when the
	//reference count drops to 0, even if there are std::weak_ptrs still referring to the data.
	std::shared_ptr<std::vector<unsigned char>> fileData(new std::vector<unsigned char>(fileSize));
	fontFile.seekg(0, std::ios::beg);
	fontFile.read(reinterpret_cast<char*>(fileData->data()), fileSize);
	fontFile.close();
	return fileData;
}
Exemplo n.º 11
0
/* Prints out the line from font text file of a letter */
void isoLetters::drawVert(){
    std::ifstream fontFile( "fonts/isometric4.txt" );
    std::string line;

    if(!fontFile) std::cerr << "Could not open the file!" << std::endl;

    int ascii = this->letter - ASCII_BUF;
    int position = (ascii*MAXHEIGHT);
    int count = 0;
    
    while( std::getline(fontFile, line) ){
        if( count == position ){
            std::cout << line << std::endl;
            for( int i = 0; i < 10; i++ ){
                std::getline(fontFile, line);
                std::cout << line << std::endl;
            }
        } 
        count++;
    }
}
Exemplo n.º 12
0
bool FMPDFFontExtractor::write(const QString & name, QIODevice*  openedDevice)
{
	
	if(!mfont.contains(name))
		return false;
	
	PoDoFo::PdfObject * fontFile(mfont[name]);
	
	PoDoFo::PdfMemoryOutputStream outMemStream ( 1 );
	try
	{
		fontFile->GetStream()->GetFilteredCopy ( &outMemStream );
	}
	catch ( PoDoFo::PdfError & e )
	{
		qDebug() <<"Arg, unable to get a filtered copy of a fontfile stream";
		return false;
	}
	outMemStream.Close();

	QByteArray a(outMemStream.TakeBuffer(), outMemStream.GetLength());
	return (openedDevice->write(a) == outMemStream.GetLength());
	
}
Exemplo n.º 13
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent), mGraphicsScene(0), mFontPath("fonts/"),
    mFreeTypeInitialized(false), mRendering(false),
    mLibrary(0), mFace(0), mResourceFace(0), mRawGlyphString(0),
    mShapedGlyphString(0), mRawVisualizer(0), mShapedVisualizer(0),
    mShapedRenderer(0), ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    setWindowTitle("BidiRenderer");
    statusBar();

    loadSamples();
    ui->fontPathLE->setText(mFontPath);
    listFonts();

    ui->levelsColorPickerLabel->setColor(Qt::blue);
    mFontSize = ui->fontSizeSB->value();
    mPenWidth = ui->penWidthSB->value();
    ui->lineWidthSlider->setRange(mFontSize * 4, mFontSize * 40);
    ui->lineWidthSlider->setValue(mFontSize * 40);

    if (FT_Init_FreeType(&mLibrary)) {
        statusBar()->showMessage("Error initializing FreeType", messageTimeout);
        return;
    }
    mFreeTypeInitialized = true;

    QFile fontFile(":/files/fonts/DejaVuSans.ttf");
    if (fontFile.open(QIODevice::ReadOnly))
        mResourceFaceData = fontFile.readAll();

    if (FT_New_Memory_Face(mLibrary,
                           reinterpret_cast<const FT_Byte*>(mResourceFaceData.constData()),
                           fontFile.size(), 0, &mResourceFace))
    {
        statusBar()->showMessage("Error loading DejaVuSans.ttf", messageTimeout);
    }
    else
    {
        if (FT_Set_Pixel_Sizes(mResourceFace, 0, mFontSize)) {
            statusBar()->showMessage("Error setting font pixel size", messageTimeout);
            FT_Done_Face(mResourceFace);
            mResourceFace = 0;
        } else {
            mFace = mResourceFace;
        }
    }


    mGraphicsScene = new QGraphicsScene(this);
    ui->graphicsView->setScene(mGraphicsScene);

    connect(ui->actionE_xit, SIGNAL(triggered()), this, SLOT(close()));
    connect(ui->action_Panel, SIGNAL(toggled(bool)),
            ui->dockWidget, SLOT(setVisible(bool)));
    connect(ui->dockWidget, SIGNAL(visibilityChanged(bool)),
            ui->action_Panel, SLOT(setChecked(bool)));
    connect(ui->textCombo->lineEdit(), SIGNAL(returnPressed()),
            ui->renderButton, SLOT(animateClick()));
    connect(ui->renderButton, SIGNAL(clicked()), this, SLOT(render()));
    connect(ui->rtlRB, SIGNAL(clicked()), this, SLOT(render()));
    connect(ui->ltrRB, SIGNAL(clicked()), this, SLOT(render()));
    connect(ui->autoRB, SIGNAL(clicked()), this, SLOT(render()));
    connect(ui->resolveScriptsCB, SIGNAL(clicked()), this, SLOT(render()));
    connect(ui->breakRunsCB, SIGNAL(clicked()), this, SLOT(render()));

    connect(ui->linesCB, SIGNAL(clicked()), this, SLOT(setVisualizerFlags()));
    connect(ui->levelsCB, SIGNAL(clicked()), this, SLOT(setVisualizerFlags()));
    connect(ui->runsCB, SIGNAL(clicked()), this, SLOT(setVisualizerFlags()));
    connect(ui->codePointsCB, SIGNAL(clicked()), this, SLOT(setVisualizerFlags()));
    connect(ui->glyphIndicesCB, SIGNAL(clicked()), this, SLOT(setVisualizerFlags()));
    connect(ui->charTypesCB, SIGNAL(clicked()), this, SLOT(setVisualizerFlags()));
    connect(ui->scriptsCB, SIGNAL(clicked()), this, SLOT(setVisualizerFlags()));
    connect(ui->geometriesCB, SIGNAL(clicked()), this, SLOT(setVisualizerFlags()));
    connect(ui->indicesCB, SIGNAL(clicked()), this, SLOT(setVisualizerFlags()));
    connect(ui->reorderedIndicesCB, SIGNAL(clicked()), this, SLOT(setVisualizerFlags()));

    connect(ui->paragraphCB, SIGNAL(clicked()), this, SLOT(setRendererFlags()));
    connect(ui->levelsGB, SIGNAL(clicked()), this, SLOT(setRendererFlags()));
    connect(ui->runsGB, SIGNAL(clicked()), this, SLOT(setRendererFlags()));
    connect(ui->levelsColorPickerLabel, SIGNAL(colorChanged(QColor)),
            this, SLOT(setRendererLevelColor(QColor)));
    connect(ui->runsColorPickerLabel, SIGNAL(colorChanged(QColor)),
            this, SLOT(setRendererRunColor(QColor)));

    connect(ui->shapeHarfBuzzRB, SIGNAL(clicked()), this, SLOT(render()));
    connect(ui->shapeFriBidiRB, SIGNAL(clicked()), this, SLOT(render()));
    connect(ui->removeZeroWidthCB, SIGNAL(clicked()), this, SLOT(render()));
    connect(ui->shapeFriBidiRB, SIGNAL(toggled(bool)),
            ui->removeZeroWidthCB, SLOT(setEnabled(bool)));

    connect(ui->fontPathButton, SIGNAL(clicked()), this, SLOT(setFontPath()));
    connect(ui->fontsCombo, SIGNAL(currentIndexChanged(QString)),
            this, SLOT(setFontFile(QString)));
    connect(ui->zoomSlider, SIGNAL(valueChanged(int)),
            ui->graphicsView, SLOT(setScale(int)));
    connect(ui->graphicsView, SIGNAL(scaleChanged(int)),
            ui->zoomSlider, SLOT(setValue(int)));
    connect(ui->lineWidthSlider, SIGNAL(valueChanged(int)),
            this, SLOT(setMaxLineWidth(int)));
    connect(ui->fontSizeSB, SIGNAL(valueChanged(int)),
            this, SLOT(setFontSize(int)));
    connect(ui->fontColorPickerLabel, SIGNAL(colorChanged(QColor)),
            this, SLOT(render()));
    connect(ui->penWidthSB, SIGNAL(valueChanged(int)),
            this, SLOT(setPenWidth(int)));
}
void ReceiveCoinsDialog::loadBuyViewFinished(bool bOk)
{
#if defined(HAVE_WEBENGINE_VIEW) || defined(HAVE_WEBKIT)
    if (bOk) {
        if (buyReceiveAddress) {
            delete buyReceiveAddress;
            buyReceiveAddress = NULL;
        }

        buyReceiveAddress = new CReserveKey(pwalletMain, currentAccount, KEYCHAIN_EXTERNAL);
        CPubKey pubKey;
        QString guldenAddress;

        if (!buyReceiveAddress->GetReservedKey(pubKey)) {

            guldenAddress = "error";
        } else {
            CKeyID keyID = pubKey.GetID();
            guldenAddress = QString::fromStdString(CBitcoinAddress(keyID).ToString());
        }

        QString emailAddress = QString("");
        QString paymentMethod = QString("");
        QString paymentDetails = QString("");
#if defined(HAVE_WEBENGINE_VIEW)
        buyView->page()->runJavaScript(QString("NocksBuyFormFillDetails('%1', '%2')").arg(guldenAddress, emailAddress));
        buyView->page()->runJavaScript(QString("$('.extra-row').hide()"));
#else
        QVariant ret = buyView->page()->mainFrame()->evaluateJavaScript(QString("NocksBuyFormFillDetails('%1', '%2')").arg(guldenAddress, emailAddress));
        QString temp = ret.toString();
        buyView->page()->mainFrame()->evaluateJavaScript(QString("$('.extra-row').hide()"));
#endif

#if defined(HAVE_WEBENGINE_VIEW)
#if QT_VERSION < QT_VERSION_CHECK(5, 6, 2) || QT_VERSION == QT_VERSION_CHECK(5, 7, 0)
        buyView->page()->runJavaScript(QString("$('a[href]').attr('target', '_blank');"));
        buyView->page()->runJavaScript(QString("$('form').attr('target', '_blank');"));
#endif
#else
        buyView->page()->mainFrame()->evaluateJavaScript(QString("$('a[href]').attr('target', '_blank');"));
        buyView->page()->mainFrame()->evaluateJavaScript(QString("$('form').attr('target', '_blank');"));
#endif

        {
            QFile fontFile(":/Gulden/fontawesome");
            fontFile.open(QIODevice::ReadOnly);
            QString rawCSS = "@font-face{ font-family: FontAwesome;src: url(data:font/ttf;base64," + fontFile.readAll().toBase64() + ") format('truetype');";
            std::string encodedCSS = EncodeBase64(rawCSS.toStdString());
            QString insertFontScript = QString("(function() {") + "var parent = document.getElementsByTagName('head').item(0);" + "var style = document.createElement('style');" + "style.type = 'text/css';" + "style.innerHTML = window.atob('" + encodedCSS.c_str() + "');" + "parent.appendChild(style)" + "})()";
#if defined(HAVE_WEBENGINE_VIEW)
            buyView->page()->runJavaScript(insertFontScript);
#else
            buyView->page()->mainFrame()->evaluateJavaScript(insertFontScript);
#endif
        }

        ui->loadingAnimationLabel->setVisible(false);
        buyView->setVisible(true);
    } else {
        ui->loadingAnimationLabel->setText(tr("Error loading the buy page, please check your connection and try again later."));
        ui->loadingAnimationLabel->setVisible(true);
        buyView->setVisible(false);
    }
#endif
}
Exemplo n.º 15
0
int main(int argc, char** argv)
{
    osg::ArgumentParser arguments(&argc, argv);

    osgViewer::Viewer viewer(arguments);

    std::string fontFile("arial.ttf");
    while(arguments.read("-f",fontFile)) {}

    osg::ref_ptr<osgText::Font> font = osgText::readRefFontFile(fontFile);
    if (!font) return 1;
    OSG_NOTICE<<"Read font "<<fontFile<<" font="<<font.get()<<std::endl;

    std::string word("This is a new test.");
    while (arguments.read("-w",word)) {}

    osg::ref_ptr<osgText::Style> style = new osgText::Style;

    float thickness = 0.1f;
    while(arguments.read("--thickness",thickness)) {}
    style->setThicknessRatio(thickness);

    // set up any bevel if required
    float r;
    osg::ref_ptr<osgText::Bevel> bevel;
    while(arguments.read("--rounded",r)) { bevel = new osgText::Bevel; bevel->roundedBevel2(r); }
    while(arguments.read("--rounded")) { bevel = new osgText::Bevel; bevel->roundedBevel2(0.25); }
    while(arguments.read("--flat",r)) { bevel = new osgText::Bevel; bevel->flatBevel(r); }
    while(arguments.read("--flat")) { bevel = new osgText::Bevel; bevel->flatBevel(0.25); }
    while(arguments.read("--bevel-thickness",r)) { if (bevel.valid()) bevel->setBevelThickness(r); }


    if (bevel.valid())
    {
        while(arguments.read("--smooth-concave-Junctions") || arguments.read("--scj"))
        {
            bevel->setSmoothConcaveJunctions(true);
        }
    }


    style->setBevel(bevel.get());

    // set up outline.
    while(arguments.read("--outline",r)) { style->setOutlineRatio(r); }


    viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
    viewer.addEventHandler(new osgViewer::StatsHandler);

#if 1
    osg::ref_ptr<osg::Group> group = new osg::Group;

    float characterSize = 1.0f;
    while(arguments.read("--size",characterSize)) {}

    if (arguments.read("--2d"))
    {
        osgText::Text* text2D = new osgText::Text;
        text2D->setFont(font.get());
        text2D->setCharacterSize(characterSize);
        text2D->setFontResolution(256,256);
        text2D->setDrawMode(osgText::Text::TEXT | osgText::Text::BOUNDINGBOX);
        text2D->setAxisAlignment(osgText::Text::XZ_PLANE);
        text2D->setText(word);
        osg::Geode* geode = new osg::Geode;
        geode->addDrawable(text2D);
        group->addChild(geode);
    }

    if (arguments.read("--TextNode"))
    {
        // experimental text node
        osgText::TextNode* text = new osgText::TextNode;
        text->setFont(font.get());
        text->setStyle(style.get());
        text->setTextTechnique(new osgText::TextTechnique);
        text->setText(word);
        text->update();

        group->addChild(text);
    }
    else if (!arguments.read("--no-3d"))
    {
        osgText::Text3D* text3D = new osgText::Text3D;
        text3D->setFont(font.get());
        text3D->setStyle(style.get());
        text3D->setCharacterSize(characterSize);
        text3D->setDrawMode(osgText::Text3D::TEXT | osgText::Text3D::BOUNDINGBOX);
        text3D->setAxisAlignment(osgText::Text3D::XZ_PLANE);
        text3D->setText(word);

        osg::Geode* geode = new osg::Geode;
        geode->addDrawable(text3D);
        group->addChild(geode);

        osg::Vec4 color(1.0f, 1.0f, 1.0f, 1.0f);
        while(arguments.read("--color",color.r(),color.g(),color.b(),color.a()))
        {
            OSG_NOTICE<<"--color "<<color<<std::endl;
            text3D->setColor(color);
        }

        std::string imageFilename;
        while(arguments.read("--image",imageFilename))
        {
            OSG_NOTICE<<"--image "<<imageFilename<<std::endl;
            osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile(imageFilename);
            if (image.valid())
            {
                OSG_NOTICE<<"  loaded image "<<imageFilename<<std::endl;
                osg::StateSet* stateset = text3D->getOrCreateStateSet();
                stateset->setTextureAttributeAndModes(0, new osg::Texture2D(image), osg::StateAttribute::ON);
            }
        }

        while(arguments.read("--wall-color",color.r(),color.g(),color.b(),color.a()))
        {
            osg::StateSet* stateset = text3D->getOrCreateWallStateSet();
            osg::Material* material = new osg::Material;
            material->setDiffuse(osg::Material::FRONT_AND_BACK, color);
            stateset->setAttribute(material);
        }

        while(arguments.read("--wall-image",imageFilename))
        {
            osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile(imageFilename);
            if (image.valid())
            {
                osg::StateSet* stateset = text3D->getOrCreateWallStateSet();
                stateset->setTextureAttributeAndModes(0, new osg::Texture2D(image), osg::StateAttribute::ON);
            }
        }

        while(arguments.read("--back-color",color.r(),color.g(),color.b(),color.a()))
        {
            osg::StateSet* stateset = text3D->getOrCreateBackStateSet();
            osg::Material* material = new osg::Material;
            material->setDiffuse(osg::Material::FRONT_AND_BACK, color);
            stateset->setAttribute(material);
        }

        while(arguments.read("--back-image",imageFilename))
        {
            osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile(imageFilename);
            if (image)
            {
                osg::StateSet* stateset = text3D->getOrCreateBackStateSet();
                stateset->setTextureAttributeAndModes(0, new osg::Texture2D(image), osg::StateAttribute::ON);
            }
        }

        if (arguments.read("--size-quad"))
        {
            geode->addDrawable( osg::createTexturedQuadGeometry(osg::Vec3(0.0f,characterSize*thickness,0.0f),osg::Vec3(characterSize,0.0,0.0),osg::Vec3(0.0f,0.0,characterSize), 0.0, 0.0, 1.0, 1.0) );
        }
    }


    viewer.setSceneData(group);

#endif

    return viewer.run();
}