Pango Reference Manual | |||
---|---|---|---|
<<< Previous Page | Home | Up | Next Page >>> |
The functions and macros in this section are used by shape engines to look up glyphs for particular character sets within an PangoFont for the X rendering system.
typedef guint16 PangoXSubfont; |
The PangoXSubFont type is an integer ID that identifies one particular X font within the fonts referenced in a PangoFont.
#define PANGO_X_MAKE_GLYPH(subfont,index) ((subfont)<<16 | (index)) |
Make a glyph index from a PangoXSubFont index and a index of a character with the corresponding X font.
subfont : | a PangoXSubfont index |
index : | the index of a character within an X font. |
#define PANGO_X_GLYPH_SUBFONT(glyph) ((glyph)>>16) |
Extract the subfont index from a glyph index.
#define PANGO_X_GLYPH_INDEX(glyph) ((glyph) & 0xffff) |
Extract the character index within the X font from a glyph index.
PangoFont* pango_x_load_font (Display *display, gchar *spec); |
Loads up a logical font based on a "fontset" style text specification.
display : | the X display. |
spec : | a comma-separated list of XLFD's. |
Returns : | a new PangoFont. |
PangoGlyph pango_x_get_unknown_glyph (PangoFont *font); |
Returns the index of a glyph suitable for drawing unknown characters.
font : | a PangoFont. |
Returns : | a glyph index into font. |
gboolean pango_x_has_glyph (PangoFont *font, PangoGlyph glyph); |
Checks if the given glyph is present in a X font.
font : | a PangoFont which must be from the X backend. |
glyph : | the index of a glyph in the font. (Formed using the PANGO_X_MAKE_GLYPH macro) |
Returns : | TRUE if the glyph is present. |
int pango_x_list_subfonts (PangoFont *font, char **charsets, int n_charsets, PangoXSubfont **subfont_ids, int **subfont_charsets); |
Lists the subfonts of a given font.
font : | a PangoFont. |
charsets : | the charsets to list subfonts for. |
n_charsets : | the number of charsets in charsets. |
subfont_ids : | location to store a pointer to an array of subfont IDs for each found subfont; the result must be freed using g_free(). |
subfont_charsets : | location to store a pointer to an array of subfont IDs for each found subfont; the result must be freed using g_free(). |
Returns : | length of the arrays stored in subfont_ids and subfont_charsets. |
void pango_x_shutdown_display (Display *display); |
Free cached resources for the given X display structure.
PangoXFontCache* pango_x_font_map_get_font_cache (PangoFontMap *font_map); |
char* pango_x_font_subfont_xlfd (PangoFont *font, PangoXSubfont subfont_id); |
Determines the X Logical Font Description for the specified subfont.
gboolean pango_x_find_first_subfont (PangoFont *font, char **charsets, int n_charsets, PangoXSubfont *rfont); |
Looks for subfonts with the charset charset, in font, and puts the first one in *rfont.
font : | A PangoFont. |
charsets : | An array of charsets. |
n_charsets : | The number of charsets in charsets. |
rfont : | A pointer to a PangoXSubfont. |
Returns : | TRUE if *rfont now contains a font. |
PangoGlyph pango_x_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. |
gboolean pango_x_apply_ligatures (PangoFont *font, PangoXSubfont subfont, gunichar **glyphs, int *n_glyphs, int **clusters); |
Does subfont-specific ligation. This involves replacing groups of glyphs in chars with alternate groups of glyphs based on information provided in the X font.
font : | a PangoFont. |
subfont : | a PangoXSubFont. |
glyphs : | a pointer to a pointer to an array of glyph indices. This holds the input glyphs on entry, and ligation will be performed on this array in-place. If the number of glyphs is increased, Pango will call g_realloc() on glyphs, so chars must be allocated with g_malloc(). |
n_glyphs : | a pointer to the number of glyphs *n_glyphs is the number of original glyphs on entry and the number of resulting glyphs upon return. |
clusters : | a pointer to the cluster information. |
Returns : | TRUE if any ligations were performed. |
void pango_x_fallback_shape (PangoFont *font, PangoGlyphString *glyphs, const char *text, int n_chars); |
This is a simple fallback shaper, that can be used if no subfont that supports a given script is found. For every character in text, it puts the Unknown glyph.
font : | A PangoFont. |
glyphs : | A pointer to a PangoGlyphString. |
text : | UTF-8 string. |
n_chars : | Number of UTF-8 seqs in text. |
PangoXFontCache* pango_x_font_cache_new (Display *display); |
Create a font cache for the specified display.
display : | an X display. |
Returns : | The new font cache. This must be freed with pango_x_font_cache_free(). |
void pango_x_font_cache_free (PangoXFontCache *cache); |
Free a PangoXFontCache and all associated memory. All fonts loaded through this font cache will be freed along with the cache.
cache : | a PangoXFontCache |
XFontStruct* pango_x_font_cache_load (PangoXFontCache *cache, const char *xlfd); |
Load a XFontStruct from a X Logical Font Description. The result may be newly loaded, or it may have been previously stored
cache : | a PangoXFontCache |
xlfd : | the X Logical Font Description to load. |
Returns : | The font structure, or NULL if the font could not be loaded. In order to free this structure, you must call pango_x_font_cache_unload(). |
void pango_x_font_cache_unload (PangoXFontCache *cache, XFontStruct *fs); |
Free a font structure previously loaded with pango_x_font_cache_load()
cache : | a PangoXFontCache |
fs : | the font structure to unload |