SDL_Pango: SDL_Pango.c File Reference

Main Page | Class List | File List | File Members

# SDL_Pango.c File Reference

Implementation of SDL_Pango. More...

`#include <pango/pango.h>`
`#include <pango/pangoft2.h>`
`#include "SDL_Pango.h"`

## Classes
struct | _surfaceArgs
struct | _contextImpl
## Defines
#define | DEFAULT_FONT_FAMILY "Sans"
#define | DEFAULT_FONT_SIZE 12
#define | DEFAULT_DPI 96
#define | _MAKE_FONT_NAME(family, size) family " " #size
#define | MAKE_FONT_NAME(family, size) _MAKE_FONT_NAME(family, size)
#define | DEFAULT_DEPTH 32
#define | DEFAULT_RMASK (Uint32)(255 << (8 * 3))
#define | DEFAULT_GMASK (Uint32)(255 << (8 * 2))
#define | DEFAULT_BMASK (Uint32)(255 << (8 * 1))
#define | DEFAULT_AMASK (Uint32)255
## Typedefs
typedef _surfaceArgs | surfaceArgs
typedef _contextImpl | contextImpl
## Functions
int | SDLPango_Init ()
int | SDLPango_WasInit ()
void | SDLPango_CopyFTBitmapToSurface (const FT_Bitmap *bitmap, SDL_Surface *surface, const SDLPango_Matrix *matrix, SDL_Rect *rect)
SDLPango_Context * | SDLPango_CreateContext ()
void | SDLPango_FreeContext (SDLPango_Context *context)
void | SDLPango_SetSurfaceCreateArgs (SDLPango_Context *context, Uint32 flags, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
SDL_Surface * | SDLPango_CreateSurfaceDraw (SDLPango_Context *context)
void | SDLPango_Draw (SDLPango_Context *context, SDL_Surface *surface, int x, int y)
void | SDLPango_SetMinimumSize (SDLPango_Context *context, int width, int height)
void | SDLPango_SetDefaultColor (SDLPango_Context *context, const SDLPango_Matrix *color_matrix)
int | SDLPango_GetLayoutWidth (SDLPango_Context *context)
int | SDLPango_GetLayoutHeight (SDLPango_Context *context)
void | SDLPango_SetMarkup (SDLPango_Context *context, const char *markup, int length)
void | SDLPango_SetText (SDLPango_Context *context, const char *text, int length)
void | SDLPango_SetDpi (SDLPango_Context *context, double dpi_x, double dpi_y)
void SDLCALL | SDLPango_SetLanguage (SDLPango_Context *context, const char *language_tag)
void SDLCALL | SDLPango_SetBaseDirection (SDLPango_Context *context, SDLPango_Direction direction)
PangoFontMap *SDLCALL | SDLPango_GetPangoFontMap (SDLPango_Context *context)
PangoFontDescription *SDLCALL | SDLPango_GetPangoFontDescription (SDLPango_Context *context)
PangoLayout *SDLCALL | SDLPango_GetPangoLayout (SDLPango_Context *context)

## Detailed Description

Implementation of SDL_Pango.

Author:
  NAKAMURA Ken'ichi

Date:
  2004/12/07
  Revision
    1.6

## Function Documentation

void SDLPango_CopyFTBitmapToSurface | ( | const FT_Bitmap * | bitmap,
|  | SDL_Surface * | surface,
|  | const SDLPango_Matrix * | matrix,
|  | SDL_Rect * | rect
| ) |

  | Copy bitmap to surface. From (x, y)-(w, h) to (x, y)-(w, h) of rect. Parameters:
  | *bitmap | [in] Grayscale bitmap
  | *surface | [out] Surface
  | *matrix | [in] Foreground and background color
  | *rect | [in] Rect to copy

SDLPango_Context* SDLPango_CreateContext | ( |  | ) |

| Create a context which contains Pango objects. Returns: A pointer to the context as a SDLPango_Context*.

SDL_Surface* 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

void 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

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

  | Free a context. Parameters:
  | *context | [i/o] Context to be free

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

  | Get layout height. Parameters:
  | *context | [in] Context
Returns: Height

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

  | Get layout width. Parameters:
  | *context | [in] Context
Returns: Width

PangoFontDescription* SDLCALL SDLPango_GetPangoFontDescription | ( | SDLPango_Context * | context | ) |

  | Get font description from context. Parameters:
  | *context | [in] Context
Returns: Font description

PangoFontMap* SDLCALL SDLPango_GetPangoFontMap | ( | SDLPango_Context * | context | ) |

  | Get font map from context. Parameters:
  | *context | [in] Context
Returns: Font map

PangoLayout* SDLCALL SDLPango_GetPangoLayout | ( | SDLPango_Context * | context | ) |

  | Get layout from context. Parameters:
  | *context | [in] Context
Returns: Layout

int 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.

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

  | Set base direction to context. Parameters:
  | *context | [i/o] Context
  | direction | [in] Direction

void 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

void 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

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

void 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.

void 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.

void 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()

void 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.

int 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.