+ pen_x += vec.x/64;
+ pen_y += vec.y/64;
+ glyph = string->glyphs;
+ for(n=0; n<string->num_glyphs; ++n, ++glyph) {
+ int gr;
+ FT_Glyph image;
+ FT_BitmapGlyph bit;
+ /* long buf_x,comp_n; */
+ /* make copy to transform */
+ if (! glyph->image) {
+ fprintf (stderr, "no image\n");
+ continue;
+ }
+ error = FT_Glyph_Copy (glyph->image, &image);
+ if (error) {
+ fprintf (stderr, "couldn't copy image\n");
+ continue;
+ }
+
+ /* transform it */
+ vec = glyph->pos;
+ FT_Vector_Transform (&vec, &string->transform);
+
+ bit = (FT_BitmapGlyph) image;
+ gr = bit->bitmap.num_grays -1;
+/*
+ buf_x = (pen_x + 0.5) + (double)bit->left;
+ comp_n = buf_x + bit->bitmap.width > pys_width ? pys_width - buf_x : bit->bitmap.width;
+ if (buf_x < 0 || buf_x >= (long)pys_width) continue;
+ buf_x *= bytes_per_pixel ;
+ for (iy=0; iy < bit->bitmap.rows; iy++){
+ long buf_y = iy+(pen_y+0.5)-(double)bit->top;
+ if (buf_y < 0 || buf_y >= (long)pys_height) continue;
+ buf_y *= rowstride;
+ for (ix=0;ix < bit->bitmap.width;ix++){
+ *(letter + (ix*bytes_per_pixel+3)) = *(bit->bitmap.buffer + iy * bit->bitmap.width + ix);
+ }
+ art_rgba_rgba_composite(buffer + buf_y + buf_x ,letter,comp_n);
+ }
+ art_free(letter);
+*/
+ switch ( bit->bitmap.pixel_mode ) {
+ case FT_PIXEL_MODE_GRAY:
+ for (iy=0; iy < bit->bitmap.rows; iy++){
+ long buf_y = iy+(pen_y+0.5)-bit->top;
+ if (buf_y < 0 || buf_y >= (long)pys_height) continue;
+ buf_y *= rowstride;
+ for (ix=0;ix < bit->bitmap.width;ix++){
+ long buf_x = ix + (pen_x + 0.5) + (double)bit->left ;
+ art_u8 font_alpha;
+
+ if (buf_x < 0 || buf_x >= (long)pys_width) continue;
+ buf_x *= bytes_per_pixel ;
+ font_alpha = *(bit->bitmap.buffer + iy * bit->bitmap.pitch + ix);
+ if (font_alpha > 0){
+ fcolor[3] = (art_u8)((double)font_alpha / gr * falpha);
+ art_rgba_rgba_composite(buffer + buf_y + buf_x ,fcolor,1);
+ }
+ }
+ }
+ break;
+
+ case FT_PIXEL_MODE_MONO:
+ for (iy=0; iy < bit->bitmap.rows; iy++){
+ long buf_y = iy+(pen_y+0.5)-bit->top;
+ if (buf_y < 0 || buf_y >= (long)pys_height) continue;
+ buf_y *= rowstride;
+ for (ix=0;ix < bit->bitmap.width;ix++){
+ long buf_x = ix + (pen_x + 0.5) + (double)bit->left ;
+
+ if (buf_x < 0 || buf_x >= (long)pys_width) continue;
+ buf_x *= bytes_per_pixel ;
+ if ( (fcolor[3] = falpha * ((*(bit->bitmap.buffer + iy * bit->bitmap.pitch + ix/8) >> (7 - (ix % 8))) & 1)) > 0 )
+ art_rgba_rgba_composite(buffer + buf_y + buf_x ,fcolor,1);
+ }
+ }
+ break;