Java 类org.w3c.dom.css.CSSValueList 实例源码

项目:birt    文件:LayoutUtil.java   
/**
 * if the content is hidden
 * 
 * @return
 */
static private boolean isHiddenByVisibility( IStyle style, String format, boolean hiddenMask )
{
    CSSValueList formats = (CSSValueList) style
            .getProperty( IStyle.STYLE_VISIBLE_FORMAT );
    if ( formats != null )
    {
        if ( hiddenMask )
        {
            if( contains( formats, BIRTConstants.BIRT_ALL_VALUE  ) )
            {
                return true;
            }
        }
        else
        {
            if ( contains( formats, format ) )
            {
                return true;
            }
        }
    }
    return false;
}
项目:birt    文件:LayoutUtil.java   
static private boolean contains( CSSValueList formats, String format )
{
    int length = formats.getLength( );
    for ( int i = 0; i < length; i++ )
    {
        String fmt = formats.item( i ).getCssText( );

        if ( EngineIRConstants.FORMAT_TYPE_VIEWER.equalsIgnoreCase( fmt ) ||
                BIRTConstants.BIRT_ALL_VALUE.equalsIgnoreCase( fmt ) ||
                format.equalsIgnoreCase( fmt ) )
        {
            return true;
        }
    }
    return false;
}
项目:birt    文件:AbstractEmitterImpl.java   
private String getFontFamily( IStyle computedStyle )
{
    String fontFamily = null;
    // use the user specified font family at first. If user defined a font
    // family list, use the first one, and rely on WORD to do font
    // selection.
    CSSValueList families = (CSSValueList) computedStyle
            .getProperty( StyleConstants.STYLE_FONT_FAMILY );
    if ( families != null && families.getLength( ) > 0 )
    {
        fontFamily = mapGenericFont( families.item( 0 ).getCssText( ) );
    }
    return fontFamily;
}
项目:birt    文件:FontHandler.java   
/**
 * The constructor
 * 
 * @param textContent
 *            the textContent whose font need to be handled
 * @param fontSubstitution
 *            If it set to false, we needn't check if the character exists
 *            in the selected font.
 * @param format
 *            the output format type
 */
public FontHandler( FontMappingManager fontManager,
        ITextContent textContent, boolean fontSubstitution )
{
    this.fontManager = fontManager;

    IStyle style = textContent.getComputedStyle( );

    CSSValueList families = (CSSValueList) style
            .getProperty( StyleConstants.STYLE_FONT_FAMILY );
    this.fontFamilies = new String[families.getLength( )];
    for ( int i = 0; i < fontFamilies.length; i++ )
    {
        fontFamilies[i] = families.item( i ).getCssText( );
    }

    this.fontWeight = PropertyUtil.parseFontWeight( style
            .getProperty( StyleConstants.STYLE_FONT_WEIGHT ) );

    if ( CSSConstants.CSS_OBLIQUE_VALUE.equals( style.getFontStyle( ) ) ||
            CSSConstants.CSS_ITALIC_VALUE.equals( style.getFontStyle( ) ) )
    {
        this.fontStyle |= Font.ITALIC;
    }

    if ( PropertyUtil.isBoldFont( fontWeight ) )
    {
        this.fontStyle |= Font.BOLD;
    }

    this.fontSize = PropertyUtil.getDimensionValueConsiderDpi( style
            .getProperty( StyleConstants.STYLE_FONT_SIZE ), textContent ) /
            PDFConstants.LAYOUT_TO_PDF_RATIO;

    if ( !fontSubstitution )
    {
        for ( int i = 0; i < fontFamilies.length; i++ )
        {
            String fontName = fontManager.getAliasedFont( fontFamilies[i] );
            bf = fontManager.createFont( fontName, fontStyle );
            if ( bf != null )
                return;
        }
        bf = fontManager.createFont( FontMappingManager.DEFAULT_FONT,
                fontStyle );
    }
}