Gjsify LogoGjsify Logo

An opaque structure, to be used to store sizing and positioning values along with their unit.

record

Hierarchy

  • Units

Index

Constructors

Properties

name: string

Methods

  • free(): void
  • Frees the resources allocated by units

    You should only call this function on a #ClutterUnits created using clutter_units_copy()

    Returns void

  • get_unit_value(): number
  • to_pixels(): number
  • to_string(): string
  • Converts units into a string

    See clutter_units_from_string() for the units syntax and for examples of output

    Fractional values are truncated to the second decimal position for em, mm and cm, and to the first decimal position for typographic points. Pixels are integers.

    Returns string

  • from_cm(cm: number): Units
  • from_em(em: number): Units
  • Stores a value in em inside units, using the default font name as returned by clutter_backend_get_font_name()

    Parameters

    • em: number

      em

    Returns Units

  • from_em_for_font(font_name: string, em: number): Units
  • from_mm(mm: number): Units
  • from_pixels(px: number): Units
  • from_pt(pt: number): Units
  • from_string(str: string): [boolean, Units]
  • Parses a value and updates units with it

    A #ClutterUnits expressed in string should match:

    |[ units: wsp* unit-value wsp* unit-name? wsp* unit-value: number unit-name: 'px' | 'pt' | 'mm' | 'em' | 'cm' number: digit+ | digit* sep digit+ sep: '.' | ',' digit: '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' wsp: (#0x20 | #0x9 | #0xA | #0xB | #0xC | #0xD)+



    For instance, these are valid strings:

    |[
    10 px
    5.1 em
    24 pt
    12.6 mm
    .3 cm

    While these are not:

    |[ 42 cats omg!1!ponies



    If no unit is specified, pixels are assumed.
    @param str the string to convert

    Parameters

    • str: string

    Returns [boolean, Units]

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method