1 posts
Alex, your code looks a lot simpler. I tried it, and it doesn't return zero. But it returns 4, no matter which font I select! Even ::GetGlyphOutline() which earlier returned zero, now returns 4. (See my question, end part).
I wrote the buffer to a file, and checked those four bytes it had written and they all turned out to be zeroes.
I'm posting the code of my function here, see if you can find any problems!
CDC dc;
CFont font;
font.CreateFontIndirect(&logfont);
dc.CreateCompatibleDC(NULL);
dc.SelectObject(&font);
char tmpstr[50]="";
void* buffer;//=NULL;
const MAT2 transmat={1,0,0,1};
GLYPHMETRICS glyphmetrics;
int bufsize=0;
bufsize=dc.GetGlyphOutline('A',GGO_BITMAP,&glyphmetrics,0,NULL,&transmat);
if(bufsize==GDI_ERROR)
MessageBox("error");
buffer=malloc(bufsize);
dc.GetGlyphOutline('A',GGO_BITMAP,&glyphmetrics,bufsize,buffer,&transmat);
sprintf(tmpstr,"%u",bufsize);
MessageBox(tmpstr);
[/b:790d19a291]
I wonder what the problem is. Outside this func. I have the following code:
fontdialog.GetCurrentFont(&logfont);[/b:790d19a291]
where fontdilaog is a font selection dialog.
What could be the problem :(? In selecting the font in CFont object font? Earlier, I had made font it the member var. of the class which has this function code, and it gave a debug assertion error, and took me to a func called CGDIObject::Attach() or something like that. I wonder where the problem is :(
|
(10) Related keywords
No category matches
No designer matches
|