JCString User's Guide

How to use JCString

JCString is a rich text format. It allows a mixture of hypertext, images and text. Text can appear in a variety of colors, fonts and styles.

The next few sections describe how to use the JCString resources. More advanced JCString users should refer to the grammar.

Underline and Strikeout

JCString allows text to be underlined using the UNDERLINE resource. JCString also allows text to be crossed out using the STRIKEOUT resource. The following is a JCString that will underline a portion of the text and strikethrough another portion of the text:
This text is [UL]underlined[/UL], and this is [ST]crossed out[/ST]

Colors

JCString allows specification of different colors using the COLOR resource. The JCString shown below displays text using red, green and blue colors. Note that the resource DEFAULT_COLOR is used to reset the text color to the browser's regular text color.
[COLOR=red]Red, [COLOR=green]Green, [COLOR=blue]Blue, [DEFAULT_COLOR]Default

Fonts

JCString also allows specification of different fonts using the FONT resource. The JCString shown below displays text using a variety of fonts and font styles.
[FONT=timesroman-plain-20]TimesRoman-20, 
 [FONT=timesroman-bold-12]TimesRoman-12 bold, 
 [DEFAULT_FONT]Default

Horizontal and Vertical Spacing

JCString allows vertical and horizontal spacing to be modified using the VERT_SPACE and HORIZ_SPACE tags. VERT_SPACE offsets the current line by a number of pixels, whereas HORIZ_SPACE puts in a number of pixels of space on a particular line.

The example below makes use of the HORIZ_SPACE and VERT_SPACE. tags.

[VERT_SPACE=10]Vertical offset=10
 [HORIZ_SPACE=30][ALIGN=BOTTOM]bottom
 [ALIGN=TOP]top[ALIGN=MIDDLE]middle
 \n[VERT_SPACE]Down 20 pixels

Newline and Reset

The NEWLINE tag forces text to begin on a new line. The RESET tag will reset the font and color to the default value. An example appears below:

[COLOR=green][FONT=timesroman-plain-20]Big text\n[RESET]Regular Text

Images

The IMAGE resource can be used to specify images in a cell. A URL or file name must be provided. If a relative path is given, the document base for the page is prepended. In other words, the image path must be relative to the current directory.

The example below mixes an image with text.

Tech Support: [IMAGE=technical.gif]

Alignment

If a cell contains an image, the line height might be greater than the height of the text. JCString allows the text to be aligned vertically using the ALIGN resource. Possible values include TOP, BOTTOM and MIDDLE.
[ALIGN=TOP]top[ALIGN=MIDDLE]middle[ALIGN=bottom]bottom
 [IMAGE=technical.gif]

Hypertext

JCString allows specification of a HTML-style hypertext links. The link appears underlined, and the browser footer will display the link target when the mouse cursor passes over the linked text. Hypertext uses the HREF tag. The example below links to KL's home page:
Click [HREF=http://www.klg.com]here[/HREF] for tech support\n 
 [HREF=http://www.klg.com][IMAGE=technical.gif][HREF]

JCString Grammar

JCString        := atom | atom atom

atom            := attr | literal

literal         := string

attr            := startattr attribute endattr

startattr       := "<"

endattr         := ">"

attribute       := resource | end_resource | unary

end_resource    := end_underline | end_strike | end_reference

end_underline   := "/UNDERLINE" | "/UL" 

end_strike      := "/STRIKETHROUGH" | "/ST" 

end_reference   := "/HREF" 

unary           := setfontdefault | setcolordefault | reset | newline

setfontdefault  := "DEFAULT_FONT"

setcolordefault := "DEFAULT_COLOR"

reset           := "RESET"

newline         := "NEWLINE"

resource        := u_resource | b_resource

u_resource      := start_underline | start_strike | start_reference

start_underline := "UNDERLINE" | "UL"

start_strike    := "STRIKETHROUGH" | "ST"

start_reference := "HREF" "=" reference_value | 
                   "HREF" "=" reference_value "TARGET" "=" target_value

reference_value := url

target_value    := "_self" | "_parent" | "_top" | "_blank" | windowname

windowname      := string

b_resource      := reference | alignment | horizspace | vertspace | color |
                   image | font | 

alignment       := "ALIGN" "=" alignment_value

alignment_value := "TOP" | "MIDDLE" | "BOTTOM" 

horizspace      := "HORIZ_SPACE" "=" integer

vertspace       := "VERT_SPACE" "=" integer

color           := "COLOR" "=" color_value

color_value     := color_string | "DEFAULT"

image           := "IMAGE" "=" image_value

image_value     := url | file

font            := "FONT" "=" font_value

font_value      := font_string | "DEFAULT"