## Documentation

Table of Contents
Class Inheritance Tree
Widget Screenshots
Package groups

## Index

Package: Layout

- Goto spec source

# Description

    package Pango.Layout is

This package provides a high-level object that is capable of arranging text in a visually correct manner. It supports international character sets, although all strings should be Utf8, supports left-to-right and right-to-left writing systems, is capable of handling multi-line texts, and properly aligns tab characters in the text.

This is the base type that is used in the standard gtk+ widget for all the widgets that display some text on the screen.

Since it works directly with Pango.Font.Pango_Font_Description fonts, it is also much better at handling resizing of text, wrapping,... than direct calls to Gdk.Drawable.Draw_Text.

The idea is that this widget is used to compute the layout of the characters (ie their screen position). It doesn't do any rendering, however, and should be used in conjonction with Gdk.Drawable.Draw_Layout to actually display something on the screen.

This widget is independent from any specific drawing systems, and might for instance be used to create postscript documents, for direct access to the win32 API,...

This widget represents one of the fundamental additions to gtk+ 2.0 over what previously existed in the gtk+ 1.x series. It obsoletes the package Gdk.Font, which should only be used for legacy applications.

# Classes

### Pango_Layout_Record

- Goto declaration in source
- Goto full declaration in source

    type Pango_Layout_Record is new Glib.Object.GObject_Record with private;

#### Ancestors:

Glib.Object.GObject_Record

#### Primitive operations:

Context_Changed

- To API doc
- To spec

Get_Alignment

- To API doc
- To spec

Get_Attributes

- To API doc
- To spec

Get_Context

- To API doc
- To spec

Get_Extents

- To API doc
- To spec

Get_Justify

- To API doc
- To spec

Get_Line

- To API doc
- To spec

Get_Line_Count

- To API doc
- To spec

Get_Pixel_Extents

- To API doc
- To spec

Get_Pixel_Size

- To API doc
- To spec

Get_Size

- To API doc
- To spec

Get_Tabs

- To API doc
- To spec

Get_Text

- To API doc
- To spec

Get_Text

- To API doc
- To spec

Get_Width

- To API doc
- To spec

Get_Wrap

- To API doc
- To spec

Glib.Object.Deallocate

- To API doc
- To spec

(Inherited)
Glib.Object.Get_Type

- To API doc
- To spec

(Inherited)
Glib.Object.Notify

- To API doc
- To spec

(Inherited)
Glib.Object.Ref

- To API doc
- To spec

(Inherited)
Glib.Object.Ref_Sink

- To API doc
- To spec

(Inherited)
Glib.Object.Unref

- To API doc
- To spec

(Inherited)
Set_Attributes

- To API doc
- To spec

Set_Font_Description

- To API doc
- To spec

Set_Justify

- To API doc
- To spec

Set_Markup

- To API doc
- To spec

Set_Tabs

- To API doc
- To spec

Set_Text

- To API doc
- To spec

Set_Width

- To API doc
- To spec

Set_Wrap

- To API doc
- To spec

XY_To_Index

- To API doc
- To spec

# Types

### Pango_Layout

- Goto declaration in source

    type Pango_Layout is access all Pango_Layout_Record'Class;

A widget that allows you to easily display text, including handling of internationalization, right-to-left writing,... See the function Gtk.Widget.Create_Pango_Layout for more information on how to create layouts Use Glib.Object.Unref to destroy a Pango_Layout See Gdk.Drawable.Draw_Layout for how to actually display the layout on the screen.

### Pango_Alignment

- Goto declaration in source

    type Pango_Alignment is
         (Pango_Align_Left,
          Pango_Align_Center,
          Pango_Align_Right);

### Pango_Wrap_Mode

- Goto declaration in source

    type Pango_Wrap_Mode is
         (Pango_Wrap_Word,
          Pango_Wrap_Char);

### Pango_Ellipsize_Mode

- Goto declaration in source

    type Pango_Ellipsize_Mode is
         (Ellipsize_None,
          Ellipsize_Start,
          Ellipsize_Middle,
          Ellipsize_End);

This type describes what sort of (if any) ellipsization should be applied to a line of text. In the ellipsization process characters are removed from the text in order to make it fit to a given width and replaced with an ellipsis.

### Pango_Layout_Line

- Goto declaration in source

    type Pango_Layout_Line is new Glib.C_Proxy;

# Subprograms & Entries

### Gdk_New

- Goto spec in source

    procedure Gdk_New (Layout: out Pango_Layout;Context: access Pango.Context.Pango_Context_Record'Class);

Create a new layout, based on context.

### Get_Context

- Goto spec in source

    function Get_Context (Layout: access Pango_Layout_Record) return Pango.Context.Pango_Context;

Return the context of the layout. The returned value is the internal context itself, so you must Glib.Object.Ref it if you need to keep a reference. You shouldn't Unref it.

### Set_Font_Description

- Goto spec in source

    procedure Set_Font_Description (Layout: access Pango_Layout_Record;Font: Pango.Font.Pango_Font_Description);

Change the font used in the layout. If not font description is set for the layout, the font description from the layout's context is used.

### Context_Changed

- Goto spec in source

    procedure Context_Changed (Layout: access Pango_Layout_Record);

Forces recomputation of any state in Layout that might depend on the layout's context. This function should be called if you make changes to the context subsequent to creating the layout.

### Get_Line

- Goto spec in source

    function Get_Line (Layout: access Pango_Layout_Record;Line: Natural) return Pango_Layout_Line;

Retrieve a particular line from Layout. Line must be between 0 and Get_Line_Count (Layout) - 1. null is returned if the index is out of range. The layout line can be Ref'ed and retained, but will become invalid if changes are made to Layout.

### Line_Ref

- Goto spec in source
- Goto body in source

    procedure Line_Ref (Line: Pango_Layout_Line);

Increase the reference count of Line by 1.

### Line_Unref

- Goto spec in source
- Goto body in source

    procedure Line_Unref (Line: Pango_Layout_Line);

Decrease the reference count of Line by 1. If the result is 0, the line and all associated memory will be destroyed.

### Line_Index_To_X

- Goto spec in source
- Goto body in source

    function Line_Index_To_X (Line: Pango_Layout_Line;Index: Integer;Trailing: Integer) return Glib.Gint;

Convert an index within a line to an X position. Index is the byte offset of a graphem within the layout. Trailing is an integer indicating the edge of the grapheme to retrieve the position of. If 0, the trailing edge of the grapheme, otherwise, the leading of the grapheme. The returned value is in pango units.

### Get_Extents

- Goto spec in source

    procedure Get_Extents (Layout: access Pango_Layout_Record;Ink_Rect: out Gdk.Rectangle.Gdk_Rectangle;Logical_Rect: out Gdk.Rectangle.Gdk_Rectangle);

Compute the logical and ink extents of Layout. Logical extents are usually what you want for positioning things. The extents are given in pango units; layout coordinates begin at the top left corner of the layout. Logical_Rect is the overall size of the layout, ie it includes Ink_Rect (where the text is actually drawn) and a small border around it.

### Get_Size

- Goto spec in source

    procedure Get_Size (Layout: access Pango_Layout_Record;Width: out Glib.Gint;Height: out Glib.Gint);

Return the logical size, in pango units, of the layout. This is a convenience function around Get_Extents.

### Get_Pixel_Extents

- Goto spec in source

    procedure Get_Pixel_Extents (Layout: access Pango_Layout_Record;Ink_Rect: out Gdk.Rectangle.Gdk_Rectangle;Logical_Rect: out Gdk.Rectangle.Gdk_Rectangle);

Same as Get_Extents, but the returned values are in pixels (or device units when not drawing on the screen).

### Get_Pixel_Size

- Goto spec in source

    procedure Get_Pixel_Size (Layout: access Pango_Layout_Record;Width: out Glib.Gint;Height: out Glib.Gint);

Same as Get_Size, but the returned values are in pixels.

### XY_To_Index

- Goto spec in source

    procedure XY_To_Index (Layout: access Pango_Layout_Record;X_Pango, Y_Pango: Glib.Gint;Byte_Index: out Integer;Trailing: out Integer;Exact: out Boolean);

Convert from X and Y positions within a layout to the byte index of the character at that logical position. X and Y are given in pango units, not pixels. If the position is not inside the layout, the closest position is chosen, and Exact is set to False. Trailing is the position in the grapheme where the user clicked. It will either be 0 (left side) or the number of characters in the grapheme. In some character sets, a given character can be represented by multiple signs on the screen, which is what Trailing relates to.

### Set_Text

- Goto spec in source

    procedure Set_Text (Layout: access Pango_Layout_Record;Text: String);

Change the text that the layout displays Text must be a valid UTF8 string. See Glib.Convert for useful conversion functions.

### Get_Text

- Goto spec in source

    function Get_Text (Layout: access Pango_Layout_Record) return String;

Return the text currently displayed in the layout. It is more efficient to use the iterators on the layout than get text if you do not need Ada-specific subprograms to act on the text.

### Get_Text

- Goto spec in source

    function Get_Text (Layout: access Pango_Layout_Record) return Gtkada.Types.Chars_Ptr;

Same a Get_Text, but return directly the C string, which is more efficient. The returned value should not be freed or modified.

### Get_Line_Count

- Goto spec in source

    function Get_Line_Count (Layout: access Pango_Layout_Record) return Glib.Gint;

Return the number of lines in Layout

### Set_Markup

- Goto spec in source

    procedure Set_Markup (Layout: access Pango_Layout_Record;Markup: Glib.UTF8_String);

Change the text that layout displays. Markup must be a valid UTF8 String, and might contain markups as defined in the pango markup language.

### Set_Justify

- Goto spec in source

    procedure Set_Justify (Layout: access Pango_Layout_Record;Justify: Boolean);

Set whether or not each complete line should be stretched to fill the entire width of the layout. This stretching is typically done by adding whitespace, but for some scripts (such as Arabic), the justification is done by extending the characters.

### Get_Justify

- Goto spec in source

    function Get_Justify (Layout: access Pango_Layout_Record) return Boolean;

Return True if each complete line should be stretched to fill the entire width of the layout.

### Set_Alignment

- Goto spec in source

    procedure Set_Alignment (Layout: access Pango_Layout_Record'Class;Alignment: Pango_Alignment);

Set the alignment for the layout (how partial lines are positioned within the horizontal space available).

### Get_Alignment

- Goto spec in source

    function Get_Alignment (Layout: access Pango_Layout_Record) return Pango_Alignment;

Return the alignment for the layout.

### Set_Width

- Goto spec in source

    procedure Set_Width (Layout: access Pango_Layout_Record;Width: Glib.Gint);

Set the width to which the lines of Layout should be wrapped. No wrapping will be performed if Width is -1. Width is given in pango units.

### Get_Width

- Goto spec in source

    function Get_Width (Layout: access Pango_Layout_Record) return Glib.Gint;

Return the wrapping width of Layout

### Set_Wrap

- Goto spec in source

    procedure Set_Wrap (Layout: access Pango_Layout_Record;Mode: Pango_Wrap_Mode);

Sets the wrap style; the wrap style only has an effect if a width is set on the layout with pango_layout_set_width(). To turn off wrapping, set the width to -1.

### Get_Wrap

- Goto spec in source

    function Get_Wrap (Layout: access Pango_Layout_Record) return Pango_Wrap_Mode;

Return the current wrap style

### Set_Tabs

- Goto spec in source

    procedure Set_Tabs (Layout: access Pango_Layout_Record;Tabs: Pango.Tabs.Pango_Tab_Array);

Sets the tabs to use for Layout, overriding the default tabs (by default, tabs are every 8 spaces). If Tabs is Null_Tab_Array, the default tabs are reinstated. tabs is copied into the layout; you must free your copy of Tabs yourself.

### Get_Tabs

- Goto spec in source

    function Get_Tabs (Layout: access Pango_Layout_Record) return Pango.Tabs.Pango_Tab_Array;

Get the current tab array used by Layout. If no tab array has been set, then the default tabs are in use and Null_Tab_Array is returned. Default tabs are every 8 spaces. The return value should be freed with Pango.Tabs.Free.

### Set_Attributes

- Goto spec in source

    procedure Set_Attributes (Layout: access Pango_Layout_Record;Attributes: Pango.Attributes.Pango_Attr_List);

Set the text attributes for a layout object. Passing null removes the current list of attributes

### Get_Attributes

- Goto spec in source

    function Get_Attributes (Layout: access Pango_Layout_Record) return Pango.Attributes.Pango_Attr_List;

Get the text attributes from a layout object