From 5935dc9cd72cb9c57ba4b38ba72b72b5844c08c5 Mon Sep 17 00:00:00 2001 From: Derk-Jan Hartman Date: Tue, 9 Sep 2003 13:28:58 +0000 Subject: [PATCH] We no longer need this. --- doc/subtitles/readme | 19 ---- doc/subtitles/vlc-font.pl | 205 -------------------------------------- doc/subtitles/vlc-gimp.pl | 132 ------------------------ 3 files changed, 356 deletions(-) delete mode 100644 doc/subtitles/readme delete mode 100755 doc/subtitles/vlc-font.pl delete mode 100755 doc/subtitles/vlc-gimp.pl diff --git a/doc/subtitles/readme b/doc/subtitles/readme deleted file mode 100644 index 236f103a8f..0000000000 --- a/doc/subtitles/readme +++ /dev/null @@ -1,19 +0,0 @@ -How to create new subtitles fonts ---------------------------------- - -VLC uses run-length encoded fonts. We already provide 2 of these fonts -(share/font-eutopiabold21.rle and share/font-eutopiabold36.rle) but you might -also want to generate your own. - -Two (very basic) perl scripts are provided to generate these fonts files, -vlc-gimp.pl and vlc-font.pl. vlc-gimp.pl is perl-fu, and uses gimp's font -plotting routines to create an image, which should be saved as an RAW PNM. -Installing vlc-gimp.pl with "gimptool --install-bin vlc-gimp.pl" will add a new -entry in the Xtns/Perl-Fu menu in gimp. -vlc-font.pl extracts the characters from the raw PNM, and creates a run-length -encoded font file which VLC can use. As already stated these scripts are quite -basic so you will have to hack them to your liking. - -Also note that the subtitler engine in VLC is currently being replaced to use -the freetype library which will allow the use of fonts already available on -your system and some other new powerful features. \ No newline at end of file diff --git a/doc/subtitles/vlc-font.pl b/doc/subtitles/vlc-font.pl deleted file mode 100755 index 3dbe741ee4..0000000000 --- a/doc/subtitles/vlc-font.pl +++ /dev/null @@ -1,205 +0,0 @@ -#! /usr/bin/perl - -$file_input="font.pnm"; -$file_output="eutopiabold36.rle"; -$border=-1; -$spaceborder=4; - -$|=1; - -open(INPUT,$file_input) || die "Couldn't open font: $!\n"; - -$tag=; chop($tag); -if($tag ne "P6") - { die "Couldn't process image: not a pnm file ($tag)"; } - -$comment=; - -$dimensions=; chop($dimensions); - -if($dimensions =~ /(\d+) (\d+)/) - { $width=$1; $height=$2; } -else - { die "Couldn't process image: couldn't get dimensions"; } - -$bits=; - -print "width $width height $height\n"; - -for($j=0; $j<$height; $j++) - { for($i=0; $i<$width; $i++) - { - $red[$i][$j]=ord(getc(INPUT)); - $green[$i][$j]=ord(getc(INPUT)); - $blue[$i][$j]=ord(getc(INPUT)); - } - print "."; - } - -print "\n"; - -close(INPUT); - -open(OUTPUT,">".$file_output) || die "Couldn't open output: $!\n"; - -# Put header -print OUTPUT pack("C2",0x36,0x05); - -# Put font height -print OUTPUT pack("C",$height); - -$xstart=0; - -# Search for space - -$xstart=2; -$x=$xstart; $blank=0; -while($x<$width && !$blank) - { $blank=1; - for($y=0; $y<$height; $y++) - { if($blue[$x][$y]!=255) - { $blank=0; } - } - if(!$blank) - { $x++; } - } - -$xstart=$x; - -$x=$xstart; $blank=1; -while($x<$width && $blank) - { $blank=1; - for($y=0; $y<$height; $y++) - { if($blue[$x][$y]!=255) - { $blank=0; } - } - if($blank) - { $x++; } - } -$xend=$x; - -$spacewidth=$xend-$xstart+$spaceborder; -$spacewidth=$spacewidth/2; -if($spacewidth==0) - { $spacewidth=1; } - -print "space start=$xstart end=$xend -> width=$spacewidth\n\n"; - -# Put space character code -print OUTPUT pack("C",32); - -# Put space width -print OUTPUT pack("C",$spacewidth); - -# Put space RLE data -for($y=0;$y<$height;$y++) - { print OUTPUT pack("C",1); - print OUTPUT pack("C",0); - print OUTPUT pack("C",$spacewidth); - } - -$char=33; - -while($xstart<$width) - { - print "looking for character $char \"".chr($char)."\"\n"; - - $x=$xstart; $blank=1; - while($x<$width && $blank) - { $blank=1; - for($y=0; $y<$height; $y++) - { if($blue[$x][$y]!=255) - { $blank=0; } - } - if($blank) - { $x++; } - } - $xstart=$x; - - $x=$xstart; $blank=0; - while($x<$width && !$blank) - { $blank=1; - for($y=0; $y<$height; $y++) - { if($blue[$x][$y]!=255) - { $blank=0; } - } - if(!$blank) - { $x++; } - } - $xend=$x; - print "start=$xstart end=$xend\n"; - - $dstart=$xstart-$border; - if($dstart < 0) - { $dstart = 0; } - $dend=$xend+$border; - if($dend > $width) - { $dend = $width; } - - # Put character - print OUTPUT pack("C",$char); - - # Put character width - print OUTPUT pack("C",$dend-$dstart); - - for($y=0; $y<$height; $y++) - { $linecode=""; $bytecode=""; $lastcolour=-1; $count=0; - for($x=$dstart; $x<$dend; $x++) - { - # Transparent background - $c=":"; $colour=0; - - # Anti-aliased foreground - if($blue[$x][$y]<255 && $red[$x][$y]>0) - { $c="+"; $colour=1; } - - # Solid foreground - if($blue[$x][$y]==255 && $red[$x][$y]==255 ) - { $c="#"; $colour=2; } - - # Anti-aliased shadow (same as shadow) - if($blue[$x][$y]<255 && $red[$x][$y]==0) - { $c="."; $colour=3; } - - # Solid shadow - if($blue[$x][$y]==0 && $red[$x][$y]==0) - { $c=" "; $colour=3; } - - print $c; - - if($colour != $lastcolour) - { - if($lastcolour!=-1) - { $linecode.=" $lastcolour,$count"; - $bytecode.=pack("C2",$lastcolour,$count); - } - $lastcolour=$colour; $count=1; - } - else - { $count++; } - } - if($lastcolour!=-1) - { $linecode.=" $lastcolour,$count"; - $bytecode.=pack("C2",$lastcolour,$count); - } - print " [$linecode]\n"; - - # Put length of RLE line - print OUTPUT pack("C*",length($bytecode)/2); - - # Put RLE line - print OUTPUT $bytecode; - - } - - print "\n"; - - $xstart=$xend+1; - $char++; - } - -print OUTPUT pack("C",255); - -print "Done!\n"; - -close(OUTPUT); diff --git a/doc/subtitles/vlc-gimp.pl b/doc/subtitles/vlc-gimp.pl deleted file mode 100755 index 25619f5f23..0000000000 --- a/doc/subtitles/vlc-gimp.pl +++ /dev/null @@ -1,132 +0,0 @@ -#!/usr/bin/perl - -use Gimp ":auto"; -use Gimp::Fu; - -sub vlc_subtitler_font -{ - - $shadowcolour=[0,0,0]; - $textcolour=[255,255,255]; - $backcolour=[0,0,255]; - $font="-*-utopia-bold-r-*-*-21-*-*-*-*-*-*-*"; - $border=3; - $alias=1; - - $text="_ "; - for($i=33; $i<127; $i++) - { $text.=chr($i); $text.=" "; } - - # Create a new image of an arbitrary size with - $img = gimp_image_new(100, 100, RGB); - - # Create a new layer for the background of arbitrary size, and - # add it to the image - my $background = gimp_layer_new($img, 100, 100, - RGB, "Background", 100, - NORMAL_MODE); - gimp_image_add_layer($background, 1); - - # Choose color of text - gimp_palette_set_foreground($textcolour); - - # Create the text layer. Using -1 as the drawable creates a new layer. - my $text_layer = gimp_text_fontname($img, -1, 0, 0, $text, - $border, $alias, - xlfd_size($font), $font); - - # Get size of the text drawable and resize the image and the - # background layer to this size. - my($width, $height) = ($text_layer->width, $text_layer->height); - gimp_image_resize($img, $width, $height, 0, 0); - gimp_layer_resize($background, $width, $height, 0, 0); - - gimp_layer_delete($text_layer); - - # Fill the background layer now when it has the right size. - gimp_palette_set_background($backcolour); - gimp_edit_fill($background, BG_IMAGE_FILL); - - my $shadowlayer, $textlayer; - - # Plot eight shadow copies of the text - gimp_palette_set_foreground($shadowcolour); - $shadowlayer = gimp_text_fontname($img, -1, 0, 0, $text, - $border, $alias, - xlfd_size($font), $font); - gimp_layer_translate($shadowlayer, -2, 0); - gimp_image_flatten($img); - - gimp_palette_set_foreground($shadowcolour); - $shadowlayer = gimp_text_fontname($img, -1, 0, 0, $text, - $border, $alias, - xlfd_size($font), $font); - gimp_layer_translate($shadowlayer, 2, 0); - gimp_image_flatten($img); - - gimp_palette_set_foreground($shadowcolour); - $shadowlayer = gimp_text_fontname($img, -1, 0, 0, $text, - $border, $alias, - xlfd_size($font), $font); - gimp_layer_translate($shadowlayer, 0, -2); - gimp_image_flatten($img); - - gimp_palette_set_foreground($shadowcolour); - $shadowlayer = gimp_text_fontname($img, -1, 0, 0, $text, - $border, $alias, - xlfd_size($font), $font); - gimp_layer_translate($shadowlayer, 0, 2); - gimp_image_flatten($img); - - gimp_palette_set_foreground($shadowcolour); - $shadowlayer = gimp_text_fontname($img, -1, 0, 0, $text, - $border, $alias, - xlfd_size($font), $font); - gimp_layer_translate($shadowlayer, -1, -1); - gimp_image_flatten($img); - - gimp_palette_set_foreground($shadowcolour); - $shadowlayer = gimp_text_fontname($img, -1, 0, 0, $text, - $border, $alias, - xlfd_size($font), $font); - gimp_layer_translate($shadowlayer, -1, 1); - gimp_image_flatten($img); - - gimp_palette_set_foreground($shadowcolour); - $shadowlayer = gimp_text_fontname($img, -1, 0, 0, $text, - $border, $alias, - xlfd_size($font), $font); - gimp_layer_translate($shadowlayer, 1, -1); - gimp_image_flatten($img); - - gimp_palette_set_foreground($shadowcolour); - $shadowlayer = gimp_text_fontname($img, -1, 0, 0, $text, - $border, $alias, - xlfd_size($font), $font); - gimp_layer_translate($shadowlayer, 1, 1); - gimp_image_flatten($img); - - # Plot the text itself - gimp_palette_set_foreground($textcolour); - $textlayer = gimp_text_fontname($img, -1, 0, 0, $text, - $border, $alias, - xlfd_size($font), $font); - gimp_image_flatten($img); - - return $img; -} - -# register the script -register "vlc_subtitler_font", - "vlc subtitler font", - "vlc subtitler font", - "Andrew Flintham", - "Andrew Flintham", - "2002-06-18", - "/Xtns/Perl-Fu/VLC Subtitles Font", - "*", - [], - \&vlc_subtitler_font; - -# Handle over control to gimp -exit main(); -- 2.39.2