FontStyle

Description

The FontStyle element defines a style for a text string.

Context

Table 1 lists the elements that can contain, or be contained by, a FontStyle element.

Table 1. Context
Contained by Element Contains

NamedStyle or CompositeStyle

FontStyle

(empty)

Attributes

Table 2 lists the attributes of a FontStyle element.

Table 2. Attributes
Attribute Description

id

A unique identifier for the element.

name

A descriptive name for the element.

family

A string value specifying the name of a TrueType font.

The family attribute is optional. The default value is arial.

size

A floating-point value specifying the font size.

The size attribute is optional. The default is 12.

size-unit

A reference to a length in the mapinfo codespace, which specifies the unit of measurement used for the size attribute.

The size-unit attribute is optional. The default value is mapinfo:length pt.

stroke

A string value specifying the color of the font.

The value can be any valid CSS color. (See http://www.w3.org/TR/REC-CSS1#color-units.)

The stroke attribute is optional. The default value is black.

stroke-opacity

A floating-point value from 0 to 1 specifying the opacity of the font.

A value of 0 means that the font is totally transparent. A value of 1 means that the font is totally opaque. A value of 0.5 means that the font is 50% translucent.

The stroke-opacity attribute is optional. The default value is 1.

font-style

An enumeration value specifying the font style. The possible values are:

  • normal
  • italic
  • oblique

The font-style attribute is optional. The default value is normal.

effect

A string value specifying the color of the text effect provided by the effect-type attribute.

The value can be any valid CSS color. (See http://www.w3.org/TR/REC-CSS1#color-units.)

The effect attribute is optional. The default value is none.

effect-opacity

A floating-point value from 0 to 1 specifying the opacity of the text effect.

A value of 0 means that the effect is totally transparent. A value of 1 means that the effect is totally opaque. A value of 0.5 means that the effect is 50% translucent.

The effect-opacity attribute is optional. The default value is 1.

effect-type

An enumeration value specifying the text effect type. The possible values are:

  • box
  • halo
  • glyph-outline
  • none

The effect-type attribute is optional. The default value is none.

font-weight

An enumeration value specifying the font weight. The possible values are:

  • normal
  • bold
  • 100
  • 200
  • 300
  • 400
  • 500
  • 600
  • 700
  • 800
  • 900
Note: normal is equivalent to 200; bold is equivalent to 400.

The font-weight attribute is optional. The default value is normal.

text-decoration

A string value specifying the text decoration.

The value must have the following pattern: a choice of one or more of (underline | line-through) separated by a single space or the single value none. Examples: line-through underline, underline, none.

The text-decoration attribute is optional. The default value is none.

text-case

An enumeration value specifying the text case. The possible values are:

  • upper
  • lower
  • default
Note: default means 'retain the current case'.

The text-case attribute is optional. The default value is default.

shadow

A boolean value (true or false) specifying whether to have a drop-shadow drawn behind the font. A value of false (the default) specifies no drop-shadow.

The shadow attribute is optional. The default value is false.

expand

A boolean value (true or false) specifying whether a space character should be inserted between each pair of visible characters in the text string.

The expand attribute is optional. The default value is false.

Example

This example specifies a 12-point black sans serif font.



<?xml version="1.0" encoding="UTF-8"?>
<NamedStyle
    version="MXP_WorkSpace_1_5"
    xmlns="http://www.mapinfo.com/mxp">
    <FontStyle
        family="Microsoft Sans Serif"
        font-style="normal"
        effect="white"
        effect-opacity="1"
        effect-type="none"
        font-weight="normal"
        text-decoration="none"
        text-case="default"
        shadow="false"
        expand="false"
        size="12"
        size-unit="mapinfo:length pt"
        stroke="black"/>
</NamedStyle>