Question : TTF font, can not show in windows version.(Fixed)

This is my “hello world” project. system default.

CCLabelTTD, Draw “Hello World” on the screen.
The text is not show. And It’s only show a empty rect. (The pictrue ’s red rect)

project “testes” is also have this bug.
All text can not show.

I’m using windows xp now.
The project is build in win.

I hope i can get some help.
Thank you very much.


bug.JPG (28.5 KB)

I’m looking for CCLabelTTF ’s win32 code.

It’s use windows api.

1, Dc.DrawText() to HBitmap.
2, HBitmap copy to CCImage.m_pData, Use the func GetDIBits(), And It’s return err.
3, So … CCImage.m_pData is empty. When it’s draw on the screen, no words, only a empty rect.

More help ?
Thanks.

Hava a look again.

hbitmap create by func CreateBitmap(), bitCount 32, DrawText failed.

hbitmap create by func CreateCompatibleBitmap(), DrawText succ.
But, hbitmap ’s bitCount is 1.

So, hbitmap copy to CCImage.m_pData have some mistake. CCImage ’s bitCount is 32.

ok, I find out how to fix it.

Edit win32/ccimage.cpp :

m_hBmp = CreateBitmap(nWidth, nHeight, 1, 32, NULL);
Change to :
m_hBmp = CreateCompatibleBitmap(m_hDC, nWidth, nHeight);

Add
bi.bmiHeader.biBitCount = 32;
Before
GetDIBits(dc.getDC(), dc.getBitmap(), 0, m_nHeight, m_pData, (LPBITMAPINFO)&bi, DIB_RGB_COLORS);

If you have the same bug like me.
You can try this way.

Good luck.