Moscrif API Docs for: 2012q3
Show:

Typeface Class

Library: core

The Typeface class specifies the typeface and intrinsic style of a font. This is used in the paint, along with optionally algorithmic settings like textSize, textSkewX, textScaleX, kFakeBoldText_Mask, to specify how text appears when drawn (and measured).Typeface objects are immutable, and so they can be shared between threads.

Item Index

Methods

Properties

Methods

fromName

(
  • fromName
  • style
)
Typeface

Creates new instance of Typeface class to the font that most closely matches the requested familyName and style.

Parameters:

  • fromName String

    The name of the font family. Pass null as the familyName to return the default font for the requested style.

  • style Symbol

    The style of the typeface.

    • #normal
    • #bold
    • #italic
    • #bold+italic

Returns:

Typeface: A new reference to the typeface that most closely matches the requested familyName and style (never returns null).

Example:

// create paint object for text
var paint = new Paint();
paint.textSize = 40;
// set diferent font
paint.typeface = Typeface.fromName("FreeMono", #bold+italic);

Properties

bold

Boolean

True if style is the #bold.

italic

Boolean

True if style is the #italic.

style

Symbol

Typeface's style attributes.

  • #normal
  • #bold
  • #italic
  • #bold+italic

uniqueId

Integer

Integer value for this typeface, unique for the underlying font data. This is never 0.