freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] Free tyep font - query


From: Werner LEMBERG
Subject: Re: [ft-devel] Free tyep font - query
Date: Tue, 01 Dec 2009 07:09:29 +0100 (CET)

> (1) We couldn't be successful in getting display of more than one
> character.  The characters gets overlapped.

Uh, oh, this is basic programming...  You've modified the source
without thinking:


 draw_bitmap( FT_Bitmap*  bitmap,
              FT_Int      x,
              FT_Int      y)
 {
   FT_Int  i, j, p, q;
   FT_Int  x_max = x + bitmap->width;
   FT_Int  y_max = y + bitmap->rows;

-
+  width = bitmap->width;
+  rows = bitmap->rows;
   for ( i = x, p = 0; i < x_max; i++, p++ )
   {
     for ( j = y, q = 0; j < y_max; j++, q++ )
     {
       if ( i < 0      || j < 0       ||
            i >= WIDTH || j >= HEIGHT )
         continue;

-      image[j][i] |= bitmap->buffer[q * bitmap->width + p];
+      image[q][p] |= bitmap->buffer[q * bitmap->width + p];  <<<<< wrong!
     }
   }
+
+  printf("\n Bitmap Width %d",width);
+  printf("\n Bitmap Height %d",rows);
+  printf("\n Width %d",p);
+  printf("\n Height %d\n",q);
 }


The marked line causes your problems since you ignore any offset given
by x and y.

> (2) Since height and width of each character gets varied, how the
> starting position of drawing the next character be found.

The original example1.c code works just fine and does the expected!
Why not checking it carefully?  The position of the next glyph is
controlled by the last glyph's advance width (and height).  All these
details are discussed in the tutorial and the other documentation
files.

> It will be helpful if you support us as early as possible.

As others have already mentioned, this attitude is inappropriate for a
library which you are using for free, without any fees, and where
everyone is working as a volunteer in his sparetime.


    Werner




reply via email to

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