Finally I solved my problem, I write this because it may help people with the
same problem.
I was using the mothod SetTextHeight after creating my texts that sets the font
size, I removed that line and program works well.
Here is a sample that causes errors :
MyFrame::MyFrame( wxWindow* parent, wxWindowID id, const wxString& title,
const wxPoint& position, const wxSize& size, long style ) :
wxFrame( parent, id, title, position, size, style )
{
a2dAggDrawer *drawer2d = new a2dAggDrawer( 0, 0 );
m_canvas = new a2dCanvas( this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
wxTAB_TRAVERSAL, drawer2d);
a2dDEFAULT_CANVASFONT = new a2dFont(wxT("tahoma.ttf"), 150.0,
wxFONTENCODING_DEFAULT);
a2dCanvasDocument* root = m_canvas->GetCanvasDocument();
int maxText = 510; // crashes if you set maxText to 510.
for (int i = 0; i < maxText; ++i)
{
a2dText* text = new a2dText( wxT( "test text" ), 2*i, 2*i);
text->SetTextHeight(10); // This cause errors!
root->Append( text );
}
m_canvas->SetMappingUpp(0, 0, 1, 1);
}
________________________________
From: klaas.holwerda <n...@klaasholwerda.nl>
To: Hojjat jafary <hojjatjaf...@yahoo.com>;
wxart2d-users_dev@lists.sourceforge.net
Sent: Saturday, February 18, 2012 2:25 AM
Subject: Re: [Wxart2d-users_dev] Agg, a2dText, freetype
On 17-2-2012 10:41, Hojjat jafary wrote:
Hi,
>
>
>This is my first post in wxart2d mailing list, wxart2d is a great library,
>
>
>I have a problem if anyone can help me he/she will be very appreciated,
>
>
>I have a a2dcanvas with aggdrawer for its drawer, I like to put some a2dText
>on it but after some number of addition an error occurred that write
>FT_Stream_Open : could not open font file on the console and could not show
>the texts.
>I checked the font I'm using to be exist in the path(C:\windows\fonts\..), the
>a2d itself check this in a2dFontFreetypeData::SetFilename but it seems
>freetype can not open the font file.
>
>
>This is how I create my texts:
>
>
>mText = new a2dText( wxT("test text."), 0, 0, a2dFont(wxT("tahoma.ttf"),
>150.0, wxFONTENCODING_DEFAULT) );
>
>
>When I modified the split sample to use aggdrawer and putting editable text in
>a loop the program crashes if the loop runs for 510 times but it work properly
>if the loop runs lower that 510.
Euh you mean 510 times text objects placed on the canvas? And indeed
only a problem with that font?
Anyway if all those text string use the same font and size, better
share the font between them.
a2dFont afont(wxT("tahoma.ttf"), 150.0, wxFONTENCODING_DEFAULT)
mText = new a2dText( wxT("test text."), 0, 0, afont);
mText2 = new a2dText( wxT("test text2."), 0, 100, afont);
etc.
That should start sharing the loaded font, i think.
Klaas
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Wxart2d-users_dev mailing list
Wxart2d-users_dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxart2d-users_dev