Package eu.webtoolkit.jwt
Class WFont
- java.lang.Object
-
- eu.webtoolkit.jwt.WFont
-
public class WFont extends java.lang.ObjectA value class that describes a font.
-
-
Constructor Summary
Constructors Constructor Description WFont()A default font (dependent on the user agent).WFont(FontFamily family)A font of a given family.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(WFont other)Indicates whether some other object is "equal to" this one.FontFamilygetGenericFamily()Returns the font generic family.FontSizegetSize()Returns the font size.FontSizegetSize(double mediumSize)Returns the font size.WLengthgetSizeLength()Returns the font size as a numerical value.WLengthgetSizeLength(double mediumSize)Returns the font size as a numerical value.WStringgetSpecificFamilies()Returns the font specific family names.FontStylegetStyle()Returns the font style.FontVariantgetVariant()Returns the font variant.FontWeightgetWeight()Returns the font weight.intgetWeightValue()Returns the font weight value.voidsetFamily(FontFamily genericFamily)Sets the font family.voidsetFamily(FontFamily genericFamily, java.lang.CharSequence specificFamilies)Sets the font family.voidsetSize(FontSize size)Sets the font size.voidsetSize(WLength size)Sets the font size.voidsetStyle(FontStyle style)Sets the font style.voidsetVariant(FontVariant variant)Sets the font variant.voidsetWeight(FontWeight weight)Sets the font weight.voidsetWeight(FontWeight weight, int value)Sets the font weight.voidupdateDomElement(DomElement element, boolean fontall, boolean all)
-
-
-
Constructor Detail
-
WFont
public WFont()
A default font (dependent on the user agent).
-
WFont
public WFont(FontFamily family)
A font of a given family.Creates a Medium font of the given family.
-
-
Method Detail
-
equals
public boolean equals(WFont other)
Indicates whether some other object is "equal to" this one.
-
setFamily
public void setFamily(FontFamily genericFamily, java.lang.CharSequence specificFamilies)
Sets the font family.The font family is specified using a generic family name, in addition to a comma-separated list of specific font choices.
The first specific font that can be matched will be used, otherwise a generic font will be used.
Careful, for a font family name that contains a space, you need to add quotes, to
setFamily(), e.g.WFont mono; mono.setFamily(FontFamily::Monospace, "'Courier New'"); mono.setSize(18);
-
setFamily
public final void setFamily(FontFamily genericFamily)
Sets the font family.
-
getGenericFamily
public FontFamily getGenericFamily()
Returns the font generic family.
-
getSpecificFamilies
public WString getSpecificFamilies()
Returns the font specific family names.
-
setStyle
public void setStyle(FontStyle style)
Sets the font style.
-
getStyle
public FontStyle getStyle()
Returns the font style.
-
setVariant
public void setVariant(FontVariant variant)
Sets the font variant.
-
getVariant
public FontVariant getVariant()
Returns the font variant.
-
setWeight
public void setWeight(FontWeight weight, int value)
Sets the font weight.When setting weight == Value, you may specify a value.
Valid values are between 100 and 900, and are rounded to multiples of 100.
-
setWeight
public final void setWeight(FontWeight weight)
Sets the font weight.Calls
setWeight(weight, 400)
-
getWeight
public FontWeight getWeight()
Returns the font weight.
-
getWeightValue
public int getWeightValue()
Returns the font weight value.
-
setSize
public void setSize(FontSize size)
Sets the font size.Sets the font size using a predefined CSS size.
-
setSize
public void setSize(WLength size)
Sets the font size.Sets the font size.
-
getSize
public FontSize getSize(double mediumSize)
Returns the font size.
-
getSize
public final FontSize getSize()
Returns the font size.Returns
getSize(16)
-
getSizeLength
public WLength getSizeLength(double mediumSize)
Returns the font size as a numerical value.PositionScheme.Absolutesize enumerations are converted to a length assuming a Medium font size of 16 px.
-
getSizeLength
public final WLength getSizeLength()
Returns the font size as a numerical value.Returns
getSizeLength(16)
-
updateDomElement
public void updateDomElement(DomElement element, boolean fontall, boolean all)
-
-