|
GLuint | cairo_dock_create_texture_from_text_simple (const gchar *cText, const gchar *cFontDescription, cairo_t *pSourceContext, int *iWidth, int *iHeight) |
|
CairoDockGLFont * | cairo_dock_load_textured_font (const gchar *cFontDescription, int first, int count) |
|
CairoDockGLFont * | cairo_dock_load_textured_font_from_image (const gchar *cImagePath) |
|
void | cairo_dock_free_gl_font (CairoDockGLFont *pFont) |
|
void | cairo_dock_get_gl_text_extent (const gchar *cText, CairoDockGLFont *pFont, int *iWidth, int *iHeight) |
|
void | cairo_dock_draw_gl_text (const guchar *cText, CairoDockGLFont *pFont) |
|
void | cairo_dock_draw_gl_text_at_position (const guchar *cText, CairoDockGLFont *pFont, int x, int y) |
|
void | cairo_dock_draw_gl_text_in_area (const guchar *cText, CairoDockGLFont *pFont, int iWidth, int iHeight, gboolean bCentered) |
|
void | cairo_dock_draw_gl_text_at_position_in_area (const guchar *cText, CairoDockGLFont *pFont, int x, int y, int iWidth, int iHeight, gboolean bCentered) |
|
This class provides different ways to draw text directly in OpenGL. cairo_dock_create_texture_from_text_simple lets you draw any text in any font, by creating a texture from a Pango font description. This is a convenient function but not very fast. For a more efficient way, you load a font into a CairoDockGLFont with either : cairo_dock_load_textured_font to load a subset of a Mono font into textures. You then use cairo_dock_draw_gl_text_at_position to draw the text.
GLuint cairo_dock_create_texture_from_text_simple |
( |
const gchar * |
cText, |
|
|
const gchar * |
cFontDescription, |
|
|
cairo_t * |
pSourceContext, |
|
|
int * |
iWidth, |
|
|
int * |
iHeight |
|
) |
| |
Create a texture from a text. The text is drawn in white, so that you can later colorize it with a mere glColor.
- Parameters
-
cText | the text |
cFontDescription | a description of the font, for instance "Monospace Bold 12" |
pSourceContext | a cairo context, not altered by the function. |
iWidth | a pointer that will be filled with the width of the texture. |
iHeight | a pointer that will be filled with the height of the texture. |
- Returns
- a newly allocated texture.
CairoDockGLFont* cairo_dock_load_textured_font |
( |
const gchar * |
cFontDescription, |
|
|
int |
first, |
|
|
int |
count |
|
) |
| |
Load a font into textures. You can then render your text like a normal texture (zoom, etc). The drawback is that only a mono font can be used with this function.
- Parameters
-
cFontDescription | a description of the font, for instance "Monospace Bold 12" |
first | first character to load. |
count | number of characters to load. |
- Returns
- a newly allocated opengl font.
CairoDockGLFont* cairo_dock_load_textured_font_from_image |
( |
const gchar * |
cImagePath | ) |
|
Like the previous function, but loads the characters from an image. The image must be squared and contain the 256 extended ASCII characters in the alphabetic order.
- Parameters
-
cImagePath | path to the image. |
- Returns
- a newly allocated opengl font.
Free an opengl font.
- Parameters
-
void cairo_dock_get_gl_text_extent |
( |
const gchar * |
cText, |
|
|
CairoDockGLFont * |
pFont, |
|
|
int * |
iWidth, |
|
|
int * |
iHeight |
|
) |
| |
Compute the size a text will take for a given font.
- Parameters
-
cText | the text |
pFont | the font. |
iWidth | a pointer that will be filled with the width of the text. |
iHeight | a pointer that will be filled with the height of the text. |
void cairo_dock_draw_gl_text |
( |
const guchar * |
cText, |
|
|
CairoDockGLFont * |
pFont |
|
) |
| |
Render a text for a given font. In the case of a bitmap font, the current raster position is used. In the case of a texture font, the current model view is used.
- Parameters
-
cText | the text |
pFont | the font. |
void cairo_dock_draw_gl_text_at_position |
( |
const guchar * |
cText, |
|
|
CairoDockGLFont * |
pFont, |
|
|
int |
x, |
|
|
int |
y |
|
) |
| |
Like /ref cairo_dock_draw_gl_text but at a given position.
- Parameters
-
cText | the text |
pFont | the font. |
x | x position of the left bottom corner of the text. |
y | y position of the left bottom corner of the text. |
void cairo_dock_draw_gl_text_in_area |
( |
const guchar * |
cText, |
|
|
CairoDockGLFont * |
pFont, |
|
|
int |
iWidth, |
|
|
int |
iHeight, |
|
|
gboolean |
bCentered |
|
) |
| |
Like /ref cairo_dock_draw_gl_text but resize the text so that it fits into a given area. Only works for a texture font.
- Parameters
-
cText | the text |
pFont | the font. |
iWidth | iWidth of the area. |
iHeight | iHeight of the area |
bCentered | whether the text is centered on the current position or not. |
void cairo_dock_draw_gl_text_at_position_in_area |
( |
const guchar * |
cText, |
|
|
CairoDockGLFont * |
pFont, |
|
|
int |
x, |
|
|
int |
y, |
|
|
int |
iWidth, |
|
|
int |
iHeight, |
|
|
gboolean |
bCentered |
|
) |
| |
Like /ref cairo_dock_draw_gl_text_in_area and /ref cairo_dock_draw_gl_text_at_position.
- Parameters
-
cText | the text |
pFont | the font. |
x | x position of the left bottom corner of the text. |
y | y position of the left bottom corner of the text. |
iWidth | iWidth of the area. |
iHeight | iHeight of the area |
bCentered | whether the text is centered on the given position or not. |