Package icyllis.modernui.graphics.text

# Class FontPaint

java.lang.Object
icyllis.modernui.graphics.text.FontPaint

public class FontPaint extends Object
The base paint used with layout engine at lower levels.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `BOLD`
  Bit flag used with fontStyle to request the bold style
  `static final int`
  `BOLD_ITALIC`
  Font style constant to request the bold and italic style
  `static final int`
  `FONT_STYLE_MASK`
  `static final float`
  `INV_FONT_SIZE_GRANULARITY`
  `static final int`
  `ITALIC`
  Bit flag used with fontStyle to request the italic style
  `static final int`
  `NORMAL`
  Bit flag used with fontStyle to request the normal/regular style

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `FontPaint()`
  `FontPaint(FontPaint paint)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `equals(Object o)`
  `static float`
  `getCanonicalFontSize(float fontSize)`
  `FontCollection`
  `getFont()`
  `int`
  `getFontMetricsInt(FontMetricsInt fm)`
  Return the font's interline spacing, given the Paint's settings for typeface, textSize, etc.
  `float`
  `getFontSize()`
  Return the paint's text size, in points.
  `int`
  `getFontStyle()`
  Get the font's style.
  `Locale`
  `getLocale()`
  `int`
  `hashCode()`
  `boolean`
  `isAntiAlias()`
  `boolean`
  `isLinearMetrics()`
  `boolean`
  `isMetricAffecting(FontPaint paint)`
  Returns true of the passed `FontPaint` will have the different effect on text measurement
  `void`
  `set(FontPaint paint)`
  Copy the data from paint into this TextPaint
  `void`
  `setAntiAlias(boolean aa)`
  `void`
  `setFont(FontCollection font)`
  `void`
  `setFontSize(float fontSize)`
  Set the paint's text size in pixel units.
  `void`
  `setFontStyle(int fontStyle)`
  Set font's style.
  `void`
  `setLinearMetrics(boolean linearMetrics)`
  `void`
  `setLocale(Locale locale)`
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### NORMAL

    public static final int NORMAL
    Bit flag used with fontStyle to request the normal/regular style
    See Also:
      - Constant Field Values

  - ### BOLD

    public static final int BOLD
    Bit flag used with fontStyle to request the bold style
    See Also:
      - Constant Field Values

  - ### ITALIC

    public static final int ITALIC
    Bit flag used with fontStyle to request the italic style
    See Also:
      - Constant Field Values

  - ### BOLD_ITALIC

    public static final int BOLD_ITALIC
    Font style constant to request the bold and italic style
    See Also:
      - Constant Field Values

  - ### FONT_STYLE_MASK

    public static final int FONT_STYLE_MASK
    See Also:
      - Constant Field Values

  - ### INV_FONT_SIZE_GRANULARITY

    public static final float INV_FONT_SIZE_GRANULARITY
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### FontPaint

    @Internal public FontPaint()

  - ### FontPaint

    @Internal public FontPaint(@Nonnull FontPaint paint)

- ## Method Details

  - ### set

    public void set(@Nonnull FontPaint paint)
    Copy the data from paint into this TextPaint

  - ### setFont

    public void setFont(@Nonnull FontCollection font)

  - ### getFont

    public FontCollection getFont()

  - ### setLocale

    public void setLocale(@Nonnull Locale locale)

  - ### getLocale

    public Locale getLocale()

  - ### setFontStyle

    public void setFontStyle(int fontStyle)
    Set font's style. Combination of REGULAR, BOLD and ITALIC.
    Parameters:
      `fontStyle` - the style of the font

  - ### getFontStyle

    public int getFontStyle()
    Get the font's style.
    Returns:
      the style of the font

  - ### setFontSize

    public void setFontSize(float fontSize)
    Set the paint's text size in pixel units. For example, a text size of 16 (1em) means the letter 'M' is 16 pixels high in device space. Very large or small sizes will impact rendering performance, and the rendering system might not render text at these sizes. For now, text sizes will clamp to 1 and 2184.

    Note: the point size is measured at 72 dpi, while Windows has 96 dpi. This indicates that the font size 12 in MS Word is equal to the font size 16 here.

    Parameters:
      `fontSize` - set the paint's text size in pixel units.

  - ### getFontSize

    public float getFontSize()
    Return the paint's text size, in points.
    Returns:
      the paint's text size in pixel units.

  - ### setAntiAlias

    public void setAntiAlias(boolean aa)

  - ### isAntiAlias

    public boolean isAntiAlias()

  - ### setLinearMetrics

    public void setLinearMetrics(boolean linearMetrics)

  - ### isLinearMetrics

    public boolean isLinearMetrics()

  - ### isMetricAffecting

    public boolean isMetricAffecting(@Nonnull FontPaint paint)
    Returns true of the passed `FontPaint` will have the different effect on text measurement
    Parameters:
      `paint` - the paint to compare with
    Returns:
      true if given `FontPaint` has the different effect on text measurement.

  - ### getFontMetricsInt

    public int getFontMetricsInt(@Nullable FontMetricsInt fm)
    Return the font's interline spacing, given the Paint's settings for typeface, textSize, etc. If metrics is not null, return the fontmetric values in it. Note: all values have been converted to integers from floats, in such a way has to make the answers useful for both spacing and clipping. If you want more control over the rounding, call getFontMetrics().

    Note that these are the values for the main typeface, and actual text rendered may need a larger set of values because fallback fonts may get used in rendering the text.

    Returns:
      the font's interline spacing.

  - ### getCanonicalFontSize

    public static float getCanonicalFontSize(float fontSize)

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### equals

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

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`