Package icyllis.arc3d.core
Class Font
java.lang.Object
icyllis.arc3d.core.Font
Font controls options applied when drawing text.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Text antialiasing mode.static final int
Text antialiasing mode. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfloat
approximateTransformedFontSize
(Matrixc matrix, float centerX, float centerY) Return the approximate largest dimension of typical text when transformed by the matrix.boolean
int
Whether edge pixels draw opaque or with partial transparency.float
getSize()
Returns text size in points.Returns a raw pointer to Typeface.int
hashCode()
boolean
Returns true if font and glyph metrics are requested to be linearly scalable.void
void
setEdging
(int edging) Requests, but does not require, that edge pixels draw opaque or with partial transparency.void
setLinearMetrics
(boolean linearMetrics) Requests, but does not require, linearly scalable font and glyph metrics.void
setSize
(float size) Sets text size in points.void
setTypeface
(Typeface typeface) Sets SkTypeface to typeface, decreasing SkRefCnt of the previous SkTypeface.
-
Field Details
-
kAlias_Edging
public static final int kAlias_EdgingText antialiasing mode.- See Also:
-
kAntiAlias_Edging
public static final int kAntiAlias_EdgingText antialiasing mode.- See Also:
-
-
Constructor Details
-
Font
public Font() -
Font
-
-
Method Details
-
set
-
setTypeface
Sets SkTypeface to typeface, decreasing SkRefCnt of the previous SkTypeface. Pass nullptr to clear SkTypeface and use an empty typeface (which draws nothing). Increments tf SkRefCnt by one.- Parameters:
typeface
- font and style used to draw text
-
getTypeface
Returns a raw pointer to Typeface.- Returns:
- non-null typeface
-
getSize
public float getSize()Returns text size in points.- Returns:
- typographic height of text
-
setSize
public void setSize(float size) Sets text size in points. Has no effect if size is not greater than or equal to zero.- Parameters:
size
- typographic height of text
-
getEdging
public int getEdging()Whether edge pixels draw opaque or with partial transparency. -
setEdging
public void setEdging(int edging) Requests, but does not require, that edge pixels draw opaque or with partial transparency. -
isLinearMetrics
public boolean isLinearMetrics()Returns true if font and glyph metrics are requested to be linearly scalable.- Returns:
- true if font and glyph metrics are requested to be linearly scalable.
-
setLinearMetrics
public void setLinearMetrics(boolean linearMetrics) Requests, but does not require, linearly scalable font and glyph metrics.For outline fonts 'true' means font and glyph metrics should ignore hinting and rounding. Note that some bitmap formats may not be able to scale linearly and will ignore this flag.
- Parameters:
linearMetrics
- setting for linearly scalable font and glyph metrics.
-
approximateTransformedFontSize
Return the approximate largest dimension of typical text when transformed by the matrix.- Parameters:
matrix
- used to transform sizecenterX
- location of the text prior to matrix transformation. Used if the matrix has perspective.- Returns:
- typical largest dimension
-
hashCode
public int hashCode() -
equals
-