Package org.xhtmlrenderer.swing
Class Java2DTextRenderer
- java.lang.Object
-
- org.xhtmlrenderer.swing.Java2DTextRenderer
-
- All Implemented Interfaces:
TextRenderer
public class Java2DTextRenderer extends Object implements TextRenderer
Renders to a Graphics2D instance.- Author:
- Joshua Marinacci, Torbjoern Gannholm
-
-
Constructor Summary
Constructors Constructor Description Java2DTextRenderer()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voiddrawGlyphVector(OutputDevice outputDevice, FSGlyphVector fsGlyphVector, float x, float y)voiddrawString(OutputDevice outputDevice, String string, float x, float y)voiddrawString(OutputDevice outputDevice, String string, float x, float y, JustificationInfo info)floatgetFontScale()FSFontMetricsgetFSFontMetrics(FontContext fc, FSFont font, String string)RectanglegetGlyphBounds(OutputDevice outputDevice, FSFont font, FSGlyphVector fsGlyphVector, int index, float x, float y)float[]getGlyphPositions(OutputDevice outputDevice, FSFont font, String text)float[]getGlyphPositions(OutputDevice outputDevice, FSFont font, FSGlyphVector fsGlyphVector)FSGlyphVectorgetGlyphVector(OutputDevice outputDevice, FSFont font, String text)ObjectgetRenderingHints()If anti-alias text is enabled, the value from RenderingHints to use for AA smoothing in Java2D.intgetSmoothingLevel()intgetWidth(FontContext fc, FSFont font, String string)voidsetFontScale(float scale)voidsetRenderingHints(Object renderingHints)If anti-alias text is enabled, the value from RenderingHints to use for AA smoothing in Java2D.voidsetSmoothingLevel(int level)Deprecated.voidsetSmoothingThreshold(float fontsize)Set the smoothing threshold.voidsetup(FontContext fontContext)
-
-
-
Method Detail
-
drawString
public void drawString(OutputDevice outputDevice, String string, float x, float y)
- Specified by:
drawStringin interfaceTextRenderer
-
drawString
public void drawString(OutputDevice outputDevice, String string, float x, float y, JustificationInfo info)
- Specified by:
drawStringin interfaceTextRenderer
-
drawGlyphVector
public void drawGlyphVector(OutputDevice outputDevice, FSGlyphVector fsGlyphVector, float x, float y)
- Specified by:
drawGlyphVectorin interfaceTextRenderer
-
setup
public void setup(FontContext fontContext)
- Specified by:
setupin interfaceTextRenderer
-
setFontScale
public void setFontScale(float scale)
- Specified by:
setFontScalein interfaceTextRenderer
-
setSmoothingThreshold
public void setSmoothingThreshold(float fontsize)
Description copied from interface:TextRendererSet the smoothing threshold. This is a font size above which all text will be anti-aliased. Text below this size will not be anti-aliased. Set to -1 for no antialiasing. Set to 0 for all antialiasing. Else, set to the threshold font size. does not take font scaling into account.- Specified by:
setSmoothingThresholdin interfaceTextRenderer
-
setSmoothingLevel
@Deprecated public void setSmoothingLevel(int level)
Deprecated.- Specified by:
setSmoothingLevelin interfaceTextRenderer- Parameters:
level- no-op
-
getFSFontMetrics
public FSFontMetrics getFSFontMetrics(FontContext fc, FSFont font, String string)
- Specified by:
getFSFontMetricsin interfaceTextRenderer
-
getWidth
public int getWidth(FontContext fc, FSFont font, String string)
- Specified by:
getWidthin interfaceTextRenderer
-
getFontScale
public float getFontScale()
- Specified by:
getFontScalein interfaceTextRenderer
-
getSmoothingLevel
public int getSmoothingLevel()
- Specified by:
getSmoothingLevelin interfaceTextRenderer
-
getRenderingHints
public Object getRenderingHints()
If anti-alias text is enabled, the value from RenderingHints to use for AA smoothing in Java2D. Defaults toRenderingHints.VALUE_TEXT_ANTIALIAS_ON.- Returns:
- Current AA rendering hint
-
setRenderingHints
public void setRenderingHints(Object renderingHints)
If anti-alias text is enabled, the value from RenderingHints to use for AA smoothing in Java2D. Defaults toRenderingHints.VALUE_TEXT_ANTIALIAS_ON.- Parameters:
renderingHints- rendering hint for AA smoothing in Java2D
-
getGlyphPositions
public float[] getGlyphPositions(OutputDevice outputDevice, FSFont font, String text)
-
getGlyphBounds
public Rectangle getGlyphBounds(OutputDevice outputDevice, FSFont font, FSGlyphVector fsGlyphVector, int index, float x, float y)
- Specified by:
getGlyphBoundsin interfaceTextRenderer
-
getGlyphPositions
public float[] getGlyphPositions(OutputDevice outputDevice, FSFont font, FSGlyphVector fsGlyphVector)
- Specified by:
getGlyphPositionsin interfaceTextRenderer
-
getGlyphVector
public FSGlyphVector getGlyphVector(OutputDevice outputDevice, FSFont font, String text)
- Specified by:
getGlyphVectorin interfaceTextRenderer
-
-