well, it is very important to figure out what you are doing...
are you writing a program that will create custom font previews?
are you writing a windows application and you are trying to simply draw a string text on a custom control or something?
if the 2nd one then you should be overloading OnPaint() function or DrawItem, depending if you declared the control as BS_OWNERDRAW
if the 1st one, i haven't done that in vc++, but cant you just use CDC's DrawText function?
another thing, this is definition of CDC that i found and i has more than just 1 arg:
const MAT2* lpmat2
also, post the function that you are trying to write.
if you are not printing it anywhere on the screen that means you can do with just CreateCompatibleDC()
once again, CDC::GetGlyphOutline() has the following arguments:
const MAT2* lpmat2
char ch = 'a';
mat.eM11 = 1;
mat.eM12 = 0;
mat.eM21 = 0;
mat.eM22 = 1;
dc.SelectObject( font );
int bufferSize = dc.GetGlyphOutline( ch, GGO_BITMAP, 0, NULL, &mat );
dc.GetGlyphOutline( ch, GGO_BITMAP, bufferSize, pointerToBitmap, &mat );[/b:4672d4a11f]
provide a pointer to the bitmap and it should be filled in with the bitmap... there probably are some syntax errors but the idea is similar... try it and let me know
heeey, i think the buffer is the problem... I think it has to be initialized to the length of bufsize and then you pass a pointer to it in the 2nd GetGlyphOutline call. because if you make the bufsize=0 or buffer=NULL the function will return the needed size without trying to fill the buffer ( since it is NULL )
init it by doing this:
buffer = GlobalAlloc( GPTR, bufsize );
after you get bufsize, of course
sorry didnt notice... hmmm...
what would be the next step? craete a bitmap from that? you should try it and see if CraeteBitmap will spew out an error after you will try creating a bitmap with the buffer as the source...
wanna give that a try?
try doing dc.CreateCompatibleDC( GetDC() );
i am assuming that the class you are currently in extends CWnd at some point...
ouch!!! not NATIVE!!! :D UGLY!!!
i am assuming that you have checked the values of bufsize and buffer to make sure that the 2nd time you are calling they are not 0 and not NULL. ( well, they gotta have values since you got result for NATIVE... )
ok, what does GetLastError() return after the 2nd call to GetGlyphOutline()?
also, try using GGO_GRAY8_BITMAP instead of simply GGO_BITMAP
also, try a different font... try a couple... maybe the font is corrupted...
another thing, try declaring buffer as
maybe the void thing is screwnig it up... it shouldnt though
native will take you years from what i see... you have to prtty much interpret all of the curves and lines, vectors... crazy
if the error is 0 then you should try using that bitmap... maybe you're not usign a valid char... make sure it is an unsigned char...
Register and/or login to access this feature.