## Xft Fonts and Rendering

Xft Fonts and Rendering — Functions for shape engines to manipulate Xft fonts

## Synopsis

    #define     PANGO_RENDER_TYPE_XFT
    PangoContext* pango_xft_get_context         (Display *display,
                                                 int screen);
    PangoFontMap* pango_xft_get_font_map        (Display *display,
                                                 int screen);
    void        pango_xft_set_default_substitute
                                                (Display *display,
                                                 int screen,
                                                 PangoXftSubstituteFunc func,
                                                 gpointer data,
                                                 GDestroyNotify notify);
    void        (*PangoXftSubstituteFunc)       (FcPattern *pattern,
                                                 gpointer data);
    void        pango_xft_substitute_changed    (Display *display,
                                                 int screen);
    void        pango_xft_shutdown_display      (Display *display,
                                                 int screen);
    void        pango_xft_render                (XftDraw *draw,
                                                 XftColor *color,
                                                 PangoFont *font,
                                                 PangoGlyphString *glyphs,
                                                 gint x,
                                                 gint y);
    void        pango_xft_picture_render        (Display *display,
                                                 Picture src_picture,
                                                 Picture dest_picture,
                                                 PangoFont *font,
                                                 PangoGlyphString *glyphs,
                                                 gint x,
                                                 gint y);
    XftFont*    pango_xft_font_get_font         (PangoFont *font);
    Display*    pango_xft_font_get_display      (PangoFont *font);
    gboolean    pango_xft_font_has_char         (PangoFont *font,
                                                 gunichar wc);
    FT_Face     pango_xft_font_lock_face        (PangoFont *font);
    void        pango_xft_font_unlock_face      (PangoFont *font);
    guint       pango_xft_font_get_glyph        (PangoFont *font,
                                                 gunichar wc);
    PangoGlyph  pango_xft_font_get_unknown_glyph
                                                (PangoFont *font,
                                                 gunichar wc);

## Description

## Details

### PANGO_RENDER_TYPE_XFT

    #define PANGO_RENDER_TYPE_XFT "PangoRenderXft"

A string constant identifying the Xft renderer. The associated quark (see g_quark_from_string()) is used to identify the renderer in pango_find_map().

### pango_xft_get_context ()

    PangoContext* pango_xft_get_context         (Display *display,
                                                 int screen);

Retrieves a PangoContext appropriate for rendering with Xft fonts on the given screen of the given display.

`display` : | an X display.
`screen` : | an X screen.
Returns : | the new PangoContext.

### pango_xft_get_font_map ()

    PangoFontMap* pango_xft_get_font_map        (Display *display,
                                                 int screen);

Returns the PangoXftFontmap for the given display and screen. The fontmap is owned by Pango and will be valid until the display is closed.

`display` : | an X display
`screen` : | the screen number of a screen within `display`
Returns : | a PangoFontMap object, owned by Pango.

Since 1.2

### pango_xft_set_default_substitute ()

    void        pango_xft_set_default_substitute
                                                (Display *display,
                                                 int screen,
                                                 PangoXftSubstituteFunc func,
                                                 gpointer data,
                                                 GDestroyNotify notify);

Sets a function that will be called to do final configuration substitution on a FcPattern before it is used to load the font. This function can be used to do things like set hinting and antiasing options.

`display` : | an X Display
`screen` : | the screen number of a screen within `display`
`func` : | function to call to to do final config tweaking on FcPattern objects.
`data` : | data to pass to `func`
`notify` : | function to call when `data` is no longer used.

Since 1.2

### PangoXftSubstituteFunc ()

    void        (*PangoXftSubstituteFunc)       (FcPattern *pattern,
                                                 gpointer data);

Function type for doing final config tweaking on prepared FcPatterns.

`pattern` : | the FcPattern to tweak.
`data` : | user data.

### pango_xft_substitute_changed ()

    void        pango_xft_substitute_changed    (Display *display,
                                                 int screen);

Call this function any time the results of the default substitution function set with pango_xft_set_default_substitute() change. That is, if your subsitution function will return different results for the same input pattern, you must call this function.

`display` : | an X Display
`screen` : | the screen number of a screen within `display`

Since 1.2

### pango_xft_shutdown_display ()

    void        pango_xft_shutdown_display      (Display *display,
                                                 int screen);

Release any resources that have been cached for the combination of `display` and `screen`.

`display` : | an X display
`screen` : | the screen number of a screen within `display`

Since 1.2

### pango_xft_render ()

    void        pango_xft_render                (XftDraw *draw,
                                                 XftColor *color,
                                                 PangoFont *font,
                                                 PangoGlyphString *glyphs,
                                                 gint x,
                                                 gint y);

Renders a PangoGlyphString onto an XftDraw object wrapping an X drawable.

`draw` : | the XftDraw object.
`color` : | the color in which to draw the string
`font` : | the font in which to draw the string
`glyphs` : | the glyph string to draw
`x` : | the x position of start of string (in pixels)
`y` : | the y position of baseline (in pixels)

### pango_xft_picture_render ()

    void        pango_xft_picture_render        (Display *display,
                                                 Picture src_picture,
                                                 Picture dest_picture,
                                                 PangoFont *font,
                                                 PangoGlyphString *glyphs,
                                                 gint x,
                                                 gint y);

Renders a PangoGlyphString onto an Xrender Picture object.

`display` : | an X display
`src_picture` : | the source picture to draw the string with
`dest_picture` : | the destination picture to draw the strign onto
`font` : | the font in which to draw the string
`glyphs` : | the glyph string to draw
`x` : | the x position of start of string (in pixels)
`y` : | the y position of baseline (in pixels)

### pango_xft_font_get_font ()

    XftFont*    pango_xft_font_get_font         (PangoFont *font);

Returns the XftFont of a font.

`font` : | a PangoFont.
Returns : | the XftFont associated to `font`.

### pango_xft_font_get_display ()

    Display*    pango_xft_font_get_display      (PangoFont *font);

Returns the X display of the XftFont of a font.

`font` : | a PangoFont.
Returns : | the X display of the XftFont associated to `font`.

### pango_xft_font_has_char ()

    gboolean    pango_xft_font_has_char         (PangoFont *font,
                                                 gunichar wc);

Determines whether `font` has a glyph for the codepoint `wc`.

`font` : | a PangoFont for the Xft backend
`wc` : | Unicode codepoint to look up
Returns : | `TRUE` if `font` has the requested codepoint.

Since 1.2

### pango_xft_font_lock_face ()

    FT_Face     pango_xft_font_lock_face        (PangoFont *font);

Gets the FreeType FT_Face associated with a font, This face will be kept around until you call pango_xft_font_unlock_face().

`font` : | a PangoFont.
Returns : | the FreeType FT_Face associated with `font`.

Since 1.2

### pango_xft_font_unlock_face ()

    void        pango_xft_font_unlock_face      (PangoFont *font);

Releases a font previously obtained with pango_xft_font_lock_face().

`font` : | a PangoFont.

Since 1.2

### pango_xft_font_get_glyph ()

    guint       pango_xft_font_get_glyph        (PangoFont *font,
                                                 gunichar wc);

Gets the glyph index for a given unicode codepoint for `font`. If you only want to determine whether the font has the glyph, use pango_xft_font_has_char().

`font` : | a PangoFont for the Xft backend
`wc` : | Unicode codepoint to look up
Returns : | the glyph index, or 0, if the unicode codepoint doesn't exist in the font.

Since 1.2

### pango_xft_font_get_unknown_glyph ()

    PangoGlyph  pango_xft_font_get_unknown_glyph
                                                (PangoFont *font,
                                                 gunichar wc);

Returns the index of a glyph suitable for drawing `wc` as an unknown character.

`font` : | a PangoFont.
`wc` : | the Unicode character for which a glyph is needed.
Returns : | a glyph index into `font`.