Class FontAbstract

Hierarchy

  • default
    • Font

Implements

Properties

_nativeObject: any
ios: { allFontNames: any }

iOS Only Static Properties

Type declaration

  • allFontNames:function
    • Method

      allFontNames

      Ios

      Returns supported font names.

      Example

      import Font from '@smartface/native/ui/font';
      const fontNames = Font.ios.allFontNames();
      for (const index in fontNames) {
      console.log(fontNames[index]);
      }

      Since

      0.1

      Returns string[]

DEFAULT: string = ...

Default font family. This might be different for Android and iOS.

Android

Ios

Since

0.1

IOS_SYSTEM_FONT: string = ...

Default iOS System font family. Only works on iOS.

Android

Ios

Since

0.1

NORMAL: FontStyle = FontStyle.NORMAL

Represents normal font style

Android

Ios

Since

0.1

BOLD: FontStyle = FontStyle.BOLD

Represents bold font style

Android

Ios

Since

0.1

ITALIC: FontStyle = FontStyle.ITALIC

Represents italic font style

Android

Ios

Since

0.1

BOLD_ITALIC: FontStyle = FontStyle.BOLD_ITALIC

Represents both bold and italic font style

Android

Ios

Since

0.1

Accessors

  • get nativeObject(): any
  • Returns any

  • set nativeObject(value: any): void
  • Parameters

    • value: any

    Returns void

  • get size(): number
  • Gets/sets size of font.

    Android

    Ios

    Since

    4.2.3

    Returns number

  • set size(value: number): void
  • Gets/sets size of font.

    Android

    Ios

    Since

    4.2.3

    Parameters

    • value: number

    Returns void

Methods

  • Executed before constuctor and after createNativeObject. Use this when you have default values which needs to be set before constructor.

    Parameters

    • Optional params: Partial<Record<string, any>>

    Returns void

  • This method returns the string size

    Android

    Ios

    Since

    1.1.18

    Parameters

    • string: string
    • maxWidth: number

    Returns Size

  • Executed before everything. This should return nativeObject since it will be assinged directly to nativeObject.

    Returns any

  • Android

    Ios

    Since

    0.1 Creates a font instance with the given family name, size and style. Assigning font style is deprecated usage (may not work mostly) instead font name parameter must be specified according to actual name of font. To obtain actual font name for iOS, use UI.Font#allFontNames allFontNames method. The actual name is same as named of font file in Android.

    Example

    import Font from '@smartface/native/ui/font';
    import Label from '@smartface/native/ui/label';
    const myLabel = new Label({
    font: Font.create("Arial-ItalicMT", 16)
    });
    myLabel.text = "Label text";

    Parameters

    • fontFamily: string
    • size: number
    • Optional style: FontStyle

    Returns null | Font

  • Android

    Ios

    Creates a font instance with the given file path and size.

    Example

    import Font from '@smartface/native/ui/font';
    import Label from '@smartface/native/ui/label';
    const myLabel = new Label({
    font: Font.createFromFile("assets://MyFont.ttf", 16)
    });
    myLabel.text = "Label text";

    Since

    0.1

    Static

    Parameters

    • path: string
    • size: number

    Returns Font

Constructors

  • Parameters

    • Optional params: Partial<Font>

    Returns Font

Generated using TypeDoc