Hello,

Thanks a lot for the freetype plugin! I created a patch that makes
the resulting text layer a floating layer instead of a normal layer.
The patch also checks if there was is a selection active in which
case it will center the resulting text within the selection.

Perhaps you would like to have another checkbutton for the user to
decide if she wants a normal layer or a floating layer. I'll leave
that up to you to decide.

Another issue that I am looking into is why in some Hebrew ttf fonts
all the characters are mapped into font position '0'. But if I press
[Font Table] I do see all the rendered characters of the font. There
must be some mapping somewhere that gets screwed up. I'll let you
know on this mailing list know if I find something.

Regards,
Dov

*** gimp-freetype-0.2/src/render.c      Sat Nov 25 12:43:25 2000
--- gimp-freetype-0.2-dov/src/render.c  Mon Feb 12 23:18:04 2001
***************
*** 555,560 ****
--- 555,562 ----
    guchar        *dest;
    guchar         fg[3];
    gint           i;
+   gboolean       is_selection;
+   gint           x1,x2,y1,y2;
  
    type = gimp_image_base_type (image_ID);
    switch (type)
***************
*** 584,591 ****
                             type,
                             100,
                             GIMP_NORMAL_MODE);
    
-   gimp_image_add_layer (image_ID, layer_ID, 0);
    drawable = gimp_drawable_get (layer_ID);
  
    /* fill with fg color and clear transparency */
--- 586,609 ----
                             type,
                             100,
                             GIMP_NORMAL_MODE);
+ 
+   /* Make undo erase the text */
+   gimp_undo_push_group_start(image_ID);
+   
+   /* Paste the image as a floating selection */
+   gimp_floating_sel_attach(layer_ID, gimp_image_get_active_layer(image_ID));
+   
+   /* Move the new image to the center of the selection, or the center
+      of the image if there is no selection. */
+   gimp_selection_bounds(image_ID, &is_selection, &x1,&y1,&x2,&y2);
+   if (!is_selection)
+     {
+       x1=y1=0;
+       x2=gimp_image_width(image_ID);
+       y2=gimp_image_height(image_ID);
+     }
+   gimp_layer_translate(layer_ID, (x2+x1-width)/2, (y2+y1-height)/2);
    
    drawable = gimp_drawable_get (layer_ID);
  
    /* fill with fg color and clear transparency */
***************
*** 623,628 ****
--- 641,648 ----
    gimp_pixel_rgn_set_rect (pixel_rgn, buf, 0, 0, width, height);
  
    g_free (buf);
+ 
+   gimp_undo_push_group_end(image_ID);
  
    return drawable;
  }

Reply via email to