freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Devel] Some characters don´t draw righ t


From: David Turner
Subject: Re: [Devel] Some characters don´t draw righ t
Date: Thu, 23 Jan 2003 19:04:31 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1) Gecko/20021130

Hello,

José Carlos García Rufino wrote:
I have a function for drawing a character in the screen. I use FT_Load_Char(...,FT_LOAD_RENDER) for rendering this character. The problem is that many charartes are drawing bad (B,C,D,F,H,...) and others are drawind right( A,E,M,G,W, ...)
I don't know the reason.
I use W2000 pro and VC 6.0 SP5.

I believe that you need to adjust the bitmap "position" with the values
of "face->glyph.bitmap_left" and "face->glyph.bitmap_top". The documentation should have more details on this..

Hope this helps,

- David Turner
- The FreeType Project  (www.freetype.org)


The function is the next: void my_draw_bitmap(HDC hDC,FT_Bitmap b, int posx, int posy, int zoom)
{
int tam,filas,columnas;
filas=b.rows;
columnas=b.width;
tam=filas*columnas;
BITMAPINFO *bmi;
bmi = (BITMAPINFO *) malloc(sizeof(BITMAPINFOHEADER)
                                  + 256 * sizeof(RGBQUAD));
bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi->bmiHeader.biWidth       = columnas;
bmi->bmiHeader.biHeight      = -filas; // top-down image
bmi->bmiHeader.biPlanes      = 1;
bmi->bmiHeader.biBitCount    = 8;
bmi->bmiHeader.biCompression = BI_RGB;
bmi->bmiHeader.biSizeImage   = filas*columnas;
bmi->bmiHeader.biXPelsPerMeter = 0;
bmi->bmiHeader.biYPelsPerMeter = 0;
bmi->bmiHeader.biClrUsed = 0;
bmi->bmiHeader.biClrImportant = 0;
RGBQUAD *paleta=(LPRGBQUAD)(((BYTE *)(bmi))
            + sizeof(BITMAPINFOHEADER));
for (int i = 0; i < 256; i++)
 {
    paleta->rgbBlue = paleta->rgbGreen = paleta->rgbRed = (BYTE) i;
    paleta->rgbReserved = 0;
    paleta++;
    }
StretchDIBits(hDC,
                  posx,      // x destino
                  posy,          // y destino
                  columnas*zoom,   // ancho destino
                  filas*zoom,    // alto destino
                  0,      // x fuente
                  0,      // y fuente
                  columnas,        // ancho fuente
                  filas,        // alto fuente
                  b.buffer,        // puntero a los bits
                  bmi,                    // BITMAPINFO
                  DIB_RGB_COLORS,   // options
SRCCOPY); // rop free(bmi);
}





reply via email to

[Prev in Thread] Current Thread [Next in Thread]