Gimp.Unit
Description: Reference for Gimp.Unit

### Class

# GimpUnit

#### Description [src]

    final class Gimp.Unit : GObject.TypeInstance {
      /* No available fields */
    }

Provides a collection of predefined units and functions for creating user-defined units.

#### Constructors

###### gimp_unit_new

Returns the integer ID of the new `GimpUnit`.

#### Functions

###### gimp_unit_format_string

The `format` string supports the following percent expansions:

since: 2.8

###### gimp_unit_get_number_of_built_in_units

Returns the number of `GimpUnit`‘s which are hardcoded in the unit system (UNIT_INCH, UNIT_MM, UNIT_POINT, UNIT_PICA and the two “pseudo unit” UNIT_PIXEL).

###### gimp_unit_get_number_of_units

Returns the number of units which are known to the `GimpUnit` system.

#### Instance methods

###### gimp_unit_get_abbreviation

For built-in units, this function returns the translated abbreviation of the unit.

###### gimp_unit_get_deletion_flag

No description available.

###### gimp_unit_get_digits

Returns the number of digits set for `unit`. Built-in units’ accuracy is approximately the same as an inch with two digits. User-defined units can suggest a different accuracy.

###### gimp_unit_get_factor

A `GimpUnit`‘s `factor` is defined to be:

###### gimp_unit_get_identifier

This is an untranslated string and must not be changed or freed.

###### gimp_unit_get_plural

For built-in units, this function returns the translated plural form of the unit’s name.

###### gimp_unit_get_scaled_digits

Returns the number of digits a `unit` field should provide to get enough accuracy so that every pixel position shows a different value from neighboring pixels.

###### gimp_unit_get_singular

For built-in units, this function returns the translated singular form of the unit’s name.

###### gimp_unit_get_symbol

This is e.g. “”” for UNIT_INCH.

###### gimp_unit_is_metric

Checks if the given `unit` is metric. A simplistic test is used that looks at the unit’s factor and checks if it is 2.54 multiplied by some common powers of 10. Currently it checks for mm, cm, dm, m.

since: 2.10

###### gimp_unit_set_deletion_flag

Sets a `GimpUnit`‘s `deletion_flag`. If the `deletion_flag` of a unit is `TRUE` when GIMP exits, this unit will not be saved in the users’s “unitrc” file.