Class 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);
    
     
    • Constructor Detail

      • 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 Detail

      • getFontFamilies

        public java.lang.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.