Class Font

java.lang.Object
icyllis.arc3d.core.Font

public class Font extends Object
Font controls options applied when drawing text.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Text antialiasing mode.
    static final int
    Text antialiasing mode.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    Font(Font other)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    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
    Returns text size in points.
    Returns a raw pointer to Typeface.
    int
     
    boolean
    Returns true if font and glyph metrics are requested to be linearly scalable.
    void
    set(Font other)
     
    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
    Sets SkTypeface to typeface, decreasing SkRefCnt of the previous SkTypeface.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • kAlias_Edging

      public static final int kAlias_Edging
      Text antialiasing mode.
      See Also:
    • kAntiAlias_Edging

      public static final int kAntiAlias_Edging
      Text antialiasing mode.
      See Also:
  • Constructor Details

    • Font

      public Font()
    • Font

      public Font(@Nonnull Font other)
  • Method Details

    • set

      public void set(@Nonnull Font other)
    • setTypeface

      public void setTypeface(Typeface typeface)
      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

      public Typeface 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

      @Internal public float approximateTransformedFontSize(Matrixc matrix, float centerX, float centerY)
      Return the approximate largest dimension of typical text when transformed by the matrix.
      Parameters:
      matrix - used to transform size
      centerX - location of the text prior to matrix transformation. Used if the matrix has perspective.
      Returns:
      typical largest dimension
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object