public class GeneralFont extends Object implements Font<GeneralFont>
MBFImage img = new MBFImage( 400, 400, 3 );
GeneralFont f = new GeneralFont( "Times New Roman", Font.PLAIN, 72 );
img.drawText( "Hello World", new Point2dImpl(10,500),
new GeneralFontStyle( f, r, true ) );
Constructor and Description |
---|
GeneralFont(String name,
int type)
Create a font with the given name, type and size.
|
Modifier and Type | Method and Description |
---|---|
<T> FontStyle<T> |
createStyle(ImageRenderer<T,?> renderer)
Create an instance of a FontStyle with the default parameters for the given
image.
|
String |
getName()
Get the name of this font
|
<T,Q extends FontStyle<T>> |
getRenderer(ImageRenderer<T,?> renderer)
Get a font renderer suitable for rendering this font to the given image renderer.
|
int |
getType()
Get the font attributes
|
void |
setType(int type)
Set the type of the font.
|
public GeneralFont(String name, int type)
name
- Name of the fonttype
- Font attributespublic <T,Q extends FontStyle<T>> FontRenderer<T,Q> getRenderer(ImageRenderer<T,?> renderer)
getRenderer
in interface Font<GeneralFont>
T
- type of pixel.Q
- type of FontStyle
.renderer
- the target image renderer.Font.getRenderer(org.openimaj.image.renderer.ImageRenderer)
public <T> FontStyle<T> createStyle(ImageRenderer<T,?> renderer)
createStyle
in interface Font<GeneralFont>
T
- type of pixel.renderer
- the image rendererFont.createStyle(org.openimaj.image.renderer.ImageRenderer)
public String getName()
getName
in interface Font<GeneralFont>
Font.getName()
public void setType(int type)
type
- the type of the font.public int getType()