## Pango Interaction

Pango Interaction — Low-level access to Pango

## Synopsis

    #include <gdk/gdk.h>

    PangoContext* gdk_pango_context_get         (void);
    PangoContext* gdk_pango_context_get_for_screen
                                                (GdkScreen *screen);
    void        gdk_pango_context_set_colormap  (PangoContext *context,
                                                 GdkColormap *colormap);
    struct      GdkPangoAttrEmbossed;
    struct      GdkPangoAttrStipple;
    PangoAttribute* gdk_pango_attr_embossed_new (gboolean embossed);
    PangoAttribute* gdk_pango_attr_stipple_new  (GdkBitmap *stipple);
    GdkRegion*  gdk_pango_layout_get_clip_region
                                                (PangoLayout *layout,
                                                 gint x_origin,
                                                 gint y_origin,
                                                 gint *index_ranges,
                                                 gint n_ranges);
    GdkRegion*  gdk_pango_layout_line_get_clip_region
                                                (PangoLayoutLine *line,
                                                 gint x_origin,
                                                 gint y_origin,
                                                 gint *index_ranges,
                                                 gint n_ranges);

## Description

## Details

### gdk_pango_context_get ()

    PangoContext* gdk_pango_context_get         (void);

Creates a PangoContext for the default GDK screen.

The context must be freed when you're finished with it.

When using GTK+, normally you should use `gtk_widget_get_pango_context()` instead of this function, to get the appropriate context for the widget you intend to render text onto.

Returns : | a new PangoContext for the default display

### gdk_pango_context_get_for_screen ()

    PangoContext* gdk_pango_context_get_for_screen
                                                (GdkScreen *screen);

Creates a PangoContext for `screen`.

The context must be freed when you're finished with it.

When using GTK+, normally you should use `gtk_widget_get_pango_context()` instead of this function, to get the appropriate context for the widget you intend to render text onto.

`screen` : | the GdkScreen for which the context is to be created.
Returns : | a new PangoContext for `screen`

Since 2.2

### gdk_pango_context_set_colormap ()

    void        gdk_pango_context_set_colormap  (PangoContext *context,
                                                 GdkColormap *colormap);

Sets the colormap to be used for drawing with `context`.

If you obtained your context from `gtk_widget_get_pango_context()` or `gtk_widget_create_pango_context()`, the colormap will already be set to the colormap for the widget, so you shouldn't need this function.

`context` : | a PangoContext
`colormap` : | a GdkColormap

### struct GdkPangoAttrEmbossed

    struct GdkPangoAttrEmbossed {

      PangoAttribute attr;
      gboolean embossed;
    };

A Pango text attribute containing a embossed bitmap to be used when rendering the text.

PangoAttribute `attr` | the PangoAttribute.
gboolean `embossed` | the embossed bitmap.

### struct GdkPangoAttrStipple

    struct GdkPangoAttrStipple {

      PangoAttribute attr;
      GdkBitmap *stipple;
    };

A Pango text attribute containing a stipple bitmap to be used when rendering the text.

PangoAttribute `attr` | the PangoAttribute.
GdkBitmap *`stipple` | the stipple bitmap.

### gdk_pango_attr_embossed_new ()

    PangoAttribute* gdk_pango_attr_embossed_new (gboolean embossed);

Creates a new attribute containing a embossed bitmap to be used when rendering the text.

`embossed` : | a bitmap to be set as embossed
Returns : | new PangoAttribute

### gdk_pango_attr_stipple_new ()

    PangoAttribute* gdk_pango_attr_stipple_new  (GdkBitmap *stipple);

Creates a new attribute containing a stipple bitmap to be used when rendering the text.

`stipple` : | a bitmap to be set as stipple
Returns : | new PangoAttribute

### gdk_pango_layout_get_clip_region ()

    GdkRegion*  gdk_pango_layout_get_clip_region
                                                (PangoLayout *layout,
                                                 gint x_origin,
                                                 gint y_origin,
                                                 gint *index_ranges,
                                                 gint n_ranges);

Obtains a clip region which contains the areas where the given ranges of text would be drawn. `x_origin` and `y_origin` are the same position you would pass to `gdk_draw_layout_line()`. `index_ranges` should contain ranges of bytes in the layout's text.

`layout` : | a PangoLayout
`x_origin` : | X pixel where you intend to draw the layout with this clip
`y_origin` : | Y pixel where you intend to draw the layout with this clip
`index_ranges` : | array of byte indexes into the layout, where even members of array are start indexes and odd elements are end indexes
`n_ranges` : | number of ranges in `index_ranges`, i.e. half the size of `index_ranges`
Returns : | a clip region containing the given ranges

### gdk_pango_layout_line_get_clip_region ()

    GdkRegion*  gdk_pango_layout_line_get_clip_region
                                                (PangoLayoutLine *line,
                                                 gint x_origin,
                                                 gint y_origin,
                                                 gint *index_ranges,
                                                 gint n_ranges);

Obtains a clip region which contains the areas where the given ranges of text would be drawn. `x_origin` and `y_origin` are the same position you would pass to `gdk_draw_layout_line()`. `index_ranges` should contain ranges of bytes in the layout's text. The clip region will include space to the left or right of the line (to the layout bounding box) if you have indexes above or below the indexes contained inside the line. This is to draw the selection all the way to the side of the layout. However, the clip region is in line coordinates, not layout coordinates.

`line` : | a PangoLayoutLine
`x_origin` : | X pixel where you intend to draw the layout line with this clip
`y_origin` : | baseline pixel where you intend to draw the layout line with this clip
`index_ranges` : | array of byte indexes into the layout, where even members of array are start indexes and odd elements are end indexes
`n_ranges` : | number of ranges in `index_ranges`, i.e. half the size of `index_ranges`
Returns : | a clip region containing the given ranges