GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  WML::DES::TYPOGRAPHY (3)

.ds Aq ’ #use wml::std::tags #use wml::des::imgdot #use wml::des::gfont #use wml::des::space #use wml::fmt::verbatim

# # typographical paragraph skip (ps) # [german variant: *D*urch*S*chuss (ds)] # <define-tag ps> <br /> <imgdot height=<or %0 4 /> /><br /> </define-tag>

<let ds=ps />

# # typographical paragraph indention (pi) # [german variant: *Ein*rueckung (ein)] # <define-tag pi> <br /> <imgdot height=16 width=<or %0 40 /> /> </define-tag>

<let ein=pi />

# # big letter # <define-tag big> <gfont face=ps:ptmb8r size=+4 align=left crop>%0</gfont> </define-tag>

# # Spaced Paragraph # [german variant: Gesperrt] # <define-tag spaced endtag=required> <preserve interchar interline /> <set-var %attributes /> <perl> {
my $n_char = qq|<get-var interchar />|;
my $n_line = qq|<get-var interline />|;
my $base = qq|<or <get-var IMGDOT_BASE /> <get-var IMAGE_BASE /> />|;
my $format = qq|<or <get-var IMAGE_FORMAT /> gif />|;
<perl:assign:sq $body>%body</perl:assign:sq>
$n_char = 0 if ($n_char eq ’’ or $n_char < 0);
$n_line = 0 if ($n_line eq ’’ or $n_line < 0);



    my $pad_char = ;
    if ($n_char > 0) {
        $pad_char =   x $n_char;
    }

    my $pad_line = ;
    if ($n_line > 0) {
        $n_line += 14; # 14 pt is the average text width
        my $file = &imgdot($base, 1, 1, transp-ffffff, 255, 255, 255, 1, $format);
        $pad_line = <*img src=".$file." width=1 height=.$n_line. alt="">;
    }

    my $cnt = 0;
    my $every = int(5 / ($n_char+1));
    $every = 1 if ($every < 1);
    while ($body) {
        if ($body =~ s|^(</?[a-zA-Z]+[^>]*>)||s) {
            <perl:print: $1 />
        }
        elsif ($body =~ s|^([^<\s]+)||s) {
            $word = $1;
            $word =~ s|\G(.)|$1$pad_char|sg;
            <perl:print: $word />
            if (($cnt++ % $every) == 0) {
                <perl:print: $pad_line />
            }
        }
        elsif ($body =~ s|^(\S+)||s) {
            $word = $1;
            $word =~ s|\G(.)|$1$pad_char|sg;
            <perl:print: $word />
            if (($cnt++ % $every) == 0) {
                <perl:print: $pad_line />
            }
        }
        elsif ($body =~ s|^(\s+)||s) {
            $space = $1;
            $space =~ s|\G([^\n])|$pad_char$1|sg;
            <perl:print: $space />
        }
    }
}
</perl>
<restore  interchar interline />
</define-tag>



<let gesperrt=spaced />

# # Small Caps (sc) # i.e. change all lower case letters to upper case but lower # them a little bit by font size. Optionally all words can # begin with an upper case letter # [german variant: Kapitaelchen] # <define-tag sc endtag=required>\ <preserve complete />\ <set-var complete=* />\ <set-var %attributes />\ <perl> {
my $complete = (qq|<get-var complete />| eq ’’ ? 1 : 0);
<perl:assign:sq $body>%body</perl:assign:sq>
$body =~ s|\n$||s;
use locale;
sub convword {
my ($w) = @_;



        #   optionally make all words start with an upper case letter
        $w = uc(substr($w, 0, 1)).substr($w, 1) if ($complete);

        #   convert lower case chars to upper case
        my $c;
        my @C = split(, $w);
        my $makeupper = 0;
        $w = ;
        foreach $c (@C) {
            if (not $makeupper and $c eq lc($c)) {
                $w .= <*font size="-1">.uc($c);
                $makeupper = 1;
            }
            elsif ($makeupper and $c ne lc($c)) {
                $w .= <*/font>.$c;
                $makeupper = 0;
            }
            elsif ($makeupper and $c eq lc($c)) {
                $w .= uc($c);
            }
            else {
                $w .= $c;
            }
        }
        $w .= <*/font> if ($makeupper);
        return $w;
    }
    my $text = ;
    while ($body ne ) {
        if ($body =~ m|^([^<]+)(<[/a-zA-Z].*?>)(.*)$|) {
            my $words = $1;
            my $rest  = $2;
            $body = $3;
            $words =~ s|(\w+)|&convword($1)|sge;
            $text .= $words . $rest;
        }
        elsif ($body =~ m|^(<[/a-zA-Z].*?>)(.*)$|) {
            $text .= $1;
            $body = $2;
        }
        else {
            $body =~ s|(\w+)|&convword($1)|sge;
            $text .= $body;
            $body = ;
        }
    }
    <perl:print: $text />
}
</perl>\
<restore complete />\
</define-tag>



<let csc=sc />

# # Verbatim Code Text # <define-tag verbcode endtag=required> <p*> <over 30> <b><verbatim>%body</verbatim></b> </over> </define-tag>

# # Headline # [german variant: Ueberschrift] # <define-tag headline endtag=required> <if %0 <a* name=%0> />\ <font face=Arial,Helvetica size=+4><b>%body</b></font>\ <if %0 </a*> /> <ds 5 />\ </define-tag>

<let ue=headline />

# # Sub Headline # [german variant: Zwischenueberschrift] # <define-tag subheadline endtag=required> <if %0 <a* name=%0> />\ <font face=Arial,Helvetica size=+2><b>%body</b></font> <if %0 </a*> /> <ds 2 />\ </define-tag>

<let zwue=subheadline />

# # Emulation of the <ul>...</ul> environment in # a more typographically strong layout. # <define-tag tul endtag=required> <preserve ps pi /> <set-var %attributes /> <defvar pi 30 /> <ps <get-var ps /> /> <table cellspacing=0 cellpadding=0 border=$(DEBUG:-0) summary=""> <tr> <td valign=top><imgdot height=1 width=<get-var pi /> /></td><suck/> <td valign=top><imgdot height=1 width=<get-var pi /> /><suck/> %body<suck/> </td> </tr> </table> <restore ps pi /> </define-tag>

<define-tag tli endtag=required> <preserve pshape pcolor /> <set-var %attributes /> <defvar pshape box /> <defvar pcolor #cccccc /> <ps <get-var ps /> /> </td*>\ </tr*> <tr*>\ <td valign=top align=right>\ <ifeq <get-var pshape /> box
<imgdot color=<get-var pcolor /> height=10 width=10 />
<font color=<get-var pcolor />>-</font> />\   \ </td>\ <td*> %body <restore pshape pcolor /> </define-tag>

# # the ‘‘#use ... face_shortcuts’’ support # <if $(face_shortcuts) <group {: [[s/(face=)?helvetica?/face=Arial,Helvetica/ig]] {#TYPOGRAPHY_FACE_SHORTCUTS#} :} {#TYPOGRAPHY_FACE_SHORTCUTS#: />/>

##EOF## __END__

NAME

wml::des::typography - Typography

CONTENTS

SYNOPSIS



 #use wml::des::typography [face_shortcuts]
 
 #   paragraph whitespace
 <ps [height]>
 (<ds [height]>)
 <pi [width]>
 (<ein [width]>)

 #   paragraph text rendering
 <big X>
 <sc [complete]>...</sc>
 <csc>...</csc>
 <spaced [interchar=N] [interline=N]>...</spaced>
 <verbcode>...</verbcode>

 #   headlines
 <headline [name]>...</headline>
 (<ue [name]>...</ue>)
 <subheadline [name]>...</subheadline>
 (<zwue [name]>...</zwue>)

 #   unsorted lists
 <tul [ps=N] [pi=N]>
   <tli [pshape=dash|box] [pcolor=#rrggbb]>...</tli>
   ...
 </tul>



DESCRIPTION

This include file provides tags for more typographically strong layouting then HTML per default provides. The following tags are provided:
Typographical Paragraph Skip <ps [height]>

This is the typographical way to insert a blank line between two paragraphs. It is not as high as the one generated by HTML’s <p> tag. Default is 4 pixels for height. Optically and functionally <ps> is between <br> and <p>. In german this is called Durchschuss, so you can also use the alterntive name <ds> for this tag.



  ...The last line of the previous paragraph.
  <ps>
  The new line of the following paragraph...



Typographical Paragraph Indention <pi [width]>

This is the typographical way to glue paragraphs which should become one optical block. A complete blank line between them would be ugly and without any inserts the reader cannot distinguish between the two paragraphs. The typographical solution here is to indent the second paragraph by width pixels. The default is 40 pixels. Optically <pi> also includes the effect of <ps>. In german this is called ‘Einrueckung’, so you can also use the alterntive name <ein> for this tag.

Example:



  ...The last line of the previous paragraph.
  <pi>The new line of the following paragraph...



Big Paragraph Starting Letter <big X>

This is the typographical way to mark the beginning of a more important paragraph by rendering the first letter of the first word of this paragraph in huge font. Optically this letter then is approximately three times bigger then the normal text font. Additionally the alt attribute of the used <img> tag is set to the letter, so text-based browsers correctly show the first word. Because such a paragraph should also be introduced by more whitespace, one usually uses the standard <p> tag in front of <big> to achieve the correct optical effect.

Example:



  ...The last line of the previous paragraph.
  <p>
  <big T>he new line of the following paragraph...



Small Caps Text <sc [complete]>...</sc>

This container tag renders its body with small caps, i.e. all lower case letters are changed to upper case while lowered optically via font size. In german typography this is also known as ‘Kapitaelchen’. Optionally when adding the attribute complete, all words are forced to begin with an upper case letter, too.

If you have support for i18n (internationalization) you may also convert case of non-ASCII characters. See your local documentation locale(7) for details or ask your system administrator.

Spaced Text <spaced [interchar=N] [interline=N]>...</spaced>

This container tag renders its body as spaced text, i.e. text with spaces between the lines and characters. In typpgraphy this is usually used to emphasize the text by the use of whitespace. Per default interchar and interline are 0, i.e. no spacing. The spacing is achieved by inserting as much   entities as interchar specifies and 1pt-images of height 14+interline every fifth word. In german typography this is also known as ‘Gesperrt’.

Headline <headline [name]>...</headline>

This container tag creates a typographically better headline as the standard HTML <h1> does, i.e. it renders the text in Helvetica and used better whitespaces around it. Actually it does not create any whitespace above it, but the correct one below it. This way you can create the leading whitespace your own (which is usually different according to the context) but get nice trailing whitespace (which has to be choosen carefully to make the headline and the following paragraph one unit). In german this is called ‘Ueberschrift’ hence the alias <ue>.

Example:



  ...The last line of the previous paragraph.
  <p>
  <ue>The headline</ue>
  The new line of the following paragraph...



Sub-Headline <subheadline [name]>...</subheadline>

This container tag creates a typographically better sub-headline as the standard HTML <h2> does, i.e. it renders the text in Helvetica and used better whitespaces around it. Actually it does not create any whitespace above it, but the correct one below it. This way you can create the leading whitespace your own (which is usually different according to the context) but get nice trailing whitespace (which has to be choosen carefully to make the headline and the following paragraph one unit). In german this is called ‘Zwischenueberschrift’ hence the alias <zwue>.

Example:



  ...The last line of the previous paragraph.
  <p>
  <zwue>The headline</zwue>
  The new line of the following paragraph...



Verbatim Code <verbcode>...</verbcode>

This container tag renders its body mostly verbatim, i.e. treats it like plain (source) code. Internally this just is an indented <verbatim> container from wml::fmt::verbatim(3) which itself is an enhanced <pre> container.

Unnumbered Lists <tul [ps=N] [pi=N]>...</tul>

This container tag displays unnumbered lists in a more typographically strong layout, rendered via HTML tables for indentation.

<tli [pshape=box|dash] [pcolor=#rrggbb]>...</tli>

Items are prefixed by a box or a dash, depending on the pshape attribute, and its color may be defined.

AUTHOR



 Ralf S. Engelschall
 rse@engelschall.com
 www.engelschall.com



REQUIRES



 Internal: P1, P2, P3, P8



SEEALSO

HTML <font> and <br> tags.
Search for    or go to Top of page |  Section 3 |  Main Index


EN Tools WML::DES::TYPOGRAPHY (1) 2016-04-03

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.