Package org.xhtmlrenderer.swing
Class Java2DTextRenderer
java.lang.Object
org.xhtmlrenderer.swing.Java2DTextRenderer
- All Implemented Interfaces:
TextRenderer
Renders to a Graphics2D instance.
- Author:
- Joshua Marinacci, Torbjoern Gannholm
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
drawGlyphVector
(OutputDevice outputDevice, FSGlyphVector fsGlyphVector, float x, float y) void
drawString
(OutputDevice outputDevice, String string, float x, float y) void
drawString
(OutputDevice outputDevice, String string, float x, float y, JustificationInfo info) float
getFSFontMetrics
(FontContext fc, FSFont font, String string) getGlyphBounds
(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) getGlyphVector
(OutputDevice outputDevice, FSFont font, String text) If anti-alias text is enabled, the value from RenderingHints to use for AA smoothing in Java2D.int
int
getWidth
(FontContext fc, FSFont font, String string) void
setFontScale
(float scale) void
setRenderingHints
(Object renderingHints) If anti-alias text is enabled, the value from RenderingHints to use for AA smoothing in Java2D.void
setSmoothingLevel
(int level) void
setSmoothingThreshold
(float fontsize) Set the smoothing threashold.void
setup
(FontContext fontContext)
-
Constructor Details
-
Java2DTextRenderer
public Java2DTextRenderer()
-
-
Method Details
-
drawString
- Specified by:
drawString
in interfaceTextRenderer
-
drawString
public void drawString(OutputDevice outputDevice, String string, float x, float y, JustificationInfo info) - Specified by:
drawString
in interfaceTextRenderer
-
drawGlyphVector
public void drawGlyphVector(OutputDevice outputDevice, FSGlyphVector fsGlyphVector, float x, float y) - Specified by:
drawGlyphVector
in interfaceTextRenderer
-
setup
- Specified by:
setup
in interfaceTextRenderer
-
setFontScale
public void setFontScale(float scale) - Specified by:
setFontScale
in interfaceTextRenderer
-
setSmoothingThreshold
public void setSmoothingThreshold(float fontsize) Description copied from interface:TextRenderer
Set the smoothing threashold. This is a font size above which all text will be anti-aliased. Text below this size will not be antialiased. Set to -1 for no antialiasing. Set to 0 for all antialising. Else, set to the threshold font size. does not take font scaling into account.- Specified by:
setSmoothingThreshold
in interfaceTextRenderer
-
setSmoothingLevel
public void setSmoothingLevel(int level) - Specified by:
setSmoothingLevel
in interfaceTextRenderer
- Parameters:
level
- no-op
-
getFSFontMetrics
- Specified by:
getFSFontMetrics
in interfaceTextRenderer
-
getWidth
- Specified by:
getWidth
in interfaceTextRenderer
-
getFontScale
public float getFontScale()- Specified by:
getFontScale
in interfaceTextRenderer
-
getSmoothingLevel
public int getSmoothingLevel()- Specified by:
getSmoothingLevel
in interfaceTextRenderer
-
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
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
-
getGlyphBounds
public Rectangle getGlyphBounds(OutputDevice outputDevice, FSFont font, FSGlyphVector fsGlyphVector, int index, float x, float y) - Specified by:
getGlyphBounds
in interfaceTextRenderer
-
getGlyphPositions
public float[] getGlyphPositions(OutputDevice outputDevice, FSFont font, FSGlyphVector fsGlyphVector) - Specified by:
getGlyphPositions
in interfaceTextRenderer
-
getGlyphVector
- Specified by:
getGlyphVector
in interfaceTextRenderer
-