reply   forum
    site moderator alex
    Aug 7th, 2003 / quote /
    well, it is very important to figure out what you are doing...

    are you writing a program that will create custom font previews?
    or
    are you writing a windows application and you are trying to simply draw a string text on a custom control or something?
    site moderator alex
    Aug 7th, 2003 / quote /
    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:

    DWORD GetGlyphOutline(
    UINT nChar,
    UINT nFormat,
    LPGLYPHMETRICS lpgm,
    DWORD cbBuffer,
    LPVOID lpBuffer,
    const MAT2* lpmat2
    ) const;


    also, post the function that you are trying to write.
    site moderator alex
    Aug 7th, 2003 / quote /
    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:
    DWORD GetGlyphOutline(
    UINT nChar,
    UINT nFormat,
    LPGLYPHMETRICS lpgm,
    DWORD cbBuffer,
    LPVOID lpBuffer,
    const MAT2* lpmat2
    ) const;





    CDC dc;
    MAT2 mat;
    char ch = 'a';

    mat.eM11 = 1;
    mat.eM12 = 0;
    mat.eM21 = 0;
    mat.eM22 = 1;

    dc.CreateCompatibleDC(NULL);
    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
    site moderator alex
    Aug 7th, 2003 / quote /
    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 )
    site moderator alex
    Aug 7th, 2003 / quote /
    init it by doing this:

    buffer = GlobalAlloc( GPTR, bufsize );

    after you get bufsize, of course
    site moderator alex
    Aug 7th, 2003 / quote /
    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?
    site moderator alex
    Aug 7th, 2003 / quote /
    try doing dc.CreateCompatibleDC( GetDC() );


    i am assuming that the class you are currently in extends CWnd at some point...
    site moderator alex
    Aug 8th, 2003 / quote /
    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...
    site moderator alex
    Aug 8th, 2003 / quote /
    another thing, try declaring buffer as

    BYTE buffer[buffsize];

    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...
    site moderator alex
    Aug 8th, 2003 / quote /
    yea... as i typed it i realized that it's my love for PHP is talking... but was too lazy to retype it.. s'all :rolleyes:

    Register and/or login to access this feature.

    Login

    Email
    Password
      Forgot password?