Cairo.Font_Face

Entities

Subprograms

Description

A set of utilities to handle the Cairo_Font_Face type, and the Cairo 'toy' text API.

<c_version>1.8.8</c_version> <group>Cairo</group>

Destroy

procedure Destroy (Font_Face : Cairo_Font_Face)

Decreases the reference count on Font_Face by one. If the result is zero, then Font_Face and all associated resources are freed. See Cairo.Font_Face.Reference.

Parameters
Font_Face

a Cairo_Font_Face

Get_Reference_Count

function Get_Reference_Count (Font_Face : Cairo_Font_Face) return Guint

Returns the current reference count of Font_Face.

@since 1.4

Parameters
Font_Face

a Cairo_Font_Face

Return Value

the current reference count of Font_Face. If the object is a nil object, 0 will be returned.

Get_Type

function Get_Type (Font_Face : Cairo_Font_Face) return Cairo_Font_Type

This function returns the type of the backend used to create a font face. See Cairo_Font_Type for available types.

@since 1.2

Parameters
Font_Face

a font face

Return Value

The type of Font_Face.

Get_User_Data

function Get_User_Data
  (Font_Face : Cairo_Font_Face;
   Key       : access Cairo_User_Data_Key) return System.Address

Return user data previously attached to Font_Face using the specified key. If no user data has been attached with the given key this function returns System.Null_Address.

Parameters
Font_Face

a Cairo_Font_Face

Key

the address of the Cairo_User_Data_Key the user data was attached to

Return Value

the user data previously attached or System.Null_Address.

Reference

function Reference (Font_Face : Cairo_Font_Face) return Cairo_Font_Face

Increases the reference count on Font_Face by one. This prevents Font_Face from being destroyed until a matching call to Cairo.Font_Face.Destroy is made.

The number of references to a Cairo_Font_Face can be get using Cairo.Font_Face.Get_Reference_Count.

Parameters
Font_Face

a Cairo_Font_Face, (may be Null_Font_Face in which case this function does nothing).

Return Value

the referenced Cairo_Font_Face.

Set_User_Data

function Set_User_Data
  (Font_Face : Cairo_Font_Face;
   Key       : access Cairo_User_Data_Key;
   User_Data : System.Address;
   Destroy   : Cairo_Destroy_Func) return Cairo_Status

Attach user data to Font_Face. To remove user data from a font face, call this function with the key that was used to set it and System.Null_Address for data.

Parameters
Font_Face

a Cairo_Font_Face

Key

the address of a Cairo_User_Data_Key to attach the user data to

User_Data

the user data to attach to the font face

Destroy

a Cairo_Destroy_Func which will be called when the font face is destroyed or when new user data is attached using the same key.

Return Value

Cairo_Status_Success or Cairo_Status_No_Memory if a slot could not be allocated for the user data.

Status

function Status (Font_Face : Cairo_Font_Face) return Cairo_Status

Checks whether an error has previously occurred for this font face

Parameters
Font_Face

a Cairo_Font_Face

Return Value

Cairo_Status_Success or another error such as Cairo_Status_No_Memory.

Toy_Font_Face_Create

function Toy_Font_Face_Create
  (Family : Gtkada.Types.Chars_Ptr;
   Slant  : Cairo_Font_Slant;
   Weight : Cairo_Font_Weight)
   return   Cairo_Font_Face

Creates a font face from a triplet of family, slant, and weight. These font faces are used in implementation of the the Cairo_Context "toy" font API.

If Family is the zero-length string "", the platform-specific default family is assumed. The default family then can be queried using Toy_Font_Face_Get_Family.

The Cairo_Select_Font_Face function uses this to create font faces. See that function for limitations of toy font faces.

@since 1.8

Parameters
Family

a font Family name, encoded in UTF-8

Slant

the Slant for the font

Weight

the Weight for the font

Return Value

a newly created Cairo_Font_Face. Free with Cairo.Font_Face.Destroy when you are done using it.

Toy_Font_Face_Get_Family

function Toy_Font_Face_Get_Family
  (Font_Face : Cairo_Font_Face)
   return      Gtkada.Types.Chars_Ptr

Gets the familly name of a toy font.

@since 1.8

Parameters
Font_Face

A toy font face

Return Value

The family name. This string is owned by the font face and remains valid as long as the font face is alive (referenced).

Toy_Font_Face_Get_Slant

function Toy_Font_Face_Get_Slant
  (Font_Face : Cairo_Font_Face)
   return      Cairo_Font_Slant

Gets the slant a toy font.

@since 1.8

Parameters
Font_Face

A toy font face

Return Value

The slant value

Toy_Font_Face_Get_Weight

function Toy_Font_Face_Get_Weight
  (Font_Face : Cairo_Font_Face)
   return      Cairo_Font_Weight

Gets the weight a toy font.

@since 1.8

Parameters
Font_Face

A toy font face

Return Value

The weight value