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

[Patch wml::des::gfont]



Hi again,

this patch implements the 2 new options of gfont (if you want to
incorporate them, of course). It adds another option (font) whose
argument is passed unchanged to gfont, e.g.
  <gfont font="mf:ecrm1200-6.0">Test</gfont>

--- wml-1.6.7/wml_include/des/gfont.src	Sun Jul  5 19:43:04 1998
+++ wml-1.6.7/wml_include/des/gfont.src	Wed Dec 30 10:10:05 1998
@@ -18,6 +18,9 @@
 <preserve base>
 <preserve color>
 <preserve bgcolor>
+<preserve border>
+<preserve bordercolor>
+<preserve font>
 <preserve face>
 <preserve size>
 <preserve align>
@@ -34,6 +37,9 @@
     my $base    = "<get-var base>";
     my $color   = "<get-var color>";
     my $bgcolor = "<get-var bgcolor>";
+    my $border  = "<get-var border>";
+    my $bordercolor = "<get-var bordercolor>";
+    my $font    = "<get-var font>";
     my $face    = "<get-var face>";
     my $size    = "<get-var size>";
     my $align   = "<get-var align>";
@@ -64,18 +70,20 @@
     }
 
     #   determine fontface, fontsize and thus fontname
-    $face = 'Times' if ($face eq '');
-    $size = 0 if ($size eq '');
-    $size = -2 if ($size <= -2);
-    $size =  9 if ($size >= 9);
-    $size += 2;
-    if ($face =~ /^CM/) {
-        $size = $gfont_size_CM[$size+2];
-    }
-    else {
-        $size = $gfont_size[$size];
+    if ($font eq '') {
+        $face = 'Times' if ($face eq '');
+        $size = 0 if ($size eq '');
+        $size = -2 if ($size <= -2);
+        $size =  9 if ($size >= 9);
+        $size += 2;
+        if ($face =~ /^CM/) {
+            $size = $gfont_size_CM[$size+2];
+        }
+        else {
+            $size = $gfont_size[$size];
+        }
+        $font = "$face-$size";
     }
-    $font = "-F $face-$size";
 
     #   determine colors
     if ($bgcolor =~ m|^#([0-9a-fA-F]+)$|) {
@@ -92,7 +100,15 @@
         # default is black
         $color = '-f 000000'; 
     }
+    if ($bordercolor =~ m|^#([0-9a-fA-F]+)$|) {
+        $bordercolor = "-C $1";
+    }
+    else {
+        # default is black
+        $bordercolor = '-C 000000';
+    }
     $align = " align=$align" if ($align ne '');
+    $border = " --border $border" if ($border ne '');
 
     #   cropping and size support
     if ($crop) {
@@ -109,7 +125,7 @@
     }
 
     #   create GIF image via external gFONT tool
-    my $error = `gfont -o $file $crop $adjust $bgcolor $color $font '$str' 2\>&1`;
+    my $error = `gfont -o $file $crop $adjust $bgcolor $color $border $bordercolor -F $font '$str' 2\>&1`;
     if ($? >> 8) {
         print STDERR "** wml::des::gfont:\n$error";
         exit(1);
@@ -131,6 +147,9 @@
 <restore align>
 <restore size>
 <restore face>
+<restore font>
+<restore bordercolor>
+<restore border>
 <restore bgcolor>
 <restore color>
 <restore base>
@@ -223,6 +242,21 @@
 
 Sets the image background color. Default is no color at all, i.e. transparent
 background.
+
+=item C<border=>I<pixels>
+
+Sets the image border width. Default is 0 (no border).
+
+=item C<bordercolor=#>I<rrggbb>
+
+Sets the image border background color. If C<border> is non-null, default is
+black.
+
+=item C<font=>I<fontname>
+
+Sets the type and size of the used font. It is passed directly to gFONT,
+and this option overrides C<face> and C<size> options. See the -F option
+of gfont(1) for more details.
 
 =item C<face=>I<fontname>
 

______________________________________________________________________
Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com