Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

OSGTextTXFFace.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002  *                                OpenSG                                     *
00003  *                                                                           *
00004  *                                                                           *
00005  *             Copyright (C) 2000-2002 by the OpenSG Forum                   *
00006  *                                                                           *
00007  *                            www.opensg.org                                 *
00008  *                                                                           *
00009  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
00010  *                                                                           *
00011 \*---------------------------------------------------------------------------*/
00012 /*---------------------------------------------------------------------------*\
00013  *                                License                                    *
00014  *                                                                           *
00015  * This library is free software; you can redistribute it and/or modify it   *
00016  * under the terms of the GNU Library General Public License as published    *
00017  * by the Free Software Foundation, version 2.                               *
00018  *                                                                           *
00019  * This library is distributed in the hope that it will be useful, but       *
00020  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
00022  * Library General Public License for more details.                          *
00023  *                                                                           *
00024  * You should have received a copy of the GNU Library General Public         *
00025  * License along with this library; if not, write to the Free Software       *
00026  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
00027  *                                                                           *
00028 \*---------------------------------------------------------------------------*/
00029 /*---------------------------------------------------------------------------*\
00030  *                                Changes                                    *
00031  *                                                                           *
00032  *                                                                           *
00033  *                                                                           *
00034  *                                                                           *
00035  *                                                                           *
00036  *                                                                           *
00037 \*---------------------------------------------------------------------------*/
00038 
00039 #ifndef _OSGTEXTTXFFACE_H_
00040 #define _OSGTEXTTXFFACE_H_
00041 
00042 #ifdef _MSC_VER
00043 # pragma once
00044 #endif
00045 
00046 
00047 #include <OSGConfig.h>
00048 #include <OSGSystemDef.h>
00049 #include <OSGBaseTypes.h>
00050 #include <OSGGeometry.h>
00051 #include <OSGNode.h>
00052 #include <OSGImage.h>
00053 
00054 #include "OSGTextFace.h"
00055 #include "OSGTextGlyph.h"
00056 #include "OSGTextTXFParam.h"
00057 
00058 #include <string>
00059 #include <map>
00060 #include <iosfwd>
00061 
00062 
00063 OSG_BEGIN_NAMESPACE
00064 
00065 
00066 class TextTXFGlyph;
00067 class TextLayoutParam;
00068 class TextLayoutResult;
00069 
00070 
00120 class OSG_SYSTEMLIB_DLLMAPPING TextTXFFace: public TextFace
00121 {
00122     /*==========================  PUBLIC  =================================*/
00123   public:
00124 
00129     inline Real32 getScale() const;
00130 
00135     inline const TextTXFParam &getParam() const;
00136 
00142     inline ImagePtr getTexture() const;
00143 
00150     virtual const TextGlyph &getGlyph(TextGlyph::Index glyphIndex);
00151 
00158     const TextTXFGlyph &getTXFGlyph(TextGlyph::Index glyphIndex);
00159 
00166     virtual void layout(const std::string &utf8Text,
00167                         const TextLayoutParam &param,
00168                         TextLayoutResult &result);
00169 
00176     virtual void layout(const std::wstring &text,
00177                         const TextLayoutParam &param,
00178                         TextLayoutResult &result);
00179 
00186     virtual void layout(const std::vector<std::string> &lines,
00187                         const TextLayoutParam &param,
00188                         TextLayoutResult &result);
00189 
00196     virtual void layout(const std::vector<std::wstring> &lines,
00197                         const TextLayoutParam &param,
00198                         TextLayoutResult &result);
00199 
00208     void fillGeo(GeometryPtr &geoPtr, const TextLayoutResult &layoutResult, Real32 scale = 1.f,
00209                  Vec2f offset = Vec2f(0,0), Color3f color = Color3f(-1,-1,-1));
00210 
00220     void addToGeom(GeometryPtr &geoPtr, const TextLayoutResult &layoutResult, Real32 scale = 1.f,
00221                  Vec2f offset = Vec2f(0,0), Color3f color = Color3f(-1,-1,-1));
00222 
00231     GeometryPtr makeGeo(const TextLayoutResult &layoutResult, Real32 scale = 1.f,
00232                         Vec2f offset = Vec2f(0,0), Color3f color = Color3f(-1,-1,-1));
00233 
00242     NodePtr makeNode(const TextLayoutResult &layoutResult, Real32 scale = 1.f,
00243                      Vec2f offset = Vec2f(0,0), Color3f color = Color3f(-1,-1,-1));
00244 
00253     static TextTXFFace *create(const std::string &family, Style style = STYLE_PLAIN,
00254                                const TextTXFParam &param = TextTXFParam());
00255 
00261     static TextTXFFace *createFromStream(std::istream &is,
00262                                          const std::string &family = std::string(),
00263                                          Style style = STYLE_PLAIN);
00264 
00270     static TextTXFFace *createFromFile(const std::string &filename);
00271 
00277     bool writeToStream(std::ostream &os) const;
00278 
00284     bool writeToFile(const std::string &filename) const;
00285 
00286     /*=========================  PROTECTED  ===============================*/
00287   protected:
00288 
00290     inline TextTXFFace();
00291 
00293     virtual ~TextTXFFace();
00294 
00296     void prepareTexture(const TextTXFParam &param);
00297 
00299     Real32 _scale;
00300 
00302     TextTXFParam _param;
00303 
00305     ImagePtr _texture;
00306 
00308     typedef std::map<TextGlyph::Index, TextTXFGlyph*> GlyphMap;
00309 
00311     GlyphMap _glyphMap;
00312 
00313     /*==========================  PRIVATE  ================================*/
00314   private:
00315 
00317     TextTXFFace(const TextTXFFace &);
00318 
00320     const TextTXFFace &operator=(const TextTXFFace &);
00321 
00323     static TextTXFGlyph _emptyGlyph;
00324 };
00325 
00326 
00327 OSG_END_NAMESPACE
00328 
00329 
00330 #include <OSGTextTXFFace.inl>
00331 
00332 #define OSGTEXTTXFFACE_HEADER_CVSID "@(#)$Id: OSGTextTXFFace.h,v 1.4 2005/07/05 16:25:15 dirk Exp $"
00333 
00334 #endif /* _OSGTEXTTXFFACE_H_ */

Generated on Thu Aug 25 04:11:18 2005 for OpenSG by  doxygen 1.4.3