Changeset 2236


Ignore:
Timestamp:
2001-04-01T13:18:22+12:00 (23 years ago)
Author:
sjboddie
Message:

Made a couple of changes to image creation scripts to handle cyrillic
characters

Location:
trunk/gsdl/bin/script
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/bin/script/gimp/flash_button.pl

    r1469 r2236  
    4141use parsargv;
    4242use util;
     43use unicode;
     44
    4345
    4446# set trace level to watch functions as they are executed
     
    5153my ($cfg_file, $width, $height, $text, $filenamestem, $fixed_width,
    5254    $width_space, $whitespace, $dont_center, $bgcolor, $fontcolor,
    53     $fontsize, $fontname, $fontweight, $fontslant, $fontwidth,
     55    $fontsize, $foundry, $fontname, $fontweight, $fontslant, $fontwidth,
    5456    $fontspacing, $image_dir);
    5557
     
    7981    print STDERR "   -fontcolor hex_value  text color [$black]\n";
    8082    print STDERR "   -fontsize number      font point size [10]\n";
     83    print STDERR "   -foundry string       [*]\n";
    8184    print STDERR "   -fontname string      [lucida]\n";
    8285    print STDERR "   -fontweight string    [medium]\n";
     
    99102    $fontcolor = $black;
    100103    $fontsize = 10;
     104    $foundry = "*";
    101105    $fontname = "lucida";
    102106    $fontweight = "medium";
     
    122126             "fontcolor/#[0-9A-Fa-f]{6}/$black", \$fontcolor,
    123127             'fontsize/^\d+$/10', \$fontsize,
     128             'foundry/.*/*', \$foundry,
    124129             'fontname/.*/lucida', \$fontname,
    125130             'fontweight/.*/medium', \$fontweight,
     
    139144    # replace any '\n' occurring in text with carriage return
    140145    $text =~ s/\\n/\n/gi;
    141    
     146
    142147    if ($cfg_file =~ /\w/) {
    143148   
     
    177182
    178183    my $textlayer = gimp_text ($image, $backlayer, 0, 0, $text, 0, 1,
    179                    $fontsize, PIXELS, "*", $fontname, $fontweight,
     184                   $fontsize, PIXELS, $foundry, $fontname, $fontweight,
    180185                   $fontslant, $fontwidth, $fontspacing);
    181186   
     
    205210        ($image, $backlayer) = &create_image ($off_img);
    206211        $textlayer = gimp_text ($image, $backlayer, 0, 0, $text, 0, 1,
    207                     $fontsize, PIXELS, "*", $fontname, $fontweight,
     212                    $fontsize, PIXELS, $foundry, $fontname, $fontweight,
    208213                    $fontslant, $fontwidth, $fontspacing);
    209214       
     
    211216
    212217    my $y_offset = ($height-$textheight)-int($fontsize/5);
    213     if ($text =~ /[gjpqyJ]/) { ## capital J is a descender in lucida font
     218
     219    my $descenders = "";
     220
     221    # russian descenders (KOI8-R)
     222    # $descenders .= chr(0xD2);
     223    # $descenders .= chr(0xD5);
     224
     225    if ($text =~ /[gjpqyJ$descenders]/) { ## capital J is a descender in lucida font
    214226        # descenders - put text at bottom of image, otherwise
    215227        # go for fontsize/5 pixels above bottom. This is kind of hacky
  • trunk/gsdl/bin/script/gimp/green_bar.pl

    r1037 r2236  
    4040use parsargv;
    4141use util;
     42use unicode;
    4243
    4344# set trace level to watch functions as they are executed
     
    4950
    5051my ($cfg_file, $width, $height, $text, $filename, $width_space,
    51     $dont_center, $bgcolor, $fontcolor, $fontsize, $fontname,
     52    $dont_center, $bgcolor, $fontcolor, $fontsize, $foundry, $fontname,
    5253    $fontweight, $fontslant, $fontwidth, $fontspacing, $image_dir);
    5354
     
    7071    print STDERR "   -fontcolor hex_value  text color [$black]\n";
    7172    print STDERR "   -fontsize number      font point size [17]\n";
     73    print STDERR "   -foundry string       [*]\n";
    7274    print STDERR "   -fontname string      [lucida]\n";
    7375    print STDERR "   -fontweight string    [medium]\n";
     
    8890    $fontcolor = $black;
    8991    $fontsize = 17;
     92    $foundry = "*";
    9093    $fontname = "lucida";
    9194    $fontweight = "medium";
     
    109112             "fontcolor/#[0-9A-Fa-f]{6}/$black", \$fontcolor,
    110113             'fontsize/^\d+$/17', \$fontsize,
     114             'foundry/.*/*', \$foundry,
    111115             'fontname/.*/lucida', \$fontname,
    112116             'fontweight/.*/medium', \$fontweight,
     
    160164
    161165    my $textlayer = gimp_text ($image, $backlayer, 0, 0, $text, 0, 1,
    162                    $fontsize, PIXELS, "*", $fontname, $fontweight,
     166                   $fontsize, PIXELS, $foundry, $fontname, $fontweight,
    163167                   $fontslant, $fontwidth, $fontspacing);
    164168   
     
    185189        ($image, $backlayer) = &create_image ();
    186190        $textlayer = gimp_text ($image, $backlayer, 0, 0, $text, 0, 1,
    187                     $fontsize, PIXELS, "*", $fontname, $fontweight,
     191                    $fontsize, PIXELS, $foundry, $fontname, $fontweight,
    188192                    $fontslant, $fontwidth, $fontspacing);
    189193       
     
    191195
    192196    my $y_offset = ($height-$textheight)-int($fontsize/5);
    193     if ($text =~ /[gjpqy]/) {
     197
     198    my $descenders = "";
     199
     200    # russian descenders (KOI8-R)
     201    # $descenders .= chr(0xD2);
     202    # $descenders .= chr(0xD5);
     203
     204    if ($text =~ /[gjpqyJ$descenders]/) { ## capital J is a descender in lucida font
    194205        # descenders - put text at bottom of image, otherwise
    195206        # go for fontsize/5 pixels above bottom. This is kind of hacky
  • trunk/gsdl/bin/script/gimp/title_icon.pl

    r1267 r2236  
    3737use parsargv;
    3838use util;
     39use unicode;
    3940
    4041# set trace level to watch functions as they are executed
     
    4849local ($cfg_file, $size, $imagefile, $width, $height, $imageheight, $stripecolor, $stripewidth,
    4950       $stripe_alignment, $i_transparency, $text, $text_alignment, $filename, $textspace_x,
    50        $textspace_y, $bgcolor, $fontcolor, $fontsize, $minfontsize, $fontname,
     51       $textspace_y, $bgcolor, $fontcolor, $fontsize, $minfontsize, $foundry, $fontname,
    5152       $fontweight, $fontslant, $fontwidth, $fontspacing, $image_dir, $dont_wrap);
    5253
     
    8182    print STDERR "   -fontsize number       font point size [17]\n";
    8283    print STDERR "   -minfontsize number    minimum point size font will be reduced to fit image [10]\n";
     84    print STDERR "   -foundry string        [*]\n";
    8385    print STDERR "   -fontname string       [lucida]\n";
    8486    print STDERR "   -fontweight string     [medium]\n";
     
    108110    $fontsize = int (17 * $size);
    109111    $minfontsize = int (10 * $size);
     112    $foundry = "*";
    110113    $fontname = "lucida";
    111114    $fontweight = "medium";
     
    138141             'fontsize/^\d+$/17', \$fontsize,
    139142             'minfontsize/^\d+$/10', \$minfontsize,
     143             'foundry/.*/*', \$foundry,
    140144             'fontname/.*/lucida', \$fontname,
    141145             'fontweight/.*/medium', \$fontweight,
     
    259263    if (length($text)) {
    260264    $text =~ s/\\n/\n/gi;
     265
    261266    while (1) {
    262267        $textlayer = gimp_text ($image, $backlayer, 0, 0, $text, 0, 1, $fsize,
    263                     PIXELS, "*", $fontname, $fontweight, $fontslant,
     268                    PIXELS, $foundry, $fontname, $fontweight, $fontslant,
    264269                    $fontwidth, $fontspacing);
    265270       
  • trunk/gsdl/bin/script/translate.pl

    r1970 r2236  
    4141use parsargv;
    4242use util;
     43use unicode;
    4344
    4445# these html entities will be translated correctly when occurring in
     
    188189    $text =~ s/&([^;]*);/$rmap{$1}/g;
    189190
     191    # special case for russian images - fonts expect text to be koi8-r encoded
     192    if ($language_symbol eq "ru") {
     193    $text = &unicode::unicode2koi8r(&unicode::utf82unicode($text));
     194    }
     195
    190196    # edit image macros
    191197    $image_macros =~ s/(_httpimg_\/)(?:[^\/\}]*\/)?([^\}]*\.(?:gif|jpe?g|png))/$1$language_symbol\/$2/gs;
     
    195201    # generate images
    196202    my $options = "-text \"$text\" -filenamestem $image_name";
    197     $options .= " -fontsize 12 -height 20 -whitespace -image_dir $image_dir";
     203    # special case for russian images
     204    if ($language_symbol eq "ru") {
     205        $options .= " -fontsize 10 -height 20 -whitespace -image_dir $image_dir";
     206        $options .= " -foundry cronyx -fontname helvetica";
     207    } else {
     208        $options .= " -fontsize 12 -height 20 -whitespace -image_dir $image_dir";
     209    }
    198210    `$ENV{'GSDLHOME'}/bin/script/gimp/flash_button.pl $options`;
    199211
     
    208220    $options .= " -fontsize 17 -height 17 -fixed_width -width 87";
    209221    $options .= " -image_dir $image_dir";
     222    # special case for russian images
     223    if ($language_symbol eq "ru") {
     224        $options .= " -foundry cronyx -fontname helvetica";
     225    }
    210226    `$ENV{'GSDLHOME'}/bin/script/gimp/flash_button.pl $options`;
    211227
     
    213229    $options = "-text \"$text\" -filename ${image_name}gr.gif";
    214230    $options .= " -image_dir $image_dir";
     231    # special case for russian images
     232    if ($language_symbol eq "ru") {
     233        $options .= " -foundry cronyx -fontname helvetica";
     234    }
    215235    `$ENV{'GSDLHOME'}/bin/script/gimp/green_bar.pl $options`;
    216236
     
    224244    my $options = "-text \"$text\" -filenamestem $image_name";
    225245    $options .= " -fixed_width -whitespace -image_dir $image_dir";
     246    if ($language_symbol eq "ru") {
     247        $options .= " -fontsize 8 -foundry cronyx -fontname helvetica";
     248    }
    226249    `$ENV{'GSDLHOME'}/bin/script/gimp/flash_button.pl $options`;
    227250
     
    236259    my $options = "-text \"$text\" -filename ${image_name}.gif -dont_center";
    237260    $options .= " -width 537 -width_space 15 -image_dir $image_dir";
     261    if ($language_symbol eq "ru") {
     262        $options .= " -foundry cronyx -fontname helvetica";
     263    }
    238264    `$ENV{'GSDLHOME'}/bin/script/gimp/green_bar.pl $options`;
    239265
     
    248274    $options .= " -width $width -height 57 -stripe_alignment right -text_alignment right";
    249275    $options .= " -fontsize 26 -fontweight bold";
     276    # special case for russian images
     277    if ($language_symbol eq "ru") {
     278        $options .= " -foundry cronyx -fontname helvetica";
     279    }
    250280    `$ENV{'GSDLHOME'}/bin/script/gimp/title_icon.pl $options`;
    251281
Note: See TracChangeset for help on using the changeset viewer.