package net.xoetrope.optional.resources;
import java.awt.Font;
import net.xoetrope.xui.style.XStyle;
/**
* A helper for conversion of xstyles to some more useful types.
* <p> Copyright (c) Xoetrope Ltd., 2002-2004</p>
* <p> $Revision: 1.1 $</p>
* <p> License: see License.txt</p>
*/
public class StyleHelper
{
public static Font getFont( XStyle style )
{
String fontface = style.getStyleAsString( style.FONT_FACE );
int fontsize = style.getStyleAsInt( style.FONT_SIZE );
int fontitalic = style.getStyleAsInt( style.FONT_ITALIC );
int fontweight = style.getStyleAsInt( style.FONT_WEIGHT );
int fontStyle = 0;
if ( fontweight == 1 )
fontStyle = Font.BOLD;
if ( fontitalic == 1 )
fontStyle = fontStyle | Font.ITALIC;
return new Font( fontface, fontStyle, fontsize );
}
}
|