use TRUETYPE env var for the font location
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8237 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -59,6 +59,11 @@ class MyApp: public wxApp
|
||||
{
|
||||
public:
|
||||
virtual bool OnInit();
|
||||
|
||||
const wxString& GetFontPath() const { return m_fontpath; }
|
||||
|
||||
private:
|
||||
wxString m_fontpath;
|
||||
};
|
||||
|
||||
// main program
|
||||
@@ -120,7 +125,8 @@ MyFrame::MyFrame()
|
||||
wxButton *button = new wxButton( m_canvas, -1, "Hello", wxPoint(80,50) );
|
||||
m_canvas->Append( new wxCanvasControl( button ) );
|
||||
|
||||
m_canvas->Append( new wxCanvasText( "Hello", 180, 50, "/home/robert/TrueType/times.ttf", 20 ) );
|
||||
m_canvas->Append( new wxCanvasText( "Hello", 180, 50,
|
||||
wxGetApp().GetFontPath() + "/times.ttf", 20 ) );
|
||||
|
||||
m_timer = new wxTimer( this );
|
||||
m_timer->Start( 100, FALSE );
|
||||
@@ -156,6 +162,15 @@ void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) )
|
||||
|
||||
bool MyApp::OnInit()
|
||||
{
|
||||
m_fontpath = getenv("TRUETYPE");
|
||||
if ( !m_fontpath )
|
||||
{
|
||||
wxLogError("Please set env var TRUETYPE to the path where times.ttf lives.");
|
||||
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
|
||||
#if wxUSE_LIBPNG
|
||||
wxImage::AddHandler( new wxPNGHandler );
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user