10 $textcolour=[255,255,255];
11 $backcolour=[0,0,255];
12 $font="-*-utopia-bold-r-*-*-21-*-*-*-*-*-*-*";
17 for($i=33; $i<127; $i++)
18 { $text.=chr($i); $text.=" "; }
20 # Create a new image of an arbitrary size with
21 $img = gimp_image_new(100, 100, RGB);
23 # Create a new layer for the background of arbitrary size, and
25 my $background = gimp_layer_new($img, 100, 100,
26 RGB, "Background", 100,
28 gimp_image_add_layer($background, 1);
30 # Choose color of text
31 gimp_palette_set_foreground($textcolour);
33 # Create the text layer. Using -1 as the drawable creates a new layer.
34 my $text_layer = gimp_text_fontname($img, -1, 0, 0, $text,
36 xlfd_size($font), $font);
38 # Get size of the text drawable and resize the image and the
39 # background layer to this size.
40 my($width, $height) = ($text_layer->width, $text_layer->height);
41 gimp_image_resize($img, $width, $height, 0, 0);
42 gimp_layer_resize($background, $width, $height, 0, 0);
44 gimp_layer_delete($text_layer);
46 # Fill the background layer now when it has the right size.
47 gimp_palette_set_background($backcolour);
48 gimp_edit_fill($background, BG_IMAGE_FILL);
50 my $shadowlayer, $textlayer;
52 # Plot eight shadow copies of the text
53 gimp_palette_set_foreground($shadowcolour);
54 $shadowlayer = gimp_text_fontname($img, -1, 0, 0, $text,
56 xlfd_size($font), $font);
57 gimp_layer_translate($shadowlayer, -2, 0);
58 gimp_image_flatten($img);
60 gimp_palette_set_foreground($shadowcolour);
61 $shadowlayer = gimp_text_fontname($img, -1, 0, 0, $text,
63 xlfd_size($font), $font);
64 gimp_layer_translate($shadowlayer, 2, 0);
65 gimp_image_flatten($img);
67 gimp_palette_set_foreground($shadowcolour);
68 $shadowlayer = gimp_text_fontname($img, -1, 0, 0, $text,
70 xlfd_size($font), $font);
71 gimp_layer_translate($shadowlayer, 0, -2);
72 gimp_image_flatten($img);
74 gimp_palette_set_foreground($shadowcolour);
75 $shadowlayer = gimp_text_fontname($img, -1, 0, 0, $text,
77 xlfd_size($font), $font);
78 gimp_layer_translate($shadowlayer, 0, 2);
79 gimp_image_flatten($img);
81 gimp_palette_set_foreground($shadowcolour);
82 $shadowlayer = gimp_text_fontname($img, -1, 0, 0, $text,
84 xlfd_size($font), $font);
85 gimp_layer_translate($shadowlayer, -1, -1);
86 gimp_image_flatten($img);
88 gimp_palette_set_foreground($shadowcolour);
89 $shadowlayer = gimp_text_fontname($img, -1, 0, 0, $text,
91 xlfd_size($font), $font);
92 gimp_layer_translate($shadowlayer, -1, 1);
93 gimp_image_flatten($img);
95 gimp_palette_set_foreground($shadowcolour);
96 $shadowlayer = gimp_text_fontname($img, -1, 0, 0, $text,
98 xlfd_size($font), $font);
99 gimp_layer_translate($shadowlayer, 1, -1);
100 gimp_image_flatten($img);
102 gimp_palette_set_foreground($shadowcolour);
103 $shadowlayer = gimp_text_fontname($img, -1, 0, 0, $text,
105 xlfd_size($font), $font);
106 gimp_layer_translate($shadowlayer, 1, 1);
107 gimp_image_flatten($img);
109 # Plot the text itself
110 gimp_palette_set_foreground($textcolour);
111 $textlayer = gimp_text_fontname($img, -1, 0, 0, $text,
113 xlfd_size($font), $font);
114 gimp_image_flatten($img);
119 # register the script
120 register "vlc_subtitler_font",
121 "vlc subtitler font",
122 "vlc subtitler font",
126 "<Toolbox>/Xtns/Perl-Fu/VLC Subtitles Font",
129 \&vlc_subtitler_font;
131 # Handle over control to gimp