Package icyllis.arc3d.sketch
Class Font
java.lang.Object
icyllis.arc3d.sketch.Font
Font controls options applied when drawing text.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Text antialiasing mode.static final int
Text antialiasing mode.static final int
-
Constructor Summary
Constructors -
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.boolean
Returns true if glyphs may be drawn at sub-pixel offsets.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
setSubpixel
(boolean subpixel) Requests, but does not require, that glyphs respect sub-pixel positioning.void
setTypeface
(Typeface typeface) Sets SkTypeface to typeface, decreasing SkRefCnt of the previous SkTypeface.float
setupForPaths
(Paint paint)
-
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:
-
kCanonicalTextSizeForPaths
@Internal public static final int kCanonicalTextSizeForPaths- 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. -
isSubpixel
public boolean isSubpixel()Returns true if glyphs may be drawn at sub-pixel offsets.- Returns:
- true if glyphs may be drawn at sub-pixel offsets.
-
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.
-
setSubpixel
public void setSubpixel(boolean subpixel) Requests, but does not require, that glyphs respect sub-pixel positioning.- Parameters:
subpixel
- setting for sub-pixel positioning
-
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
-
setupForPaths
-
hashCode
public int hashCode() -
equals
-