Package org.eclipse.birt.report.model.api

# Class FontHandle

java.lang.Object
org.eclipse.birt.report.model.api.ElementDetailHandle
org.eclipse.birt.report.model.api.ValueHandle
org.eclipse.birt.report.model.api.ComplexValueHandle
org.eclipse.birt.report.model.api.FontHandle

public class FontHandle extends ComplexValueHandle
Simplifies working with the font family property. The font family can be for either a element property or a structure member.

Values of a font family can be a list of font names, a string, a CSS (pre-defined) string. The CSS values are defined in `DesignChoiceConstants`. For example, the font family allows values in these formats:

- "serif, recursive, Times New Roman, Arial" ( a list of font names separated by commas )
- Song ( a string )
- cursive, sans-serif ( a CSS constant )

CSS has the following predefined font names:

- serif
- sans-serif
- cursive
- fantasy
- monospace

Please note that for a list of font names, blanks are allowed between two neighboring font names.

The application generally does not create font handles directly. It uses the method in `DesignElementHandle` to get a color handle like:

     DesignElementHandle elementHandle = element.handle();
     FontHandle fontHandle = elementHandle.getFontProperty(Style.FONT_FAMILY_PROP);

## Field Summary

### Fields inherited from class org.eclipse.birt.report.model.api.ComplexValueHandle

`memberContext, propDefn`

### Fields inherited from class org.eclipse.birt.report.model.api.ElementDetailHandle

`elementHandle`

## Constructor Summary

Constructors
Constructor
Description
`FontHandle(DesignElementHandle handle)`
Constructs a font family handle for an element property.
`FontHandle(DesignElementHandle handle, org.eclipse.birt.report.model.core.MemberRef context)`
Deprecated.
`FontHandle(DesignElementHandle handle, org.eclipse.birt.report.model.core.StructureContext context)`
Constructs a font family handle for a structure member.

## Method Summary

Modifier and Type
Method
Description
`IChoice[]`
`getCSSFontFamilies()`
Returns an array containing CSS (pre-defined) font names.
`String[]`
`getFontFamilies()`
Returns an array containing all of font names in the correct order.

### Methods inherited from class org.eclipse.birt.report.model.api.ComplexValueHandle

`getContext, getDefn, getDisplayValue, getPropertyDefn, getRawValue, getStringValue, getValue, isSet, setStringValue, setValue`

### Methods inherited from class org.eclipse.birt.report.model.api.ValueHandle

`getReference`

### Methods inherited from class org.eclipse.birt.report.model.api.ElementDetailHandle

`getDesign, getElement, getElementHandle, getModule`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### FontHandle

public FontHandle(DesignElementHandle handle)
Constructs a font family handle for an element property.

Parameters:
  `handle` - the element handle

### FontHandle

public FontHandle(DesignElementHandle handle, org.eclipse.birt.report.model.core.StructureContext context)
Constructs a font family handle for a structure member.

Parameters:
  `handle` - the element handle
  `context` - the context to the structure member.

### FontHandle

@Deprecated public FontHandle(DesignElementHandle handle, org.eclipse.birt.report.model.core.MemberRef context)
Deprecated.
Constructs a font family handle for a structure member.

Parameters:
  `handle` - the element handle
  `context` - the context to the structure member

## Method Details

### getFontFamilies

public String[] getFontFamilies()
Returns an array containing all of font names in the correct order. Names are separated by commas in the property value, and are slit into an array by this method.

Returns:
  an array containing font names or `null` if the value of the font family property is not set.

### getCSSFontFamilies

public IChoice[] getCSSFontFamilies()
Returns an array containing CSS (pre-defined) font names. Each item in the array is a CSS constant defined in the `DesignChoiceConstants`.

Returns:
  an array containing CSS (pre-defined) font names.