Skip to content

FONT (GraphRep) ​

Font :

FONT [ strExpr ] [ h: measureExpr ] FontStyle [ color: ColorSpecOrExpr ] [ line-orientation: realExpr ] .

FontStyle :

style: strExpr | DirectFontStyle .

DirectFontStyle :

[ bold ] [ underline ] [ italic ] .

ColorSpecOrExpr :

ColorSpec | intExpr .

The FONT element determines which type of font is used for the following TEXT and ATTR elements. The term following the key-word FONT - such as "Helvetica", "Times New Roman", "Arial" and so on - specifies the font. The font's height is specified by the attribute h. Usually, the font height is specified in pt, but sometimes it is possible to choose between cm and pt - as everywhere else measures are specified in LEO.

Hint

All fonts available in the operating system can be used. Default is "Helvetica" 10pt.

The font style can be defined in two ways. Either the style attribute is used, or the parameters bold, underline and italic can be entered directly. These style tokens are recognised:

  • bold - bold

  • underline - underlined

  • strikeout - crossed out

  • italic - italics

  • outline - outlined

  • shadow - shadowed

These tokens can be used in any combination. However, shadow suppresses outline.

Example:

FONT "Times New Roman" h:32pt TEXT "V" x:0cm y:-.07cm w:c h:c

draws a "V" in the font type "Times New Roman" with a font height of 32pt, centred at point (0,0 cm,-0,07cm).

For font name, fonts style and font size, an expression can be specified so that these parameters can be set according to corresponding instance attributes.

Example:

AVAL fn:"font name" AVAL fh:"font height (in points)" FONT (fn) h:(PT fh)

With line-orientation the text can be rotated. The value of this parameter determines the rotation angle (anticlockwise) for TEXT or ATTR. 0 (default) means horizontally from left to right. Rotated text can be combined with all other options (hyperlinks, absolute coordinates etc.).

Example:

GRAPHREP SHADOW off PEN w:0.1cm color:$000080 FILL color:$6060d0 RECTANGLE x:0cm y:-1cm w:2.8cm h:2.4cm LINE x1:1cm y1:-1cm x2:1cm y2:1.4cm FONT "Arial" h:24pt line-orientation:90 style:"outline" color:$000080 TEXT "Hello!" y:1.2cm FONT "Arial" h:12pt bold line-orientation:45 TEXT "Description\nLine 2" x:-2cm y:-0.5cm w:3cm

The colour assignment (color) is executed through the name or the rgb values. The allowed color names are listed in the GraphRep grammar (s. "ColorName") and are according to the LEO colour names.

For the color assignment over the rgb values there are always three color components used (red, green, blue);decimal value from between 0 (dark) and 255 (bright) orhexadecimal value from between $00 (dark) and $FF (bright), from which according to the principle of the additive color synthesis the mixed colors will be calculated.

The standard colour is black (ColorName: "black" or ColorRGB: "r:0 g:0 b:0").

Example:

If the text should be bold and written in light green you have to quote the following: FONT bold color:lightgreen

The same is achieved with: FONT bold r:0 g:255 b:0 or FONT bold r:$00 g:$FF b:$00

Hint

The command FONT style:shadow is not supported in SVG Graphics. Instead, the text is shown without shadow.