Anyone know why the latter GetGlyphOutline call tanks and produces a '...has encountered a problem and needs to close. We are sorry for the inconvenience' error?
The first call to GetGlyphOutline returns a buffer size of 380 in this case, so that call seems to work. The second call, however, doesn't like what I'm passing to it because I get the error mentioned above. BTW: How does one allocate a buffer of a particular size in PB if one doesn't know the size to begin with? My 'DIM buffer AS STRING*600' was an attempt to get something to work, but I'm sure there's a better way.
The first call to GetGlyphOutline returns a buffer size of 380 in this case, so that call seems to work. The second call, however, doesn't like what I'm passing to it because I get the error mentioned above. BTW: How does one allocate a buffer of a particular size in PB if one doesn't know the size to begin with? My 'DIM buffer AS STRING*600' was an attempt to get something to work, but I'm sure there's a better way.
Code:
hScreenDC=GetDC(%NULL) point_size =30 points_per_inch =72 pixels_per_inch =GetDeviceCaps(hScreenDC, %LOGPIXELSY) logical_height = -MulDiv(point_size, pixels_per_inch, points_per_inch) hFont=CreateFont(logical_height,0,0,0,0,%TRUE,0,0,%ANSI_CHARSET,0,0,0,0,"Times New Roman") hOldFont=SelectObject(hScreenDC, hFont) DIM GlyphMets AS GLYPHMETRICS, xformation AS MAT2, bufferSize AS DWORD, bufferPointer AS STRING POINTER, buffer AS STRING*600 xformation.eM11.value =1 xformation.eM11.fract =0 xformation.eM12.value =0 xformation.eM12.fract =0 xformation.eM21.value =0 xformation.eM21.fract =0 xformation.eM22.value =1 xformation.eM22.fract =0 bufferSize =0 bufferPointer =%NULL bufferSize=GetGlyphOutline(hScreenDC, ASC("A"), %GGO_NATIVE, GlyphMets, bufferSize, bufferPointer, xformation) MSGBOX FORMAT$(bufferSize) bufferPointer=VARPTR(buffer) GetGlyphOutline(hScreenDC, ASC("A"), %GGO_NATIVE, GlyphMets, bufferSize, bufferPointer, xformation) DeleteObject(SelectObject(hScreenDC, hOldFont)) ReleaseDC(%NULL,hScreenDC)
Comment