# SDL_Pango.h File Reference

Header file of SDL_Pango. More...

`#include "SDL.h"`
`#include "begin_code.h"`
`#include "close_code.h"`

Go to the source code of this file.

## Classes

struct | _SDLPango_Matrix

## Typedefs

typedef _contextImpl | SDLPango_Context
typedef _SDLPango_Matrix | SDLPango_Matrix

## Enumerations

enum | SDLPango_Direction { SDLPANGO_DIRECTION_LTR, SDLPANGO_DIRECTION_RTL, SDLPANGO_DIRECTION_WEAK_LTR, SDLPANGO_DIRECTION_WEAK_RTL, SDLPANGO_DIRECTION_NEUTRAL }

## Functions

DECLSPEC int SDLCALL | SDLPango_Init ()
DECLSPEC int SDLCALL | SDLPango_WasInit ()
DECLSPEC SDLPango_Context *SDLCALL | SDLPango_CreateContext ()
DECLSPEC void SDLCALL | SDLPango_FreeContext (SDLPango_Context *context)
DECLSPEC void SDLCALL | SDLPango_SetSurfaceCreateArgs (SDLPango_Context *context, Uint32 flags, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
DECLSPEC SDL_Surface *SDLCALL | SDLPango_CreateSurfaceDraw (SDLPango_Context *context)
DECLSPEC void SDLCALL | SDLPango_Draw (SDLPango_Context *context, SDL_Surface *surface, int x, int y)
DECLSPEC void SDLCALL | SDLPango_SetDpi (SDLPango_Context *context, double dpi_x, double dpi_y)
DECLSPEC void SDLCALL | SDLPango_SetMinimumSize (SDLPango_Context *context, int width, int height)
DECLSPEC void SDLCALL | SDLPango_SetDefaultColor (SDLPango_Context *context, const SDLPango_Matrix *color_matrix)
DECLSPEC int SDLCALL | SDLPango_GetLayoutWidth (SDLPango_Context *context)
DECLSPEC int SDLCALL | SDLPango_GetLayoutHeight (SDLPango_Context *context)
DECLSPEC void SDLCALL | SDLPango_SetMarkup (SDLPango_Context *context, const char *markup, int length)
DECLSPEC void SDLCALL | SDLPango_SetText (SDLPango_Context *context, const char *markup, int length)
DECLSPEC void SDLCALL | SDLPango_SetLanguage (SDLPango_Context *context, const char *language_tag)
DECLSPEC void SDLCALL | SDLPango_SetBaseDirection (SDLPango_Context *context, SDLPango_Direction direction)

## Variables

const SDLPango_Matrix | _MATRIX_WHITE_BACK
const SDLPango_Matrix * | MATRIX_WHITE_BACK = &_MATRIX_WHITE_BACK
const SDLPango_Matrix | _MATRIX_BLACK_BACK
const SDLPango_Matrix * | MATRIX_BLACK_BACK = &_MATRIX_BLACK_BACK
const SDLPango_Matrix | _MATRIX_TRANSPARENT_BACK_BLACK_LETTER
const SDLPango_Matrix * | MATRIX_TRANSPARENT_BACK_BLACK_LETTER = &_MATRIX_TRANSPARENT_BACK_BLACK_LETTER
const SDLPango_Matrix | _MATRIX_TRANSPARENT_BACK_WHITE_LETTER
const SDLPango_Matrix * | MATRIX_TRANSPARENT_BACK_WHITE_LETTER = &_MATRIX_TRANSPARENT_BACK_WHITE_LETTER
const SDLPango_Matrix | _MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER
const SDLPango_Matrix * | MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER = &_MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER

## Detailed Description

Header file of SDL_Pango.

Author:
  NAKAMURA Ken'ichi

Date:
  2004/08/26
  Revision
    1.3

## Typedef Documentation

typedef struct _SDLPango_Matrix SDLPango_Matrix

| General 4 X 4 matrix struct.

## Enumeration Type Documentation

enum SDLPango_Direction

Specifies direction of text. See Pango reference for detail

Enumeration values:

  SDLPANGO_DIRECTION_RTL | Left to right
  SDLPANGO_DIRECTION_WEAK_LTR | Right to left
  SDLPANGO_DIRECTION_WEAK_RTL | Left to right (weak)
  SDLPANGO_DIRECTION_NEUTRAL | Neutral

## Function Documentation

DECLSPEC SDLPango_Context* SDLCALL SDLPango_CreateContext | ( |  | ) |

Create a context which contains Pango objects.

Returns:
  A pointer to the context as a SDLPango_Context*.

DECLSPEC SDL_Surface* SDLCALL SDLPango_CreateSurfaceDraw | ( | SDLPango_Context * | context | ) |

Create a surface and draw text on it. The size of surface is same as lauout size.

Parameters:

  | *context | [in] Context

Returns:
  A newly created surface

DECLSPEC void SDLCALL SDLPango_Draw | ( | SDLPango_Context * | context,
|  | SDL_Surface * | surface,
|  | int | x,
|  | int | y
| ) |

Draw text on a existing surface.

Parameters:

  | *context | [in] Context
  | *surface | [i/o] Surface to draw on it
  | x | [in] X of left-top of drawing area
  | y | [in] Y of left-top of drawing area

DECLSPEC void SDLCALL SDLPango_FreeContext | ( | SDLPango_Context * | context | ) |

Free a context.

Parameters:

  | *context | [i/o] Context to be free

DECLSPEC int SDLCALL SDLPango_GetLayoutHeight | ( | SDLPango_Context * | context | ) |

Get layout height.

Parameters:

  | *context | [in] Context

Returns:
  Height

DECLSPEC int SDLCALL SDLPango_GetLayoutWidth | ( | SDLPango_Context * | context | ) |

Get layout width.

Parameters:

  | *context | [in] Context

Returns:
  Width

DECLSPEC int SDLCALL SDLPango_Init | ( |  | ) |

Initialize the Glib and Pango API. This must be called before using other functions in this library, excepting SDLPango_WasInit. SDL does not have to be initialized before this call.

Returns:
  always 0.

DECLSPEC void SDLCALL SDLPango_SetBaseDirection | ( | SDLPango_Context * | context,
|  | SDLPango_Direction | direction
| ) |

Set base direction to context.

Parameters:

  | *context | [i/o] Context
  | direction | [in] Direction

DECLSPEC void SDLCALL SDLPango_SetDefaultColor | ( | SDLPango_Context * | context,
|  | const SDLPango_Matrix * | color_matrix
| ) |

Specify default color.

Parameters:

  | *context | [i/o] Context
  | *color_matrix | [in] Foreground and background color

DECLSPEC void SDLCALL SDLPango_SetDpi | ( | SDLPango_Context * | context,
|  | double | dpi_x,
|  | double | dpi_y
| ) |

Set DPI to context.

Parameters:

  | *context | [i/o] Context
  | dpi_x | [in] X dpi
  | dpi_y | [in] Y dpi

DECLSPEC void SDLCALL SDLPango_SetLanguage | ( | SDLPango_Context * | context,
|  | const char * | language_tag
| ) |

Set language to context.

Parameters:

  | *context | [i/o] Context
  | *language_tag | [in] A RFC-3066 format language tag

DECLSPEC void SDLCALL SDLPango_SetMarkup | ( | SDLPango_Context * | context,
|  | const char * | markup,
|  | int | length
| ) |

Set markup text to context. Text must be utf-8. Markup format is same as pango.

Parameters:

  | *context | [i/o] Context
  | *markup | [in] Markup text
  | length | [in] Text length. -1 means NULL-terminated text.

DECLSPEC void SDLCALL SDLPango_SetMinimumSize | ( | SDLPango_Context * | context,
|  | int | width,
|  | int | height
| ) |

Specify minimum size of drawing rect.

Parameters:

  | *context | [i/o] Context
  | width | [in] Width. -1 means no wrapping mode.
  | height | [in] Height. zero/minus value means non-specified.

DECLSPEC void SDLCALL SDLPango_SetSurfaceCreateArgs | ( | SDLPango_Context * | context,
|  | Uint32 | flags,
|  | int | depth,
|  | Uint32 | Rmask,
|  | Uint32 | Gmask,
|  | Uint32 | Bmask,
|  | Uint32 | Amask
| ) |

Specify Arguments when create a surface. When SDL_Pango creates a surface, the arguments are used.

Parameters:

  | *context | [i/o] Context
  | flags | [in] Same as SDL_CreateRGBSurface()
  | depth | [in] Same as SDL_CreateRGBSurface()
  | Rmask | [in] Same as SDL_CreateRGBSurface()
  | Gmask | [in] Same as SDL_CreateRGBSurface()
  | Bmask | [in] Same as SDL_CreateRGBSurface()
  | Amask | [in] Same as SDL_CreateRGBSurface()

DECLSPEC void SDLCALL SDLPango_SetText | ( | SDLPango_Context * | context,
|  | const char * | text,
|  | int | length
| ) |

Set plain text to context. Text must be utf-8.

Parameters:

  | *context | [i/o] Context
  | *text | [in] Plain text
  | length | [in] Text length. -1 means NULL-terminated text.

DECLSPEC int SDLCALL SDLPango_WasInit | ( |  | ) |

Query the initilization status of the Glib and Pango API. You may, of course, use this before SDLPango_Init to avoid initilizing twice in a row.

Returns:
  zero when already initialized. non-zero when not initialized.

## Variable Documentation

const SDLPango_Matrix _MATRIX_BLACK_BACK

Initial value:

     {0, 255, 0, 0,
           0, 255, 0, 0,
           0, 255, 0, 0,
           255, 255, 0, 0,}

const SDLPango_Matrix _MATRIX_TRANSPARENT_BACK_BLACK_LETTER

Initial value:

     {0, 0, 0, 0,
           0, 0, 0, 0,
           0, 0, 0, 0,
           0, 255, 0, 0,}

const SDLPango_Matrix _MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER

Initial value:

     {255, 255, 0, 0,
           255, 255, 0, 0,
           255, 255, 0, 0,
           0, 0, 0, 0,}

const SDLPango_Matrix _MATRIX_TRANSPARENT_BACK_WHITE_LETTER

Initial value:

     {255, 255, 0, 0,
           255, 255, 0, 0,
           255, 255, 0, 0,
           0, 255, 0, 0,}

const SDLPango_Matrix _MATRIX_WHITE_BACK

Initial value:

     {255, 0, 0, 0,
           255, 0, 0, 0,
           255, 0, 0, 0,
           255, 255, 0, 0,}

const SDLPango_Matrix* MATRIX_BLACK_BACK = &_MATRIX_BLACK_BACK

| Specifies black back and white letter.

const SDLPango_Matrix* MATRIX_TRANSPARENT_BACK_BLACK_LETTER = &_MATRIX_TRANSPARENT_BACK_BLACK_LETTER

| Specifies transparent back and black letter.

const SDLPango_Matrix* MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER = &_MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER

| Specifies transparent back and transparent letter. This is useful for KARAOKE like rendering.

const SDLPango_Matrix* MATRIX_TRANSPARENT_BACK_WHITE_LETTER = &_MATRIX_TRANSPARENT_BACK_WHITE_LETTER

| Specifies transparent back and white letter.

const SDLPango_Matrix* MATRIX_WHITE_BACK = &_MATRIX_WHITE_BACK

| Specifies white back and black letter.