Package com.iizigo.panel
Class FontInfo
java.lang.Object
com.iizigo.panel.FontInfo
- All Implemented Interfaces:
- IFontInfo
Font information class for the UI. The values are the styles that govern the font information and contains the font family, weight, style and line height.
- Author:
- Christopher Mindus
- Nested Class Summary- Nested classes/interfaces inherited from interface com.iizix.IFontInfo- IFontInfo.Resolver
- Field SummaryFields
- Constructor SummaryConstructors
- Method SummaryModifier and TypeMethodDescription- booleanIf two font informations are equal.- static FontInfoGets the font information from a component.- static FontInfoGets the font information from a component.- doubleGets the font average character width.- double- getEM()Gets the EM size.- double- getEX()Gets the EX size.The font family, null for default.- doubleGets the font height.- doubleGets the input character width used in calculations of HTML elements that are "input" tag based.Letter spacing as in CSS, null for default.Line height as in CSS, null for default.- doubleGets the line height in pixels.- doubleGets the maximum character width.- double- getPT()Gets the PT size.- getSize()The font size with unit as in CSS, e.g.- int- getStringWidth- (KString text) Gets the string width of the specified unwrapped string (no line breaks).- getStyle()The font style as in CSS, e.g.The font weight as in CSS, e.g.- int- hashCode()The hash code.- static voidInitializes the resolver.- static void- shutdown()Shuts down the instance, saves current data in workspace properties.- toString()Debug output string.
- Field Details- DEFAULT_DESKTOPThe default font information for desktop.
- DEFAULT_MOBILEThe default font information for mobile.
- DEFAULT_WINDOWS_MOBILEThe default font information for Windows Mobile.
 
- Constructor Details- FontInfoConstructor from family and size.- Parameters:
- family- Font family, null for default.
- size- Font size with unit as in CSS, e.g. 12px, 110% or 14pt, null for default.
 
- FontInfopublic FontInfo- (String family, String size, String weight, String style, String lineHeight, String letterSpacing) Constructor from discrete values.- Parameters:
- family- Font family, null for default.
- size- Font size with unit as in CSS, e.g. 12px, 110% or 14pt, null for default.
- weight- Font weight as in CSS, e.g. bold, thin or 800, null for default.
- style- Font style as in CSS, e.g. italic or oblique, null for default.
- lineHeight- Line height as in CSS, null for default.
- letterSpacing- Letter spacing as in CSS, null for default.
 
 
- Method Details- initializepublic static void initialize()Initializes the resolver.
- shutdownpublic static void shutdown()Shuts down the instance, saves current data in workspace properties.
- fromGets the font information from a component.- The font information is extracted from the component's styles and/or the parents of the component. - Returns:
- The font information.
 
- fromGets the font information from a component.- The font information is extracted from the component's styles and/or the parents of the component. - Parameters:
- comp- The component.
- recurseParents- The recurse flag, if the parent(s) should be requested to fill in missing/inherited values.
- Returns:
- The font information.
 
- getFamilyThe font family, null for default.
- getSizeThe font size with unit as in CSS, e.g. 12px, 110% or 14pt, null for default.
- getWeightThe font weight as in CSS, e.g. bold, thin or 800, null for default.
- getStyleThe font style as in CSS, e.g. italic or oblique, null for default.
- getLineHeightLine height as in CSS, null for default.- Specified by:
- getLineHeightin interface- IFontInfo
- Returns:
- Line height, null for default.
 
- getLetterSpacingLetter spacing as in CSS, null for default.- Specified by:
- getLetterSpacingin interface- IFontInfo
- Returns:
- Letter spacing, null for default.
 
- equalsIf two font informations are equal.
- hashCodepublic int hashCode()The hash code.
- toStringDebug output string.
- getHeightpublic double getHeight()Gets the font height.
- getMaxWidthpublic double getMaxWidth()Gets the maximum character width.
- getAverageWidthpublic double getAverageWidth()Gets the font average character width.- Specified by:
- getAverageWidthin interface- IFontInfo
- Returns:
- The average width.
 
- getEMpublic double getEM()Gets the EM size.
- getEXpublic double getEX()Gets the EX size.
- getPTpublic double getPT()Gets the PT size.
- getInputCharWidthpublic double getInputCharWidth()Gets the input character width used in calculations of HTML elements that are "input" tag based.- Specified by:
- getInputCharWidthin interface- IFontInfo
- Returns:
- The input character width.
 
- getLineHeightPXpublic double getLineHeightPX()Gets the line height in pixels.
- getStringWidthGets the string width of the specified unwrapped string (no line breaks).- Specified by:
- getStringWidthin interface- IFontInfo
- Parameters:
- text- The text to measure.
- Returns:
- The width in pixels in the current font.