font problem with wxMemoryDC::DrawText()

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
pencil
Earned a small fee
Earned a small fee
Posts: 10
Joined: Fri May 27, 2005 3:10 pm
Location: Germany
Contact:

font problem with wxMemoryDC::DrawText()

Post by pencil » Fri May 27, 2005 3:19 pm

Hi there,

I tried for so long now an didn't find the solution how to decrease the size of the default font when using DrawText on a wxMemoryDC.
My Code looks like this so far:

Code: Select all

memDC->SetFont( wxFont( 12, wxDEFAULT, wxNORMAL, wxNORMAL ) );
...
memDC->DrawText( current->m_text, x, y );
and that looks like this:
Image

But changes to wxFont( 9, ... ) or taking for example
wxFont(9, wxDEFAULT, wxNORMAL, wxNORMAL, false, "Arial")
didn't help. (In the second case nothing is written on the screen!)
Any ideas to this?
(using wxWindows 2.4.2)

cheers
pencil

eco
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 203
Joined: Tue Aug 31, 2004 7:06 pm
Location: Behind a can of Mountain Dew
Contact:

Post by eco » Fri May 27, 2005 11:47 pm

You really should use wxWidgets 2.6.0. I know that the default font on windows (the one that would be chosen by your first example) is Serif which is a non-TrueType font and you can only make it so small before it just stops getting any smaller. Arial should have no problems though. I've seen Arial drawn to nothing more than a pixel high in my print previews.

I guess my suggestion is to try it out in 2.6.0 since I seem to be having no problems (print preview prints to wxMemoryDC).

pencil
Earned a small fee
Earned a small fee
Posts: 10
Joined: Fri May 27, 2005 3:10 pm
Location: Germany
Contact:

Post by pencil » Sat May 28, 2005 7:33 am

Thanks! I will go having a look if I find a 2.6.0 package for DevCpp then. ;)
cheers

Post Reply