Units

Units — Type to represent units of distance supported by libglabels

Types and Values

enum lglUnits

Includes

#include <libglabels/lgl-units.h>

Description

This section defines a type to represent the various units of distance supported by libglabels. It also defines a set of related functions.

Functions

lgl_units_get_id ()

const gchar *
lgl_units_get_id (lglUnits units);

Return a unique ID string for the given units. This ID is how units are encoded in libglabels XML files and will remain constant across all locales. IDs are identical to the absolute length units supported in the CSS2 Specification (Section 4.3.2).

Parameters

units

Units (lglUnits)

 

Returns

ID string.


lgl_units_from_id ()

lglUnits
lgl_units_from_id (const gchar *id);

Return the unique lglUnits for the given ID string. This ID is how units are encoded in libglabels XML files and will remain constant across all locales. IDs are identical to the absolute length units supported in the CSS2 Specification (Section 4.3.2).

Parameters

id

ID string

 

Returns

units (lglUnits).


lgl_units_get_name ()

const gchar *
lgl_units_get_name (lglUnits units);

Return a unique name string for the given units. This name is human readable and will be translated to the current locale.

Parameters

units

Units (lglUnits)

 

Returns

name string.


lgl_units_from_name ()

lglUnits
lgl_units_from_name (const gchar *name);

Return the unique lglUnits for the given name string. This name is human readable and is expected to be translated to the current locale.

Parameters

name

NAME string

 

Returns

units (lglUnits).


lgl_units_get_points_per_unit ()

gdouble
lgl_units_get_points_per_unit (lglUnits units);

Return a scale factor for the given units in points/unit.

Parameters

units

Units (lglUnits)

 

Returns

scale factor.


lgl_units_get_units_per_point ()

gdouble
lgl_units_get_units_per_point (lglUnits units);

Return a scale factor for the given units in units/point.

Parameters

units

Units (lglUnits)

 

Returns

scale factor.

Types and Values

enum lglUnits

This enumeration defines supported units of distance.

Members

LGL_UNITS_POINT

Points.

 

LGL_UNITS_INCH

Inches.

 

LGL_UNITS_MM

Millimeters

 

LGL_UNITS_CM

Centimeters

 

LGL_UNITS_PICA

Picas

 

LGL_UNITS_FIRST

First supported unit. (Used for bounds checking and iteration through supported units.)

 

LGL_UNITS_LAST

Last supported unit. (Used for bounds checking and iteration through supported units.)

 

LGL_UNITS_INVALID

Invalid unit. (Returned by libglabels units functions when a supported unit cannot be determined.)