Description
Pango supports a flexible architecture where a
particular rendering architecture can supply an
implementation of fonts. The PangoFont structure
representn an abstract rendering-system-indepent font.
Pango provides routines to list available fonts, and
to load a font of a given description.
Details
struct PangoFontDescription
struct PangoFontDescription
{
char *family_name;
PangoStyle style;
PangoVariant variant;
PangoWeight weight;
PangoStretch stretch;
int size;
}; |
The PangoFontDescription structure represents the description
of an ideal font. These structures are used both to list
what fonts are available on the system and also for specifying
the characteristics of a font to load.
enum PangoStyle
typedef enum {
PANGO_STYLE_NORMAL,
PANGO_STYLE_OBLIQUE,
PANGO_STYLE_ITALIC
} PangoStyle; |
An enumeration specifying the various slant styles possible for a font.
enum PangoWeight
typedef enum {
PANGO_WEIGHT_NORMAL = 400,
PANGO_WEIGHT_BOLD = 700
} PangoWeight; |
An enumeration specifying the weight (boldness) of a font. This is a numerical
value ranging from 100 to 900, but there are two predefined values:
enum PangoVariant
typedef enum {
PANGO_VARIANT_NORMAL,
PANGO_VARIANT_SMALL_CAPS
} PangoVariant; |
An enumeration specifying capitalization variant of the font.
enum PangoStretch
typedef enum {
PANGO_STRETCH_ULTRA_CONDENSED,
PANGO_STRETCH_EXTRA_CONDENSED,
PANGO_STRETCH_CONDENSED,
PANGO_STRETCH_SEMI_CONDENSED,
PANGO_STRETCH_NORMAL,
PANGO_STRETCH_SEMI_EXPANDED,
PANGO_STRETCH_EXPANDED,
PANGO_STRETCH_EXTRA_EXPANDED,
PANGO_STRETCH_ULTRA_EXPANDED
} PangoStretch; |
An enumeration specifying the width of the font relative to other designs
within a family.
pango_font_description_compare ()
Compare two font descriptions for equality.
pango_font_description_from_string ()
Create a new font description from a string representation in the
form "[FAMILY-LIST] [STYLE-OPTIONS] [SIZE]", where FAMILY-LIST is a
comma separated list of families optionally terminated by a comma,
STYLE_OPTIONS is a whitespace separated list of words where each
WORD describes one of style, variant, weight, or stretch, and SIZE
is an decimal number (size in points). Any one of the options may
be absent. If FAMILY-LIST is absent, then the family_name field of
the resulting font description will be initialized to NULL. If
STYLE-OPTIONS is missing, then all style options will be set to the
default values. If SIZE is missing, the size in the resulting font
description will be set to 0.
pango_font_description_to_string ()
Create a string representation of a font description. See
pango_font_description_from_string() for a description of the
format of the string representation. The family list in the
string description will only have a terminating comma if the
last word of the list is a valid style option.
struct PangoFont
struct PangoFont
{
GObject parent_instance;
}; |
The PangoFont structure is used to represent
a font in a rendering-system-independent matter.
To create an implementation of a PangoFont,
the rendering-system specific code should malloc
a larger structure that contains a nested
PangoFont, fill in the klass member of
the nested PangoFont with a pointer to
a appropriate PangoFontClass, then call
pango_font_init() on the structure.
The PangoFont structure contains one member
which the implementation fills in:
struct PangoFontClass
struct PangoFontClass
{
GObjectClass parent_class;
PangoFontDescription *(*describe) (PangoFont *font);
PangoCoverage * (*get_coverage) (PangoFont *font,
const char *lang);
PangoEngineShape * (*find_shaper) (PangoFont *font,
const char *lang,
guint32 ch);
void (*get_glyph_extents) (PangoFont *font,
PangoGlyph glyph,
PangoRectangle *ink_rect,
PangoRectangle *logical_rect);
void (*get_metrics) (PangoFont *font,
const gchar *lang,
PangoFontMetrics *metrics);
}; |
The PangoFontClass structure contains the virtual
functions for an implementation of a a PangoFont.
It contains the following members:
struct PangoFontMetrics
struct PangoFontMetrics
{
int ascent;
int descent;
}; |
The PangoFontMetrics structure represents the overall metrics for
a font. It contains the following members:
pango_font_find_shaper ()
Find the best matching shaper for a font for a particular
language tag and character point.
pango_font_get_coverage ()
Compute the coverage map for a given font and language tag.
pango_font_get_glyph_extents ()
Get the logical and ink extents of a glyph within a font. The
coordinate system for each rectangle has its origin at the
base line and horizontal origin of the character with increasing
coordinates extending to the right and down. The macros PANGO_ASCENT(),
PANGO_DESCENT(), PANGO_LBEARING(), and PANGO_RBEARING can be used to convert
from the extents rectangle to more traditional font metrics. The units
of the rectangles are in 1/PANGO_SCALE of a device unit.
pango_font_get_metrics ()
Get overall metric information for a font. Since the metrics may be
substantially different for different scripts, a language tag can
be provided to indicate that the metrics should be retrieved that
correspond to the script(s) used by that language.
PANGO_TYPE_FONT
#define PANGO_TYPE_FONT (pango_font_get_type ()) |
PANGO_FONT()
#define PANGO_FONT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FONT, PangoFont)) |
PANGO_IS_FONT()
#define PANGO_IS_FONT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FONT)) |
PANGO_FONT_CLASS()
#define PANGO_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FONT, PangoFontClass)) |
PANGO_IS_FONT_CLASS()
#define PANGO_IS_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_FONT)) |
PANGO_FONT_GET_CLASS()
#define PANGO_FONT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONT, PangoFontClass)) |
pango_font_get_type ()
GType pango_font_get_type (void); |
struct PangoFontMap
struct PangoFontMap
{
GObject parent_instance;
}; |
The PangoFontMap represents the set of fonts available for a
particular rendering system. This is a virtual object with
implementations being specific to particular rendering systems. To
create an implementation of a PangoFontMap, the rendering-system
specific code should malloc a larger structure that contains a nested
PangoFontMap, fill in the klass member of the nested PangoFontMap with a
pointer to a appropriate PangoFontMapClass, then call
pango_font_map_init() on the structure.
The PangoFont structure contains one member which the implementation fills in:
struct PangoFontMapClass
struct PangoFontMapClass
{
GObjectClass parent_class;
PangoFont *(*load_font) (PangoFontMap *fontmap,
const PangoFontDescription *desc);
void (*list_fonts) (PangoFontMap *fontmap,
const gchar *family,
PangoFontDescription ***descs,
int *n_descs);
void (*list_families) (PangoFontMap *fontmap,
gchar ***families,
int *n_families);
}; |
The PangoFontMapClass structure holds the virtual functions for
a particular PangoFontMap implementation.
pango_font_map_load_font ()
Load the font in the fontmap that is the closest match for desc.
pango_font_map_list_families ()
void pango_font_map_list_families (PangoFontMap *fontmap,
gchar ***families,
int *n_families); |
List all families for a fontmap.
pango_font_map_free_families ()
void pango_font_map_free_families (gchar **families,
int n_families); |
Free a list of families returned from pango_font_map_list_families()
pango_font_map_list_fonts ()
List all fonts in a fontmap, or the fonts in a particular family.
PANGO_TYPE_FONT_MAP
#define PANGO_TYPE_FONT_MAP (pango_font_map_get_type ()) |
PANGO_FONT_MAP()
#define PANGO_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FONT_MAP, PangoFontMap)) |
PANGO_IS_FONT_MAP()
#define PANGO_IS_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FONT_MAP)) |
PANGO_FONT_MAP_CLASS()
#define PANGO_FONT_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FONT_MAP, PangoFontMapClass)) |
PANGO_IS_FONT_MAP_CLASS()
#define PANGO_IS_FONT_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_FONT_MAP)) |
PANGO_FONT_MAP_GET_CLASS()
#define PANGO_FONT_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONT_MAP, PangoFontMapClass)) |
pango_font_map_get_type ()
GType pango_font_map_get_type (void); |