Re: Rendering text with gimp_perl and gimp_text

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

 



Hi,

firstly, sorry for the long delay. A public holiday in parts of germany.

On Fri, Oct 29, 1999 at 05:28:37PM +0200, Marc Lehmann wrote:
> I don´t understand this conclusion.. Do you mean the "top" (or the
> baseline) of the two text layers doesn´t match, or do you mean that the
> baselines agree while the layers are sized differently?
to clarify this a bit consider this script (sorry for the clumsy
perl - its my graphiclanguage-to-perl-translator, I have cut and pastet from
the debug output so please ignore the linenumbering :):
 3: use Gimp;
 4: Gimp::Net::gimp_init();
 5: my $gimpl={};
 6:
 7: $gimpl->{img}=gimp_image_new(200,200,RGB_IMAGE);
 8: $gimpl->{bg}=gimp_layer_new($gimpl->{img},200,200,RGBA_IMAGE,"background",100,NORMAL_MODE);
 9: gimp_image_add_layer($gimpl->{bg},-1);
10: gimp_palette_set_background([0xFF,0xFF,0xFF]);
11: $gimpl->{bg}->gimp_drawable_fill(BG_IMAGE_FILL);
12:
13: gimp_palette_set_foreground([0x00,0x00,0x00]);
14: $gimpl->{small}=$gimpl->{img}->gimp_text(-1,0,0,"Äq",0,1,48,0,"ttf","arial","*","r","normal","*","*","iso8859");
15:
16: $gimpl->{small}->gimp_layer_set_offsets(0,10);
17:
18: gimp_palette_set_foreground([0x00,0x00,0x00]);
19: $gimpl->{big}=$gimpl->{img}->gimp_text(-1,0,0,"ru",0,1,48,0,"ttf","arial","*","r","normal","*","*","iso8859");
20:
21: $gimpl->{big}->gimp_layer_set_offsets(100,10);
22: wm3print(qq{ });
23: $gimpl->{img}->gimp_display_new;

This script produces an image which has two gdtextlayers. One with
Aumlaut-q and one with r-u.

Though both are positioned at equal y positions they are not on the
same text-baseline.

> Yes, you could use Gimp->text_get_extents to get the position of the
> baseline, and the maximum size (measure XygjZ79 or something similar to
> be sure ;) then you can resize the layer after it was created.
gimp_text_get_extents returns 62, 53, 43, 10 and 46, 53, 43, 10
which seems correct to me. 

Now, why does gimp_text put the top of Äq and ru on the same line.
The bottom of ru should be on the same y-pos as the baseline of Äq.

BTW: Using the gimp-GUI does produce a different result. The two
textlayers have the same height now, though ru is still at the top.

The "right" approach to me seems to patch gimp_text and not to create a 
new wrapper which positions them correctly. 

Thanks anyway

Martin

-- 
http://www.dmcs.de/    mailto:mtvb@xxxxxxx       Tel: 07 21/9 20 60-42
digital marketing concepts & services GmbH       Fax: 07 21/9 20 60-30

martin:x:518:112:Martin Treusch von Buttlar:/home/martin:/usr/bin/perl


[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux