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,
33 //render text by last requested font
34 void render_text( const char* text );
36 //returns direct access to FTGL font
37 //Warning: don't change font pointer.
38 const FTFont* fontById( const Standard_Integer id );
40 //returns width of string
41 Standard_ShortReal computeWidth( const Standard_Integer id, const char* str );
43 bool requestFontList( Graphic3d_NListOfHAsciiString& );
45 void setCurrentScale( const Standard_ShortReal xScale = 1.f,
46 const Standard_ShortReal yScale = 1.f);
50 OpenGl_FontMgr( const OpenGl_FontMgr& ){};
51 OpenGl_FontMgr& operator = ( const OpenGl_FontMgr&){ return *this;};
54 void _initializeFontDB();
56 typedef NCollection_List<Standard_Integer> IDList;
58 struct OGLFont_SysInfo {
59 Handle(OSD_SystemFont) SysFont;
60 IDList GeneratedFonts;
63 struct OGLFont_Cache {
65 Standard_Integer FontHeight;
69 typedef NCollection_List<OGLFont_SysInfo*> FontDataBase;
70 typedef FontDataBase::Iterator FontDBIt;
71 typedef NCollection_DataMap<Standard_Integer,OGLFont_Cache> FontCache;
72 typedef FontCache::Iterator FCacheIt;
77 Standard_Integer _CurrentFontId;
79 Standard_ShortReal _XCurrentScale,
83 #endif //OPENGL_FONT_MGR_H