X3DFontStyleNode.h

Go to the documentation of this file.
00001 
00002 //    Copyright 2004, SenseGraphics AB
00003 //
00004 //    This file is part of H3D API.
00005 //
00006 //    H3D API is free software; you can redistribute it and/or modify
00007 //    it under the terms of the GNU General Public License as published by
00008 //    the Free Software Foundation; either version 2 of the License, or
00009 //    (at your option) any later version.
00010 //
00011 //    H3D API is distributed in the hope that it will be useful,
00012 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //    GNU General Public License for more details.
00015 //
00016 //    You should have received a copy of the GNU General Public License
00017 //    along with H3D API; if not, write to the Free Software
00018 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 //
00020 //    A commercial license is also available. Please contact us at 
00021 //    www.sensegraphics.com for more information.
00022 //
00023 //
00027 //
00029 #ifndef __X3DFONTSTYLENODE_H__
00030 #define __X3DFONTSTYLENODE_H__
00031 
00032 #include "X3DNode.h"
00033 #include "GL/glew.h"
00034 
00035 namespace H3D {
00036 
00041   class H3DAPI_API X3DFontStyleNode : public X3DNode {
00042   public:
00043 
00045     typedef enum {
00046       HORIZONTAL,
00047       VERTICAL
00048     } Alignment;
00049 
00051     typedef enum {
00052       FIRST, 
00053       BEGIN,
00054       MIDDLE,
00055       END 
00056     } Justification;
00057     
00059     X3DFontStyleNode( Inst< SFNode>  _metadata = 0 );
00060 
00065     virtual void buildFonts() {}
00066 
00068     inline bool fontsBuilt() {
00069       return fonts_built;
00070     }
00071 
00074     virtual bool isTopToBottom() {
00075       return true;
00076     }
00077 
00080     virtual bool isLeftToRight() {
00081       return true;
00082     }
00083 
00086     virtual H3DFloat getSpacing() { 
00087       return 1;
00088     }
00089 
00091     virtual Alignment getAlignment() {
00092       return HORIZONTAL;
00093     }
00094     
00096     virtual Justification getMajorJustification() {
00097       return BEGIN;
00098     }
00099     
00101     virtual Justification getMinorJustification() {
00102       return FIRST;
00103     }
00104 
00106     virtual void renderChar( unsigned char c ) {}
00107 
00110     virtual Vec3f charDimensions( unsigned char c ) { return Vec3f(); }
00111 
00114     virtual H3DFloat ascender() { return 0; }
00115 
00118     virtual H3DFloat descender() { return 0; }
00119 
00123     Vec3f stringDimensions( const string &text,
00124                             Alignment alignment );
00125 
00132     Vec3f stringDimensions( const vector< string > &text,
00133                             Alignment alignment,
00134                             const vector< H3DFloat > &length = 
00135                             vector< H3DFloat >() );
00136 
00140     virtual string defaultXMLContainerField() {
00141       return "fontStyle";
00142     }
00143 
00144 protected:
00146     bool fonts_built;
00147   };
00148 }
00149 
00150 #endif

Generated on Thu Aug 24 12:38:35 2006 for H3D API by  doxygen 1.4.5