00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
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