1 #ifndef OPENGL_FONT_MGR_H
2 #define OPENGL_FONT_MGR_H
12 #include <InterfaceGraphic.hxx>
13 #include <TCollection_HAsciiString.hxx>
14 #include <NCollection_List.hxx>
15 #include <NCollection_DataMap.hxx>
16 #include <Graphic3d_NListOfHAsciiString.hxx>
17 #include <OSD_FontMgr.hxx>
24 static OpenGl_FontMgr* instance();
26 int request_font( const Handle(TCollection_HAsciiString)& fontName,
27 const OSD_FontAspect fontAspect,
28 const Standard_Integer fontHeight );
30 void render_text( const Standard_Integer id,
32 const Standard_Boolean is2d = 0 );
34 //render text by last requested font
35 void render_text( const char* text, const Standard_Boolean is2d = 0 );
37 //returns direct access to FTGL font
38 //Warning: don't change font pointer.
39 const FTFont* fontById( const Standard_Integer id );
41 //returns width of string
42 Standard_ShortReal computeWidth( const Standard_Integer id, const char* str );
44 bool requestFontList( Graphic3d_NListOfHAsciiString& );
46 void setCurrentScale( const Standard_ShortReal xScale = 1.f,
47 const Standard_ShortReal yScale = 1.f);
51 OpenGl_FontMgr( const OpenGl_FontMgr& ){};
52 OpenGl_FontMgr& operator = ( const OpenGl_FontMgr&){ return *this;};
55 void _initializeFontDB();
57 typedef NCollection_List<Standard_Integer> IDList;
59 struct OGLFont_SysInfo {
60 Handle(OSD_SystemFont) SysFont;
61 IDList GeneratedFonts;
64 struct OGLFont_Cache {
66 Standard_Integer FontHeight;
70 typedef NCollection_List<OGLFont_SysInfo*> FontDataBase;
71 typedef FontDataBase::Iterator FontDBIt;
72 typedef NCollection_DataMap<Standard_Integer,OGLFont_Cache> FontCache;
73 typedef FontCache::Iterator FCacheIt;
78 Standard_Integer _CurrentFontId;
80 Standard_ShortReal _XCurrentScale,
84 #endif //OPENGL_FONT_MGR_H