First cut of new osgText implementation.

This commit is contained in:
Robert Osfield
2003-03-02 21:05:05 +00:00
parent a826f5ee31
commit fbe674b321
71 changed files with 1933 additions and 7226 deletions

View File

@@ -0,0 +1,126 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include "FreeTypeFont.h"
#include FT_GLYPH_H
#include <osgDB/WriteFile>
FreeTypeFont::FreeTypeFont(const std::string& filename, FT_Face face):
_filename(filename),
_face(face)
{
}
void FreeTypeFont::setSize(unsigned int width, unsigned int height)
{
FT_Error error = FT_Set_Pixel_Sizes( _face, /* handle to face object */
width, /* pixel_width */
height ); /* pixel_height */
if (error)
{
std::cout<<"FT_Set_Pixel_Sizes() - error "<<error<<std::endl;
}
else
{
_width = width;
_height = height;
}
}
osgText::Font::Glyph* FreeTypeFont::getGlyph(unsigned int charcode)
{
// search for glyph amoungst existing glyphs.
GlyphMap::iterator itr = _glyphMap.find(charcode);
if (itr!=_glyphMap.end()) return itr->second.get();
FT_Error error = FT_Load_Char( _face, charcode, FT_LOAD_RENDER|FT_LOAD_NO_BITMAP );
if (error)
{
std::cout << "FT_Load_Char(...) error "<<error<<std::endl;
return 0;
}
FT_GlyphSlot glyphslot = _face->glyph;
int rows = glyphslot->bitmap.rows;
int width = glyphslot->bitmap.width;
int pitch = glyphslot->bitmap.pitch;
unsigned char* buffer = glyphslot->bitmap.buffer;
osg::ref_ptr<Glyph> glyph = new Glyph;
unsigned char* data = new unsigned char[width*rows*2];
glyph->setImage(width,rows,1,
GL_LUMINANCE_ALPHA,
GL_LUMINANCE_ALPHA,GL_UNSIGNED_BYTE,
data,
osg::Image::USE_NEW_DELETE,
1);
// copy image across to osgText::Glyph image.
for(int r=rows-1;r>=0;--r)
{
unsigned char* ptr = buffer+r*pitch;
for(int c=0;c<width;++c,++ptr)
{
(*data++)=255;
(*data++)=*ptr;
}
}
FT_Glyph_Metrics* metrics = &(glyphslot->metrics);
glyph->setFont(this);
glyph->setHorizontalBearing(osg::Vec2((float)metrics->horiBearingX/64.0f,(float)(metrics->horiBearingY-metrics->height)/64.0f)); // bottom left.
glyph->setHorizontalAdvance((float)metrics->horiAdvance/64.0f);
glyph->setVerticalBearing(osg::Vec2((float)metrics->vertBearingX/64.0f,(float)(metrics->vertBearingY-metrics->height)/64.0f)); // top middle.
glyph->setVerticalAdvance((float)metrics->vertAdvance/64.0f);
addGlyph(charcode,glyph.get());
return glyph.get();
}
osg::Vec2 FreeTypeFont::getKerning(unsigned int leftcharcode,unsigned int rightcharcode)
{
if (!FT_HAS_KERNING(_face)) return osg::Vec2(0.0f,0.0f);
// convert character code to glyph index
FT_UInt left = FT_Get_Char_Index( _face, leftcharcode );
FT_UInt right = FT_Get_Char_Index( _face, rightcharcode );
// get the kerning distances.
FT_Vector kerning;
FT_Error error = FT_Get_Kerning( _face, // handle to face object
left, // left glyph index
right, // right glyph index
ft_kerning_default, // kerning mode
&kerning ); // target vector
if (error)
{
return osg::Vec2(0.0f,0.0f);
}
return osg::Vec2((float)kerning.x/64.0f,(float)kerning.y/64.0f);
}
bool FreeTypeFont::hasVertical() const
{
return FT_HAS_VERTICAL(_face);
}

View File

@@ -0,0 +1,46 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef FREETYPE_FONT
#define FREETYPE_FONT 1
#include <osgText/Font>
#include <ft2build.h>
#include FT_FREETYPE_H
class FreeTypeFont : public osgText::Font
{
// declare the interface to a font.
public:
FreeTypeFont(const std::string& filename, FT_Face face);
virtual std::string getFileName() const { return _filename; }
virtual void setSize(unsigned int width, unsigned int height);
virtual osgText::Font::Glyph* getGlyph(unsigned int charcode);
virtual osg::Vec2 getKerning(unsigned int leftcharcode,unsigned int rightcharcode);
virtual bool hasVertical() const;
protected:
std::string _filename;
FT_Face _face;
};
#endif

View File

@@ -0,0 +1,57 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include "FreeTypeLibrary.h"
FreeTypeLibrary::FreeTypeLibrary()
{
FT_Error error = FT_Init_FreeType( &_ftlibrary );
if (error)
{
std::cout<<"Warning: an error occured during FT_Init_FreeType(..) initialisation .. "<<std::endl;
}
}
FreeTypeLibrary::~FreeTypeLibrary()
{
FT_Done_FreeType( _ftlibrary);
}
FreeTypeLibrary* FreeTypeLibrary::instance()
{
static FreeTypeLibrary s_library;
return &s_library;
}
FreeTypeFont* FreeTypeLibrary::getFont(const std::string& fontfile,unsigned int index)
{
FT_Face face; /* handle to face object */
FT_Error error = FT_New_Face( _ftlibrary, fontfile.c_str(), index, &face );
if (error == FT_Err_Unknown_File_Format)
{
std::cout<<" .... the font file could be opened and read, but it appears"<<std::endl;
std::cout<<" .... that its font format is unsupported"<<std::endl;
return 0;
}
else if (error)
{
std::cout<<" .... another error code means that the font file could notd"<<std::endl;
std::cout<<" .... be opened, read or simply that it is broken..d"<<std::endl;
return 0;
}
return new FreeTypeFont(fontfile,face);
}

View File

@@ -0,0 +1,42 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSGTEXT_LIBRARY
#define OSGTEXT_LIBRARY
#include "FreeTypeFont.h"
class FreeTypeLibrary
{
public:
/** get the singleton instance.*/
static FreeTypeLibrary* instance();
FreeTypeFont* getFont(const std::string& fontfile,unsigned int index=0);
protected:
/** protected constructor to ensure the only way to create the
* library is via the singleton instance method.*/
FreeTypeLibrary();
/** protected destrcutor to prevent inappropriate deletion.*/
virtual ~FreeTypeLibrary();
FT_Library _ftlibrary;
};
#endif

View File

@@ -0,0 +1,29 @@
TOPDIR = ../../..
include $(TOPDIR)/Make/makedefs
CXXFILES =\
FreeTypeLibrary.cpp\
FreeTypeFont.cpp\
ReaderWriterFreeType.cpp\
LIBS += $(OSG_LIBS) $(FREETYPE_LIB) $(OTHER_LIBS)
ifneq ($(OS),HP-UX)
INC += -I$(OSGHOME)/include \
-I/usr/include/freetype2 \
-I/usr/local/include \
-I/usr/local/include/freetype2 \
-I/usr/freeware/include \
-I/usr/freeware/include/freetype2
LINKARGS += -L/usr/local/lib\
-L/usr/freeware/lib$(ARCH)
else
INC += $(FREETYPE_INCLUDE)
endif
TARGET_BASENAME = freetype
include $(TOPDIR)/Make/cygwin_plugin_def
PLUGIN = $(PLUGIN_PREFIX)$(TARGET_BASENAME).$(PLUGIN_EXT)
include $(TOPDIR)/Make/makerules

View File

@@ -0,0 +1,37 @@
#include <osgDB/FileNameUtils>
#include <osgDB/Registry>
#include "FreeTypeLibrary.h"
class ReaderWriterFreeType : public osgDB::ReaderWriter
{;
public:
virtual const char* className() { return "FreeType Font Reader/Writer"; }
virtual bool acceptsExtension(const std::string& extension)
{
return osgDB::equalCaseInsensitive(extension,"ttf") || // true type
osgDB::equalCaseInsensitive(extension,"ttc") || // true type
osgDB::equalCaseInsensitive(extension,"pfb") || // type1 binary
osgDB::equalCaseInsensitive(extension,"pfa") || // type2 ascii
osgDB::equalCaseInsensitive(extension,"cid") || // Postscript CID-Fonts
osgDB::equalCaseInsensitive(extension,"cff") || // OpenType
osgDB::equalCaseInsensitive(extension,"cef") || // OpenType
osgDB::equalCaseInsensitive(extension,"fon") || // Windows bitmap fonts
osgDB::equalCaseInsensitive(extension,"fnt"); // Windows bitmap fonts
}
virtual ReadResult readObject(const std::string& fileName, const osgDB::ReaderWriter::Options*)
{
std::string ext = osgDB::getFileExtension(fileName);
if (!acceptsExtension(ext)) return ReadResult::FILE_NOT_HANDLED;
osgText::Font* font = FreeTypeLibrary::instance()->getFont(fileName,0);
return font;
}
};
// now register with Registry to instantiate the above
// reader/writer.
osgDB::RegisterReaderWriterProxy<ReaderWriterFreeType> g_readerWriter_FreeType_Proxy;

View File

@@ -703,10 +703,8 @@ class ReaderWriterGEO : public ReaderWriter
osg::MatrixTransform *numt=NULL;
std::string ttfPath("fonts/times.ttf");
int gFontSize1=2;
osgText::PolygonFont* polygonFont= new osgText::PolygonFont(ttfPath,
gFontSize1,
3);
osgText::Text *text= new osgText::Text(polygonFont);
osgText::Text *text= new osgText::Text;
text->setFont(ttfPath);
const geoField *gfd=gr->getField(GEO_DB_TEXT_NAME);
//const char *name=gfd ? gfd->getChar() : "a text";
gfd=gr->getField(GEO_DB_TEXT_STRING);

View File

@@ -1,205 +0,0 @@
#include <osgText/Font>
#include <osgText/Font>
#include <iostream>
#include <string>
#include <osg/Vec3>
#include <osgDB/Registry>
#include <osgDB/Input>
#include <osgDB/Output>
/////////////////////////////////////////////////////////////////////////////
// class Font
/////////////////////////////////////////////////////////////////////////////
bool Font_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
osgDB::RegisterDotOsgWrapperProxy Font_Proxy
(
0,
"Font",
"Object Font",
0,
Font_writeLocalData
);
bool Font_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{
const osgText::Font &myobj = static_cast<const osgText::Font &>(obj);
fw.indent() << "parameters ";
fw << myobj.getPointSize() << " " << myobj.getTextureSize() << " ";
fw << fw.wrapString(myobj.getFontName()) << std::endl;
return true;
}
/////////////////////////////////////////////////////////////////////////////
// class BitmapFont
/////////////////////////////////////////////////////////////////////////////
bool BitmapFont_readLocalData(osg::Object &obj, osgDB::Input &fr);
osgDB::RegisterDotOsgWrapperProxy BitmapFont_Proxy
(
new osgText::BitmapFont,
"BitmapFont",
"Object Font RasterFont BitmapFont",
BitmapFont_readLocalData,
0
);
bool BitmapFont_readLocalData(osg::Object &obj, osgDB::Input &fr)
{
osgText::BitmapFont &myobj = static_cast<osgText::BitmapFont &>(obj);
bool itAdvanced = false;
if (fr[0].matchWord("parameters")) {
int psize;
if (fr[1].getInt(psize) && fr[2].isInt() && fr[3].isString()) {
osgText::BitmapFont *temp = new osgText::BitmapFont(std::string(fr[3].getStr()), psize);
temp->copyAndInvalidate(myobj);
fr += 4;
itAdvanced = true;
}
}
return itAdvanced;
}
/////////////////////////////////////////////////////////////////////////////
// class PixmapFont
/////////////////////////////////////////////////////////////////////////////
bool PixmapFont_readLocalData(osg::Object &obj, osgDB::Input &fr);
osgDB::RegisterDotOsgWrapperProxy PixmapFont_Proxy
(
new osgText::PixmapFont,
"PixmapFont",
"Object Font RasterFont PixmapFont",
PixmapFont_readLocalData,
0
);
bool PixmapFont_readLocalData(osg::Object &obj, osgDB::Input &fr)
{
osgText::PixmapFont &myobj = static_cast<osgText::PixmapFont &>(obj);
bool itAdvanced = false;
if (fr[0].matchWord("parameters")) {
int psize;
if (fr[1].getInt(psize) && fr[2].isInt() && fr[3].isString()) {
osgText::PixmapFont *temp = new osgText::PixmapFont(std::string(fr[3].getStr()), psize);
temp->copyAndInvalidate(myobj);
fr += 4;
itAdvanced = true;
}
}
return itAdvanced;
}
/////////////////////////////////////////////////////////////////////////////
// class TextureFont
/////////////////////////////////////////////////////////////////////////////
bool TextureFont_readLocalData(osg::Object &obj, osgDB::Input &fr);
osgDB::RegisterDotOsgWrapperProxy TextureFont_Proxy
(
new osgText::TextureFont,
"TextureFont",
"Object Font RasterFont TextureFont",
TextureFont_readLocalData,
0
);
bool TextureFont_readLocalData(osg::Object &obj, osgDB::Input &fr)
{
osgText::TextureFont &myobj = static_cast<osgText::TextureFont &>(obj);
bool itAdvanced = false;
if (fr[0].matchWord("parameters")) {
int psize, txsize;
if (fr[1].getInt(psize) && fr[2].getInt(txsize) && fr[3].isString()) {
osgText::TextureFont *temp = new osgText::TextureFont(std::string(fr[3].getStr()), psize, txsize);
temp->copyAndInvalidate(myobj);
fr += 4;
itAdvanced = true;
}
}
return itAdvanced;
}
/////////////////////////////////////////////////////////////////////////////
// class OutlineFont
/////////////////////////////////////////////////////////////////////////////
bool OutlineFont_readLocalData(osg::Object &obj, osgDB::Input &fr);
osgDB::RegisterDotOsgWrapperProxy OutlineFont_Proxy
(
new osgText::OutlineFont,
"OutlineFont",
"Object Font VectorFont OutlineFont",
OutlineFont_readLocalData,
0
);
bool OutlineFont_readLocalData(osg::Object &obj, osgDB::Input &fr)
{
osgText::OutlineFont &myobj = static_cast<osgText::OutlineFont &>(obj);
bool itAdvanced = false;
if (fr[0].matchWord("parameters")) {
int psize;
if (fr[1].getInt(psize) && fr[2].isInt() && fr[3].isString()) {
osgText::OutlineFont *temp = new osgText::OutlineFont(std::string(fr[3].getStr()), psize, 1);
temp->copyAndInvalidate(myobj);
fr += 4;
itAdvanced = true;
}
}
return itAdvanced;
}
/////////////////////////////////////////////////////////////////////////////
// class PolygonFont
/////////////////////////////////////////////////////////////////////////////
bool PolygonFont_readLocalData(osg::Object &obj, osgDB::Input &fr);
osgDB::RegisterDotOsgWrapperProxy PolygonFont_Proxy
(
new osgText::PolygonFont,
"PolygonFont",
"Object Font VectorFont PolygonFont",
PolygonFont_readLocalData,
0
);
bool PolygonFont_readLocalData(osg::Object &obj, osgDB::Input &fr)
{
osgText::PolygonFont &myobj = static_cast<osgText::PolygonFont &>(obj);
bool itAdvanced = false;
if (fr[0].matchWord("parameters")) {
int psize;
if (fr[1].getInt(psize) && fr[2].isInt() && fr[3].isString()) {
osgText::PolygonFont *temp = new osgText::PolygonFont(std::string(fr[3].getStr()), psize, 1);
temp->copyAndInvalidate(myobj);
fr += 4;
itAdvanced = true;
}
}
return itAdvanced;
}

View File

@@ -1,100 +0,0 @@
#include <osgText/Paragraph>
#include <osgText/Font>
#include <iostream>
#include <string>
#include <osg/Vec3>
#include <osgDB/Registry>
#include <osgDB/Input>
#include <osgDB/Output>
bool Paragraph_readLocalData(osg::Object &obj, osgDB::Input &fr);
bool Paragraph_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
// osgDB::RegisterDotOsgWrapperProxy Paragraph_Proxy
// (
// new osgText::Paragraph,
// "Paragraph",
// "Object Node Geode Paragraph",
// Paragraph_readLocalData,
// Paragraph_writeLocalData
// );
//
bool Paragraph_readLocalData(osg::Object &obj, osgDB::Input &fr)
{
osgText::Paragraph &myobj = static_cast<osgText::Paragraph &>(obj);
bool itAdvanced = false;
// font
osgText::Font *font = dynamic_cast<osgText::Font *>(fr.readObject());
if (font) {
myobj.setFont(font);
itAdvanced = true;
}
// maximum chars
if (fr[0].matchWord("maximumNoCharactersPerLine")) {
int i;
if (fr[1].getInt(i)) {
myobj.setMaximumNoCharactersPerLine(i);
fr += 2;
itAdvanced = true;
}
}
// text
if (fr[0].matchWord("text") && fr[1].isString()) {
myobj.setText(std::string(fr[1].getStr()));
fr += 2;
itAdvanced = true;
}
// position
if (fr[0].matchWord("position")) {
osg::Vec3 p;
if (fr[1].getFloat(p.x()) && fr[2].getFloat(p.y()) && fr[3].getFloat(p.z())) {
myobj.setPosition(p);
fr += 4;
itAdvanced = true;
}
}
// alignment
if (fr[0].matchWord("alignment")) {
int i;
if (fr[1].getInt(i)) {
myobj.setAlignment(i);
fr += 2;
itAdvanced = true;
}
}
return itAdvanced;
}
bool Paragraph_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{
const osgText::Paragraph &myobj = static_cast<const osgText::Paragraph &>(obj);
// font
fw.writeObject(*myobj.getFont());
// maximum chars
fw.indent() << "maximumNoCharactersPerLine " << myobj.getMaximumNoCharactersPerLine() << std::endl;
// text
fw.indent() << "text " << myobj.getText() << std::endl;
// position
osg::Vec3 p = myobj.getPosition();
fw.indent() << "position " << p.x() << " " << p.y() << " " << p.z() << std::endl;
// alignment
fw.indent() << "alignment " << myobj.getAlignment() << std::endl;
return true;
}

View File

@@ -25,14 +25,14 @@ osgDB::RegisterDotOsgWrapperProxy Text_Proxy
bool Text_readLocalData(osg::Object &obj, osgDB::Input &fr)
{
osgText::Text &myobj = static_cast<osgText::Text &>(obj);
osgText::Text &text = static_cast<osgText::Text &>(obj);
bool itAdvanced = false;
// position
if (fr[0].matchWord("position")) {
osg::Vec3 p;
if (fr[1].getFloat(p.x()) && fr[2].getFloat(p.y()) && fr[3].getFloat(p.z())) {
myobj.setPosition(p);
text.setPosition(p);
fr += 4;
itAdvanced = true;
}
@@ -42,7 +42,7 @@ bool Text_readLocalData(osg::Object &obj, osgDB::Input &fr)
if (fr[0].matchWord("color")) {
osg::Vec4 c;
if (fr[1].getFloat(c.x()) && fr[2].getFloat(c.y()) && fr[3].getFloat(c.z()) && fr[4].getFloat(c.w())) {
myobj.setColor(c);
text.setColor(c);
fr += 4;
itAdvanced = true;
}
@@ -52,17 +52,7 @@ bool Text_readLocalData(osg::Object &obj, osgDB::Input &fr)
if (fr[0].matchWord("drawMode")) {
int i;
if (fr[1].getInt(i)) {
myobj.setDrawMode(i);
fr += 2;
itAdvanced = true;
}
}
// bounding box
if (fr[0].matchWord("boundingBox")) {
int i;
if (fr[1].getInt(i)) {
myobj.setBoundingBox(i);
text.setDrawMode(i);
fr += 2;
itAdvanced = true;
}
@@ -72,22 +62,15 @@ bool Text_readLocalData(osg::Object &obj, osgDB::Input &fr)
if (fr[0].matchWord("alignment")) {
int i;
if (fr[1].getInt(i)) {
myobj.setAlignment(i);
text.setAlignment((osgText::Text::AlignmentType)i);
fr += 2;
itAdvanced = true;
}
}
// font
osgText::Font *font = dynamic_cast<osgText::Font *>(fr.readObject());
if (font) {
myobj.setFont(font);
itAdvanced = true;
}
// text
if (fr.matchSequence("text %s")) {
myobj.setText(std::string(fr[1].getStr()));
text.setText(std::string(fr[1].getStr()));
fr += 2;
itAdvanced = true;
}
@@ -97,30 +80,47 @@ bool Text_readLocalData(osg::Object &obj, osgDB::Input &fr)
bool Text_writeLocalData(const osg::Object &obj, osgDB::Output &fw)
{
const osgText::Text &myobj = static_cast<const osgText::Text &>(obj);
const osgText::Text &text = static_cast<const osgText::Text &>(obj);
if (text.getFont())
{
fw.indent() << "font " << text.getFont()->getFileName() << std::endl;
}
fw.indent() << "fontSize " << text.getFontWidth() << " " << text.getFontHeight() << std::endl;
// position
osg::Vec3 p = myobj.getPosition();
osg::Vec3 p = text.getPosition();
fw.indent() << "position " << p.x() << " " << p.y() << " " << p.z() << std::endl;
// color
osg::Vec4 c = myobj.getColor();
osg::Vec4 c = text.getColor();
fw.indent() << "color " << c.x() << " " << c.y() << " " << c.z() << " " << c.w() << std::endl;
// draw mode
fw.indent() << "drawMode " << myobj.getDrawMode() << std::endl;
// bounding box
fw.indent() << "boundingBox " << myobj.getBoundingBox() << std::endl;
fw.indent() << "drawMode " << text.getDrawMode() << std::endl;
// alignment
fw.indent() << "alignment " << myobj.getAlignment() << std::endl;
// font
fw.writeObject(*myobj.getFont());
fw.indent() << "alignment " << text.getAlignment() << std::endl;
// text
fw.indent() << "text " << fw.wrapString(myobj.getText()) << std::endl;
const osgText::Text::TextString& textstring = text.getText();
bool isACString = true;
for(osgText::Text::TextString::const_iterator itr=textstring.begin();
itr!=textstring.end() && isACString;
++itr)
{
if (*itr==0 || *itr>256) isACString=false;
}
if (isACString)
{
std::string str(textstring.begin(),textstring.end());
fw.indent() << "text " << fw.wrapString(str) << std::endl;
}
else
{
// do it the hardway...
}
return true;
}

View File

@@ -2,10 +2,7 @@ TOPDIR = ../../..
include $(TOPDIR)/Make/makedefs
CXXFILES =\
IO_Text.cpp \
IO_Font.cpp \
IO_Paragraph.cpp \
IO_Text.cpp
LIBS += -losgText $(OSG_LIBS) $(OTHER_LIBS)