freetype-devel
[Top][All Lists]
Advanced

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

Re: [Devel] Letter as cursive


From: David Turner
Subject: Re: [Devel] Letter as cursive
Date: Wed, 19 Feb 2003 00:15:17 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3b) Gecko/20030210

Hello,

Chances are that you need to pad your windows bitmap's line byte size to 4.

Regards,

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



José Carlos García Rufino wrote:
I'm trying to print any string in the screen.
I use FT_Load_Char for rendering the characters one to one.
The problem is that the characters apears leaning to the right and the part of the character that disaperars for the right then apears for the left of the next line. The contents of the buffer is the correct because the contents of the file generated in the function Voltear_Buffer is right. Some characters are draw right, but they are not always the same. It's depends of the size of the font that I select. This is my code: void my_draw_bitmap(HDC hDC,FT_Bitmap *b, int posx, int posy, int zoom, int bitmap_top, int bitmap_left)
{
BITMAPINFO *bmi;
int i,filas,columnas,tam;
filas=b->rows;
columnas=b->width;
tam=filas*columnas;
Voltear_Buffer(b->buffer,filas,columnas);
bmi = (BITMAPINFO *) malloc(sizeof(BITMAPINFOHEADER)
                                  + 256 * sizeof(RGBQUAD));
BITMAPINFOHEADER *pBI=(BITMAPINFOHEADER *) bmi; pBI->biSize = sizeof(BITMAPINFOHEADER);
pBI->biWidth       = columnas;
pBI->biHeight      = -filas; // top-down image
pBI->biPlanes      = 1;
pBI->biBitCount    = 8;
pBI->biCompression = BI_RGB;
pBI->biSizeImage   = tam;
pBI->biXPelsPerMeter = 0;
pBI->biYPelsPerMeter = 0;
pBI->biClrUsed = 0;
pBI->biClrImportant = 0;
RGBQUAD *paleta=(LPRGBQUAD)(((BYTE *)(bmi))
            + sizeof(BITMAPINFOHEADER));
for (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);
}
void Voltear_Buffer(unsigned char *buf, int filas, int columnas)
{
 int i;
 int tam=filas*columnas;
 FILE *pf=fopen("equis.txt","a");
 for(i=0;i<tam;i++)
 {
  if(i%columnas==0 && i!=0)
   fprintf(pf,"\n");
  if(buf[i]>127)
   fprintf(pf,"X");
  else
   fprintf(pf," ");
 }
 fprintf(pf,"\n\n");
fclose(pf);





reply via email to

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