navit  0.5.3-trunk
font_freetype_methods Struct Reference

#include <font_freetype.h>

Data Fields

void(* destroy )(void)
 
struct font_freetype_font *(* font_new )(struct graphics_priv *gr, struct graphics_font_methods *meth, char *font, int size, int flags)
 Load a font, preferring one with the given font family. More...
 
void(* get_text_bbox )(struct graphics_priv *gr, struct font_freetype_font *font, char *text, int dx, int dy, struct point *ret, int estimate)
 
struct font_freetype_text *(* text_new )(char *text, struct font_freetype_font *font, int dx, int dy)
 
void(* text_destroy )(struct font_freetype_text *text)
 
int(* get_shadow )(struct font_freetype_glyph *glyph, unsigned char *data, int stride, struct color *fg, struct color *tr)
 Get glyph "shadow", a glyph bitmap to be used as background. More...
 
int(* get_glyph )(struct font_freetype_glyph *glyph, unsigned char *data, int stride, struct color *fg, struct color *bg, struct color *tr)
 Get a glyph bitmap. More...
 

Detailed Description

Methods provided by this plugin.

Field Documentation

◆ destroy

void(* font_freetype_methods::destroy) (void)

Referenced by graphics_destroy().

◆ font_new

struct font_freetype_font*(* font_freetype_methods::font_new) (struct graphics_priv *gr, struct graphics_font_methods *meth, char *font, int size, int flags)

Load a font, preferring one with the given font family.

Try to load a font, trying to match either the given font family, or one from a list of hardcoded families, or let fontconfig pick the best match.

Parameters
graphics_privunused
graphics_font_methodsused to return font methods
fontfamilythe preferred font family
sizerequested size of font
flagsextra flags for the font (bold,etc)
Returns
loaded font, or NULL

Referenced by graphics_gd_new(), graphics_qt5_new(), graphics_qt_qpainter_new(), and overlay_new().

◆ get_glyph

int(* font_freetype_methods::get_glyph) (struct font_freetype_glyph *glyph, unsigned char *data, int stride, struct color *fg, struct color *bg, struct color *tr)

Get a glyph bitmap.

This method returns a bitmap for rendering the supplied glyph.

Parameters
gglyph to render, usually obtained from a struct font_freetype_text created via font_freetype_methods.text_new()
databuffer for result image bitmap. Size must be at least (4 * stride * g->h).
stridestride (bytes per data row) for result bitmap; must be at least g->w, but may include padding. Special case: If set to 0, 'data' is interpreted as an array of pointers to image data rows (i.e. unsigned char**).
fgcolor for rendering the glyph
bgcolor to alpha blend with fg for semi-transparent glyph pixels
transparentcolor for background pixels
Returns
0 if depth is invalid, 1 otherwise

Referenced by display_text_draw(), and draw_text().

◆ get_shadow

int(* font_freetype_methods::get_shadow) (struct font_freetype_glyph *glyph, unsigned char *data, int stride, struct color *fg, struct color *tr)

Get glyph "shadow", a glyph bitmap to be used as background.

This method returns a glyph shadow, a bitmap with the glyph, where the glyph has been "fattened" by expanding it by one pixel on each side. In Navit, the shadow is used as the background behind the glyph bitmaps (returned by font_freetype_methods.get_glyph() ), to make the text easier to read.

Parameters
gglyph to render, usually created via font_freetype_methods.text_new()
databuffer for result image bitmap. Size must be at least (4 * stride * (g->h+2)).
stridesee font_freetype_methods.get_glyph(). Minimum: g->w+2.
foregroundcolor for rendering the "shadow"
backgroundcolor for rest of the bitmap (typically set to transparent)
Returns
0 if depth is invalid, 1 otherwise

Referenced by display_text_draw(), and draw_text().

◆ get_text_bbox

void(* font_freetype_methods::get_text_bbox) (struct graphics_priv *gr, struct font_freetype_font *font, char *text, int dx, int dy, struct point *ret, int estimate)

◆ text_destroy

void(* font_freetype_methods::text_destroy) (struct font_freetype_text *text)

Referenced by draw_text().

◆ text_new

struct font_freetype_text*(* font_freetype_methods::text_new) (char *text, struct font_freetype_font *font, int dx, int dy)

Referenced by draw_text().


The documentation for this struct was generated from the following file: